src/hotspot/share/gc/cms/cmsArguments.cpp
changeset 49710 f67333fc42bd
parent 49629 b786280276dc
child 52148 2d9f8845d0ae
--- 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();