src/share/vm/runtime/arguments.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Cdiff src/share/vm/runtime/arguments.cpp

src/share/vm/runtime/arguments.cpp

Print this page

        

*** 1445,1454 **** --- 1445,1465 ---- if (FLAG_IS_DEFAULT(UseParallelOldGC)) { FLAG_SET_DEFAULT(UseParallelOldGC, true); } FLAG_SET_DEFAULT(UseParallelGC, true); + if (UseAdaptiveSizePolicy) { + // We don't want to limit adaptive heap sizing's freedom to adjust the heap + // unless the user actually sets these flags. + if (FLAG_IS_DEFAULT(MinHeapFreeRatio)) { + FLAG_SET_DEFAULT(MinHeapFreeRatio, 0); + } + if (FLAG_IS_DEFAULT(MaxHeapFreeRatio)) { + FLAG_SET_DEFAULT(MaxHeapFreeRatio, 100); + } + } + // If no heap maximum was requested explicitly, use some reasonable fraction // of the physical memory, up to a maximum of 1GB. if (UseParallelGC) { FLAG_SET_DEFAULT(ParallelGCThreads, Abstract_VM_Version::parallel_worker_threads());
*** 1717,1727 **** name, val, min); return false; } bool Arguments::verify_percentage(uintx value, const char* name) { ! if (value <= 100) { return true; } jio_fprintf(defaultStream::error_stream(), "%s of " UINTX_FORMAT " is invalid; must be between 0 and 100\n", name, value); --- 1728,1738 ---- name, val, min); return false; } bool Arguments::verify_percentage(uintx value, const char* name) { ! if (is_percentage(value)) { return true; } jio_fprintf(defaultStream::error_stream(), "%s of " UINTX_FORMAT " is invalid; must be between 0 and 100\n", name, value);
*** 1766,1775 **** --- 1777,1814 ---- jio_fprintf(defaultStream::output_stream(), "GCLogFileSize changed to minimum 8K\n"); } } + bool Arguments::verify_MinHeapFreeRatio(FormatBuffer<80>& err_msg, uintx min_heap_free_ratio) { + if (!is_percentage(min_heap_free_ratio)) { + err_msg.print("MinHeapFreeRatio must have a value between 0 and 100"); + return false; + } + if (min_heap_free_ratio > MaxHeapFreeRatio) { + err_msg.print("MinHeapFreeRatio (" UINTX_FORMAT ") must be less than or " + "equal to MaxHeapFreeRatio (" UINTX_FORMAT ")", min_heap_free_ratio, + MaxHeapFreeRatio); + return false; + } + return true; + } + + bool Arguments::verify_MaxHeapFreeRatio(FormatBuffer<80>& err_msg, uintx max_heap_free_ratio) { + if (!is_percentage(max_heap_free_ratio)) { + err_msg.print("MaxHeapFreeRatio must have a value between 0 and 100"); + return false; + } + if (max_heap_free_ratio < MinHeapFreeRatio) { + err_msg.print("MaxHeapFreeRatio (" UINTX_FORMAT ") must be greater than or " + "equal to MinHeapFreeRatio (" UINTX_FORMAT ")", max_heap_free_ratio, + MinHeapFreeRatio); + return false; + } + return true; + } + // Check consistency of GC selection bool Arguments::check_gc_consistency() { check_gclog_consistency(); bool status = true; // Ensure that the user has not selected conflicting sets
*** 1850,1868 **** status = status && verify_percentage(AdaptiveSizePolicyWeight, "AdaptiveSizePolicyWeight"); status = status && verify_percentage(AdaptivePermSizeWeight, "AdaptivePermSizeWeight"); status = status && verify_percentage(ThresholdTolerance, "ThresholdTolerance"); - status = status && verify_percentage(MinHeapFreeRatio, "MinHeapFreeRatio"); - status = status && verify_percentage(MaxHeapFreeRatio, "MaxHeapFreeRatio"); ! if (MinHeapFreeRatio > MaxHeapFreeRatio) { ! jio_fprintf(defaultStream::error_stream(), ! "MinHeapFreeRatio (" UINTX_FORMAT ") must be less than or " ! "equal to MaxHeapFreeRatio (" UINTX_FORMAT ")\n", ! MinHeapFreeRatio, MaxHeapFreeRatio); status = false; } // Keeping the heap 100% free is hard ;-) so limit it to 99%. MinHeapFreeRatio = MIN2(MinHeapFreeRatio, (uintx) 99); if (FullGCALot && FLAG_IS_DEFAULT(MarkSweepAlwaysCompactCount)) { --- 1889,1911 ---- status = status && verify_percentage(AdaptiveSizePolicyWeight, "AdaptiveSizePolicyWeight"); status = status && verify_percentage(AdaptivePermSizeWeight, "AdaptivePermSizeWeight"); status = status && verify_percentage(ThresholdTolerance, "ThresholdTolerance"); ! { ! // Using "else if" below to avoid printing two error messages if min > max. ! // This will also prevent us from reporting both min>100 and max>100 at the ! // same time, but that is less annoying than printing two identical errors IMHO. ! FormatBuffer<80> err_msg(""); ! if (!verify_MinHeapFreeRatio(err_msg, MinHeapFreeRatio)) { ! jio_fprintf(defaultStream::error_stream(), "%s\n", err_msg.buffer()); status = false; + } else if (!verify_MaxHeapFreeRatio(err_msg, MaxHeapFreeRatio)) { + jio_fprintf(defaultStream::error_stream(), "%s\n", err_msg.buffer()); + status = false; + } } // Keeping the heap 100% free is hard ;-) so limit it to 99%. MinHeapFreeRatio = MIN2(MinHeapFreeRatio, (uintx) 99); if (FullGCALot && FLAG_IS_DEFAULT(MarkSweepAlwaysCompactCount)) {
src/share/vm/runtime/arguments.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File