Mercurial > hg > truffle
annotate test/compiler/6689060/Test.java @ 21864:e44b10693a44
Added tag jdk8u45-b11 for changeset f4822d122041
author | asaha |
---|---|
date | Mon, 09 Mar 2015 12:35:33 -0700 |
parents | c18cbe5936b8 |
children |
rev | line source |
---|---|
163 | 1 /* |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
386
diff
changeset
|
2 * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. |
253
b0fe4deeb9fb
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
163
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
163 | 4 * |
253
b0fe4deeb9fb
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
163
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
b0fe4deeb9fb
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
163
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
b0fe4deeb9fb
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
163
diff
changeset
|
7 * published by the Free Software Foundation. |
163 | 8 * |
253
b0fe4deeb9fb
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
163
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
b0fe4deeb9fb
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
163
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
b0fe4deeb9fb
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
163
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
b0fe4deeb9fb
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
163
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
b0fe4deeb9fb
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
163
diff
changeset
|
13 * accompanied this code). |
163 | 14 * |
253
b0fe4deeb9fb
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
163
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
b0fe4deeb9fb
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
163
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
b0fe4deeb9fb
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
163
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
163 | 18 * |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
386
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
386
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
386
diff
changeset
|
21 * questions. |
163 | 22 */ |
23 | |
24 /* | |
25 * @test | |
26 * @bug 6689060 | |
27 * @summary Escape Analysis does not work with Compressed Oops | |
28 * @run main/othervm -Xbatch -XX:CompileCommand=exclude,Test.dummy -XX:+AggressiveOpts Test | |
29 */ | |
30 | |
31 import java.lang.reflect.Array; | |
32 | |
33 class Point { | |
34 int x; | |
35 int y; | |
36 Point next; | |
37 int ax[]; | |
38 int ay[]; | |
39 Point pax[]; | |
40 Point pay[]; | |
41 public Point getNext() { | |
42 return next; | |
43 } | |
44 } | |
45 | |
46 public class Test { | |
47 | |
48 void dummy() { | |
49 // Empty method to verify correctness of DebugInfo. | |
50 // Use -XX:CompileCommand=exclude,Test.dummy | |
51 } | |
52 | |
53 int ival(int i) { | |
54 return i*2; | |
55 } | |
56 | |
57 int test80(int y, int l, int i) { | |
58 Point p = new Point(); | |
59 p.ax = new int[2]; | |
60 p.ay = new int[2]; | |
61 int x = 3; | |
62 p.ax[0] = x; | |
63 p.ay[1] = 3 * x + y; | |
64 dummy(); | |
65 return p.ax[0] * p.ay[1]; | |
66 } | |
67 | |
68 int test81(int y, int l, int i) { | |
69 Point p = new Point(); | |
70 p.ax = new int[2]; | |
71 p.ay = new int[2]; | |
72 int x = 3; | |
73 p.ax[0] = x; | |
74 p.ay[1] = 3 * x + y; | |
75 dummy(); | |
76 return p.ax[0] * p.ay[1]; | |
77 } | |
78 | |
79 | |
80 int test44(int y) { | |
81 Point p1 = new Point(); | |
82 p1.x = ival(3); | |
83 dummy(); | |
84 p1.y = 3 * p1.x + y; | |
85 return p1.y; | |
86 } | |
87 | |
88 int test43(int y) { | |
89 Point p1 = new Point(); | |
90 if ( (y & 1) == 1 ) { | |
91 p1.x = ival(3); | |
92 } else { | |
93 p1.x = ival(5); | |
94 } | |
95 dummy(); | |
96 p1.y = 3 * p1.x + y; | |
97 return p1.y; | |
98 } | |
99 | |
100 int test42(int y) { | |
101 Point p1 = new Point(); | |
102 p1.x = 3; | |
103 for (int i = 0; i < y; i++) { | |
104 if ( (i & 1) == 1 ) { | |
105 p1.x += 4; | |
106 } | |
107 } | |
108 p1.y = 3 * y + p1.x; | |
109 return p1.y; | |
110 } | |
111 | |
112 int test40(int y) { | |
113 Point p1 = new Point(); | |
114 if ( (y & 1) == 1 ) { | |
115 p1.x = 3; | |
116 } else { | |
117 p1.x = 5; | |
118 } | |
119 p1.y = 3 * p1.x + y; | |
120 return p1.y; | |
121 } | |
122 | |
123 int test41(int y) { | |
124 Point p1 = new Point(); | |
125 if ( (y & 1) == 1 ) { | |
126 p1.x += 4; | |
127 } else { | |
128 p1.x += 5; | |
129 } | |
130 p1.y = 3 * p1.x + y; | |
131 return p1.y; | |
132 } | |
133 | |
134 Point test00(int y) { | |
135 int x = 3; | |
136 Point p = new Point(); | |
137 p.x = x; | |
138 p.y = 3 * x + y; | |
139 return p; | |
140 } | |
141 | |
142 Point test01(int y) { | |
143 int x = 3; | |
144 Point p = new Point(); | |
145 p.x = x; | |
146 p.y = 3 * x + y; | |
147 dummy(); | |
148 return p; | |
149 } | |
150 | |
151 Point test02(int y) { | |
152 int x = 3; | |
153 Point p1 = null; | |
154 for (int i = 0; i < y; i++) { | |
155 Point p2 = new Point(); | |
156 p2.x = x; | |
157 p2.y = 3 * y + x; | |
158 p2.next = p1; | |
159 p1 = p2; | |
160 } | |
161 return p1; | |
162 } | |
163 | |
164 Point test03(int y) { | |
165 int x = 3; | |
166 Point p1 = null; | |
167 for (int i = 0; i < y; i++) { | |
168 Point p2 = new Point(); | |
169 p2.x = x; | |
170 p2.y = 3 * y + x; | |
171 p2.next = p1; | |
172 p1 = p2; | |
173 } | |
174 dummy(); | |
175 return p1; | |
176 } | |
177 | |
178 Point test04(int y) { | |
179 int x = 3; | |
180 Point p1 = null; | |
181 for (int i = 0; i < y; i++) { | |
182 Point p2 = new Point(); | |
183 p2.x = x; | |
184 p2.y = 3 * y + x; | |
185 p2.next = p1; | |
186 dummy(); | |
187 p1 = p2; | |
188 } | |
189 return p1; | |
190 } | |
191 | |
192 int test05(int y) { | |
193 int x = 3; | |
194 Point p1 = new Point(); | |
195 for (int i = 0; i < y; i++) { | |
196 Point p2 = new Point(); | |
197 p2.x = x; | |
198 p2.y = 3 * y + x; | |
199 p1.next = p2; | |
200 p1 = p2; | |
201 } | |
202 return p1.y; | |
203 } | |
204 | |
205 int test0(int y) { | |
206 int x = 3; | |
207 Point p = new Point(); | |
208 p.x = x; | |
209 p.y = 3 * x + y; | |
210 dummy(); | |
211 return p.x * p.y; | |
212 } | |
213 | |
214 int test1(int y) { | |
215 Point p = new Point(); | |
216 if ( (y & 1) == 1 ) { | |
217 p = new Point(); // Kill previous | |
218 } | |
219 int x = 3; | |
220 p.x = x; | |
221 p.y = 3 * x + y; | |
222 dummy(); | |
223 return p.x * p.y; | |
224 } | |
225 | |
226 int test2(int y) { | |
227 Point p1 = new Point(); | |
228 Point p2 = new Point(); | |
229 p1.x = 3; | |
230 p2.x = 4; | |
231 p1.y = 3 * p2.x + y; | |
232 p2.y = 3 * p1.x + y; | |
233 dummy(); | |
234 return p1.y * p2.y; | |
235 } | |
236 | |
237 int test3(int y, Point p1) { | |
238 Point p2 = new Point(); | |
239 p1.x = 3; | |
240 p2.x = 4; | |
241 p1.y = 3 * p2.x + y; | |
242 p2.y = 3 * p1.x + y; | |
243 dummy(); | |
244 return p1.y * p2.y; | |
245 } | |
246 | |
247 int test4(int y) { | |
248 Point p1 = new Point(); | |
249 Point p2 = new Point(); | |
250 if ( (y & 1) == 1 ) { | |
251 p1.x = 3; | |
252 p2.x = 4; | |
253 } else { | |
254 p1.x = 5; | |
255 p2.x = 6; | |
256 } | |
257 p1.y = 3 * p2.x + y; | |
258 p2.y = 3 * p1.x + y; | |
259 dummy(); | |
260 return p1.y * p2.y; | |
261 } | |
262 | |
263 int test5(int y, Point p1) { | |
264 Point p2 = new Point(); | |
265 if ( (y & 1) == 1 ) { | |
266 p1.x = 3; | |
267 p2.x = 4; | |
268 } else { | |
269 p1.x = 5; | |
270 p2.x = 6; | |
271 } | |
272 p1.y = 3 * p2.x + y; | |
273 p2.y = 3 * p1.x + y; | |
274 dummy(); | |
275 return p1.y * p2.y; | |
276 } | |
277 | |
278 int test6(int y) { | |
279 Point p1 = new Point(); | |
280 Point p2 = new Point(); | |
281 p1.next = p2; | |
282 if ( (y & 1) == 1 ) { | |
283 p1.x = 3; | |
284 p1.getNext().x = 4; | |
285 } else { | |
286 p1.x = 5; | |
287 p1.getNext().x = 6; | |
288 } | |
289 p1.y = 3 * p2.x + y; | |
290 p2.y = 3 * p1.x + y; | |
291 dummy(); | |
292 return p1.y * p2.y; | |
293 } | |
294 | |
295 int test7(int y, Point p1) { | |
296 Point p2 = new Point(); | |
297 p1.next = p2; | |
298 if ( (y & 1) == 1 ) { | |
299 p1.x = 3; | |
300 p1.getNext().x = 4; | |
301 } else { | |
302 p1.x = 5; | |
303 p1.getNext().x = 6; | |
304 } | |
305 p1.y = 3 * p2.x + y; | |
306 p2.y = 3 * p1.x + y; | |
307 dummy(); | |
308 return p1.y * p2.y; | |
309 } | |
310 | |
311 int test8(int y, int l, int i) { | |
312 Point p = new Point(); | |
313 p.ax = new int[l]; | |
314 p.ay = new int[l]; | |
315 int x = 3; | |
316 p.ax[i] = x; | |
317 p.ay[i] = 3 * x + y; | |
318 dummy(); | |
319 return p.ax[i] * p.ay[i]; | |
320 } | |
321 | |
322 int test9(int y, int l, int i) { | |
323 Point p = new Point(); | |
324 p.pax = new Point[l]; | |
325 p.pay = new Point[l]; | |
326 p.pax[i] = new Point(); | |
327 p.pay[i] = new Point(); | |
328 p.pax[i].x = 3; | |
329 p.pay[i].x = 4; | |
330 p.pax[i].y = 3 * p.pay[i].x + y; | |
331 p.pay[i].y = 3 * p.pax[i].x + y; | |
332 dummy(); | |
333 return p.pax[i].y * p.pay[i].y; | |
334 } | |
335 | |
336 int test10(int y, int l, int i, Class cls) { | |
337 Point p = new Point(); | |
338 try { | |
339 p.pax = (Point[])Array.newInstance(cls, l); | |
340 p.pax[i] = (Point)cls.newInstance(); | |
341 } | |
342 catch(java.lang.InstantiationException ex) { | |
343 return 0; | |
344 } | |
345 catch(java.lang.IllegalAccessException ex) { | |
346 return 0; | |
347 } | |
348 p.pax[i].x = 3; | |
349 p.pax[i].y = 3 * p.pax[i].x + y; | |
350 dummy(); | |
351 return p.pax[i].x * p.pax[i].y; | |
352 } | |
353 | |
354 int test11(int y) { | |
355 Point p1 = new Point(); | |
356 Point p2 = new Point(); | |
357 p1.next = p2; | |
358 if ( (y & 1) == 1 ) { | |
359 p1.x = 3; | |
360 p1.next.x = 4; | |
361 } else { | |
362 p1.x = 5; | |
363 p1.next.x = 6; | |
364 } | |
365 p1.y = 3 * p1.next.x + y; | |
366 p1.next.y = 3 * p1.x + y; | |
367 dummy(); | |
368 return p1.y * p1.next.y; | |
369 } | |
370 | |
371 int test12(int y) { | |
372 Point p1 = new Point(); | |
373 p1.next = p1; | |
374 if ( (y & 1) == 1 ) { | |
375 p1.x = 3; | |
376 p1.next.x = 4; | |
377 } else { | |
378 p1.x = 5; | |
379 p1.next.x = 6; | |
380 } | |
381 p1.y = 3 * p1.next.x + y; | |
382 p1.next.y = 3 * p1.x + y; | |
383 dummy(); | |
384 return p1.y * p1.next.y; | |
385 } | |
386 | |
387 | |
388 public static void main(String args[]) { | |
389 Test tsr = new Test(); | |
390 Point p = new Point(); | |
391 Point ptmp = p; | |
392 Class cls = Point.class; | |
393 int y = 0; | |
394 for (int i=0; i<10000; i++) { | |
395 ptmp.next = tsr.test00(1); | |
396 ptmp.next = tsr.test01(1); | |
397 ptmp.next = tsr.test02(1); | |
398 ptmp.next = tsr.test03(1); | |
399 ptmp.next = tsr.test04(1); | |
400 | |
401 y = tsr.test05(1); | |
402 | |
403 y = tsr.test80(y, 1, 0); | |
404 y = tsr.test81(y, 1, 0); | |
405 | |
406 y = tsr.test44(y); | |
407 y = tsr.test43(y); | |
408 y = tsr.test42(y); | |
409 y = tsr.test40(y); | |
410 y = tsr.test41(y); | |
411 | |
412 y = tsr.test0(y); | |
413 y = tsr.test1(y); | |
414 y = tsr.test2(y); | |
415 y = tsr.test3(y, p); | |
416 y = tsr.test4(y); | |
417 y = tsr.test5(y, p); | |
418 y = tsr.test6(y); | |
419 y = tsr.test7(y, p); | |
420 y = tsr.test8(y, 1, 0); | |
421 y = tsr.test9(y, 1, 0); | |
422 y = tsr.test10(y, 1, 0, cls); | |
423 y = tsr.test11(y); | |
424 y = tsr.test12(y); | |
425 } | |
426 for (int i=0; i<10000; i++) { | |
427 ptmp.next = tsr.test00(1); | |
428 ptmp.next = tsr.test01(1); | |
429 ptmp.next = tsr.test02(1); | |
430 ptmp.next = tsr.test03(1); | |
431 ptmp.next = tsr.test04(1); | |
432 | |
433 y = tsr.test05(1); | |
434 | |
435 y = tsr.test80(y, 1, 0); | |
436 y = tsr.test81(y, 1, 0); | |
437 | |
438 y = tsr.test44(y); | |
439 y = tsr.test43(y); | |
440 y = tsr.test42(y); | |
441 y = tsr.test40(y); | |
442 y = tsr.test41(y); | |
443 | |
444 y = tsr.test0(y); | |
445 y = tsr.test1(y); | |
446 y = tsr.test2(y); | |
447 y = tsr.test3(y, p); | |
448 y = tsr.test4(y); | |
449 y = tsr.test5(y, p); | |
450 y = tsr.test6(y); | |
451 y = tsr.test7(y, p); | |
452 y = tsr.test8(y, 1, 0); | |
453 y = tsr.test9(y, 1, 0); | |
454 y = tsr.test10(y, 1, 0, cls); | |
455 y = tsr.test11(y); | |
456 y = tsr.test12(y); | |
457 } | |
458 for (int i=0; i<10000; i++) { | |
459 ptmp.next = tsr.test00(1); | |
460 ptmp.next = tsr.test01(1); | |
461 ptmp.next = tsr.test02(1); | |
462 ptmp.next = tsr.test03(1); | |
463 ptmp.next = tsr.test04(1); | |
464 | |
465 y = tsr.test05(1); | |
466 | |
467 y = tsr.test80(y, 1, 0); | |
468 y = tsr.test81(y, 1, 0); | |
469 | |
470 y = tsr.test44(y); | |
471 y = tsr.test43(y); | |
472 y = tsr.test42(y); | |
473 y = tsr.test40(y); | |
474 y = tsr.test41(y); | |
475 | |
476 y = tsr.test0(y); | |
477 y = tsr.test1(y); | |
478 y = tsr.test2(y); | |
479 y = tsr.test3(y, p); | |
480 y = tsr.test4(y); | |
481 y = tsr.test5(y, p); | |
482 y = tsr.test6(y); | |
483 y = tsr.test7(y, p); | |
484 y = tsr.test8(y, 1, 0); | |
485 y = tsr.test9(y, 1, 0); | |
486 y = tsr.test10(y, 1, 0, cls); | |
487 y = tsr.test11(y); | |
488 y = tsr.test12(y); | |
489 } | |
490 | |
491 int z = 0; | |
492 y = tsr.test80(0, 1, 0); | |
493 z += y; | |
494 System.out.println("After 'test80' y=" + y); | |
495 y = tsr.test81(0, 1, 0); | |
496 z += y; | |
497 System.out.println("After 'test81' y=" + y); | |
498 | |
499 y = tsr.test44(0); | |
500 z += y; | |
501 System.out.println("After 'test44' y=" + y); | |
502 y = tsr.test43(0); | |
503 z += y; | |
504 System.out.println("After 'test43' y=" + y); | |
505 y = tsr.test42(0); | |
506 z += y; | |
507 System.out.println("After 'test42' y=" + y); | |
508 y = tsr.test40(0); | |
509 z += y; | |
510 System.out.println("After 'test40' y=" + y); | |
511 y = tsr.test41(0); | |
512 z += y; | |
513 System.out.println("After 'test41' y=" + y); | |
514 | |
515 ptmp.next = tsr.test00(1); | |
516 z += y; | |
517 System.out.println("After 'test00' p.y=" + ptmp.next.y); | |
518 ptmp.next = tsr.test01(1); | |
519 z += y; | |
520 System.out.println("After 'test01' p.y=" + ptmp.next.y); | |
521 ptmp.next = tsr.test02(1); | |
522 z += y; | |
523 System.out.println("After 'test02' p.y=" + ptmp.next.y); | |
524 ptmp.next = tsr.test03(1); | |
525 z += y; | |
526 System.out.println("After 'test03' p.y=" + ptmp.next.y); | |
527 ptmp.next = tsr.test04(1); | |
528 z += y; | |
529 System.out.println("After 'test04' p.y=" + ptmp.next.y); | |
530 | |
531 y = tsr.test05(1); | |
532 z += y; | |
533 System.out.println("After 'test05' y=" + y); | |
534 | |
535 y = tsr.test0(0); | |
536 z += y; | |
537 System.out.println("After 'test0' y=" + y); | |
538 y = tsr.test1(0); | |
539 z += y; | |
540 System.out.println("After 'test1' y=" + y); | |
541 y = tsr.test2(0); | |
542 z += y; | |
543 System.out.println("After 'test2' y=" + y); | |
544 y = tsr.test3(0, new Point()); | |
545 z += y; | |
546 System.out.println("After 'test3' y=" + y); | |
547 y = tsr.test4(0); | |
548 z += y; | |
549 System.out.println("After 'test4' y=" + y); | |
550 y = tsr.test5(0, new Point()); | |
551 z += y; | |
552 System.out.println("After 'test5' y=" + y); | |
553 y = tsr.test6(0); | |
554 z += y; | |
555 System.out.println("After 'test6' y=" + y); | |
556 y = tsr.test7(0, new Point()); | |
557 z += y; | |
558 System.out.println("After 'test7' y=" + y); | |
559 y = tsr.test8(0, 1, 0); | |
560 z += y; | |
561 System.out.println("After 'test8' y=" + y); | |
562 y = tsr.test9(0, 1, 0); | |
563 z += y; | |
564 System.out.println("After 'test9' y=" + y); | |
565 y = tsr.test10(0, 1, 0, cls); | |
566 z += y; | |
567 System.out.println("After 'test10' y=" + y); | |
568 y = tsr.test11(0); | |
569 z += y; | |
570 System.out.println("After 'test11' y=" + y); | |
571 y = tsr.test12(0); | |
572 z += y; | |
573 System.out.println("After 'test12' y=" + y); | |
574 System.out.println("Sum of y =" + z); | |
575 } | |
576 } |