harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From var...@apache.org
Subject svn commit: r545155 - in /harmony/enhanced/drlvm/trunk: src/test/regression/H2113/ src/test/regression/H2113/ExcInFinallyTest.j src/test/regression/H2113/Test.java src/test/regression/H2113/run.test.xml vm/jitrino/src/optimizer/FlowGraph.cpp
Date Thu, 07 Jun 2007 12:32:54 GMT
Author: varlax
Date: Thu Jun  7 05:32:53 2007
New Revision: 545155

URL: http://svn.apache.org/viewvc?view=rev&rev=545155
Log:
Applied HARMONY-2113 [drlvm][jit][opt] Jitrino.OPT loops infinitely in inlineJSR() when an
exception from a subroutine (JSR->RET) is expected

Added:
    harmony/enhanced/drlvm/trunk/src/test/regression/H2113/
    harmony/enhanced/drlvm/trunk/src/test/regression/H2113/ExcInFinallyTest.j
    harmony/enhanced/drlvm/trunk/src/test/regression/H2113/Test.java
    harmony/enhanced/drlvm/trunk/src/test/regression/H2113/run.test.xml
Modified:
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/FlowGraph.cpp

Added: harmony/enhanced/drlvm/trunk/src/test/regression/H2113/ExcInFinallyTest.j
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/src/test/regression/H2113/ExcInFinallyTest.j?view=auto&rev=545155
==============================================================================
--- harmony/enhanced/drlvm/trunk/src/test/regression/H2113/ExcInFinallyTest.j (added)
+++ harmony/enhanced/drlvm/trunk/src/test/regression/H2113/ExcInFinallyTest.j Thu Jun  7 05:32:53
2007
@@ -0,0 +1,50 @@
+.class public org/apache/harmony/drlvm/tests/regression/H2113/ExcInFinallyTest
+.super java/lang/Object
+
+.method public <init>()V
+   aload_0
+   invokespecial java/lang/Object/<init>()V
+   return
+.end method
+
+.method public static test()V
+.limit stack 3
+.limit locals 6
+
+	bipush 1
+	newarray int
+	astore_1
+	iconst_0
+	istore_2
+	aload_1
+TryStart:
+	iload_2
+	iconst_0
+	iastore        ; <-- use var2
+	goto EndSubroutine
+TryEnd1:
+    pop
+	jsr BeginSubroutine
+    goto ExitLabel
+BeginSubroutine:   ; begin sub
+	astore 4
+    iconst_1
+    iconst_0
+    idiv           ; <-- guaranteed exception here
+    istore_3
+	ret 4
+EndSubroutine:     ; end sub
+	jsr BeginSubroutine
+	iinc 2 1       ; <-- use var2
+	goto ExitLabel
+TryEnd2:
+	pop
+	getstatic java.lang.System.out Ljava/io/PrintStream;
+	ldc "PASS"
+	invokevirtual java/io/PrintStream/println(Ljava/lang/String;)V
+ExitLabel:
+	return
+
+.catch all from TryStart to TryEnd1 using TryEnd1
+.catch all from TryStart to TryEnd2 using TryEnd2
+.end method

Added: harmony/enhanced/drlvm/trunk/src/test/regression/H2113/Test.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/src/test/regression/H2113/Test.java?view=auto&rev=545155
==============================================================================
--- harmony/enhanced/drlvm/trunk/src/test/regression/H2113/Test.java (added)
+++ harmony/enhanced/drlvm/trunk/src/test/regression/H2113/Test.java Thu Jun  7 05:32:53 2007
@@ -0,0 +1,23 @@
+package org.apache.harmony.drlvm.tests.regression.H2113;
+
+import junit.framework.TestCase;
+
+/**
+ * Loads class and tries to invoke a method which should fail
+ * verification.
+ *
+ * SubClass contains an incorrect invokespecial instruction which invokes
+ * a method from a subclass of the current class, while only superclass
+ * constructors can be called using this instruction.
+ */
+public class Test extends TestCase {
+    public static void main(String args[]) {
+        (new Test()).test();
+    }
+
+    public void test() {
+    	ExcInFinallyTest.test();
+    }
+}
+
+

Added: harmony/enhanced/drlvm/trunk/src/test/regression/H2113/run.test.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/src/test/regression/H2113/run.test.xml?view=auto&rev=545155
==============================================================================
--- harmony/enhanced/drlvm/trunk/src/test/regression/H2113/run.test.xml (added)
+++ harmony/enhanced/drlvm/trunk/src/test/regression/H2113/run.test.xml Thu Jun  7 05:32:53
2007
@@ -0,0 +1,9 @@
+<project name="RUN HARMONY-2113 Regression Test">
+    <target name="run-test">
+        <run-junit-test
+            test="org.apache.harmony.drlvm.tests.regression.H2113.Test"
+            vmarg="-Xem:opt">
+        </run-junit-test>
+    </target>
+</project>
+

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/FlowGraph.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/FlowGraph.cpp?view=diff&rev=545155&r1=545154&r2=545155
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/FlowGraph.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/FlowGraph.cpp Thu Jun  7 05:32:53
2007
@@ -523,7 +523,30 @@
     //
     // entryMap is a mapping [stVar -> ret inst]
     //
-    if(retVar == NULL || (entryMap.find(stVar) == entryMap.end())) {
+    // In some cases retNode exists, but is unreachable
+    // Let's check this
+    // if retNodeIsUnrichable==true
+    // then JSR never returns.  Convert to jmp
+    bool retNodeIsUnreachable = true;
+    if (entryMap.find(stVar) != entryMap.end()) {
+        JsrEntryCIterRange jsr_range = entryMap.equal_range(stVar);
+        JsrEntryInstToRetInstMap::const_iterator i;
+        for(i = jsr_range.first; i != jsr_range.second; ++i) {
+            assert(i->first->getNode() == entryJSR);
+            Node* retNode = i->second->getNode();
+            UNUSED Inst* ret = (Inst*)retNode->getLastInst();
+            assert(ret->isRet());
+            assert(ret->getSrc(0) == retVar);
+
+            const Edges& inEdges = retNode->getInEdges();
+            if (!inEdges.empty()) {
+                retNodeIsUnreachable = false;
+                break;
+            }
+        }
+    }
+
+    if(retNodeIsUnreachable == true || retVar == NULL || (entryMap.find(stVar) == entryMap.end()))
{
         //
         // JSR never returns.  Convert to jmp.
         //
@@ -845,6 +868,7 @@
     fg.purgeUnreachableNodes();
 
     inlineJSRs(&irm);
+    fg.purgeUnreachableNodes();
     
     {
         static CountTime cleanupPhaseInternalTimer("ptra::fg::cleanupPhase::in");



Mime
View raw message