annotate test/compiler/types/TypeSpeculation.java @ 12966:b2ee5dc63353

8024070: C2 needs some form of type speculation Summary: record unused type profile information with type system, propagate and use it. Reviewed-by: kvn, twisti
author roland
date Wed, 23 Oct 2013 12:40:23 +0200
parents
children 1891b98ded49
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12966
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
1 /*
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
4 *
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
7 * published by the Free Software Foundation.
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
8 *
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
13 * accompanied this code).
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
14 *
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
18 *
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
21 * questions.
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
22 */
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
23
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
24 /*
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
25 * @test
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
26 * @bug 8024070
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
27 * @summary Test that type speculation doesn't cause incorrect execution
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
28 * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -XX:TypeProfileLevel=222 TypeSpeculation
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
29 *
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
30 */
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
31
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
32 public class TypeSpeculation {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
33
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
34 interface I {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
35 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
36
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
37 static class A {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
38 int m() {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
39 return 1;
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
40 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
41 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
42
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
43 static class B extends A implements I {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
44 int m() {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
45 return 2;
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
46 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
47 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
48
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
49 static class C extends B {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
50 int m() {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
51 return 3;
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
52 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
53 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
54
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
55 static int test1_invokevirtual(A a) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
56 return a.m();
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
57 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
58
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
59 static int test1_1(A a) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
60 return test1_invokevirtual(a);
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
61 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
62
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
63 static boolean test1() {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
64 A a = new A();
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
65 B b = new B();
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
66 C c = new C();
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
67
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
68 // pollute profile at test1_invokevirtual to make sure the
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
69 // compiler cannot rely on it
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
70 for (int i = 0; i < 5000; i++) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
71 test1_invokevirtual(a);
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
72 test1_invokevirtual(b);
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
73 test1_invokevirtual(c);
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
74 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
75
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
76 // profiling + speculation should make test1_invokevirtual
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
77 // inline A.m() with a guard
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
78 for (int i = 0; i < 20000; i++) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
79 int res = test1_1(b);
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
80 if (res != b.m()) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
81 System.out.println("test1 failed with class B");
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
82 return false;
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
83 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
84 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
85 // check that the guard works as expected by passing a
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
86 // different type
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
87 int res = test1_1(a);
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
88 if (res != a.m()) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
89 System.out.println("test1 failed with class A");
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
90 return false;
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
91 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
92 return true;
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
93 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
94
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
95 static int test2_invokevirtual(A a) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
96 return a.m();
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
97 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
98
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
99 static int test2_1(A a, boolean t) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
100 A aa;
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
101 if (t) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
102 aa = (B)a;
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
103 } else {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
104 aa = a;
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
105 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
106 // if a of type B is passed to test2_1, the static type of aa
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
107 // here is no better than A but the profiled type is B so this
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
108 // should inline
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
109 return test2_invokevirtual(aa);
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
110 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
111
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
112 static boolean test2() {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
113 A a = new A();
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
114 B b = new B();
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
115 C c = new C();
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
116
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
117 // pollute profile at test2_invokevirtual to make sure the
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
118 // compiler cannot rely on it
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
119 for (int i = 0; i < 5000; i++) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
120 test2_invokevirtual(a);
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
121 test2_invokevirtual(b);
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
122 test2_invokevirtual(c);
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
123 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
124
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
125 // profiling + speculation should make test2_invokevirtual
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
126 // inline A.m() with a guard
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
127 for (int i = 0; i < 20000; i++) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
128 int res = test2_1(b, (i % 2) == 0);
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
129 if (res != b.m()) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
130 System.out.println("test2 failed with class B");
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
131 return false;
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
132 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
133 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
134 // check that the guard works as expected by passing a
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
135 // different type
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
136 int res = test2_1(a, false);
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
137 if (res != a.m()) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
138 System.out.println("test2 failed with class A");
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
139 return false;
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
140 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
141 return true;
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
142 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
143
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
144 static int test3_invokevirtual(A a) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
145 return a.m();
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
146 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
147
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
148 static void test3_2(A a) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
149 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
150
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
151 static int test3_1(A a, int i) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
152 if (i == 0) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
153 return 0;
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
154 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
155 // If we come here and a is of type B but parameter profiling
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
156 // is polluted, both branches of the if below should have
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
157 // profiling that tell us and inlining of the virtual call
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
158 // should happen
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
159 if (i == 1) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
160 test3_2(a);
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
161 } else {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
162 test3_2(a);
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
163 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
164 return test3_invokevirtual(a);
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
165 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
166
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
167 static boolean test3() {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
168 A a = new A();
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
169 B b = new B();
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
170 C c = new C();
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
171
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
172 // pollute profile at test3_invokevirtual and test3_1 to make
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
173 // sure the compiler cannot rely on it
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
174 for (int i = 0; i < 3000; i++) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
175 test3_invokevirtual(a);
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
176 test3_invokevirtual(b);
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
177 test3_invokevirtual(c);
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
178 test3_1(a, 0);
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
179 test3_1(b, 0);
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
180 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
181
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
182 // profiling + speculation should make test3_invokevirtual
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
183 // inline A.m() with a guard
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
184 for (int i = 0; i < 20000; i++) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
185 int res = test3_1(b, (i % 2) + 1);
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
186 if (res != b.m()) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
187 System.out.println("test3 failed with class B");
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
188 return false;
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
189 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
190 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
191 // check that the guard works as expected by passing a
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
192 // different type
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
193 int res = test3_1(a, 1);
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
194 if (res != a.m()) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
195 System.out.println("test3 failed with class A");
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
196 return false;
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
197 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
198 return true;
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
199 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
200
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
201 // Mix 2 incompatible profiled types
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
202 static int test4_invokevirtual(A a) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
203 return a.m();
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
204 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
205
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
206 static void test4_2(A a) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
207 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
208
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
209 static int test4_1(A a, boolean b) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
210 if (b) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
211 test4_2(a);
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
212 } else {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
213 test4_2(a);
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
214 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
215 // shouldn't inline
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
216 return test4_invokevirtual(a);
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
217 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
218
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
219 static boolean test4() {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
220 A a = new A();
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
221 B b = new B();
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
222 C c = new C();
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
223
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
224 // pollute profile at test3_invokevirtual and test3_1 to make
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
225 // sure the compiler cannot rely on it
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
226 for (int i = 0; i < 3000; i++) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
227 test4_invokevirtual(a);
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
228 test4_invokevirtual(b);
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
229 test4_invokevirtual(c);
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
230 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
231
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
232 for (int i = 0; i < 20000; i++) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
233 if ((i % 2) == 0) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
234 int res = test4_1(a, true);
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
235 if (res != a.m()) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
236 System.out.println("test4 failed with class A");
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
237 return false;
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
238 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
239 } else {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
240 int res = test4_1(b, false);
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
241 if (res != b.m()) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
242 System.out.println("test4 failed with class B");
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
243 return false;
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
244 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
245 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
246 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
247 return true;
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
248 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
249
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
250 // Mix one profiled type with an incompatible type
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
251 static int test5_invokevirtual(A a) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
252 return a.m();
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
253 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
254
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
255 static void test5_2(A a) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
256 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
257
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
258 static int test5_1(A a, boolean b) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
259 if (b) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
260 test5_2(a);
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
261 } else {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
262 A aa = (B)a;
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
263 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
264 // shouldn't inline
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
265 return test5_invokevirtual(a);
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
266 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
267
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
268 static boolean test5() {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
269 A a = new A();
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
270 B b = new B();
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
271 C c = new C();
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
272
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
273 // pollute profile at test3_invokevirtual and test3_1 to make
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
274 // sure the compiler cannot rely on it
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
275 for (int i = 0; i < 3000; i++) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
276 test5_invokevirtual(a);
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
277 test5_invokevirtual(b);
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
278 test5_invokevirtual(c);
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
279 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
280
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
281 for (int i = 0; i < 20000; i++) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
282 if ((i % 2) == 0) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
283 int res = test5_1(a, true);
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
284 if (res != a.m()) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
285 System.out.println("test5 failed with class A");
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
286 return false;
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
287 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
288 } else {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
289 int res = test5_1(b, false);
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
290 if (res != b.m()) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
291 System.out.println("test5 failed with class B");
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
292 return false;
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
293 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
294 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
295 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
296 return true;
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
297 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
298
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
299 // Mix incompatible profiled types
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
300 static void test6_2(Object o) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
301 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
302
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
303 static Object test6_1(Object o, boolean b) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
304 if (b) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
305 test6_2(o);
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
306 } else {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
307 test6_2(o);
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
308 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
309 return o;
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
310 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
311
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
312 static boolean test6() {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
313 A a = new A();
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
314 A[] aa = new A[10];
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
315
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
316 for (int i = 0; i < 20000; i++) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
317 if ((i % 2) == 0) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
318 test6_1(a, true);
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
319 } else {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
320 test6_1(aa, false);
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
321 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
322 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
323 return true;
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
324 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
325
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
326 // Mix a profiled type with an incompatible type
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
327 static void test7_2(Object o) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
328 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
329
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
330 static Object test7_1(Object o, boolean b) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
331 if (b) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
332 test7_2(o);
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
333 } else {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
334 Object oo = (A[])o;
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
335 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
336 return o;
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
337 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
338
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
339 static boolean test7() {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
340 A a = new A();
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
341 A[] aa = new A[10];
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
342
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
343 for (int i = 0; i < 20000; i++) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
344 if ((i % 2) == 0) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
345 test7_1(a, true);
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
346 } else {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
347 test7_1(aa, false);
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
348 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
349 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
350 return true;
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
351 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
352
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
353 // Mix a profiled type with an interface
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
354 static void test8_2(Object o) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
355 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
356
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
357 static I test8_1(Object o) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
358 test8_2(o);
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
359 return (I)o;
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
360 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
361
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
362 static boolean test8() {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
363 A a = new A();
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
364 B b = new B();
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
365 C c = new C();
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
366
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
367 for (int i = 0; i < 20000; i++) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
368 test8_1(b);
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
369 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
370 return true;
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
371 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
372
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
373 // Mix a profiled type with a constant
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
374 static void test9_2(Object o) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
375 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
376
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
377 static Object test9_1(Object o, boolean b) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
378 Object oo;
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
379 if (b) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
380 test9_2(o);
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
381 oo = o;
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
382 } else {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
383 oo = "some string";
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
384 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
385 return oo;
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
386 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
387
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
388 static boolean test9() {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
389 A a = new A();
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
390
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
391 for (int i = 0; i < 20000; i++) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
392 if ((i % 2) == 0) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
393 test9_1(a, true);
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
394 } else {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
395 test9_1(a, false);
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
396 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
397 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
398 return true;
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
399 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
400
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
401 static public void main(String[] args) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
402 boolean success = true;
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
403
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
404 success = test1() && success;
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
405
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
406 success = test2() && success;
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
407
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
408 success = test3() && success;
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
409
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
410 success = test4() && success;
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
411
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
412 success = test5() && success;
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
413
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
414 success = test6() && success;
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
415
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
416 success = test7() && success;
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
417
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
418 success = test8() && success;
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
419
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
420 success = test9() && success;
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
421
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
422 if (success) {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
423 System.out.println("TEST PASSED");
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
424 } else {
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
425 throw new RuntimeException("TEST FAILED: erroneous bound check elimination");
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
426 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
427 }
b2ee5dc63353 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
428 }