Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/compiler/gcbarriers/EqvUncastStepOverBarrier.java
41152 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 8212673
27
* @summary Node::eqv_uncast() shouldn't step over load barriers unconditionally
28
* @library /test/lib /
29
* @modules java.base/jdk.internal.misc
30
*
31
* @build sun.hotspot.WhiteBox
32
* @run driver jdk.test.lib.helpers.ClassFileInstaller sun.hotspot.WhiteBox
33
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:-UseOnStackReplacement -XX:-TieredCompilation -XX:-BackgroundCompilation EqvUncastStepOverBarrier
34
*/
35
36
import sun.hotspot.WhiteBox;
37
import java.lang.reflect.Method;
38
39
public class EqvUncastStepOverBarrier {
40
static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
41
42
private static Object field = new A();
43
44
public static void main(String[] args) throws Exception {
45
for (int i = 0; i < 20_000; i++) {
46
test();
47
test();
48
test_helper(null, 0);
49
}
50
Method m = EqvUncastStepOverBarrier.class.getDeclaredMethod("test");
51
WHITE_BOX.enqueueMethodForCompilation(m, 4);
52
if (!WHITE_BOX.isMethodCompiled(m, false)) {
53
throw new RuntimeException("Method compilation failed");
54
}
55
}
56
57
private static Object test() {
58
Object o = field;
59
if (o == null) {}
60
for (int i = 1; i < 100; i *= 2) {
61
int j = 0;
62
for (; j < 4; j++) ;
63
o = test_helper(o, j);
64
}
65
return o;
66
}
67
68
private static Object test_helper(Object o, int j) {
69
if (j == 4) {
70
A a = (A) o;
71
o = a;
72
} else {
73
o = new Object();
74
}
75
return o;
76
}
77
78
private static class A {
79
}
80
}
81
82