< prev index next >

src/share/vm/runtime/commandLineFlagConstraintsGC.cpp

Print this page

        

@@ -28,20 +28,64 @@
 #include "runtime/globals.hpp"
 #include "utilities/defaultStream.hpp"
 
 #if INCLUDE_ALL_GCS
 #include "gc/g1/g1_globals.hpp"
+#include "gc/g1/heapRegionBounds.inline.hpp"
+#include "gc/parallel/parallelScavengeHeap.hpp"
+#include "gc/shared/plab.hpp"
 #endif // INCLUDE_ALL_GCS
 #ifdef COMPILER1
 #include "c1/c1_globals.hpp"
 #endif // COMPILER1
 #ifdef COMPILER2
 #include "opto/c2_globals.hpp"
 #endif // COMPILER2
 
+static Flag::Error MinPLABSizeBounds(const char* name, bool verbose, size_t* value) {
+#if INCLUDE_ALL_GCS
+  if ((UseConcMarkSweepGC || UseG1GC) && (*value < PLAB::min_size())) {
+    if (verbose == true) {
+      jio_fprintf(defaultStream::error_stream(),
+                  "%s (" SIZE_FORMAT ") must be greater than "
+                  "PLAB::min_size (" SIZE_FORMAT ")\n",
+                  name, *value, PLAB::min_size());
+    }
+    return Flag::VIOLATES_CONSTRAINT;
+  }
+#endif // INCLUDE_ALL_GCS
+  return Flag::SUCCESS;
+}
+
+static Flag::Error MaxPLABSizeBounds(const char* name, bool verbose, size_t* value) {
+#if INCLUDE_ALL_GCS
+  if ((UseConcMarkSweepGC || UseG1GC) && (*value > PLAB::max_size())) {
+    if (verbose == true) {
+      jio_fprintf(defaultStream::error_stream(),
+                  "%s (" SIZE_FORMAT ") must be less than "
+                  "PLAB::max_size (" SIZE_FORMAT ")\n",
+                  name, *value, PLAB::max_size());
+    }
+    return Flag::VIOLATES_CONSTRAINT;
+  }
+#endif // INCLUDE_ALL_GCS
+  return Flag::SUCCESS;
+}
+
+static Flag::Error MinMaxPLABSizeBounds(const char* name, bool verbose, size_t* value) {
+  if (MinPLABSizeBounds(name, verbose, value) == Flag::SUCCESS) {
+    return MaxPLABSizeBounds(name, verbose, value);
+  }
+  return Flag::VIOLATES_CONSTRAINT;
+}
+
+Flag::Error YoungPLABSizeConstraintFunc(bool verbose, size_t* value) {
+  return MinMaxPLABSizeBounds("YoungPLABSize", verbose, value);
+}
+
 Flag::Error MinHeapFreeRatioConstraintFunc(bool verbose, uintx* value) {
-  if ((CommandLineFlags::finishedInitializing()) && (*value > MaxHeapFreeRatio)) {
+  if (*value > MaxHeapFreeRatio) {
     if (verbose == true) {
       jio_fprintf(defaultStream::error_stream(),
                   "MinHeapFreeRatio (" UINTX_FORMAT ") must be less than or "
                   "equal to MaxHeapFreeRatio (" UINTX_FORMAT ")\n",
                   *value, MaxHeapFreeRatio);

@@ -51,11 +95,11 @@
     return Flag::SUCCESS;
   }
 }
 
 Flag::Error MaxHeapFreeRatioConstraintFunc(bool verbose, uintx* value) {
-  if ((CommandLineFlags::finishedInitializing()) && (*value < MinHeapFreeRatio)) {
+  if (*value < MinHeapFreeRatio) {
     if (verbose == true) {
       jio_fprintf(defaultStream::error_stream(),
                   "MaxHeapFreeRatio (" UINTX_FORMAT ") must be greater than or "
                   "equal to MinHeapFreeRatio (" UINTX_FORMAT ")\n",
                   *value, MinHeapFreeRatio);

@@ -65,11 +109,11 @@
     return Flag::SUCCESS;
   }
 }
 
 Flag::Error MinMetaspaceFreeRatioConstraintFunc(bool verbose, uintx* value) {
-  if ((CommandLineFlags::finishedInitializing()) && (*value > MaxMetaspaceFreeRatio)) {
+  if (*value > MaxMetaspaceFreeRatio) {
     if (verbose == true) {
       jio_fprintf(defaultStream::error_stream(),
                   "MinMetaspaceFreeRatio (" UINTX_FORMAT ") must be less than or "
                   "equal to MaxMetaspaceFreeRatio (" UINTX_FORMAT ")\n",
                   *value, MaxMetaspaceFreeRatio);

@@ -79,11 +123,11 @@
     return Flag::SUCCESS;
   }
 }
 
 Flag::Error MaxMetaspaceFreeRatioConstraintFunc(bool verbose, uintx* value) {
-  if ((CommandLineFlags::finishedInitializing()) && (*value < MinMetaspaceFreeRatio)) {
+  if (*value < MinMetaspaceFreeRatio) {
     if (verbose == true) {
       jio_fprintf(defaultStream::error_stream(),
                   "MaxMetaspaceFreeRatio (" UINTX_FORMAT ") must be greater than or "
                   "equal to MinMetaspaceFreeRatio (" UINTX_FORMAT ")\n",
                   *value, MinMetaspaceFreeRatio);

@@ -104,11 +148,11 @@
 }
 
 Flag::Error InitialTenuringThresholdConstraintFunc(bool verbose, uintx* value) {
   UseConcMarkSweepGCWorkaroundIfNeeded(*value, MaxTenuringThreshold);
 
-  if ((CommandLineFlags::finishedInitializing()) && (*value > MaxTenuringThreshold)) {
+  if (*value > MaxTenuringThreshold) {
     if (verbose == true) {
       jio_fprintf(defaultStream::error_stream(),
                   "InitialTenuringThreshold (" UINTX_FORMAT ") must be less than or "
                   "equal to MaxTenuringThreshold (" UINTX_FORMAT ")\n",
                   *value, MaxTenuringThreshold);

@@ -120,11 +164,11 @@
 }
 
 Flag::Error MaxTenuringThresholdConstraintFunc(bool verbose, uintx* value) {
   UseConcMarkSweepGCWorkaroundIfNeeded(InitialTenuringThreshold, *value);
 
-  if ((CommandLineFlags::finishedInitializing()) && (*value < InitialTenuringThreshold)) {
+  if (*value < InitialTenuringThreshold) {
     if (verbose == true) {
       jio_fprintf(defaultStream::error_stream(),
                   "MaxTenuringThreshold (" UINTX_FORMAT ") must be greater than or "
                   "equal to InitialTenuringThreshold (" UINTX_FORMAT ")\n",
                   *value, InitialTenuringThreshold);

@@ -134,13 +178,12 @@
     return Flag::SUCCESS;
   }
 }
 
 #if INCLUDE_ALL_GCS
-
 Flag::Error G1NewSizePercentConstraintFunc(bool verbose, uintx* value) {
-  if ((CommandLineFlags::finishedInitializing()) && (*value > G1MaxNewSizePercent)) {
+  if (*value > G1MaxNewSizePercent) {
     if (verbose == true) {
       jio_fprintf(defaultStream::error_stream(),
                   "G1NewSizePercent (" UINTX_FORMAT ") must be less than or "
                   "equal to G1MaxNewSizePercent (" UINTX_FORMAT ")\n",
                   *value, G1MaxNewSizePercent);

@@ -150,11 +193,11 @@
     return Flag::SUCCESS;
   }
 }
 
 Flag::Error G1MaxNewSizePercentConstraintFunc(bool verbose, uintx* value) {
-  if ((CommandLineFlags::finishedInitializing()) && (*value < G1NewSizePercent)) {
+  if (*value < G1NewSizePercent) {
     if (verbose == true) {
       jio_fprintf(defaultStream::error_stream(),
                   "G1MaxNewSizePercent (" UINTX_FORMAT ") must be greater than or "
                   "equal to G1NewSizePercent (" UINTX_FORMAT ")\n",
                   *value, G1NewSizePercent);

@@ -166,11 +209,11 @@
 }
 
 #endif // INCLUDE_ALL_GCS
 
 Flag::Error CMSOldPLABMinConstraintFunc(bool verbose, size_t* value) {
-  if ((CommandLineFlags::finishedInitializing()) && (*value > CMSOldPLABMax)) {
+  if (*value > CMSOldPLABMax) {
     if (verbose == true) {
       jio_fprintf(defaultStream::error_stream(),
                   "CMSOldPLABMin (" SIZE_FORMAT ") must be less than or "
                   "equal to CMSOldPLABMax (" SIZE_FORMAT ")\n",
                   *value, CMSOldPLABMax);

@@ -180,11 +223,11 @@
     return Flag::SUCCESS;
   }
 }
 
 Flag::Error CMSPrecleanDenominatorConstraintFunc(bool verbose, uintx* value) {
-  if ((CommandLineFlags::finishedInitializing()) && (*value <= CMSPrecleanNumerator)) {
+  if (*value <= CMSPrecleanNumerator) {
     if (verbose == true) {
       jio_fprintf(defaultStream::error_stream(),
                   "CMSPrecleanDenominator (" UINTX_FORMAT ") must be strickly greater than "
                   "CMSPrecleanNumerator (" UINTX_FORMAT ")\n",
                   *value, CMSPrecleanNumerator);

@@ -194,11 +237,11 @@
     return Flag::SUCCESS;
   }
 }
 
 Flag::Error CMSPrecleanNumeratorConstraintFunc(bool verbose, uintx* value) {
-  if ((CommandLineFlags::finishedInitializing()) && (*value > (CMSPrecleanDenominator - 1))) {
+  if (*value > (CMSPrecleanDenominator - 1)) {
     if (verbose == true) {
       jio_fprintf(defaultStream::error_stream(),
                   "CMSPrecleanNumerator (" UINTX_FORMAT ") must be less than or "
                   "equal to CMSPrecleanDenominator - 1 (" UINTX_FORMAT ")\n", *value,
                   CMSPrecleanDenominator - 1);

@@ -208,11 +251,10 @@
     return Flag::SUCCESS;
   }
 }
 
 Flag::Error SurvivorAlignmentInBytesConstraintFunc(bool verbose, intx* value) {
-  if (CommandLineFlags::finishedInitializing()) {
     if (*value != 0) {
       if (!is_power_of_2(*value)) {
         if (verbose == true) {
           jio_fprintf(defaultStream::error_stream(),
                     "SurvivorAlignmentInBytes (" INTX_FORMAT ") must be power of 2\n",

@@ -222,14 +264,13 @@
       }
       if (*value < ObjectAlignmentInBytes) {
         if (verbose == true) {
           jio_fprintf(defaultStream::error_stream(),
                     "SurvivorAlignmentInBytes (" INTX_FORMAT ") must be greater than or "
-                    "equal to ObjectAlignmentInBytes (" INTX_FORMAT ") \n",
+                  "equal to ObjectAlignmentInBytes (" INTX_FORMAT ")\n",
                     *value, ObjectAlignmentInBytes);
         }
         return Flag::VIOLATES_CONSTRAINT;
       }
     }
-  }
   return Flag::SUCCESS;
 }
< prev index next >