Mon, 11 Mar 2019 11:42:57 +0100
8218201: Failures when vmIntrinsics::_getClass is not inlined
Summary: Fix BCEscapeAnalyzer to correctly handle _getClass intrinsic.
Reviewed-by: kvn, dlong, redestad, neliasso
thartmann@9736 | 1 | /* |
thartmann@9736 | 2 | * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. |
thartmann@9736 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
thartmann@9736 | 4 | * |
thartmann@9736 | 5 | * This code is free software; you can redistribute it and/or modify it |
thartmann@9736 | 6 | * under the terms of the GNU General Public License version 2 only, as |
thartmann@9736 | 7 | * published by the Free Software Foundation. |
thartmann@9736 | 8 | * |
thartmann@9736 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
thartmann@9736 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
thartmann@9736 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
thartmann@9736 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
thartmann@9736 | 13 | * accompanied this code). |
thartmann@9736 | 14 | * |
thartmann@9736 | 15 | * You should have received a copy of the GNU General Public License version |
thartmann@9736 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
thartmann@9736 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
thartmann@9736 | 18 | * |
thartmann@9736 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
thartmann@9736 | 20 | * or visit www.oracle.com if you need additional information or have any |
thartmann@9736 | 21 | * questions. |
thartmann@9736 | 22 | */ |
thartmann@9736 | 23 | |
thartmann@9736 | 24 | /* |
thartmann@9736 | 25 | * @test |
thartmann@9736 | 26 | * @bug 8218201 |
thartmann@9736 | 27 | * @summary BCEscapeAnalyzer assigns wrong escape state to getClass return value. |
thartmann@9736 | 28 | * @run main/othervm -XX:-TieredCompilation -Xcomp -XX:+UnlockDiagnosticVMOptions -XX:DisableIntrinsic=_getClass |
thartmann@9736 | 29 | * -XX:CompileCommand=quiet -XX:CompileCommand=compileonly,compiler.escapeAnalysis.TestGetClass::test |
thartmann@9736 | 30 | * -XX:+PrintCompilation compiler.escapeAnalysis.TestGetClass |
thartmann@9736 | 31 | */ |
thartmann@9736 | 32 | |
thartmann@9736 | 33 | package compiler.escapeAnalysis; |
thartmann@9736 | 34 | |
thartmann@9736 | 35 | public class TestGetClass { |
thartmann@9736 | 36 | static Object obj = new Object(); |
thartmann@9736 | 37 | |
thartmann@9736 | 38 | public static boolean test() { |
thartmann@9736 | 39 | if (obj.getClass() == Object.class) { |
thartmann@9736 | 40 | synchronized (obj) { |
thartmann@9736 | 41 | return true; |
thartmann@9736 | 42 | } |
thartmann@9736 | 43 | } |
thartmann@9736 | 44 | return false; |
thartmann@9736 | 45 | } |
thartmann@9736 | 46 | |
thartmann@9736 | 47 | public static void main(String[] args) { |
thartmann@9736 | 48 | if (!test()) { |
thartmann@9736 | 49 | throw new RuntimeException("Test failed"); |
thartmann@9736 | 50 | } |
thartmann@9736 | 51 | } |
thartmann@9736 | 52 | } |