Path: blob/master/test/hotspot/jtreg/compiler/c1/TestPinnedConstantExceptionEdge.java
41149 views
/*1* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/*24* @test25* @bug 825505826* @summary Add check in LinearScan::resolve_exception_edge for pinned constant that is not virtual which cannot be used to find an interval which27resulted in an assertion error.28* @run main/othervm -Xcomp -XX:TieredStopAtLevel=1 -XX:CompileCommand=dontinline,compiler.c1.TestPinnedConstantExceptionEdge::dontInline29* -XX:CompileCommand=compileonly,compiler.c1.TestPinnedConstantExceptionEdge::* compiler.c1.TestPinnedConstantExceptionEdge30*/31package compiler.c1;3233public class TestPinnedConstantExceptionEdge {3435public static long iFld = 0;36public static boolean b1;37public static boolean b2;3839public static void test() {40int x = 5;41int y = 11;42for (int i = 1; i < 8; i++) {43for (int j = 1; j < 2; ++j) {44if (b1) {45try {46y = (x / x);47y = (500 / i);48y = (-214 / i);49} catch (ArithmeticException a_e) {}50// Recursion too deep in UseCountComputer::uses_do and therefore constant 1 is pinned.51iFld += (b1 ? 1 : 0) + (b2 ? 1 : 0) + 5 + 7 + 6 + 5 + y52+ dontInline(7) + dontInline(5) + 8 + 8 + 953+ dontInline(3) + dontInline(3) + dontInline(4)54+ dontInline(dontInline(5)) + dontInline(2);55return;56}57}58}59}6061// Not inlined62public static int dontInline(int a) {63return 0;64}6566public static void main(String[] strArr) {67test();68}69}70717273