8200737: Move GC code out of Arguments::check_vm_args_consistency into GCArguments
authorstefank
Fri, 06 Apr 2018 11:37:31 +0200
changeset 49710 f67333fc42bd
parent 49709 6705b1563b42
child 49711 4a7addb5762c
8200737: Move GC code out of Arguments::check_vm_args_consistency into GCArguments Reviewed-by: sjohanss, pliden
src/hotspot/share/gc/cms/cmsArguments.cpp
src/hotspot/share/gc/shared/gcArguments.cpp
src/hotspot/share/runtime/arguments.cpp
--- a/src/hotspot/share/gc/cms/cmsArguments.cpp	Fri Apr 06 11:37:28 2018 +0200
+++ b/src/hotspot/share/gc/cms/cmsArguments.cpp	Fri Apr 06 11:37:31 2018 +0200
@@ -82,9 +82,36 @@
 // certainly gain from analysis of platform and environment.
 void CMSArguments::initialize() {
   GCArguments::initialize();
+
   assert(!UseSerialGC && !UseParallelOldGC && !UseParallelGC, "Error");
   assert(UseConcMarkSweepGC, "CMS is expected to be on here");
 
+  // CMS space iteration, which FLSVerifyAllHeapreferences entails,
+  // insists that we hold the requisite locks so that the iteration is
+  // MT-safe. For the verification at start-up and shut-down, we don't
+  // yet have a good way of acquiring and releasing these locks,
+  // which are not visible at the CollectedHeap level. We want to
+  // be able to acquire these locks and then do the iteration rather
+  // than just disable the lock verification. This will be fixed under
+  // bug 4788986.
+  if (UseConcMarkSweepGC && FLSVerifyAllHeapReferences) {
+    if (VerifyDuringStartup) {
+      warning("Heap verification at start-up disabled "
+              "(due to current incompatibility with FLSVerifyAllHeapReferences)");
+      VerifyDuringStartup = false; // Disable verification at start-up
+    }
+
+    if (VerifyBeforeExit) {
+      warning("Heap verification at shutdown disabled "
+              "(due to current incompatibility with FLSVerifyAllHeapReferences)");
+      VerifyBeforeExit = false; // Disable verification at shutdown
+    }
+  }
+
+  if (!ClassUnloading) {
+    FLAG_SET_CMDLINE(bool, CMSClassUnloadingEnabled, false);
+  }
+
   // Set CMS global values
   CompactibleFreeListSpace::set_cms_values();
 
--- a/src/hotspot/share/gc/shared/gcArguments.cpp	Fri Apr 06 11:37:28 2018 +0200
+++ b/src/hotspot/share/gc/shared/gcArguments.cpp	Fri Apr 06 11:37:31 2018 +0200
@@ -31,16 +31,26 @@
 #include "utilities/macros.hpp"
 
 void GCArguments::initialize() {
-#if INCLUDE_ALL_GCS
+  if (FullGCALot && FLAG_IS_DEFAULT(MarkSweepAlwaysCompactCount)) {
+    MarkSweepAlwaysCompactCount = 1;  // Move objects every gc.
+  }
+
+  if (!(UseParallelGC || UseParallelOldGC) && FLAG_IS_DEFAULT(ScavengeBeforeFullGC)) {
+    FLAG_SET_DEFAULT(ScavengeBeforeFullGC, false);
+  }
+
+  if (GCTimeLimit == 100) {
+    // Turn off gc-overhead-limit-exceeded checks
+    FLAG_SET_DEFAULT(UseGCOverheadLimit, false);
+  }
+
   if (MinHeapFreeRatio == 100) {
     // Keeping the heap 100% free is hard ;-) so limit it to 99%.
     FLAG_SET_ERGO(uintx, MinHeapFreeRatio, 99);
   }
 
-  // If class unloading is disabled, also disable concurrent class unloading.
   if (!ClassUnloading) {
-    FLAG_SET_CMDLINE(bool, CMSClassUnloadingEnabled, false);
+    // If class unloading is disabled, also disable concurrent class unloading.
     FLAG_SET_CMDLINE(bool, ClassUnloadingWithConcurrentMark, false);
   }
-#endif // INCLUDE_ALL_GCS
 }
--- a/src/hotspot/share/runtime/arguments.cpp	Fri Apr 06 11:37:28 2018 +0200
+++ b/src/hotspot/share/runtime/arguments.cpp	Fri Apr 06 11:37:31 2018 +0200
@@ -29,11 +29,9 @@
 #include "classfile/moduleEntry.hpp"
 #include "classfile/stringTable.hpp"
 #include "classfile/symbolTable.hpp"
+#include "gc/shared/collectorPolicy.hpp"
 #include "gc/shared/gcArguments.hpp"
 #include "gc/shared/gcConfig.hpp"
-#include "gc/shared/genCollectedHeap.hpp"
-#include "gc/shared/referenceProcessor.hpp"
-#include "gc/shared/taskqueue.hpp"
 #include "logging/log.hpp"
 #include "logging/logConfiguration.hpp"
 #include "logging/logStream.hpp"
@@ -2190,41 +2188,6 @@
     status = false;
   }
 
-  if (FullGCALot && FLAG_IS_DEFAULT(MarkSweepAlwaysCompactCount)) {
-    MarkSweepAlwaysCompactCount = 1;  // Move objects every gc.
-  }
-
-  if (!(UseParallelGC || UseParallelOldGC) && FLAG_IS_DEFAULT(ScavengeBeforeFullGC)) {
-    FLAG_SET_DEFAULT(ScavengeBeforeFullGC, false);
-  }
-
-  if (GCTimeLimit == 100) {
-    // Turn off gc-overhead-limit-exceeded checks
-    FLAG_SET_DEFAULT(UseGCOverheadLimit, false);
-  }
-
-  // CMS space iteration, which FLSVerifyAllHeapreferences entails,
-  // insists that we hold the requisite locks so that the iteration is
-  // MT-safe. For the verification at start-up and shut-down, we don't
-  // yet have a good way of acquiring and releasing these locks,
-  // which are not visible at the CollectedHeap level. We want to
-  // be able to acquire these locks and then do the iteration rather
-  // than just disable the lock verification. This will be fixed under
-  // bug 4788986.
-  if (UseConcMarkSweepGC && FLSVerifyAllHeapReferences) {
-    if (VerifyDuringStartup) {
-      warning("Heap verification at start-up disabled "
-              "(due to current incompatibility with FLSVerifyAllHeapReferences)");
-      VerifyDuringStartup = false; // Disable verification at start-up
-    }
-
-    if (VerifyBeforeExit) {
-      warning("Heap verification at shutdown disabled "
-              "(due to current incompatibility with FLSVerifyAllHeapReferences)");
-      VerifyBeforeExit = false; // Disable verification at shutdown
-    }
-  }
-
   if (PrintNMTStatistics) {
 #if INCLUDE_NMT
     if (MemTracker::tracking_level() == NMT_off) {