Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/gc/g1/TestMarkStackSizes.java
40942 views
1
/*
2
* Copyright (c) 2020, Oracle and/or its affiliates. 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
package gc.g1;
25
26
/*
27
* @test TestMarkStackSizes
28
* @bug 8238855
29
* @summary Consistency checks for marking flag related options.
30
* @requires vm.gc.G1
31
* @library /test/lib
32
* @modules java.base/jdk.internal.misc
33
* java.management
34
* @run driver gc.g1.TestMarkStackSizes
35
*/
36
37
import java.util.ArrayList;
38
import java.util.Collections;
39
40
import jdk.test.lib.process.OutputAnalyzer;
41
import jdk.test.lib.process.ProcessTools;
42
43
public class TestMarkStackSizes {
44
private static void runTest(boolean shouldSucceed, String... extraArgs) throws Exception {
45
ArrayList<String> testArguments = new ArrayList<String>();
46
47
testArguments.add("-XX:+UseG1GC");
48
testArguments.add("-Xmx12m");
49
testArguments.add("-XX:+PrintFlagsFinal");
50
Collections.addAll(testArguments, extraArgs);
51
testArguments.add("-version");
52
53
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(testArguments);
54
55
OutputAnalyzer output = new OutputAnalyzer(pb.start());
56
57
System.out.println(output.getStderr());
58
59
if (shouldSucceed) {
60
long markStackSize = Long.parseLong(output.firstMatch("MarkStackSize\\s+=\\s(\\d+)",1));
61
long markStackSizeMax = Long.parseLong(output.firstMatch("MarkStackSizeMax\\s+=\\s(\\d+)",1));
62
long concGCThreads = Long.parseLong(output.firstMatch("ConcGCThreads\\s+=\\s(\\d+)",1));
63
long parallelGCThreads = Long.parseLong(output.firstMatch("ParallelGCThreads\\s+=\\s(\\d+)",1));
64
65
System.out.println("MarkStackSize=" + markStackSize + " MarkStackSizeMax=" + markStackSizeMax +
66
"ConcGCThreads=" + concGCThreads + " ParallelGCThreads=" + parallelGCThreads);
67
68
output.shouldHaveExitValue(0);
69
} else {
70
output.shouldNotHaveExitValue(0);
71
}
72
}
73
74
public static void main(String[] args) throws Exception {
75
runTest(false, "-XX:MarkStackSize=0");
76
runTest(false, "-XX:MarkStackSizeMax=0");
77
78
runTest(true, "-XX:MarkStackSize=100", "-XX:MarkStackSizeMax=101");
79
runTest(true, "-XX:MarkStackSize=101", "-XX:MarkStackSizeMax=101");
80
runTest(false, "-XX:MarkStackSize=101", "-XX:MarkStackSizeMax=100");
81
82
runTest(true, "-XX:ConcGCThreads=3", "-XX:ParallelGCThreads=3");
83
runTest(true, "-XX:ConcGCThreads=0", "-XX:ParallelGCThreads=3");
84
runTest(false, "-XX:ConcGCThreads=4", "-XX:ParallelGCThreads=3");
85
86
// With that high ParallelGCThreads the default ergonomics would calculate
87
// a mark stack size higher than maximum mark stack size.
88
runTest(true, "-XX:ParallelGCThreads=100", "-XX:MarkStackSizeMax=100");
89
}
90
}
91
92