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/TestObjItrWithHeapDump.java
32284 views
1
/*
2
* Copyright (c) 2019, 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 TestObjIterWithHeapDump
26
* @summary Test heap dump triggered heap object iteration
27
* @key gc
28
* @bug 8225014
29
* @library /testlibrary
30
* @run main/othervm TestObjItrWithHeapDump
31
*/
32
33
import java.util.*;
34
import com.oracle.java.testlibrary.*;
35
36
public class TestObjItrWithHeapDump {
37
public static void testWith(String... args) throws Exception {
38
String[] cmds = Arrays.copyOf(args, args.length + 2);
39
cmds[args.length] = TestObjItrWithHeapDump.class.getName();
40
cmds[args.length + 1] = "test";
41
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(cmds);
42
43
OutputAnalyzer output = new OutputAnalyzer(pb.start());
44
output.shouldHaveExitValue(0);
45
output.shouldContain("Class Histogram (before full gc)");
46
output.shouldContain("Class Histogram (after full gc)");
47
}
48
49
public static void main(String[] args) throws Exception {
50
if (args.length > 0 && args[0].equals("test")) {
51
System.gc();
52
System.exit(0);
53
}
54
55
String[][][] modeHeuristics = new String[][][]{
56
{{"satb"}, {"adaptive", "compact", "static", "aggressive"}},
57
{{"iu"}, {"adaptive", "aggressive"}},
58
{{"passive"}, {"passive"}}
59
};
60
61
for (String[][] mh : modeHeuristics) {
62
String mode = mh[0][0];
63
String[] heuristics = mh[1];
64
for (String h : heuristics) {
65
testWith("-XX:+UnlockDiagnosticVMOptions",
66
"-XX:+UnlockExperimentalVMOptions",
67
"-XX:+UseShenandoahGC",
68
"-XX:-ShenandoahDegeneratedGC",
69
"-XX:ShenandoahGCMode=" + mode,
70
"-XX:ShenandoahGCHeuristics=" + h,
71
"-XX:+PrintClassHistogramBeforeFullGC",
72
"-XX:+PrintClassHistogramAfterFullGC",
73
"-XX:+PrintGCDetails",
74
"-XX:-ExplicitGCInvokesConcurrent",
75
"-Xmx512M"
76
);
77
}
78
}
79
}
80
}
81
82