Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/compiler/escapeAnalysis/TestMissingAntiDependency.java
41149 views
1
/*
2
* Copyright (c) 2020, 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 8252292
27
* @summary 8240795 may cause anti-dependency to be missed
28
* @requires vm.gc.Parallel
29
*
30
* @run main/othervm -XX:-BackgroundCompilation -XX:+UseParallelGC TestMissingAntiDependency
31
*
32
*/
33
34
public class TestMissingAntiDependency {
35
public static void main(String[] args) {
36
int[] src = new int[10];
37
for (int i = 0; i < 20_000; i++) {
38
test(src, true, true, 10);
39
test(src, true, false, 10);
40
test(src, false, false, 10);
41
}
42
src[9] = 42;
43
final int v = test(src, true, true, 1);
44
if (v != 42) {
45
throw new RuntimeException("Incorrect return value " + v);
46
}
47
}
48
49
private static int test(int[] src, boolean flag1, boolean flag2, int stop) {
50
int v = 0;
51
int j = 1;
52
for (; j < 10; j++) {
53
for (int i = 0; i < 2; i++) {
54
55
}
56
}
57
int[] dst = new int[10];
58
for (int i = 0; i < stop; i ++) {
59
if (flag1) {
60
System.arraycopy(src, 0, dst, 0, j);
61
v = dst[9];
62
if (flag2) {
63
src[9] = 0x42;
64
}
65
}
66
}
67
return v;
68
}
69
}
70
71