Merge from mainline.
[official-gcc.git] / libjava / classpath / testsuite / java.opstack / LeftBehind.j
blob30a82c4b3167e91017ad3afb2a625c977567832e
2 ; LeftBehind.j - contrived test to see how japhar reacts to
3 ; stuff left on the stack after a method returns.
4 .class public LeftBehind
5 .super java/lang/Object
7 .method public static test()I
8 .limit stack 10 ; up to 10 items can be pushed
10 ; push some ints.
11 bipush 1
12 bipush 2
13 bipush 3
14 bipush 4
15 bipush 5
16 ; then push some strings.
17 ldc "6th item"
18 ldc "7th item"
20 bipush 5
22 ; now push our return value
23 bipush 9
25 ireturn
26 .end method
28 .method public static main([Ljava/lang/String;)V
29 .limit stack 3 ; up to three items can be pushed
31 ; we push a value onto the stack, and
32 ; then check to see that only one item (the return
33 ; value from the test() method) is on the stack on top
34 ; of it.
35 bipush 8
37 invokestatic LeftBehind/test()I
39 pop ; get rid of the return value
40 bipush 8
41 isub
43 ifeq pass
45 fail:
46 ; push System.out onto the stack
47 getstatic java/lang/System/out Ljava/io/PrintStream;
49 ldc "FAILED:"
51 invokevirtual java/io/PrintStream/println(Ljava/lang/String;)V
52 bipush 0
53 invokestatic java/lang/System/exit(I)V
55 pass:
56 ; push System.out onto the stack
57 getstatic java/lang/System/out Ljava/io/PrintStream;
59 ldc "PASSED:"
61 invokevirtual java/io/PrintStream/println(Ljava/lang/String;)V
62 bipush 0
63 invokestatic java/lang/System/exit(I)V
64 .end method