test/compiler/loopopts/TestBeautifyLoops_2.java

changeset 9922
f7691a80458c
equal deleted inserted replaced
9921:9cbafea410f5 9922:f7691a80458c
1 /*
2 * Copyright (c) 2020, Huawei Technologies Co. Ltd. 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 8244407
27 * @summary JVM crashes after transformation in C2 IdealLoopTree::split_fall_in
28 *
29 * @run main/othervm -Xcomp -XX:-BackgroundCompilation
30 * -XX:CompileCommand=compileonly,compiler.loopopts.TestBeautifyLoops_2::testMethod
31 * compiler.loopopts.TestBeautifyLoops_2
32 */
33
34 package compiler.loopopts;
35
36 public class TestBeautifyLoops_2 {
37
38 private class X {
39 public int x() {
40 return -1;
41 }
42 }
43
44 private int mI = 0;
45 private float mF = 0;
46 private boolean mZ = false;
47 private X mX = new X();
48 private long[] mArray = new long[331];
49
50 private void testMethod() {
51 double d = 0;
52
53 for (int i = 0; i < 331; i++) {
54 if (mZ) {
55 continue;
56 }
57
58 try {
59 for (int j = mArray.length - 1; j >= 0; j--) {
60 for (int k = 0; k < 331; k++) {
61 d += ((double) new Double(d));
62 switch (267) {
63 case 256:
64 default: {
65 mF += (mX.x());
66 break;
67 }
68 }
69 }
70 }
71 } catch (Exception ignore) {
72 }
73 }
74 }
75
76 public static void main(String[] args) {
77 TestBeautifyLoops_2 obj = new TestBeautifyLoops_2();
78 obj.testMethod();
79 }
80
81 }

mercurial