Mercurial > hg > truffle
annotate test/compiler/types/TestSpeculationFailedHigherEqual.java @ 21867:dc29108bcbcb jdk8u45-b12
Merge
author | asaha |
---|---|
date | Mon, 16 Mar 2015 09:13:01 -0700 |
parents | 8f28240318a2 |
children | 92aa6797d639 |
rev | line source |
---|---|
17671
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
1 /* |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
4 * |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
8 * |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
13 * accompanied this code). |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
14 * |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
18 * |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
21 * questions. |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
22 */ |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
23 |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
24 /* |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
25 * @test |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
26 * @bug 8027422 |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
27 * @summary type methods shouldn't always operate on speculative part |
17735 | 28 * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:TypeProfileLevel=222 -XX:+UseTypeSpeculation -XX:-BackgroundCompilation TestSpeculationFailedHigherEqual |
17671
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
29 * |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
30 */ |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
31 |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
32 public class TestSpeculationFailedHigherEqual { |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
33 |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
34 static class A { |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
35 void m() {} |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
36 int i; |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
37 } |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
38 |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
39 static class C extends A { |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
40 } |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
41 |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
42 static C c; |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
43 |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
44 static A m1(A a, boolean cond) { |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
45 // speculative type for a is C not null |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
46 if (cond ) { |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
47 a = c; |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
48 } |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
49 // speculative type for a is C (may be null) |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
50 int i = a.i; |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
51 return a; |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
52 } |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
53 |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
54 static public void main(String[] args) { |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
55 C c = new C(); |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
56 TestSpeculationFailedHigherEqual.c = c; |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
57 for (int i = 0; i < 20000; i++) { |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
58 m1(c, i%2 == 0); |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
59 } |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
60 |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
61 System.out.println("TEST PASSED"); |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
62 } |
de95063c0e34
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
63 } |