hotspot/src/share/vm/runtime/commandLineFlagConstraintsGC.cpp
changeset 37264 d9b0f2b53b73
parent 37234 07d212151499
child 37433 f8fd0bcc60af
--- a/hotspot/src/share/vm/runtime/commandLineFlagConstraintsGC.cpp	Tue Apr 05 11:17:50 2016 -0400
+++ b/hotspot/src/share/vm/runtime/commandLineFlagConstraintsGC.cpp	Tue Apr 05 16:15:53 2016 -0700
@@ -36,6 +36,7 @@
 #include "utilities/defaultStream.hpp"
 
 #if INCLUDE_ALL_GCS
+#include "gc/cms/concurrentMarkSweepGeneration.inline.hpp"
 #include "gc/g1/g1_globals.hpp"
 #include "gc/g1/heapRegionBounds.inline.hpp"
 #include "gc/shared/plab.hpp"
@@ -507,6 +508,27 @@
   return Flag::SUCCESS;
 }
 
+Flag::Error CMSBitMapYieldQuantumConstraintFunc(size_t value, bool verbose) {
+#if INCLUDE_ALL_GCS
+  // Skip for current default value.
+  if (UseConcMarkSweepGC && FLAG_IS_CMDLINE(CMSBitMapYieldQuantum)) {
+    // CMSBitMapYieldQuantum should be compared with mark bitmap size.
+    ConcurrentMarkSweepGeneration* cms = (ConcurrentMarkSweepGeneration*)GenCollectedHeap::heap()->old_gen();
+    size_t bitmap_size = cms->collector()->markBitMap()->sizeInWords();
+
+    if (value > bitmap_size) {
+      CommandLineError::print(verbose,
+                              "CMSBitMapYieldQuantum (" SIZE_FORMAT ") must "
+                              "be less than or equal to bitmap size (" SIZE_FORMAT ") "
+                              "whose size corresponds to the size of old generation of the Java heap\n",
+                              value, bitmap_size);
+      return Flag::VIOLATES_CONSTRAINT;
+    }
+  }
+#endif
+  return Flag::SUCCESS;
+}
+
 Flag::Error MaxGCPauseMillisConstraintFunc(uintx value, bool verbose) {
 #if INCLUDE_ALL_GCS
   if (UseG1GC && FLAG_IS_CMDLINE(MaxGCPauseMillis) && (value >= GCPauseIntervalMillis)) {