Index: src/test/regression/H3225/NegativeJsrTest.java
===================================================================
--- src/test/regression/H3225/NegativeJsrTest.java (revision 542211)
+++ src/test/regression/H3225/NegativeJsrTest.java (working copy)
@@ -6,11 +6,7 @@ package org.apache.harmony.drlvm.tests.r
*/
public class NegativeJsrTest extends junit.framework.TestCase {
public static void main(String args[]) {
- NegativeJsrTest t = new NegativeJsrTest();
- t.testMergeExecution();
- t.testMergeEmptyStack();
- t.testMergeIntFloat();
- t.testMergeStack();
+ junit.textui.TestRunner.run(org.apache.harmony.drlvm.tests.regression.h3225.NegativeJsrTest.class);
}
public void testMergeExecution() {
Index: src/test/regression/H3225/run.test.xml
===================================================================
--- src/test/regression/H3225/run.test.xml (revision 542211)
+++ src/test/regression/H3225/run.test.xml (working copy)
@@ -6,6 +6,9 @@
+
Index: src/test/regression/H3225/PositiveJsrTest.j
===================================================================
--- src/test/regression/H3225/PositiveJsrTest.j (revision 542211)
+++ src/test/regression/H3225/PositiveJsrTest.j (working copy)
@@ -10,34 +10,12 @@
; Launches testcases which check subroutine verification.
;
.method public static main([Ljava/lang/String;)V
- .limit stack 2
+ .limit stack 1
.limit locals 1
- new org/apache/harmony/drlvm/tests/regression/h3225/PositiveJsrTest
- dup
- invokespecial org/apache/harmony/drlvm/tests/regression/h3225/PositiveJsrTest/()V
- astore_0
-
- aload_0
- invokevirtual org/apache/harmony/drlvm/tests/regression/h3225/PositiveJsrTest/testMinimalLimits()V
-
- aload_0
- invokevirtual org/apache/harmony/drlvm/tests/regression/h3225/PositiveJsrTest/testLastJsr()V
-
- aload_0
- invokevirtual org/apache/harmony/drlvm/tests/regression/h3225/PositiveJsrTest/testCommonReturn()V
-
- aload_0
- invokevirtual org/apache/harmony/drlvm/tests/regression/h3225/PositiveJsrTest/testMultipleCalls()V
-
- aload_0
- invokevirtual org/apache/harmony/drlvm/tests/regression/h3225/PositiveJsrTest/testNestedSubs()V
-
- aload_0
- invokevirtual org/apache/harmony/drlvm/tests/regression/h3225/PositiveJsrTest/testCallFromHandler()V
-
- aload_0
- invokevirtual org/apache/harmony/drlvm/tests/regression/h3225/PositiveJsrTest/testBranches()V
+ ldc "org.apache.harmony.drlvm.tests.regression.h3225.PositiveJsrTest"
+ invokestatic java/lang/Class/forName(Ljava/lang/String;)Ljava/lang.Class;
+ invokestatic junit/textui/TestRunner/run(Ljava/lang/Class;)V
return
.end method
@@ -201,4 +179,98 @@ LabelRet:
ret 1
.end method
+
+
+;
+; A subroutine graph contains several unreachable nodes.
+;
+.method public testUnreachableNodes()V
+ .limit stack 1
+ .limit locals 1
+
+ return
+LabelBackward:
+ aconst_null
+ ifnull LabelForward
+ aconst_null
+ ifnull LabelBackward
+LabelForward:
+ aconst_null
+ ifnull LabelBackward
+ jsr LabelBackward
+.end method
+
+;
+; A subroutine is called from another subroutine nine times.
+;
+.method public testNineNestedSubs()V
+ .limit stack 3
+ .limit locals 1
+
+ iconst_0
+ jsr LabelSub
+ jsr LabelSub
+ jsr LabelSub
+ jsr LabelSub
+ jsr LabelSub
+ jsr LabelSub
+ jsr LabelSub
+ jsr LabelSub
+ jsr LabelSub
+ bipush 81
+ swap
+ invokestatic org/apache/harmony/drlvm/tests/regression/h3225/PositiveJsrTest/assertEquals(II)V
+ return
+
+LabelSub:
+ swap
+ jsr LabelSubSub
+ jsr LabelSubSub
+ jsr LabelSubSub
+ jsr LabelSubSub
+ jsr LabelSubSub
+ jsr LabelSubSub
+ jsr LabelSubSub
+ jsr LabelSubSub
+ jsr LabelSubSub
+ swap
+ astore 0
+ ret 0
+
+LabelSubSub:
+ astore 0
+ iconst_1
+ iadd
+ ret 0
+
+.end method
+
+;
+; Calls one subroutine after another in the subroutine context.
+;
+.method public testSubAfterSub()V
+ .limit stack 1
+ .limit locals 2
+
+ jsr LabelSub1
+ return
+
+LabelSub1:
+ astore 0
+ jsr LabelSub2
+ jsr LabelSub2
+ jsr LabelSub3
+ jsr LabelSub3
+ ret 0
+
+LabelSub2:
+ astore 1
+ ret 1
+
+LabelSub3:
+ astore 1
+ ret 1
+
+.end method
+
Index: src/test/regression/H3225/J9CompatibleJsrTest.j
===================================================================
--- src/test/regression/H3225/J9CompatibleJsrTest.j (revision 0)
+++ src/test/regression/H3225/J9CompatibleJsrTest.j (revision 0)
@@ -0,0 +1,137 @@
+.class public org/apache/harmony/drlvm/tests/regression/h3225/J9CompatibleJsrTest
+.super junit/framework/TestCase
+.method public ()V
+ aload_0
+ invokespecial junit/framework/TestCase/()V
+ return
+.end method
+
+;
+; Launches testcases which check subroutine verification.
+;
+.method public static main([Ljava/lang/String;)V
+ .limit stack 1
+ .limit locals 1
+
+ ldc "org.apache.harmony.drlvm.tests.regression.h3225.J9CompatibleJsrTest"
+ invokestatic java/lang/Class/forName(Ljava/lang/String;)Ljava/lang.Class;
+ invokestatic junit/textui/TestRunner/run(Ljava/lang/Class;)V
+
+ return
+.end method
+
+;
+; A subroutine is called from two different subroutines. RI produce
+; a shameful error message in this case.
+;
+.method public testNestedSubs()V
+ .limit stack 3
+ .limit locals 2
+
+ jsr LabelSub1
+ jsr LabelSub2
+ return
+
+LabelSub1:
+ astore 1
+ jsr LabelSub
+ ret 1
+
+LabelSub2:
+ astore 1
+ jsr LabelSub
+ ret 1
+
+LabelSub:
+ astore 0
+ ret 0
+
+.end method
+
+;
+; A subroutine splits execution and calls another subroutine from
+; different branches.
+;
+.method public testSubSplit()V
+ .limit stack 1
+ .limit locals 2
+
+ jsr LabelSub
+ return
+
+LabelSub:
+ astore 1
+ aconst_null
+ ifnull Label1
+ jsr LabelSub1
+Label1:
+ jsr LabelSub1
+Label2:
+ jsr LabelSub2
+ aconst_null
+ ifnonnull Label2
+ jsr LabelSub2
+ goto Label4
+Label3:
+ jsr LabelSub3
+ ret 1
+Label4:
+ aconst_null
+ ifnull Label3
+ jsr LabelSub3
+ aconst_null
+ ifnull Label3
+ return
+
+LabelSub1:
+ astore 0
+ ret 0
+
+LabelSub2:
+ astore 0
+ ret 0
+
+LabelSub3:
+ astore 0
+ ret 0
+
+.end method
+
+;
+; A nested subroutine is preceded with two calls to another subroutine.
+;
+.method public testNestedPreceded()V
+ .limit stack 4
+ .limit locals 1
+
+ iconst_0
+ jsr LabelSub
+ return
+
+LabelSub:
+ swap
+ jsr LabelSub1
+ jsr LabelSub1
+ jsr LabelSub2
+ swap
+ astore 0
+ ret 0
+
+LabelSub1:
+ swap
+ iconst_1
+ iadd
+ swap
+ astore 0
+ ret 0
+
+LabelSub2:
+ swap
+ iconst_1
+ iadd
+ swap
+ astore 0
+ ret 0
+
+.end method
+