< prev index next >

src/hotspot/share/gc/shared/jvmFlagConstraintsGC.cpp

Print this page
*** 29,10 ***
--- 29,11 ---
  #include "gc/shared/gcConfig.hpp"
  #include "gc/shared/jvmFlagConstraintsGC.hpp"
  #include "gc/shared/plab.hpp"
  #include "gc/shared/threadLocalAllocBuffer.hpp"
  #include "gc/shared/tlab_globals.hpp"
+ #include "memory/metaspace.hpp"
  #include "runtime/arguments.hpp"
  #include "runtime/globals.hpp"
  #include "runtime/globals_extension.hpp"
  #include "runtime/thread.inline.hpp"
  #include "utilities/align.hpp"

*** 398,10 ***
--- 399,25 ---
    } else {
      return JVMFlag::SUCCESS;
    }
  }
  
+ JVMFlag::Error CompressedClassSpaceSizeConstraintFunc(size_t value, bool verbose) {
+ #ifdef _LP64
+   // There is no minimal value check, although class space will be transparently enlarged
+   // to a multiple of metaspace root chunk size (4m).
+   // The max. value of class space size depends on narrow klass pointer encoding range size
+   // and CDS, see metaspace.cpp.
+   if (value > Metaspace::max_class_space_size()) {
+     JVMFlag::printError(verbose, "CompressedClassSpaceSize " SIZE_FORMAT " too large (max: " SIZE_FORMAT ")\n",
+                         value, Metaspace::max_class_space_size());
+     return JVMFlag::VIOLATES_CONSTRAINT;
+   }
+ #endif
+   return JVMFlag::SUCCESS;
+ }
+ 
  JVMFlag::Error MetaspaceSizeConstraintFunc(size_t value, bool verbose) {
    if (value > MaxMetaspaceSize) {
      JVMFlag::printError(verbose,
                          "MetaspaceSize (" SIZE_FORMAT ") must be "
                          "less than or equal to MaxMetaspaceSize (" SIZE_FORMAT ")\n",
< prev index next >