|
| 1 | +/* |
| 2 | + * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. |
| 3 | + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
| 4 | + * |
| 5 | + * This code is free software; you can redistribute it and/or modify it |
| 6 | + * under the terms of the GNU General Public License version 2 only, as |
| 7 | + * published by the Free Software Foundation. |
| 8 | + * |
| 9 | + * This code is distributed in the hope that it will be useful, but WITHOUT |
| 10 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 11 | + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 12 | + * version 2 for more details (a copy is included in the LICENSE file that |
| 13 | + * accompanied this code). |
| 14 | + * |
| 15 | + * You should have received a copy of the GNU General Public License version |
| 16 | + * 2 along with this work; if not, write to the Free Software Foundation, |
| 17 | + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
| 18 | + * |
| 19 | + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
| 20 | + * or visit www.oracle.com if you need additional information or have any |
| 21 | + * questions. |
| 22 | + */ |
| 23 | + |
| 24 | +/* |
| 25 | + * @test |
| 26 | + * @bug 8255058 |
| 27 | + * @summary Add check in LinearScan::resolve_exception_edge for pinned constant that is not virtual which cannot be used to find an interval which |
| 28 | + resulted in an assertion error. |
| 29 | + * @run main/othervm -Xcomp -XX:TieredStopAtLevel=1 -XX:CompileCommand=dontinline,compiler.c1.TestPinnedConstantExceptionEdge::dontInline |
| 30 | + * -XX:CompileCommand=compileonly,compiler.c1.TestPinnedConstantExceptionEdge::* compiler.c1.TestPinnedConstantExceptionEdge |
| 31 | + */ |
| 32 | +package compiler.c1; |
| 33 | + |
| 34 | +public class TestPinnedConstantExceptionEdge { |
| 35 | + |
| 36 | + public static long iFld = 0; |
| 37 | + public static boolean b1; |
| 38 | + public static boolean b2; |
| 39 | + |
| 40 | + public static void test() { |
| 41 | + int x = 5; |
| 42 | + int y = 11; |
| 43 | + for (int i = 1; i < 8; i++) { |
| 44 | + for (int j = 1; j < 2; ++j) { |
| 45 | + if (b1) { |
| 46 | + try { |
| 47 | + y = (x / x); |
| 48 | + y = (500 / i); |
| 49 | + y = (-214 / i); |
| 50 | + } catch (ArithmeticException a_e) {} |
| 51 | + // Recursion too deep in UseCountComputer::uses_do and therefore constant 1 is pinned. |
| 52 | + iFld += (b1 ? 1 : 0) + (b2 ? 1 : 0) + 5 + 7 + 6 + 5 + y |
| 53 | + + dontInline(7) + dontInline(5) + 8 + 8 + 9 |
| 54 | + + dontInline(3) + dontInline(3) + dontInline(4) |
| 55 | + + dontInline(dontInline(5)) + dontInline(2); |
| 56 | + return; |
| 57 | + } |
| 58 | + } |
| 59 | + } |
| 60 | + } |
| 61 | + |
| 62 | + // Not inlined |
| 63 | + public static int dontInline(int a) { |
| 64 | + return 0; |
| 65 | + } |
| 66 | + |
| 67 | + public static void main(String[] strArr) { |
| 68 | + test(); |
| 69 | + } |
| 70 | +} |
| 71 | + |
0 commit comments