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