Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/jdk17u
Path: blob/master/test/hotspot/jtreg/compiler/loopopts/TestDeadCountedLoop.java
64478 views
1
/*
2
* Copyright (c) 2021, Red Hat, Inc. 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 8267399
27
* @summary C2: java/text/Normalizer/ConformanceTest.java test failed with assertion
28
*
29
* @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation TestDeadCountedLoop
30
*
31
*/
32
33
public class TestDeadCountedLoop {
34
public static void main(String[] args) {
35
for (int i = 0; i < 20_000; i++) {
36
test(true, new int[10], false, 0, 1);
37
test(false, new int[10], false, 0, 1);
38
}
39
}
40
41
private static int test(boolean flag, int[] array2, boolean flag2, int start, int stop) {
42
if (array2 == null) {
43
}
44
int[] array;
45
if (flag) {
46
array = new int[1];
47
} else {
48
array = new int[2];
49
}
50
int len = array.length;
51
int v = 1;
52
for (int j = start; j < stop; j++) {
53
for (int i = 0; i < len; i++) {
54
if (i > 0) {
55
if (flag2) {
56
break;
57
}
58
v *= array2[i + j];
59
}
60
}
61
}
62
63
return v;
64
}
65
}
66
67