Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/gc/shenandoah/compiler/TestBadRawMemoryAfterCall.java
41153 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 8258393 8263376
27
* @summary Shenandoah: "graph should be schedulable" assert failure
28
* @requires vm.flavor == "server"
29
* @requires vm.gc.Shenandoah
30
*
31
* @run main/othervm -XX:+UseShenandoahGC -XX:-BackgroundCompilation TestBadRawMemoryAfterCall
32
*
33
*/
34
35
public class TestBadRawMemoryAfterCall {
36
public static void main(String[] args) {
37
A a = new A();
38
B b = new B();
39
C c = new C();
40
for (int i = 0; i < 20_000; i++) {
41
test1(a);
42
test1(b);
43
test1(c);
44
45
test2(a, i);
46
test2(b, i);
47
test2(c, i);
48
}
49
}
50
51
private static Object test1(A a) {
52
if (a.getClass() == A.class) {
53
}
54
55
Object o = null;
56
try {
57
a.m();
58
o = a.getClass();
59
} catch (Exception e) {
60
61
}
62
return o;
63
}
64
65
static int field;
66
67
private static Object test2(A a, int i) {
68
if (a.getClass() == A.class) {
69
}
70
71
Object o = null;
72
try {
73
a.m();
74
o = a.getClass();
75
} catch (Exception e) {
76
i = 42;
77
}
78
if (i == 42) {
79
field = 42;
80
}
81
return o;
82
}
83
84
private static class A {
85
void m() throws Exception {
86
throw new Exception();
87
}
88
}
89
private static class B extends A {
90
void m() {
91
}
92
}
93
private static class C extends B {
94
void m() {
95
}
96
}
97
}
98
99