* configure.ac: New switch for disabling -O2 (--disable-optimizations).
[cacao.git] / tests / regression / jasmin / test_verify_ok_local_as_retaddr_and_reference.j
1 .class public test_verify_ok_local_as_retaddr_and_reference
2 .super java/lang/Object
3
4 ; ======================================================================
5
6 .method public <init>()V
7    aload_0
8    invokenonvirtual java/lang/Object/<init>()V
9    return
10 .end method
11
12 ; ======================================================================
13
14 .method public static check(I)V
15         .limit locals 1
16         .limit stack 10
17         getstatic java/lang/System/out Ljava/io/PrintStream;
18         iload_0
19         invokevirtual java/io/PrintStream/println(I)V
20         return
21 .end method
22
23 ; ======================================================================
24
25 .method public static main([Ljava/lang/String;)V
26         .limit stack 2
27         .limit locals 3
28
29         ldc 35
30         istore 1
31
32         ; --------------------------------------------------
33
34         ; load local 2 with a reference to a string
35     ldc "foo"
36         astore 2
37
38         ; perform some bogus instructions
39         aload 0
40         ifnull branch_a
41
42         nop
43 branch_a:
44
45     ; use the string in local 2
46         getstatic java/lang/System/out Ljava/io/PrintStream;
47         aload_2
48         invokevirtual java/io/PrintStream/println(Ljava/lang/String;)V
49         ; OUTPUT: foo
50
51         ; --------------------------------------------------
52
53         aload 0
54         ifnull branch_b
55
56         jsr sbr_1
57         goto merge_point
58         ; OUTPUT: 35
59
60 branch_b:
61         jsr sbr_2
62         goto merge_point
63
64 merge_point:
65     ; here local 2 becomes VOID, as two incompatible returnAddresses
66         ; are merged
67
68         ; --------------------------------------------------
69
70 force_basic_block_boundary:
71
72         iload 1
73         invokestatic test_verify_ok_local_as_retaddr_and_reference/check(I)V
74         ; OUTPUT: 35
75
76         return
77
78 sbr_1:
79         astore 2
80         iload 1
81         invokestatic test_verify_ok_local_as_retaddr_and_reference/check(I)V
82         ret 2
83
84 sbr_2:
85         astore 2
86         ldc 42
87         invokestatic test_verify_ok_local_as_retaddr_and_reference/check(I)V
88         ret 2
89
90 .end method
91