Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/compiler/loopstripmining/LimitSharedwithOutOfLoopTest.java
41149 views
1
/*
2
* Copyright (c) 2018, 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 8193597
27
* @summary limit test is shared with out of loop if
28
*
29
* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-BackgroundCompilation -XX:LoopUnrollLimit=0 -XX:+UseCountedLoopSafepoints -XX:LoopStripMiningIter=1000 LimitSharedwithOutOfLoopTest
30
*
31
*/
32
33
public class LimitSharedwithOutOfLoopTest {
34
public static void main(String[] args) {
35
boolean[] array1 = new boolean[2001];
36
boolean[] array2 = new boolean[2001];
37
boolean[] array3 = new boolean[2001];
38
array2[1000] = true;
39
array3[2000] = true;
40
for (int i = 0; i < 20_000; i++) {
41
if (test(2000, array1)) {
42
throw new RuntimeException("bad return");
43
}
44
if (!test(2000, array2)) {
45
throw new RuntimeException("bad return");
46
}
47
if (test(2000, array3)) {
48
throw new RuntimeException("bad return");
49
}
50
}
51
}
52
53
static volatile boolean barrier;
54
55
private static boolean test(int limit, boolean[] array) {
56
for (int i = 0; i < limit;) {
57
i++;
58
if (array[i]) {
59
// Same test as end of loop test. When loop is strip
60
// mined, this must not become the end of inner loop
61
// test.
62
if (i < limit) {
63
return true;
64
}
65
return false;
66
}
67
barrier = true;
68
}
69
return false;
70
}
71
}
72
73