Mercurial > hg > truffle
annotate test/compiler/types/TestSpeculationFailedHigherEqual.java @ 18440:7aae90a0031c
LIR: map all VirtualStackSlot operands to StackSlots.
author | Josef Eisl <josef.eisl@jku.at> |
---|---|
date | Tue, 11 Nov 2014 17:03:16 +0100 |
parents | 45b0159f30f2 |
children | 92aa6797d639 |
rev | line source |
---|---|
14383
5ec7dace41a6
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
1 /* |
5ec7dace41a6
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. |
5ec7dace41a6
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. |
5ec7dace41a6
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
4 * |
5ec7dace41a6
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 |
5ec7dace41a6
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 |
5ec7dace41a6
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. |
5ec7dace41a6
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
8 * |
5ec7dace41a6
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 |
5ec7dace41a6
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 |
5ec7dace41a6
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 |
5ec7dace41a6
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 |
5ec7dace41a6
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
13 * accompanied this code). |
5ec7dace41a6
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
14 * |
5ec7dace41a6
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 |
5ec7dace41a6
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, |
5ec7dace41a6
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. |
5ec7dace41a6
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
18 * |
5ec7dace41a6
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 |
5ec7dace41a6
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 |
5ec7dace41a6
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
21 * questions. |
5ec7dace41a6
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
22 */ |
5ec7dace41a6
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
23 |
5ec7dace41a6
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
24 /* |
5ec7dace41a6
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
25 * @test |
5ec7dace41a6
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
26 * @bug 8027422 |
5ec7dace41a6
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 |
14681 | 28 * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:TypeProfileLevel=222 -XX:+UseTypeSpeculation -XX:-BackgroundCompilation TestSpeculationFailedHigherEqual |
14383
5ec7dace41a6
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
29 * |
5ec7dace41a6
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
30 */ |
5ec7dace41a6
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
31 |
5ec7dace41a6
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
32 public class TestSpeculationFailedHigherEqual { |
5ec7dace41a6
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
33 |
5ec7dace41a6
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
34 static class A { |
5ec7dace41a6
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
35 void m() {} |
5ec7dace41a6
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
36 int i; |
5ec7dace41a6
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
37 } |
5ec7dace41a6
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
38 |
5ec7dace41a6
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 { |
5ec7dace41a6
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
40 } |
5ec7dace41a6
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
41 |
5ec7dace41a6
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
42 static C c; |
5ec7dace41a6
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
43 |
5ec7dace41a6
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) { |
5ec7dace41a6
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 |
5ec7dace41a6
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
46 if (cond ) { |
5ec7dace41a6
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
47 a = c; |
5ec7dace41a6
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
48 } |
5ec7dace41a6
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) |
5ec7dace41a6
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
50 int i = a.i; |
5ec7dace41a6
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
51 return a; |
5ec7dace41a6
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
52 } |
5ec7dace41a6
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
53 |
5ec7dace41a6
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) { |
5ec7dace41a6
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
55 C c = new C(); |
5ec7dace41a6
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
56 TestSpeculationFailedHigherEqual.c = c; |
5ec7dace41a6
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++) { |
5ec7dace41a6
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); |
5ec7dace41a6
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
59 } |
5ec7dace41a6
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
60 |
5ec7dace41a6
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"); |
5ec7dace41a6
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
62 } |
5ec7dace41a6
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
diff
changeset
|
63 } |