aboutsummaryrefslogtreecommitdiff
path: root/libjava/classpath/testsuite/java.opstack
diff options
context:
space:
mode:
authorTom Tromey <tromey@gcc.gnu.org>2005-07-16 00:30:23 +0000
committerTom Tromey <tromey@gcc.gnu.org>2005-07-16 00:30:23 +0000
commitf911ba985aa7fe0096c386c5be385ac5825ea527 (patch)
treea0b991cf5866ae1d616639b906ac001811d74508 /libjava/classpath/testsuite/java.opstack
parent6f4434b39b261de5317dc81ddfdd94d2e1d62b11 (diff)
downloadgcc-f911ba985aa7fe0096c386c5be385ac5825ea527.zip
gcc-f911ba985aa7fe0096c386c5be385ac5825ea527.tar.gz
gcc-f911ba985aa7fe0096c386c5be385ac5825ea527.tar.bz2
Initial revision
From-SVN: r102074
Diffstat (limited to 'libjava/classpath/testsuite/java.opstack')
-rw-r--r--libjava/classpath/testsuite/java.opstack/LeftBehind.j64
-rw-r--r--libjava/classpath/testsuite/java.opstack/execute.exp7
2 files changed, 71 insertions, 0 deletions
diff --git a/libjava/classpath/testsuite/java.opstack/LeftBehind.j b/libjava/classpath/testsuite/java.opstack/LeftBehind.j
new file mode 100644
index 0000000..30a82c4
--- /dev/null
+++ b/libjava/classpath/testsuite/java.opstack/LeftBehind.j
@@ -0,0 +1,64 @@
+;
+; LeftBehind.j - contrived test to see how japhar reacts to
+; stuff left on the stack after a method returns.
+.class public LeftBehind
+.super java/lang/Object
+
+.method public static test()I
+ .limit stack 10 ; up to 10 items can be pushed
+
+ ; push some ints.
+ bipush 1
+ bipush 2
+ bipush 3
+ bipush 4
+ bipush 5
+ ; then push some strings.
+ ldc "6th item"
+ ldc "7th item"
+
+ bipush 5
+
+ ; now push our return value
+ bipush 9
+
+ ireturn
+.end method
+
+.method public static main([Ljava/lang/String;)V
+ .limit stack 3 ; up to three items can be pushed
+
+ ; we push a value onto the stack, and
+ ; then check to see that only one item (the return
+ ; value from the test() method) is on the stack on top
+ ; of it.
+ bipush 8
+
+ invokestatic LeftBehind/test()I
+
+ pop ; get rid of the return value
+ bipush 8
+ isub
+
+ ifeq pass
+
+fail:
+ ; push System.out onto the stack
+ getstatic java/lang/System/out Ljava/io/PrintStream;
+
+ ldc "FAILED:"
+
+ invokevirtual java/io/PrintStream/println(Ljava/lang/String;)V
+ bipush 0
+ invokestatic java/lang/System/exit(I)V
+
+pass:
+ ; push System.out onto the stack
+ getstatic java/lang/System/out Ljava/io/PrintStream;
+
+ ldc "PASSED:"
+
+ invokevirtual java/io/PrintStream/println(Ljava/lang/String;)V
+ bipush 0
+ invokestatic java/lang/System/exit(I)V
+.end method
diff --git a/libjava/classpath/testsuite/java.opstack/execute.exp b/libjava/classpath/testsuite/java.opstack/execute.exp
new file mode 100644
index 0000000..1092485
--- /dev/null
+++ b/libjava/classpath/testsuite/java.opstack/execute.exp
@@ -0,0 +1,7 @@
+#
+# Author: Petter Reinholdtsen <pere@td.org.uit.no>
+
+# Load support procs
+load_lib java.exp
+
+test-java-source