mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-07 00:48:38 +00:00
Merge
This commit is contained in:
commit
46da2cd7f3
@ -35,6 +35,10 @@ public enum GCCause {
|
||||
_gc_locker ("GCLocker Initiated GC"),
|
||||
_heap_inspection ("Heap Inspection Initiated GC"),
|
||||
_heap_dump ("Heap Dump Initiated GC"),
|
||||
_wb_young_gc ("WhiteBox Initiated Young GC"),
|
||||
_wb_conc_mark ("WhiteBox Initiated Concurrent Mark"),
|
||||
_update_allocation_context_stats_inc ("Update Allocation Context Stats"),
|
||||
_update_allocation_context_stats_full ("Update Allocation Context Stats"),
|
||||
|
||||
_no_gc ("No GC"),
|
||||
_no_cause_specified ("Unknown GCCause"),
|
||||
@ -56,6 +60,9 @@ public enum GCCause {
|
||||
_g1_humongous_allocation ("G1 Humongous Allocation"),
|
||||
|
||||
_last_ditch_collection ("Last ditch collection"),
|
||||
|
||||
_dcmd_gc_run ("Diagnostic Command"),
|
||||
|
||||
_last_gc_cause ("ILLEGAL VALUE - last gc cause - ILLEGAL VALUE");
|
||||
|
||||
private final String value;
|
||||
|
||||
@ -33,6 +33,9 @@
|
||||
// use of this class grows, we should split it into public
|
||||
// and implementation-private "causes".
|
||||
//
|
||||
// The definitions in the SA code should be kept in sync
|
||||
// with the definitions here.
|
||||
//
|
||||
|
||||
class GCCause : public AllStatic {
|
||||
public:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -27,9 +27,9 @@
|
||||
* @bug 8068582
|
||||
* @key gc
|
||||
* @library /testlibrary
|
||||
* @requires vm.gc=="null"
|
||||
* @modules java.base/sun.misc
|
||||
* java.management
|
||||
* @ignore 8148239
|
||||
* @run driver TestSelectDefaultGC
|
||||
*/
|
||||
|
||||
@ -41,24 +41,40 @@ public class TestSelectDefaultGC {
|
||||
output.shouldMatch(" " + option + " .*=.* " + value + " ");
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
public static void testDefaultGC(boolean actAsServer) throws Exception {
|
||||
String[] args = new String[] {
|
||||
"-XX:" + (actAsServer ? "+" : "-") + "AlwaysActAsServerClassMachine",
|
||||
"-XX:" + (actAsServer ? "-" : "+") + "NeverActAsServerClassMachine",
|
||||
"-XX:+PrintFlagsFinal",
|
||||
"-version"
|
||||
};
|
||||
|
||||
// Start VM without specifying GC
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+PrintFlagsFinal", "-version");
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(args);
|
||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||
output.shouldHaveExitValue(0);
|
||||
|
||||
boolean isServerVM = Platform.isServer();
|
||||
boolean isEmbeddedVM = Platform.isEmbedded();
|
||||
final boolean isServer = actAsServer;
|
||||
final boolean isEmbedded = Platform.isEmbedded();
|
||||
|
||||
// Verify GC selection
|
||||
// G1 is default for non-embedded server VMs
|
||||
assertVMOption(output, "UseG1GC", isServerVM && !isEmbeddedVM);
|
||||
// Parallel is default for embedded server VMs
|
||||
assertVMOption(output, "UseParallelGC", isServerVM && isEmbeddedVM);
|
||||
assertVMOption(output, "UseParallelOldGC", isServerVM && isEmbeddedVM);
|
||||
// Serial is default for non-server VMs
|
||||
assertVMOption(output, "UseSerialGC", !isServerVM);
|
||||
// G1 is default for non-embedded server class machines
|
||||
assertVMOption(output, "UseG1GC", isServer && !isEmbedded);
|
||||
// Parallel is default for embedded server class machines
|
||||
assertVMOption(output, "UseParallelGC", isServer && isEmbedded);
|
||||
assertVMOption(output, "UseParallelOldGC", isServer && isEmbedded);
|
||||
// Serial is default for non-server class machines
|
||||
assertVMOption(output, "UseSerialGC", !isServer);
|
||||
// CMS is never default
|
||||
assertVMOption(output, "UseConcMarkSweepGC", false);
|
||||
assertVMOption(output, "UseParNewGC", false);
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
// Test server class machine
|
||||
testDefaultGC(false);
|
||||
|
||||
// Test non-server class machine
|
||||
testDefaultGC(true);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user