< prev index next >

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

Print this page




 302   }
 303   return JVMFlag::SUCCESS;
 304 }
 305 
 306 static JVMFlag::Error MaxSizeForHeapAlignment(const char* name, size_t value, bool verbose) {
 307   size_t heap_alignment;
 308 
 309 #if INCLUDE_G1GC
 310   if (UseG1GC) {
 311     // For G1 GC, we don't know until G1CollectedHeap is created.
 312     heap_alignment = MaxSizeForHeapAlignmentG1();
 313   } else
 314 #endif
 315   {
 316     heap_alignment = GCArguments::compute_heap_alignment();
 317   }
 318 
 319   return MaxSizeForAlignment(name, value, heap_alignment, verbose);
 320 }
 321 




 322 JVMFlag::Error InitialHeapSizeConstraintFunc(size_t value, bool verbose) {
 323   return MaxSizeForHeapAlignment("InitialHeapSize", value, verbose);
 324 }
 325 
 326 JVMFlag::Error MaxHeapSizeConstraintFunc(size_t value, bool verbose) {
 327   JVMFlag::Error status = MaxSizeForHeapAlignment("MaxHeapSize", value, verbose);
 328 
 329   if (status == JVMFlag::SUCCESS) {
 330     status = CheckMaxHeapSizeAndSoftRefLRUPolicyMSPerMB(value, SoftRefLRUPolicyMSPerMB, verbose);
 331   }
 332   return status;
 333 }
 334 
 335 JVMFlag::Error HeapBaseMinAddressConstraintFunc(size_t value, bool verbose) {
 336   // If an overflow happened in Arguments::set_heap_size(), MaxHeapSize will have too large a value.
 337   // Check for this by ensuring that MaxHeapSize plus the requested min base address still fit within max_uintx.
 338   if (UseCompressedOops && FLAG_IS_ERGO(MaxHeapSize) && (value > (max_uintx - MaxHeapSize))) {
 339     JVMFlag::printError(verbose,
 340                         "HeapBaseMinAddress (" SIZE_FORMAT ") or MaxHeapSize (" SIZE_FORMAT ") is too large. "
 341                         "Sum of them must be less than or equal to maximum of size_t (" SIZE_FORMAT ")\n",




 302   }
 303   return JVMFlag::SUCCESS;
 304 }
 305 
 306 static JVMFlag::Error MaxSizeForHeapAlignment(const char* name, size_t value, bool verbose) {
 307   size_t heap_alignment;
 308 
 309 #if INCLUDE_G1GC
 310   if (UseG1GC) {
 311     // For G1 GC, we don't know until G1CollectedHeap is created.
 312     heap_alignment = MaxSizeForHeapAlignmentG1();
 313   } else
 314 #endif
 315   {
 316     heap_alignment = GCArguments::compute_heap_alignment();
 317   }
 318 
 319   return MaxSizeForAlignment(name, value, heap_alignment, verbose);
 320 }
 321 
 322 JVMFlag::Error MinimumHeapSizeConstraintFunc(size_t value, bool verbose) {
 323   return MaxSizeForHeapAlignment("MinHeapSize", value, verbose);
 324 }
 325 
 326 JVMFlag::Error InitialHeapSizeConstraintFunc(size_t value, bool verbose) {
 327   return MaxSizeForHeapAlignment("InitialHeapSize", value, verbose);
 328 }
 329 
 330 JVMFlag::Error MaxHeapSizeConstraintFunc(size_t value, bool verbose) {
 331   JVMFlag::Error status = MaxSizeForHeapAlignment("MaxHeapSize", value, verbose);
 332 
 333   if (status == JVMFlag::SUCCESS) {
 334     status = CheckMaxHeapSizeAndSoftRefLRUPolicyMSPerMB(value, SoftRefLRUPolicyMSPerMB, verbose);
 335   }
 336   return status;
 337 }
 338 
 339 JVMFlag::Error HeapBaseMinAddressConstraintFunc(size_t value, bool verbose) {
 340   // If an overflow happened in Arguments::set_heap_size(), MaxHeapSize will have too large a value.
 341   // Check for this by ensuring that MaxHeapSize plus the requested min base address still fit within max_uintx.
 342   if (UseCompressedOops && FLAG_IS_ERGO(MaxHeapSize) && (value > (max_uintx - MaxHeapSize))) {
 343     JVMFlag::printError(verbose,
 344                         "HeapBaseMinAddress (" SIZE_FORMAT ") or MaxHeapSize (" SIZE_FORMAT ") is too large. "
 345                         "Sum of them must be less than or equal to maximum of size_t (" SIZE_FORMAT ")\n",


< prev index next >