Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/gc/shenandoah/compiler/TestBarrierExpansionDeadMemPhi.java
41153 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 8255400
27
* @summary C2 failures after JDK-8255000
28
* @requires vm.gc.Shenandoah
29
* @modules java.base/jdk.internal.misc:+open
30
*
31
* @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -XX:-TieredCompilation -XX:+UseShenandoahGC TestBarrierExpansionDeadMemPhi
32
*
33
*
34
*/
35
36
import jdk.internal.misc.Unsafe;
37
import java.util.Arrays;
38
import java.lang.reflect.Field;
39
40
public class TestBarrierExpansionDeadMemPhi {
41
42
static final jdk.internal.misc.Unsafe UNSAFE = Unsafe.getUnsafe();
43
44
static final long F_OFFSET;
45
46
static class A {
47
int f;
48
}
49
50
static {
51
try {
52
Field fField = A.class.getDeclaredField("f");
53
F_OFFSET = UNSAFE.objectFieldOffset(fField);
54
} catch (Exception e) {
55
throw new RuntimeException(e);
56
}
57
}
58
59
static int test(Object[] array) {
60
int f = 0;
61
for (int i = 0; i < 100; i++) {
62
f += UNSAFE.getInt(array[i], F_OFFSET);
63
}
64
return f;
65
}
66
67
static public void main(String[] args) {
68
Object[] array = new Object[100];
69
Arrays.fill(array, new A());
70
71
for (int i = 0; i < 20000; i++) {
72
test(array);
73
}
74
}
75
}
76
77