--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/GCCause.java Tue Mar 15 10:56:32 2016 +0000
+++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/GCCause.java Tue Mar 15 13:46:48 2016 +0100
@@ -35,6 +35,10 @@
_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 @@
_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;
--- a/hotspot/src/share/vm/gc/shared/gcCause.hpp Tue Mar 15 10:56:32 2016 +0000
+++ b/hotspot/src/share/vm/gc/shared/gcCause.hpp Tue Mar 15 13:46:48 2016 +0100
@@ -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:
--- a/hotspot/test/gc/arguments/TestSelectDefaultGC.java Tue Mar 15 10:56:32 2016 +0000
+++ b/hotspot/test/gc/arguments/TestSelectDefaultGC.java Tue Mar 15 13:46:48 2016 +0100
@@ -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 @@
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);
+ }
}