Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/test/gc/shenandoah/options/TestExplicitGC.java
32285 views
1
'/*
2
* Copyright (c) 2017, 2018, Red Hat, Inc. All rights reserved.
3
*
4
* This code is free software; you can redistribute it and/or modify it
5
* under the terms of the GNU General Public License version 2 only, as
6
* published by the Free Software Foundation.
7
*
8
* This code is distributed in the hope that it will be useful, but WITHOUT
9
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
11
* version 2 for more details (a copy is included in the LICENSE file that
12
* accompanied this code).
13
*
14
* You should have received a copy of the GNU General Public License version
15
* 2 along with this work; if not, write to the Free Software Foundation,
16
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
17
*
18
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
19
* or visit www.oracle.com if you need additional information or have any
20
* questions.
21
*
22
*/
23
24
/*
25
* @test TestExplicitGC
26
* @summary Test that Shenandoah reacts to explicit GC flags appropriately
27
* @key gc
28
* @library /testlibrary
29
*
30
* @run driver TestExplicitGC
31
*/
32
33
import com.oracle.java.testlibrary.*;
34
35
public class TestExplicitGC {
36
37
enum Mode {
38
PRODUCT,
39
DIAGNOSTIC,
40
EXPERIMENTAL,
41
}
42
43
public static void main(String[] args) throws Exception {
44
if (args.length > 0) {
45
System.out.println("Calling System.gc()");
46
System.gc();
47
return;
48
}
49
50
String[] full = new String[] {
51
"Pause Full"
52
};
53
54
String[] concNormal = new String[] {
55
"Pause Init Mark",
56
"Pause Final Mark",
57
};
58
59
{
60
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
61
"-Xmx128m",
62
"-XX:+UnlockExperimentalVMOptions",
63
"-XX:+UseShenandoahGC",
64
"-verbose:gc",
65
TestExplicitGC.class.getName(),
66
"test");
67
OutputAnalyzer output = new OutputAnalyzer(pb.start());
68
for (String p : full) {
69
output.shouldNotContain(p);
70
}
71
for (String p : concNormal) {
72
output.shouldContain(p);
73
}
74
}
75
76
{
77
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
78
"-Xmx128m",
79
"-XX:+UnlockExperimentalVMOptions",
80
"-XX:+UseShenandoahGC",
81
"-verbose:gc",
82
"-XX:+DisableExplicitGC",
83
TestExplicitGC.class.getName(),
84
"test");
85
OutputAnalyzer output = new OutputAnalyzer(pb.start());
86
for (String p : full) {
87
output.shouldNotContain(p);
88
}
89
for (String p : concNormal) {
90
output.shouldNotContain(p);
91
}
92
}
93
94
{
95
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
96
"-Xmx128m",
97
"-XX:+UnlockExperimentalVMOptions",
98
"-XX:+UseShenandoahGC",
99
"-verbose:gc",
100
"-XX:+ExplicitGCInvokesConcurrent",
101
TestExplicitGC.class.getName(),
102
"test");
103
OutputAnalyzer output = new OutputAnalyzer(pb.start());
104
for (String p : full) {
105
output.shouldNotContain(p);
106
}
107
for (String p : concNormal) {
108
output.shouldContain(p);
109
}
110
}
111
112
{
113
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
114
"-Xmx128m",
115
"-XX:+UnlockExperimentalVMOptions",
116
"-XX:+UseShenandoahGC",
117
"-verbose:gc",
118
"-XX:-ExplicitGCInvokesConcurrent",
119
TestExplicitGC.class.getName(),
120
"test");
121
OutputAnalyzer output = new OutputAnalyzer(pb.start());
122
for (String p : full) {
123
output.shouldContain(p);
124
}
125
for (String p : concNormal) {
126
output.shouldNotContain(p);
127
}
128
}
129
130
{
131
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
132
"-Xmx128m",
133
"-XX:+UnlockExperimentalVMOptions",
134
"-XX:+UseShenandoahGC",
135
"-verbose:gc",
136
"-XX:+ExplicitGCInvokesConcurrent",
137
"-XX:ShenandoahGCMode=iu",
138
TestExplicitGC.class.getName(),
139
"test");
140
OutputAnalyzer output = new OutputAnalyzer(pb.start());
141
for (String p : full) {
142
output.shouldNotContain(p);
143
}
144
for (String p : concNormal) {
145
output.shouldContain(p);
146
}
147
}
148
}
149
}
150
151