8134972: [BACKOUT] GC: implement ranges (optionally constraints) for those flags that have them missing

Reviewed-by: jwilhelm
This commit is contained in:
Sangheon Kim 2015-09-02 17:49:46 -07:00
parent 8ebc8387ba
commit c091c7348a
13 changed files with 99 additions and 714 deletions

View File

@ -26,7 +26,6 @@
#define SHARE_VM_GC_G1_G1_GLOBALS_HPP #define SHARE_VM_GC_G1_G1_GLOBALS_HPP
#include "runtime/globals.hpp" #include "runtime/globals.hpp"
#include <float.h> // for DBL_MAX
// //
// Defines all globals flags used by the garbage-first compiler. // Defines all globals flags used by the garbage-first compiler.
// //
@ -62,7 +61,6 @@
"update buffer processing info " \ "update buffer processing info " \
"(0 means do not periodically generate this info); " \ "(0 means do not periodically generate this info); " \
"it also requires -XX:+G1SummarizeRSetStats") \ "it also requires -XX:+G1SummarizeRSetStats") \
range(0, max_intx) \
\ \
diagnostic(bool, G1TraceConcRefinement, false, \ diagnostic(bool, G1TraceConcRefinement, false, \
"Trace G1 concurrent refinement") \ "Trace G1 concurrent refinement") \
@ -73,7 +71,7 @@
product(double, G1ConcMarkStepDurationMillis, 10.0, \ product(double, G1ConcMarkStepDurationMillis, 10.0, \
"Target duration of individual concurrent marking steps " \ "Target duration of individual concurrent marking steps " \
"in milliseconds.") \ "in milliseconds.") \
range(1.0, DBL_MAX) \ range(1.0, (double)max_uintx) \
\ \
product(intx, G1RefProcDrainInterval, 10, \ product(intx, G1RefProcDrainInterval, 10, \
"The number of discovered reference objects to process before " \ "The number of discovered reference objects to process before " \
@ -91,11 +89,9 @@
\ \
product(size_t, G1SATBBufferSize, 1*K, \ product(size_t, G1SATBBufferSize, 1*K, \
"Number of entries in an SATB log buffer.") \ "Number of entries in an SATB log buffer.") \
range(1, max_uintx) \
\ \
develop(intx, G1SATBProcessCompletedThreshold, 20, \ develop(intx, G1SATBProcessCompletedThreshold, 20, \
"Number of completed buffers that triggers log processing.") \ "Number of completed buffers that triggers log processing.") \
range(0, max_jint) \
\ \
product(uintx, G1SATBBufferEnqueueingThresholdPercent, 60, \ product(uintx, G1SATBBufferEnqueueingThresholdPercent, 60, \
"Before enqueueing them, each mutator thread tries to do some " \ "Before enqueueing them, each mutator thread tries to do some " \
@ -118,31 +114,26 @@
\ \
product(size_t, G1UpdateBufferSize, 256, \ product(size_t, G1UpdateBufferSize, 256, \
"Size of an update buffer") \ "Size of an update buffer") \
range(1, NOT_LP64(32*M) LP64_ONLY(1*G)) \
\ \
product(intx, G1ConcRefinementYellowZone, 0, \ product(intx, G1ConcRefinementYellowZone, 0, \
"Number of enqueued update buffers that will " \ "Number of enqueued update buffers that will " \
"trigger concurrent processing. Will be selected ergonomically " \ "trigger concurrent processing. Will be selected ergonomically " \
"by default.") \ "by default.") \
range(0, max_intx) \
\ \
product(intx, G1ConcRefinementRedZone, 0, \ product(intx, G1ConcRefinementRedZone, 0, \
"Maximum number of enqueued update buffers before mutator " \ "Maximum number of enqueued update buffers before mutator " \
"threads start processing new ones instead of enqueueing them. " \ "threads start processing new ones instead of enqueueing them. " \
"Will be selected ergonomically by default. Zero will disable " \ "Will be selected ergonomically by default. Zero will disable " \
"concurrent processing.") \ "concurrent processing.") \
range(0, max_intx) \
\ \
product(intx, G1ConcRefinementGreenZone, 0, \ product(intx, G1ConcRefinementGreenZone, 0, \
"The number of update buffers that are left in the queue by the " \ "The number of update buffers that are left in the queue by the " \
"concurrent processing threads. Will be selected ergonomically " \ "concurrent processing threads. Will be selected ergonomically " \
"by default.") \ "by default.") \
range(0, max_intx) \
\ \
product(intx, G1ConcRefinementServiceIntervalMillis, 300, \ product(intx, G1ConcRefinementServiceIntervalMillis, 300, \
"The last concurrent refinement thread wakes up every " \ "The last concurrent refinement thread wakes up every " \
"specified number of milliseconds to do miscellaneous work.") \ "specified number of milliseconds to do miscellaneous work.") \
range(0, max_intx) \
\ \
product(intx, G1ConcRefinementThresholdStep, 0, \ product(intx, G1ConcRefinementThresholdStep, 0, \
"Each time the rset update queue increases by this amount " \ "Each time the rset update queue increases by this amount " \
@ -152,7 +143,6 @@
product(intx, G1RSetUpdatingPauseTimePercent, 10, \ product(intx, G1RSetUpdatingPauseTimePercent, 10, \
"A target percentage of time that is allowed to be spend on " \ "A target percentage of time that is allowed to be spend on " \
"process RS update buffers during the collection pause.") \ "process RS update buffers during the collection pause.") \
range(0, 100) \
\ \
product(bool, G1UseAdaptiveConcRefinement, true, \ product(bool, G1UseAdaptiveConcRefinement, true, \
"Select green, yellow and red zones adaptively to meet the " \ "Select green, yellow and red zones adaptively to meet the " \
@ -168,24 +158,18 @@
\ \
develop(intx, G1RSetRegionEntriesBase, 256, \ develop(intx, G1RSetRegionEntriesBase, 256, \
"Max number of regions in a fine-grain table per MB.") \ "Max number of regions in a fine-grain table per MB.") \
range(1, max_jint) \
\ \
product(intx, G1RSetRegionEntries, 0, \ product(intx, G1RSetRegionEntries, 0, \
"Max number of regions for which we keep bitmaps." \ "Max number of regions for which we keep bitmaps." \
"Will be set ergonomically by default") \ "Will be set ergonomically by default") \
range(0, max_jint) \
constraint(G1RSetRegionEntriesConstraintFunc,AfterErgo) \
\ \
develop(intx, G1RSetSparseRegionEntriesBase, 4, \ develop(intx, G1RSetSparseRegionEntriesBase, 4, \
"Max number of entries per region in a sparse table " \ "Max number of entries per region in a sparse table " \
"per MB.") \ "per MB.") \
range(1, max_jint) \
\ \
product(intx, G1RSetSparseRegionEntries, 0, \ product(intx, G1RSetSparseRegionEntries, 0, \
"Max number of entries per region in a sparse table." \ "Max number of entries per region in a sparse table." \
"Will be set ergonomically by default.") \ "Will be set ergonomically by default.") \
range(0, max_jint) \
constraint(G1RSetSparseRegionEntriesConstraintFunc,AfterErgo) \
\ \
develop(bool, G1RecordHRRSOops, false, \ develop(bool, G1RecordHRRSOops, false, \
"When true, record recent calls to rem set operations.") \ "When true, record recent calls to rem set operations.") \
@ -196,7 +180,6 @@
develop(intx, G1MaxVerifyFailures, -1, \ develop(intx, G1MaxVerifyFailures, -1, \
"The maximum number of verification failures to print. " \ "The maximum number of verification failures to print. " \
"-1 means print all.") \ "-1 means print all.") \
range(-1, max_jint) \
\ \
develop(bool, G1ScrubRemSets, true, \ develop(bool, G1ScrubRemSets, true, \
"When true, do RS scrubbing after cleanup.") \ "When true, do RS scrubbing after cleanup.") \
@ -210,13 +193,11 @@
develop(intx, G1YoungSurvRateNumRegionsSummary, 0, \ develop(intx, G1YoungSurvRateNumRegionsSummary, 0, \
"the number of regions for which we'll print a surv rate " \ "the number of regions for which we'll print a surv rate " \
"summary.") \ "summary.") \
range(0, max_intx) \
constraint(G1YoungSurvRateNumRegionsSummaryConstraintFunc,AfterErgo)\
\ \
product(uintx, G1ReservePercent, 10, \ product(uintx, G1ReservePercent, 10, \
"It determines the minimum reserve we should have in the heap " \ "It determines the minimum reserve we should have in the heap " \
"to minimize the probability of promotion failure.") \ "to minimize the probability of promotion failure.") \
range(0, 50) \ range(0, 100) \
\ \
diagnostic(bool, G1PrintHeapRegions, false, \ diagnostic(bool, G1PrintHeapRegions, false, \
"If set G1 will print information on which regions are being " \ "If set G1 will print information on which regions are being " \
@ -234,13 +215,10 @@
\ \
product(size_t, G1HeapRegionSize, 0, \ product(size_t, G1HeapRegionSize, 0, \
"Size of the G1 regions.") \ "Size of the G1 regions.") \
range(0, 32*M) \
constraint(G1HeapRegionSizeConstraintFunc,AfterMemoryInit) \
\ \
product(uintx, G1ConcRefinementThreads, 0, \ product(uintx, G1ConcRefinementThreads, 0, \
"If non-0 is the number of parallel rem set update threads, " \ "If non-0 is the number of parallel rem set update threads, " \
"otherwise the value is determined ergonomically.") \ "otherwise the value is determined ergonomically.") \
range(0, max_jint-1) \
\ \
develop(bool, G1VerifyCTCleanup, false, \ develop(bool, G1VerifyCTCleanup, false, \
"Verify card table cleanup.") \ "Verify card table cleanup.") \
@ -248,7 +226,6 @@
product(size_t, G1RSetScanBlockSize, 64, \ product(size_t, G1RSetScanBlockSize, 64, \
"Size of a work unit of cards claimed by a worker thread" \ "Size of a work unit of cards claimed by a worker thread" \
"during RSet scanning.") \ "during RSet scanning.") \
range(1, max_uintx) \
\ \
develop(uintx, G1SecondaryFreeListAppendLength, 5, \ develop(uintx, G1SecondaryFreeListAppendLength, 5, \
"The number of regions we will add to the secondary free list " \ "The number of regions we will add to the secondary free list " \
@ -285,7 +262,6 @@
experimental(uintx, G1NewSizePercent, 5, \ experimental(uintx, G1NewSizePercent, 5, \
"Percentage (0-100) of the heap size to use as default " \ "Percentage (0-100) of the heap size to use as default " \
"minimum young gen size.") \ "minimum young gen size.") \
range(0, 100) \
constraint(G1NewSizePercentConstraintFunc,AfterErgo) \ constraint(G1NewSizePercentConstraintFunc,AfterErgo) \
\ \
experimental(uintx, G1MixedGCLiveThresholdPercent, 85, \ experimental(uintx, G1MixedGCLiveThresholdPercent, 85, \

View File

@ -581,10 +581,8 @@ static bool set_bool_flag(char* name, bool value, Flag::Flags origin) {
} }
static bool set_fp_numeric_flag(char* name, char* value, Flag::Flags origin) { static bool set_fp_numeric_flag(char* name, char* value, Flag::Flags origin) {
char* end; double v;
errno = 0; if (sscanf(value, "%lf", &v) != 1) {
double v = strtod(value, &end);
if ((errno != 0) || (*end != 0)) {
return false; return false;
} }
@ -718,9 +716,9 @@ bool Arguments::parse_argument(const char* arg, Flag::Flags origin) {
return set_string_flag(name, value, origin); return set_string_flag(name, value, origin);
} }
#define SIGNED_FP_NUMBER_RANGE "[-0123456789.eE+]" #define SIGNED_FP_NUMBER_RANGE "[-0123456789.]"
#define SIGNED_NUMBER_RANGE "[-0123456789]" #define SIGNED_NUMBER_RANGE "[-0123456789]"
#define NUMBER_RANGE "[0123456789eE+-]" #define NUMBER_RANGE "[0123456789]"
char value[BUFLEN + 1]; char value[BUFLEN + 1];
char value2[BUFLEN + 1]; char value2[BUFLEN + 1];
if (sscanf(arg, "%" XSTR(BUFLEN) NAME_RANGE "=" "%" XSTR(BUFLEN) SIGNED_NUMBER_RANGE "." "%" XSTR(BUFLEN) NUMBER_RANGE "%c", name, value, value2, &dummy) == 3) { if (sscanf(arg, "%" XSTR(BUFLEN) NAME_RANGE "=" "%" XSTR(BUFLEN) SIGNED_NUMBER_RANGE "." "%" XSTR(BUFLEN) NUMBER_RANGE "%c", name, value, value2, &dummy) == 3) {

View File

@ -220,7 +220,7 @@ void emit_constraint_double(const char* name, CommandLineFlagConstraintFunc_doub
#define EMIT_CONSTRAINT_CHECK(func, type) , func, CommandLineFlagConstraint::type #define EMIT_CONSTRAINT_CHECK(func, type) , func, CommandLineFlagConstraint::type
// the "name" argument must be a string literal // the "name" argument must be a string literal
#define INITIAL_CONSTRAINTS_SIZE 40 #define INITIAL_CONSTRAINTS_SIZE 16
GrowableArray<CommandLineFlagConstraint*>* CommandLineFlagConstraintList::_constraints = NULL; GrowableArray<CommandLineFlagConstraint*>* CommandLineFlagConstraintList::_constraints = NULL;
CommandLineFlagConstraint::ConstraintType CommandLineFlagConstraintList::_validating_type = CommandLineFlagConstraint::AtParse; CommandLineFlagConstraint::ConstraintType CommandLineFlagConstraintList::_validating_type = CommandLineFlagConstraint::AtParse;
@ -274,7 +274,7 @@ void CommandLineFlagConstraintList::init(void) {
EMIT_CONSTRAINT_CHECK)); EMIT_CONSTRAINT_CHECK));
#endif // COMPILER2 #endif // COMPILER2
#if INCLUDE_ALL_GCS #ifndef INCLUDE_ALL_GCS
emit_constraint_no(NULL G1_FLAGS(EMIT_CONSTRAINT_DEVELOPER_FLAG, emit_constraint_no(NULL G1_FLAGS(EMIT_CONSTRAINT_DEVELOPER_FLAG,
EMIT_CONSTRAINT_PD_DEVELOPER_FLAG, EMIT_CONSTRAINT_PD_DEVELOPER_FLAG,
EMIT_CONSTRAINT_PRODUCT_FLAG, EMIT_CONSTRAINT_PRODUCT_FLAG,
@ -305,7 +305,10 @@ CommandLineFlagConstraint* CommandLineFlagConstraintList::find_if_needs_check(co
// Check constraints for specific constraint type. // Check constraints for specific constraint type.
bool CommandLineFlagConstraintList::check_constraints(CommandLineFlagConstraint::ConstraintType type) { bool CommandLineFlagConstraintList::check_constraints(CommandLineFlagConstraint::ConstraintType type) {
guarantee(type > _validating_type, "Constraint check is out of order."); // Skip if we already checked.
if (type < _validating_type) {
return true;
}
_validating_type = type; _validating_type = type;
bool status = true; bool status = true;

View File

@ -54,9 +54,9 @@ public:
enum ConstraintType { enum ConstraintType {
// Will be validated during argument processing (Arguments::parse_argument). // Will be validated during argument processing (Arguments::parse_argument).
AtParse = 0, AtParse = 0,
// Will be validated by CommandLineFlagConstraintList::check_constraints(AfterErgo). // Will be validated by CommandLineFlags::check_constraints_of_after_ergo().
AfterErgo = 1, AfterErgo = 1,
// Will be validated by CommandLineFlagConstraintList::check_constraints(AfterMemoryInit). // Will be validated by CommandLineFlags::check_constraints_of_after_memory_init().
AfterMemoryInit = 2 AfterMemoryInit = 2
}; };

View File

@ -23,19 +23,16 @@
*/ */
#include "precompiled.hpp" #include "precompiled.hpp"
#include "gc/shared/collectedHeap.hpp"
#include "gc/shared/collectorPolicy.hpp"
#include "gc/shared/threadLocalAllocBuffer.hpp"
#include "runtime/arguments.hpp" #include "runtime/arguments.hpp"
#include "runtime/commandLineFlagConstraintsGC.hpp" #include "runtime/commandLineFlagConstraintsGC.hpp"
#include "runtime/commandLineFlagRangeList.hpp" #include "runtime/commandLineFlagRangeList.hpp"
#include "runtime/globals.hpp" #include "runtime/globals.hpp"
#include "runtime/globals_extension.hpp"
#include "utilities/defaultStream.hpp" #include "utilities/defaultStream.hpp"
#if INCLUDE_ALL_GCS #if INCLUDE_ALL_GCS
#include "gc/g1/g1_globals.hpp" #include "gc/g1/g1_globals.hpp"
#include "gc/g1/heapRegionBounds.inline.hpp" #include "gc/g1/heapRegionBounds.inline.hpp"
#include "gc/parallel/parallelScavengeHeap.hpp"
#include "gc/shared/plab.hpp" #include "gc/shared/plab.hpp"
#endif // INCLUDE_ALL_GCS #endif // INCLUDE_ALL_GCS
#ifdef COMPILER1 #ifdef COMPILER1
@ -45,63 +42,6 @@
#include "opto/c2_globals.hpp" #include "opto/c2_globals.hpp"
#endif // COMPILER2 #endif // COMPILER2
#if INCLUDE_ALL_GCS
static Flag::Error ParallelGCThreadsAndCMSWorkQueueDrainThreshold(uint threads, uintx threshold, bool verbose) {
// CMSWorkQueueDrainThreshold is verified to be less than max_juint
if (UseConcMarkSweepGC && (threads > (uint)(max_jint / (uint)threshold))) {
CommandLineError::print(verbose,
"ParallelGCThreads (" UINT32_FORMAT ") or CMSWorkQueueDrainThreshold ("
UINTX_FORMAT ") is too large\n",
threads, threshold);
return Flag::VIOLATES_CONSTRAINT;
}
return Flag::SUCCESS;
}
#endif
// As ParallelGCThreads differs among GC modes, we need constraint function.
Flag::Error ParallelGCThreadsConstraintFunc(uint value, bool verbose) {
Flag::Error status = Flag::SUCCESS;
#if INCLUDE_ALL_GCS
// Parallel GC passes ParallelGCThreads when creating GrowableArray as 'int' type parameter.
// So can't exceed with "max_jint"
if (UseParallelGC && (value > (uint)max_jint)) {
CommandLineError::print(verbose,
"ParallelGCThreads (" UINT32_FORMAT ") must be "
"less than or equal to " UINT32_FORMAT " for Parallel GC\n",
value, max_jint);
return Flag::VIOLATES_CONSTRAINT;
}
// To avoid overflow at ParScanClosure::do_oop_work.
if (UseConcMarkSweepGC && (value > (max_jint / 10))) {
CommandLineError::print(verbose,
"ParallelGCThreads (" UINT32_FORMAT ") must be "
"less than or equal to " UINT32_FORMAT " for CMS GC\n",
value, (max_jint / 10));
return Flag::VIOLATES_CONSTRAINT;
}
status = ParallelGCThreadsAndCMSWorkQueueDrainThreshold(value, CMSWorkQueueDrainThreshold, verbose);
#endif
return status;
}
// As ConcGCThreads should be smaller than ParallelGCThreads,
// we need constraint function.
Flag::Error ConcGCThreadsConstraintFunc(uint value, bool verbose) {
#if INCLUDE_ALL_GCS
// CMS and G1 GCs use ConcGCThreads.
if ((UseConcMarkSweepGC || UseG1GC) && (value > ParallelGCThreads)) {
CommandLineError::print(verbose,
"ConcGCThreads (" UINT32_FORMAT ") must be "
"less than or equal to ParallelGCThreads (" UINT32_FORMAT ")\n",
value, ParallelGCThreads);
return Flag::VIOLATES_CONSTRAINT;
}
#endif
return Flag::SUCCESS;
}
static Flag::Error MinPLABSizeBounds(const char* name, size_t value, bool verbose) { static Flag::Error MinPLABSizeBounds(const char* name, size_t value, bool verbose) {
#if INCLUDE_ALL_GCS #if INCLUDE_ALL_GCS
if ((UseConcMarkSweepGC || UseG1GC) && (value < PLAB::min_size())) { if ((UseConcMarkSweepGC || UseG1GC) && (value < PLAB::min_size())) {
@ -129,40 +69,16 @@ static Flag::Error MaxPLABSizeBounds(const char* name, size_t value, bool verbos
} }
static Flag::Error MinMaxPLABSizeBounds(const char* name, size_t value, bool verbose) { static Flag::Error MinMaxPLABSizeBounds(const char* name, size_t value, bool verbose) {
Flag::Error status = MinPLABSizeBounds(name, value, verbose); if (MinPLABSizeBounds(name, value, verbose) == Flag::SUCCESS) {
if (status == Flag::SUCCESS) {
return MaxPLABSizeBounds(name, value, verbose); return MaxPLABSizeBounds(name, value, verbose);
} }
return status; return Flag::VIOLATES_CONSTRAINT;
} }
Flag::Error YoungPLABSizeConstraintFunc(size_t value, bool verbose) { Flag::Error YoungPLABSizeConstraintFunc(size_t value, bool verbose) {
return MinMaxPLABSizeBounds("YoungPLABSize", value, verbose); return MinMaxPLABSizeBounds("YoungPLABSize", value, verbose);
} }
Flag::Error OldPLABSizeConstraintFunc(size_t value, bool verbose) {
Flag::Error status = Flag::SUCCESS;
#if INCLUDE_ALL_GCS
if (UseConcMarkSweepGC) {
if (value == 0) {
CommandLineError::print(verbose,
"OldPLABSize (" SIZE_FORMAT ") must be greater than 0",
value);
return Flag::VIOLATES_CONSTRAINT;
}
// For CMS, OldPLABSize is the number of free blocks of a given size that are used when
// replenishing the local per-worker free list caches.
// For more details, please refer to Arguments::set_cms_and_parnew_gc_flags().
status = MaxPLABSizeBounds("OldPLABSize", value, verbose);
} else {
status = MinMaxPLABSizeBounds("OldPLABSize", value, verbose);
}
#endif
return status;
}
Flag::Error MinHeapFreeRatioConstraintFunc(uintx value, bool verbose) { Flag::Error MinHeapFreeRatioConstraintFunc(uintx value, bool verbose) {
if (value > MaxHeapFreeRatio) { if (value > MaxHeapFreeRatio) {
CommandLineError::print(verbose, CommandLineError::print(verbose,
@ -187,23 +103,6 @@ Flag::Error MaxHeapFreeRatioConstraintFunc(uintx value, bool verbose) {
} }
} }
static Flag::Error CheckMaxHeapSizeAndSoftRefLRUPolicyMSPerMB(size_t maxHeap, intx softRef, bool verbose) {
if ((softRef > 0) && ((maxHeap / M) > (max_uintx / softRef))) {
CommandLineError::print(verbose,
"Desired lifetime of SoftReferences cannot be expressed correctly. "
"MaxHeapSize (" SIZE_FORMAT ") or SoftRefLRUPolicyMSPerMB "
"(" INTX_FORMAT ") is too large\n",
maxHeap, softRef);
return Flag::VIOLATES_CONSTRAINT;
} else {
return Flag::SUCCESS;
}
}
Flag::Error SoftRefLRUPolicyMSPerMBConstraintFunc(intx value, bool verbose) {
return CheckMaxHeapSizeAndSoftRefLRUPolicyMSPerMB(MaxHeapSize, value, verbose);
}
Flag::Error MinMetaspaceFreeRatioConstraintFunc(uintx value, bool verbose) { Flag::Error MinMetaspaceFreeRatioConstraintFunc(uintx value, bool verbose) {
if (value > MaxMetaspaceFreeRatio) { if (value > MaxMetaspaceFreeRatio) {
CommandLineError::print(verbose, CommandLineError::print(verbose,
@ -228,111 +127,45 @@ Flag::Error MaxMetaspaceFreeRatioConstraintFunc(uintx value, bool verbose) {
} }
} }
// GC workaround for "-XX:+UseConcMarkSweepGC"
// which sets InitialTenuringThreshold to 7 but leaves MaxTenuringThreshold remaining at 6
// and therefore would invalidate the constraint
#define UseConcMarkSweepGCWorkaroundIfNeeded(initial, max) { \
if ((initial == 7) && (max == 6)) { \
return Flag::SUCCESS; \
} \
}
Flag::Error InitialTenuringThresholdConstraintFunc(uintx value, bool verbose) { Flag::Error InitialTenuringThresholdConstraintFunc(uintx value, bool verbose) {
#if INCLUDE_ALL_GCS UseConcMarkSweepGCWorkaroundIfNeeded(value, MaxTenuringThreshold);
// InitialTenuringThreshold is only used for ParallelGC.
if (UseParallelGC && (value > MaxTenuringThreshold)) { if (value > MaxTenuringThreshold) {
CommandLineError::print(verbose, CommandLineError::print(verbose,
"InitialTenuringThreshold (" UINTX_FORMAT ") must be " "InitialTenuringThreshold (" UINTX_FORMAT ") must be "
"less than or equal to MaxTenuringThreshold (" UINTX_FORMAT ")\n", "less than or equal to MaxTenuringThreshold (" UINTX_FORMAT ")\n",
value, MaxTenuringThreshold); value, MaxTenuringThreshold);
return Flag::VIOLATES_CONSTRAINT; return Flag::VIOLATES_CONSTRAINT;
} else {
return Flag::SUCCESS;
} }
#endif
return Flag::SUCCESS;
} }
Flag::Error MaxTenuringThresholdConstraintFunc(uintx value, bool verbose) { Flag::Error MaxTenuringThresholdConstraintFunc(uintx value, bool verbose) {
#if INCLUDE_ALL_GCS UseConcMarkSweepGCWorkaroundIfNeeded(InitialTenuringThreshold, value);
// As only ParallelGC uses InitialTenuringThreshold,
// we don't need to compare InitialTenuringThreshold with MaxTenuringThreshold. if (value < InitialTenuringThreshold) {
if (UseParallelGC && (value < InitialTenuringThreshold)) {
CommandLineError::print(verbose, CommandLineError::print(verbose,
"MaxTenuringThreshold (" UINTX_FORMAT ") must be " "MaxTenuringThreshold (" UINTX_FORMAT ") must be "
"greater than or equal to InitialTenuringThreshold (" UINTX_FORMAT ")\n", "greater than or equal to InitialTenuringThreshold (" UINTX_FORMAT ")\n",
value, InitialTenuringThreshold); value, InitialTenuringThreshold);
return Flag::VIOLATES_CONSTRAINT; return Flag::VIOLATES_CONSTRAINT;
} else {
return Flag::SUCCESS;
} }
#endif
// MaxTenuringThreshold=0 means NeverTenure=false && AlwaysTenure=true
if ((value == 0) && (NeverTenure || !AlwaysTenure)) {
CommandLineError::print(verbose,
"MaxTenuringThreshold (0) should match to NeverTenure=false "
"&& AlwaysTenure=true. But we have NeverTenure=%s "
"AlwaysTenure=%s\n",
NeverTenure ? "true" : "false",
AlwaysTenure ? "true" : "false");
return Flag::VIOLATES_CONSTRAINT;
}
return Flag::SUCCESS;
} }
#if INCLUDE_ALL_GCS #if INCLUDE_ALL_GCS
Flag::Error G1RSetRegionEntriesConstraintFunc(intx value, bool verbose) {
if (!UseG1GC) return Flag::SUCCESS;
// Default value of G1RSetRegionEntries=0 means will be set ergonomically.
// Minimum value is 1.
if (FLAG_IS_CMDLINE(G1RSetRegionEntries) && (value < 1)) {
CommandLineError::print(verbose,
"G1RSetRegionEntries (" INTX_FORMAT ") must be "
"greater than or equal to 1\n",
value);
return Flag::VIOLATES_CONSTRAINT;
} else {
return Flag::SUCCESS;
}
}
Flag::Error G1RSetSparseRegionEntriesConstraintFunc(intx value, bool verbose) {
if (!UseG1GC) return Flag::SUCCESS;
// Default value of G1RSetSparseRegionEntries=0 means will be set ergonomically.
// Minimum value is 1.
if (FLAG_IS_CMDLINE(G1RSetSparseRegionEntries) && (value < 1)) {
CommandLineError::print(verbose,
"G1RSetSparseRegionEntries (" INTX_FORMAT ") must be "
"greater than or equal to 1\n",
value);
return Flag::VIOLATES_CONSTRAINT;
} else {
return Flag::SUCCESS;
}
}
Flag::Error G1YoungSurvRateNumRegionsSummaryConstraintFunc(intx value, bool verbose) {
if (!UseG1GC) return Flag::SUCCESS;
if (value > (intx)HeapRegionBounds::target_number()) {
CommandLineError::print(verbose,
"G1YoungSurvRateNumRegionsSummary (" INTX_FORMAT ") must be "
"less than or equal to region count (" SIZE_FORMAT ")\n",
value, HeapRegionBounds::target_number());
return Flag::VIOLATES_CONSTRAINT;
} else {
return Flag::SUCCESS;
}
}
Flag::Error G1HeapRegionSizeConstraintFunc(size_t value, bool verbose) {
if (!UseG1GC) return Flag::SUCCESS;
// Default value of G1HeapRegionSize=0 means will be set ergonomically.
if (FLAG_IS_CMDLINE(G1HeapRegionSize) && (value < HeapRegionBounds::min_size())) {
CommandLineError::print(verbose,
"G1HeapRegionSize (" SIZE_FORMAT ") must be "
"greater than or equal to ergonomic heap region minimum size\n",
value);
return Flag::VIOLATES_CONSTRAINT;
} else {
return Flag::SUCCESS;
}
}
Flag::Error G1NewSizePercentConstraintFunc(uintx value, bool verbose) { Flag::Error G1NewSizePercentConstraintFunc(uintx value, bool verbose) {
if (!UseG1GC) return Flag::SUCCESS;
if (value > G1MaxNewSizePercent) { if (value > G1MaxNewSizePercent) {
CommandLineError::print(verbose, CommandLineError::print(verbose,
"G1NewSizePercent (" UINTX_FORMAT ") must be " "G1NewSizePercent (" UINTX_FORMAT ") must be "
@ -345,8 +178,6 @@ Flag::Error G1NewSizePercentConstraintFunc(uintx value, bool verbose) {
} }
Flag::Error G1MaxNewSizePercentConstraintFunc(uintx value, bool verbose) { Flag::Error G1MaxNewSizePercentConstraintFunc(uintx value, bool verbose) {
if (!UseG1GC) return Flag::SUCCESS;
if (value < G1NewSizePercent) { if (value < G1NewSizePercent) {
CommandLineError::print(verbose, CommandLineError::print(verbose,
"G1MaxNewSizePercent (" UINTX_FORMAT ") must be " "G1MaxNewSizePercent (" UINTX_FORMAT ") must be "
@ -357,56 +188,15 @@ Flag::Error G1MaxNewSizePercentConstraintFunc(uintx value, bool verbose) {
return Flag::SUCCESS; return Flag::SUCCESS;
} }
} }
#endif // INCLUDE_ALL_GCS #endif // INCLUDE_ALL_GCS
Flag::Error ParGCStridesPerThreadConstraintFunc(uintx value, bool verbose) {
#if INCLUDE_ALL_GCS
if (UseConcMarkSweepGC && (value > ((uintx)max_jint / (uintx)ParallelGCThreads))) {
CommandLineError::print(verbose,
"ParGCStridesPerThread (" UINTX_FORMAT ") must be "
"less than or equal to ergonomic maximum (" UINTX_FORMAT ")\n",
value, ((uintx)max_jint / (uintx)ParallelGCThreads));
return Flag::VIOLATES_CONSTRAINT;
}
#endif
return Flag::SUCCESS;
}
Flag::Error CMSOldPLABMinConstraintFunc(size_t value, bool verbose) { Flag::Error CMSOldPLABMinConstraintFunc(size_t value, bool verbose) {
Flag::Error status = Flag::SUCCESS; if (value > CMSOldPLABMax) {
#if INCLUDE_ALL_GCS
if (UseConcMarkSweepGC) {
if (value > CMSOldPLABMax) {
CommandLineError::print(verbose,
"CMSOldPLABMin (" SIZE_FORMAT ") must be "
"less than or equal to CMSOldPLABMax (" SIZE_FORMAT ")\n",
value, CMSOldPLABMax);
return Flag::VIOLATES_CONSTRAINT;
}
status = MaxPLABSizeBounds("CMSOldPLABMin", value, verbose);
}
#endif
return status;
}
Flag::Error CMSOldPLABMaxConstraintFunc(size_t value, bool verbose) {
Flag::Error status = Flag::SUCCESS;
#if INCLUDE_ALL_GCS
if (UseConcMarkSweepGC) {
status = MaxPLABSizeBounds("CMSOldPLABMax", value, verbose);
}
#endif
return status;
}
Flag::Error MarkStackSizeConstraintFunc(size_t value, bool verbose) {
if (value > MarkStackSizeMax) {
CommandLineError::print(verbose, CommandLineError::print(verbose,
"MarkStackSize (" SIZE_FORMAT ") must be " "CMSOldPLABMin (" SIZE_FORMAT ") must be "
"less than or equal to MarkStackSizeMax (" SIZE_FORMAT ")\n", "less than or equal to CMSOldPLABMax (" SIZE_FORMAT ")\n",
value, MarkStackSizeMax); value, CMSOldPLABMax);
return Flag::VIOLATES_CONSTRAINT; return Flag::VIOLATES_CONSTRAINT;
} else { } else {
return Flag::SUCCESS; return Flag::SUCCESS;
@ -414,212 +204,23 @@ Flag::Error MarkStackSizeConstraintFunc(size_t value, bool verbose) {
} }
Flag::Error CMSPrecleanDenominatorConstraintFunc(uintx value, bool verbose) { Flag::Error CMSPrecleanDenominatorConstraintFunc(uintx value, bool verbose) {
#if INCLUDE_ALL_GCS if (value <= CMSPrecleanNumerator) {
if (UseConcMarkSweepGC && (value <= CMSPrecleanNumerator)) {
CommandLineError::print(verbose, CommandLineError::print(verbose,
"CMSPrecleanDenominator (" UINTX_FORMAT ") must be " "CMSPrecleanDenominator (" UINTX_FORMAT ") must be "
"strickly greater than CMSPrecleanNumerator (" UINTX_FORMAT ")\n", "strickly greater than CMSPrecleanNumerator (" UINTX_FORMAT ")\n",
value, CMSPrecleanNumerator); value, CMSPrecleanNumerator);
return Flag::VIOLATES_CONSTRAINT; return Flag::VIOLATES_CONSTRAINT;
} else {
return Flag::SUCCESS;
} }
#endif
return Flag::SUCCESS;
} }
Flag::Error CMSPrecleanNumeratorConstraintFunc(uintx value, bool verbose) { Flag::Error CMSPrecleanNumeratorConstraintFunc(uintx value, bool verbose) {
#if INCLUDE_ALL_GCS if (value > (CMSPrecleanDenominator - 1)) {
if (UseConcMarkSweepGC && (value >= CMSPrecleanDenominator)) {
CommandLineError::print(verbose, CommandLineError::print(verbose,
"CMSPrecleanNumerator (" UINTX_FORMAT ") must be " "CMSPrecleanNumerator (" UINTX_FORMAT ") must be "
"less than CMSPrecleanDenominator (" UINTX_FORMAT ")\n", "less than or equal to CMSPrecleanDenominator - 1 (" UINTX_FORMAT ")\n",
value, CMSPrecleanDenominator); value, CMSPrecleanDenominator - 1);
return Flag::VIOLATES_CONSTRAINT;
}
#endif
return Flag::SUCCESS;
}
Flag::Error CMSWorkQueueDrainThresholdConstraintFunc(uintx value, bool verbose) {
#if INCLUDE_ALL_GCS
if (UseConcMarkSweepGC) {
return ParallelGCThreadsAndCMSWorkQueueDrainThreshold(ParallelGCThreads, value, verbose);
}
#endif
return Flag::SUCCESS;
}
Flag::Error MaxGCPauseMillisConstraintFunc(uintx value, bool verbose) {
#if INCLUDE_ALL_GCS
if (UseG1GC && FLAG_IS_CMDLINE(MaxGCPauseMillis) && (value >= GCPauseIntervalMillis)) {
CommandLineError::print(verbose,
"MaxGCPauseMillis (" UINTX_FORMAT ") must be "
"less than GCPauseIntervalMillis (" UINTX_FORMAT ")\n",
value, GCPauseIntervalMillis);
return Flag::VIOLATES_CONSTRAINT;
}
#endif
return Flag::SUCCESS;
}
Flag::Error GCPauseIntervalMillisConstraintFunc(uintx value, bool verbose) {
#if INCLUDE_ALL_GCS
if (UseG1GC) {
if (FLAG_IS_CMDLINE(GCPauseIntervalMillis)) {
if (value < 1) {
CommandLineError::print(verbose,
"GCPauseIntervalMillis (" UINTX_FORMAT ") must be "
"greater than or equal to 1\n",
value);
return Flag::VIOLATES_CONSTRAINT;
}
if (value <= MaxGCPauseMillis) {
CommandLineError::print(verbose,
"GCPauseIntervalMillis (" UINTX_FORMAT ") must be "
"greater than MaxGCPauseMillis (" UINTX_FORMAT ")\n",
value, MaxGCPauseMillis);
return Flag::VIOLATES_CONSTRAINT;
}
}
}
#endif
return Flag::SUCCESS;
}
Flag::Error InitialBootClassLoaderMetaspaceSizeConstraintFunc(size_t value, bool verbose) {
size_t aligned_max = (size_t)align_size_down(max_uintx/2, Metaspace::reserve_alignment_words());
if (value > aligned_max) {
CommandLineError::print(verbose,
"InitialBootClassLoaderMetaspaceSize (" SIZE_FORMAT ") must be "
"less than or equal to aligned maximum value (" SIZE_FORMAT ")\n",
value, aligned_max);
return Flag::VIOLATES_CONSTRAINT;
}
return Flag::SUCCESS;
}
static Flag::Error MaxSizeForHeapAlignment(const char* name, size_t value, bool verbose) {
// For G1 GC, we don't know until G1CollectorPolicy is created.
size_t heap_alignment;
#if INCLUDE_ALL_GCS
if (UseG1GC) {
heap_alignment = HeapRegionBounds::max_size();
} else
#endif
{
heap_alignment = CollectorPolicy::compute_heap_alignment();
}
// Not to overflow 'align_size_up(value, _heap_alignment) used from CollectorPolicy::initialize_flags()'.
size_t aligned_max = ((max_uintx - heap_alignment) & ~(heap_alignment-1));
if (value > aligned_max) {
CommandLineError::print(verbose,
"%s (" SIZE_FORMAT ") must be "
"less than or equal to aligned maximum value (" SIZE_FORMAT ")\n",
name, value, aligned_max);
return Flag::VIOLATES_CONSTRAINT;
}
return Flag::SUCCESS;
}
Flag::Error InitialHeapSizeConstraintFunc(size_t value, bool verbose) {
return MaxSizeForHeapAlignment("InitialHeapSize", value, verbose);
}
Flag::Error MaxHeapSizeConstraintFunc(size_t value, bool verbose) {
Flag::Error status = MaxSizeForHeapAlignment("MaxHeapSize", value, verbose);
if (status == Flag::SUCCESS) {
status = CheckMaxHeapSizeAndSoftRefLRUPolicyMSPerMB(value, SoftRefLRUPolicyMSPerMB, verbose);
}
return status;
}
Flag::Error NewSizeConstraintFunc(size_t value, bool verbose) {
#ifdef _LP64
#if INCLUDE_ALL_GCS
// Overflow would happen for uint type variable of YoungGenSizer::_min_desired_young_length
// when the value to be assigned exceeds uint range.
// i.e. result of '(uint)(NewSize / region size(1~32MB))'
// So maximum of NewSize should be 'max_juint * 1M'
if (UseG1GC && (value > (max_juint * 1 * M))) {
CommandLineError::print(verbose,
"NewSize (" SIZE_FORMAT ") must be less than ergonomic maximum value\n",
value);
return Flag::VIOLATES_CONSTRAINT;
}
#endif // INCLUDE_ALL_GCS
#endif // _LP64
return Flag::SUCCESS;
}
Flag::Error MinTLABSizeConstraintFunc(size_t value, bool verbose) {
// At least, alignment reserve area is needed.
if (value < ThreadLocalAllocBuffer::alignment_reserve_in_bytes()) {
CommandLineError::print(verbose,
"MinTLABSize (" SIZE_FORMAT ") must be "
"greater than or equal to reserved area in TLAB (" SIZE_FORMAT ")\n",
value, ThreadLocalAllocBuffer::alignment_reserve_in_bytes());
return Flag::VIOLATES_CONSTRAINT;
} else {
return Flag::SUCCESS;
}
}
Flag::Error TLABSizeConstraintFunc(size_t value, bool verbose) {
// Skip for default value of zero which means set ergonomically.
if (FLAG_IS_CMDLINE(TLABSize)) {
if (value < MinTLABSize) {
CommandLineError::print(verbose,
"TLABSize (" SIZE_FORMAT ") must be "
"greater than or equal to MinTLABSize (" SIZE_FORMAT ")\n",
value, MinTLABSize);
return Flag::VIOLATES_CONSTRAINT;
}
if (value > (ThreadLocalAllocBuffer::max_size() * HeapWordSize)) {
CommandLineError::print(verbose,
"TLABSize (" SIZE_FORMAT ") must be "
"less than or equal to ergonomic TLAB maximum size (" SIZE_FORMAT ")\n",
value, (ThreadLocalAllocBuffer::max_size() * HeapWordSize));
return Flag::VIOLATES_CONSTRAINT;
}
}
return Flag::SUCCESS;
}
Flag::Error SurvivorRatioConstraintFunc(uintx value, bool verbose) {
if (FLAG_IS_CMDLINE(SurvivorRatio) &&
(value > (MaxHeapSize / Universe::heap()->collector_policy()->space_alignment()))) {
CommandLineError::print(verbose,
"SurvivorRatio (" UINTX_FORMAT ") must be "
"less than or equal to ergonomic SurvivorRatio maximum (" SIZE_FORMAT ")\n",
value,
(MaxHeapSize / Universe::heap()->collector_policy()->space_alignment()));
return Flag::VIOLATES_CONSTRAINT;
} else {
return Flag::SUCCESS;
}
}
Flag::Error MetaspaceSizeConstraintFunc(size_t value, bool verbose) {
if (value > MaxMetaspaceSize) {
CommandLineError::print(verbose,
"MetaspaceSize (" SIZE_FORMAT ") must be "
"less than or equal to MaxMetaspaceSize (" SIZE_FORMAT ")\n",
value, MaxMetaspaceSize);
return Flag::VIOLATES_CONSTRAINT;
} else {
return Flag::SUCCESS;
}
}
Flag::Error MaxMetaspaceSizeConstraintFunc(size_t value, bool verbose) {
if (value < MetaspaceSize) {
CommandLineError::print(verbose,
"MaxMetaspaceSize (" SIZE_FORMAT ") must be "
"greater than or equal to MetaspaceSize (" SIZE_FORMAT ")\n",
value, MaxMetaspaceSize);
return Flag::VIOLATES_CONSTRAINT; return Flag::VIOLATES_CONSTRAINT;
} else { } else {
return Flag::SUCCESS; return Flag::SUCCESS;

View File

@ -34,45 +34,27 @@
* an appropriate error value. * an appropriate error value.
*/ */
Flag::Error ParallelGCThreadsConstraintFunc(uint value, bool verbose);
Flag::Error ConcGCThreadsConstraintFunc(uint value, bool verbose);
Flag::Error YoungPLABSizeConstraintFunc(size_t value, bool verbose); Flag::Error YoungPLABSizeConstraintFunc(size_t value, bool verbose);
Flag::Error OldPLABSizeConstraintFunc(size_t value, bool verbose);
Flag::Error MinHeapFreeRatioConstraintFunc(uintx value, bool verbose); Flag::Error MinHeapFreeRatioConstraintFunc(uintx value, bool verbose);
Flag::Error MaxHeapFreeRatioConstraintFunc(uintx value, bool verbose); Flag::Error MaxHeapFreeRatioConstraintFunc(uintx value, bool verbose);
Flag::Error SoftRefLRUPolicyMSPerMBConstraintFunc(intx value, bool verbose);
Flag::Error MinMetaspaceFreeRatioConstraintFunc(uintx value, bool verbose); Flag::Error MinMetaspaceFreeRatioConstraintFunc(uintx value, bool verbose);
Flag::Error MaxMetaspaceFreeRatioConstraintFunc(uintx value, bool verbose); Flag::Error MaxMetaspaceFreeRatioConstraintFunc(uintx value, bool verbose);
Flag::Error InitialTenuringThresholdConstraintFunc(uintx value, bool verbose); Flag::Error InitialTenuringThresholdConstraintFunc(uintx value, bool verbose);
Flag::Error MaxTenuringThresholdConstraintFunc(uintx value, bool verbose); Flag::Error MaxTenuringThresholdConstraintFunc(uintx value, bool verbose);
#if INCLUDE_ALL_GCS #if INCLUDE_ALL_GCS
Flag::Error G1RSetRegionEntriesConstraintFunc(intx value, bool verbose);
Flag::Error G1RSetSparseRegionEntriesConstraintFunc(intx value, bool verbose);
Flag::Error G1YoungSurvRateNumRegionsSummaryConstraintFunc(intx value, bool verbose);
Flag::Error G1HeapRegionSizeConstraintFunc(size_t value, bool verbose);
Flag::Error G1NewSizePercentConstraintFunc(uintx value, bool verbose); Flag::Error G1NewSizePercentConstraintFunc(uintx value, bool verbose);
Flag::Error G1MaxNewSizePercentConstraintFunc(uintx value, bool verbose); Flag::Error G1MaxNewSizePercentConstraintFunc(uintx value, bool verbose);
#endif // INCLUDE_ALL_GCS #endif // INCLUDE_ALL_GCS
Flag::Error ParGCStridesPerThreadConstraintFunc(uintx value, bool verbose);
Flag::Error CMSOldPLABMinConstraintFunc(size_t value, bool verbose); Flag::Error CMSOldPLABMinConstraintFunc(size_t value, bool verbose);
Flag::Error CMSOldPLABMaxConstraintFunc(size_t value, bool verbose);
Flag::Error MarkStackSizeConstraintFunc(size_t value, bool verbose);
Flag::Error CMSPrecleanDenominatorConstraintFunc(uintx value, bool verbose); Flag::Error CMSPrecleanDenominatorConstraintFunc(uintx value, bool verbose);
Flag::Error CMSPrecleanNumeratorConstraintFunc(uintx value, bool verbose); Flag::Error CMSPrecleanNumeratorConstraintFunc(uintx value, bool verbose);
Flag::Error CMSWorkQueueDrainThresholdConstraintFunc(uintx value, bool verbose);
Flag::Error MaxGCPauseMillisConstraintFunc(uintx value, bool verbose);
Flag::Error GCPauseIntervalMillisConstraintFunc(uintx value, bool verbose);
Flag::Error InitialBootClassLoaderMetaspaceSizeConstraintFunc(size_t value, bool verbose);
Flag::Error InitialHeapSizeConstraintFunc(size_t value, bool verbose);
Flag::Error MaxHeapSizeConstraintFunc(size_t value, bool verbose);
Flag::Error NewSizeConstraintFunc(size_t value, bool verbose);
Flag::Error MinTLABSizeConstraintFunc(size_t value, bool verbose);
Flag::Error TLABSizeConstraintFunc(size_t value, bool verbose);
Flag::Error SurvivorRatioConstraintFunc(uintx value, bool verbose);
Flag::Error MetaspaceSizeConstraintFunc(size_t value, bool verbose);
Flag::Error MaxMetaspaceSizeConstraintFunc(size_t value, bool verbose);
Flag::Error SurvivorAlignmentInBytesConstraintFunc(intx value, bool verbose); Flag::Error SurvivorAlignmentInBytesConstraintFunc(intx value, bool verbose);
#endif /* SHARE_VM_RUNTIME_COMMANDLINEFLAGCONSTRAINTSGC_HPP */ #endif /* SHARE_VM_RUNTIME_COMMANDLINEFLAGCONSTRAINTSGC_HPP */

View File

@ -278,7 +278,7 @@ void emit_range_double(const char* name, double min, double max) {
// Generate func argument to pass into emit_range_xxx functions // Generate func argument to pass into emit_range_xxx functions
#define EMIT_RANGE_CHECK(a, b) , a, b #define EMIT_RANGE_CHECK(a, b) , a, b
#define INITIAL_RANGES_SIZE 165 #define INITIAL_RANGES_SIZE 128
GrowableArray<CommandLineFlagRange*>* CommandLineFlagRangeList::_ranges = NULL; GrowableArray<CommandLineFlagRange*>* CommandLineFlagRangeList::_ranges = NULL;
// Check the ranges of all flags that have them // Check the ranges of all flags that have them

View File

@ -26,7 +26,6 @@
#define SHARE_VM_RUNTIME_GLOBALS_HPP #define SHARE_VM_RUNTIME_GLOBALS_HPP
#include "utilities/debug.hpp" #include "utilities/debug.hpp"
#include <float.h> // for DBL_MAX
// use this for flags that are true per default in the tiered build // use this for flags that are true per default in the tiered build
// but false in non-tiered builds, and vice versa // but false in non-tiered builds, and vice versa
@ -1548,7 +1547,6 @@ public:
\ \
product(uint, ParallelGCThreads, 0, \ product(uint, ParallelGCThreads, 0, \
"Number of parallel threads parallel gc will use") \ "Number of parallel threads parallel gc will use") \
constraint(ParallelGCThreadsConstraintFunc,AfterErgo) \
\ \
diagnostic(bool, UseSemaphoreGCThreadsSynchronization, true, \ diagnostic(bool, UseSemaphoreGCThreadsSynchronization, true, \
"Use semaphore synchronization for the GC Threads, " \ "Use semaphore synchronization for the GC Threads, " \
@ -1580,7 +1578,14 @@ public:
\ \
product(uint, ConcGCThreads, 0, \ product(uint, ConcGCThreads, 0, \
"Number of threads concurrent gc will use") \ "Number of threads concurrent gc will use") \
constraint(ConcGCThreadsConstraintFunc,AfterErgo) \ \
product(size_t, YoungPLABSize, 4096, \
"Size of young gen promotion LAB's (in HeapWords)") \
constraint(YoungPLABSizeConstraintFunc,AfterMemoryInit) \
\
product(size_t, OldPLABSize, 1024, \
"Size of old gen promotion LAB's (in HeapWords), or Number \
of blocks to attempt to claim when refilling CMS LAB's") \
\ \
product(uintx, GCTaskTimeStampEntries, 200, \ product(uintx, GCTaskTimeStampEntries, 200, \
"Number of time stamp entries per gc worker thread") \ "Number of time stamp entries per gc worker thread") \
@ -1688,7 +1693,6 @@ public:
"The number of strides per worker thread that we divide up the " \ "The number of strides per worker thread that we divide up the " \
"card table scanning work into") \ "card table scanning work into") \
range(1, max_uintx) \ range(1, max_uintx) \
constraint(ParGCStridesPerThreadConstraintFunc,AfterErgo) \
\ \
diagnostic(intx, ParGCCardsPerStrideChunk, 256, \ diagnostic(intx, ParGCCardsPerStrideChunk, 256, \
"The number of cards in each chunk of the parallel chunks used " \ "The number of cards in each chunk of the parallel chunks used " \
@ -1711,13 +1715,12 @@ public:
"Maximum size of CMS gen promotion LAB caches per worker " \ "Maximum size of CMS gen promotion LAB caches per worker " \
"per block size") \ "per block size") \
range(1, max_uintx) \ range(1, max_uintx) \
constraint(CMSOldPLABMaxConstraintFunc,AfterMemoryInit) \
\ \
product(size_t, CMSOldPLABMin, 16, \ product(size_t, CMSOldPLABMin, 16, \
"Minimum size of CMS gen promotion LAB caches per worker " \ "Minimum size of CMS gen promotion LAB caches per worker " \
"per block size") \ "per block size") \
range(1, max_uintx) \ range(1, max_uintx) \
constraint(CMSOldPLABMinConstraintFunc,AfterMemoryInit) \ constraint(CMSOldPLABMinConstraintFunc,AfterErgo) \
\ \
product(uintx, CMSOldPLABNumRefills, 4, \ product(uintx, CMSOldPLABNumRefills, 4, \
"Nominal number of refills of CMS gen promotion LAB cache " \ "Nominal number of refills of CMS gen promotion LAB cache " \
@ -1776,29 +1779,24 @@ public:
product(double, FLSLargestBlockCoalesceProximity, 0.99, \ product(double, FLSLargestBlockCoalesceProximity, 0.99, \
"CMS: the smaller the percentage the greater the coalescing " \ "CMS: the smaller the percentage the greater the coalescing " \
"force") \ "force") \
range(0.0, 1.0) \
\ \
product(double, CMSSmallCoalSurplusPercent, 1.05, \ product(double, CMSSmallCoalSurplusPercent, 1.05, \
"CMS: the factor by which to inflate estimated demand of small " \ "CMS: the factor by which to inflate estimated demand of small " \
"block sizes to prevent coalescing with an adjoining block") \ "block sizes to prevent coalescing with an adjoining block") \
range(0.0, DBL_MAX) \
\ \
product(double, CMSLargeCoalSurplusPercent, 0.95, \ product(double, CMSLargeCoalSurplusPercent, 0.95, \
"CMS: the factor by which to inflate estimated demand of large " \ "CMS: the factor by which to inflate estimated demand of large " \
"block sizes to prevent coalescing with an adjoining block") \ "block sizes to prevent coalescing with an adjoining block") \
range(0.0, DBL_MAX) \
\ \
product(double, CMSSmallSplitSurplusPercent, 1.10, \ product(double, CMSSmallSplitSurplusPercent, 1.10, \
"CMS: the factor by which to inflate estimated demand of small " \ "CMS: the factor by which to inflate estimated demand of small " \
"block sizes to prevent splitting to supply demand for smaller " \ "block sizes to prevent splitting to supply demand for smaller " \
"blocks") \ "blocks") \
range(0.0, DBL_MAX) \
\ \
product(double, CMSLargeSplitSurplusPercent, 1.00, \ product(double, CMSLargeSplitSurplusPercent, 1.00, \
"CMS: the factor by which to inflate estimated demand of large " \ "CMS: the factor by which to inflate estimated demand of large " \
"block sizes to prevent splitting to supply demand for smaller " \ "block sizes to prevent splitting to supply demand for smaller " \
"blocks") \ "blocks") \
range(0.0, DBL_MAX) \
\ \
product(bool, CMSExtrapolateSweep, false, \ product(bool, CMSExtrapolateSweep, false, \
"CMS: cushion for block demand during sweep") \ "CMS: cushion for block demand during sweep") \
@ -1826,11 +1824,9 @@ public:
\ \
develop(intx, CMSDictionaryChoice, 0, \ develop(intx, CMSDictionaryChoice, 0, \
"Use BinaryTreeDictionary as default in the CMS generation") \ "Use BinaryTreeDictionary as default in the CMS generation") \
range(0, 2) \
\ \
product(uintx, CMSIndexedFreeListReplenish, 4, \ product(uintx, CMSIndexedFreeListReplenish, 4, \
"Replenish an indexed free list with this number of chunks") \ "Replenish an indexed free list with this number of chunks") \
range(1, max_uintx) \
\ \
product(bool, CMSReplenishIntermediate, true, \ product(bool, CMSReplenishIntermediate, true, \
"Replenish all intermediate free-list caches") \ "Replenish all intermediate free-list caches") \
@ -1845,15 +1841,14 @@ public:
develop(bool, CMSOverflowEarlyRestoration, false, \ develop(bool, CMSOverflowEarlyRestoration, false, \
"Restore preserved marks early") \ "Restore preserved marks early") \
\ \
product(size_t, MarkStackSize, NOT_LP64(32*K) LP64_ONLY(4*M), \
"Size of marking stack") \
\
/* where does the range max value of (max_jint - 1) come from? */ \ /* where does the range max value of (max_jint - 1) come from? */ \
product(size_t, MarkStackSizeMax, NOT_LP64(4*M) LP64_ONLY(512*M), \ product(size_t, MarkStackSizeMax, NOT_LP64(4*M) LP64_ONLY(512*M), \
"Maximum size of marking stack") \ "Maximum size of marking stack") \
range(1, (max_jint - 1)) \ range(1, (max_jint - 1)) \
\ \
product(size_t, MarkStackSize, NOT_LP64(32*K) LP64_ONLY(4*M), \
"Size of marking stack") \
constraint(MarkStackSizeConstraintFunc,AfterErgo) \
\
notproduct(bool, CMSMarkStackOverflowALot, false, \ notproduct(bool, CMSMarkStackOverflowALot, false, \
"Simulate frequent marking stack / work queue overflow") \ "Simulate frequent marking stack / work queue overflow") \
\ \
@ -1866,7 +1861,6 @@ public:
\ \
product(intx, CMSMaxAbortablePrecleanTime, 5000, \ product(intx, CMSMaxAbortablePrecleanTime, 5000, \
"Maximum time in abortable preclean (in milliseconds)") \ "Maximum time in abortable preclean (in milliseconds)") \
range(0, max_intx) \
\ \
product(uintx, CMSAbortablePrecleanMinWorkPerIteration, 100, \ product(uintx, CMSAbortablePrecleanMinWorkPerIteration, 100, \
"Nominal minimum work per abortable preclean iteration") \ "Nominal minimum work per abortable preclean iteration") \
@ -1874,7 +1868,6 @@ public:
manageable(intx, CMSAbortablePrecleanWaitMillis, 100, \ manageable(intx, CMSAbortablePrecleanWaitMillis, 100, \
"Time that we sleep between iterations when not given " \ "Time that we sleep between iterations when not given " \
"enough work per iteration") \ "enough work per iteration") \
range(0, max_intx) \
\ \
product(size_t, CMSRescanMultiple, 32, \ product(size_t, CMSRescanMultiple, 32, \
"Size (in cards) of CMS parallel rescan task") \ "Size (in cards) of CMS parallel rescan task") \
@ -1981,8 +1974,6 @@ public:
\ \
product(uintx, CMSWorkQueueDrainThreshold, 10, \ product(uintx, CMSWorkQueueDrainThreshold, 10, \
"Don't drain below this size per parallel worker/thief") \ "Don't drain below this size per parallel worker/thief") \
range(0, max_juint) \
constraint(CMSWorkQueueDrainThresholdConstraintFunc,AfterErgo) \
\ \
manageable(intx, CMSWaitDuration, 2000, \ manageable(intx, CMSWaitDuration, 2000, \
"Time in milliseconds that CMS thread waits for young GC") \ "Time in milliseconds that CMS thread waits for young GC") \
@ -2239,11 +2230,9 @@ public:
\ \
develop(intx, PSAdaptiveSizePolicyResizeVirtualSpaceAlot, -1, \ develop(intx, PSAdaptiveSizePolicyResizeVirtualSpaceAlot, -1, \
"Resize the virtual spaces of the young or old generations") \ "Resize the virtual spaces of the young or old generations") \
range(-1, 1) \
\ \
product(uintx, AdaptiveSizeThroughPutPolicy, 0, \ product(uintx, AdaptiveSizeThroughPutPolicy, 0, \
"Policy for changing generation size for throughput goals") \ "Policy for changing generation size for throughput goals") \
range(0, 1) \
\ \
develop(bool, PSAdjustTenuredGenForMinorPause, false, \ develop(bool, PSAdjustTenuredGenForMinorPause, false, \
"Adjust tenured generation to achieve a minor pause goal") \ "Adjust tenured generation to achieve a minor pause goal") \
@ -2315,12 +2304,9 @@ public:
product(uintx, MaxGCPauseMillis, max_uintx, \ product(uintx, MaxGCPauseMillis, max_uintx, \
"Adaptive size policy maximum GC pause time goal in millisecond, "\ "Adaptive size policy maximum GC pause time goal in millisecond, "\
"or (G1 Only) the maximum GC time per MMU time slice") \ "or (G1 Only) the maximum GC time per MMU time slice") \
range(1, max_uintx) \
constraint(MaxGCPauseMillisConstraintFunc,AfterErgo) \
\ \
product(uintx, GCPauseIntervalMillis, 0, \ product(uintx, GCPauseIntervalMillis, 0, \
"Time slice for MMU specification") \ "Time slice for MMU specification") \
constraint(GCPauseIntervalMillisConstraintFunc,AfterErgo) \
\ \
product(uintx, MaxGCMinorPauseMillis, max_uintx, \ product(uintx, MaxGCMinorPauseMillis, max_uintx, \
"Adaptive size policy maximum GC minor pause time goal " \ "Adaptive size policy maximum GC minor pause time goal " \
@ -2341,7 +2327,6 @@ public:
\ \
product(uintx, MinSurvivorRatio, 3, \ product(uintx, MinSurvivorRatio, 3, \
"Minimum ratio of young generation/survivor space size") \ "Minimum ratio of young generation/survivor space size") \
range(3, max_uintx) \
\ \
product(uintx, InitialSurvivorRatio, 8, \ product(uintx, InitialSurvivorRatio, 8, \
"Initial ratio of young generation/survivor space size") \ "Initial ratio of young generation/survivor space size") \
@ -2365,7 +2350,6 @@ public:
\ \
develop(uintx, AdaptiveSizePolicyGCTimeLimitThreshold, 5, \ develop(uintx, AdaptiveSizePolicyGCTimeLimitThreshold, 5, \
"Number of consecutive collections before gc time limit fires") \ "Number of consecutive collections before gc time limit fires") \
range(1, max_uintx) \
\ \
product(bool, PrintAdaptiveSizePolicy, false, \ product(bool, PrintAdaptiveSizePolicy, false, \
"Print information about AdaptiveSizePolicy") \ "Print information about AdaptiveSizePolicy") \
@ -2465,7 +2449,6 @@ public:
develop(intx, ConcGCYieldTimeout, 0, \ develop(intx, ConcGCYieldTimeout, 0, \
"If non-zero, assert that GC threads yield within this " \ "If non-zero, assert that GC threads yield within this " \
"number of milliseconds") \ "number of milliseconds") \
range(0, max_intx) \
\ \
product(bool, PrintReferenceGC, false, \ product(bool, PrintReferenceGC, false, \
"Print times spent handling reference objects during GC " \ "Print times spent handling reference objects during GC " \
@ -2504,8 +2487,6 @@ public:
product(size_t, InitialBootClassLoaderMetaspaceSize, \ product(size_t, InitialBootClassLoaderMetaspaceSize, \
NOT_LP64(2200*K) LP64_ONLY(4*M), \ NOT_LP64(2200*K) LP64_ONLY(4*M), \
"Initial size of the boot class loader data metaspace") \ "Initial size of the boot class loader data metaspace") \
range(BytesPerWord, max_uintx) \
constraint(InitialBootClassLoaderMetaspaceSizeConstraintFunc, AfterErgo)\
\ \
product(bool, TraceYoungGenTime, false, \ product(bool, TraceYoungGenTime, false, \
"Trace accumulated time for young collection") \ "Trace accumulated time for young collection") \
@ -2582,7 +2563,6 @@ public:
experimental(double, ObjectCountCutOffPercent, 0.5, \ experimental(double, ObjectCountCutOffPercent, 0.5, \
"The percentage of the used heap that the instances of a class " \ "The percentage of the used heap that the instances of a class " \
"must occupy for the class to generate a trace event") \ "must occupy for the class to generate a trace event") \
range(0.0, 100.0) \
\ \
/* GC log rotation setting */ \ /* GC log rotation setting */ \
\ \
@ -3293,19 +3273,15 @@ public:
/* gc parameters */ \ /* gc parameters */ \
product(size_t, InitialHeapSize, 0, \ product(size_t, InitialHeapSize, 0, \
"Initial heap size (in bytes); zero means use ergonomics") \ "Initial heap size (in bytes); zero means use ergonomics") \
range(0, max_uintx) \
constraint(InitialHeapSizeConstraintFunc,AfterErgo) \
\ \
product(size_t, MaxHeapSize, ScaleForWordSize(96*M), \ product(size_t, MaxHeapSize, ScaleForWordSize(96*M), \
"Maximum heap size (in bytes)") \ "Maximum heap size (in bytes)") \
constraint(MaxHeapSizeConstraintFunc,AfterErgo) \
\ \
product(size_t, OldSize, ScaleForWordSize(4*M), \ product(size_t, OldSize, ScaleForWordSize(4*M), \
"Initial tenured generation size (in bytes)") \ "Initial tenured generation size (in bytes)") \
\ \
product(size_t, NewSize, ScaleForWordSize(1*M), \ product(size_t, NewSize, ScaleForWordSize(1*M), \
"Initial new generation size (in bytes)") \ "Initial new generation size (in bytes)") \
constraint(NewSizeConstraintFunc,AfterErgo) \
\ \
product(size_t, MaxNewSize, max_uintx, \ product(size_t, MaxNewSize, max_uintx, \
"Maximum new generation size (in bytes), max_uintx means set " \ "Maximum new generation size (in bytes), max_uintx means set " \
@ -3315,23 +3291,12 @@ public:
"Maximum size in bytes of objects allocated in DefNew " \ "Maximum size in bytes of objects allocated in DefNew " \
"generation; zero means no maximum") \ "generation; zero means no maximum") \
\ \
product(size_t, TLABSize, 0, \
"Starting TLAB size (in bytes); zero means set ergonomically") \
\
product(size_t, MinTLABSize, 2*K, \ product(size_t, MinTLABSize, 2*K, \
"Minimum allowed TLAB size (in bytes)") \ "Minimum allowed TLAB size (in bytes)") \
range(1, max_uintx) \ range(1, max_uintx) \
constraint(MinTLABSizeConstraintFunc,AfterMemoryInit) \
\
product(size_t, TLABSize, 0, \
"Starting TLAB size (in bytes); zero means set ergonomically") \
constraint(TLABSizeConstraintFunc,AfterMemoryInit) \
\
product(size_t, YoungPLABSize, 4096, \
"Size of young gen promotion LAB's (in HeapWords)") \
constraint(YoungPLABSizeConstraintFunc,AfterMemoryInit) \
\
product(size_t, OldPLABSize, 1024, \
"Size of old gen promotion LAB's (in HeapWords), or Number " \
"of blocks to attempt to claim when refilling CMS LAB's") \
constraint(OldPLABSizeConstraintFunc,AfterMemoryInit) \
\ \
product(uintx, TLABAllocationWeight, 35, \ product(uintx, TLABAllocationWeight, 35, \
"Allocation averaging weight") \ "Allocation averaging weight") \
@ -3352,12 +3317,9 @@ public:
\ \
product(uintx, SurvivorRatio, 8, \ product(uintx, SurvivorRatio, 8, \
"Ratio of eden/survivor space size") \ "Ratio of eden/survivor space size") \
range(1, max_uintx-2) \
constraint(SurvivorRatioConstraintFunc,AfterMemoryInit) \
\ \
product(uintx, NewRatio, 2, \ product(uintx, NewRatio, 2, \
"Ratio of old/new generation sizes") \ "Ratio of old/new generation sizes") \
range(0, max_uintx-1) \
\ \
product_pd(size_t, NewSizeThreadIncrease, \ product_pd(size_t, NewSizeThreadIncrease, \
"Additional size added to desired new generation size per " \ "Additional size added to desired new generation size per " \
@ -3365,11 +3327,9 @@ public:
\ \
product_pd(size_t, MetaspaceSize, \ product_pd(size_t, MetaspaceSize, \
"Initial size of Metaspaces (in bytes)") \ "Initial size of Metaspaces (in bytes)") \
constraint(MetaspaceSizeConstraintFunc,AfterErgo) \
\ \
product(size_t, MaxMetaspaceSize, max_uintx, \ product(size_t, MaxMetaspaceSize, max_uintx, \
"Maximum size of Metaspaces (in bytes)") \ "Maximum size of Metaspaces (in bytes)") \
constraint(MaxMetaspaceSizeConstraintFunc,AfterErgo) \
\ \
product(size_t, CompressedClassSpaceSize, 1*G, \ product(size_t, CompressedClassSpaceSize, 1*G, \
"Maximum size of class area in Metaspace when compressed " \ "Maximum size of class area in Metaspace when compressed " \
@ -3392,8 +3352,6 @@ public:
\ \
product(intx, SoftRefLRUPolicyMSPerMB, 1000, \ product(intx, SoftRefLRUPolicyMSPerMB, 1000, \
"Number of milliseconds per MB of free space in the heap") \ "Number of milliseconds per MB of free space in the heap") \
range(0, max_intx) \
constraint(SoftRefLRUPolicyMSPerMBConstraintFunc,AfterMemoryInit) \
\ \
product(size_t, MinHeapDeltaBytes, ScaleForWordSize(128*K), \ product(size_t, MinHeapDeltaBytes, ScaleForWordSize(128*K), \
"The minimum change in heap space due to GC (in bytes)") \ "The minimum change in heap space due to GC (in bytes)") \
@ -3425,7 +3383,6 @@ public:
\ \
diagnostic(intx, VerifyGCLevel, 0, \ diagnostic(intx, VerifyGCLevel, 0, \
"Generation level at which to start +VerifyBefore/AfterGC") \ "Generation level at which to start +VerifyBefore/AfterGC") \
range(0, 1) \
\ \
product(uintx, MaxTenuringThreshold, 15, \ product(uintx, MaxTenuringThreshold, 15, \
"Maximum value for tenuring threshold") \ "Maximum value for tenuring threshold") \
@ -3484,7 +3441,6 @@ public:
"before changing safepoint polling page to RO ") \ "before changing safepoint polling page to RO ") \
\ \
product(intx, SafepointSpinBeforeYield, 2000, "(Unstable)") \ product(intx, SafepointSpinBeforeYield, 2000, "(Unstable)") \
range(0, max_intx) \
\ \
product(bool, PSChunkLargeArrays, true, \ product(bool, PSChunkLargeArrays, true, \
"Process large arrays in chunks") \ "Process large arrays in chunks") \

View File

@ -1,110 +0,0 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test TestG1ConcMarkStepDurationMillis
* @key gc
* @requires vm.gc=="null" | vm.gc=="G1"
* @summary Tests argument processing for double type flag, G1ConcMarkStepDurationMillis
* @library /testlibrary
* @modules java.base/sun.misc
* java.management
*/
import jdk.test.lib.*;
import java.util.*;
import java.util.regex.*;
public class TestG1ConcMarkStepDurationMillis {
static final int PASS = 0;
static final int FAIL_IMPROPER_VALUE = 1;
static final int FAIL_OUT_RANGE = 2;
static final String DOUBLE_1 = "1.0";
static final String DOUBLE_MAX = "1.79e+308";
static final String DOUBLE_NEG_EXP = "1.0e-30";
static final String NEG_DOUBLE_1 = "-1.0";
static final String DOUBLE_INF = "1.79e+309";
static final String NEG_DOUBLE_INF = "-1.79e+309";
static final String DOUBLE_NAN = "abe+309";
static final String WRONG_DOUBLE_1 = "1.79e+308e";
static final String WRONG_DOUBLE_2 = "1.79ee+308";
public static void main(String args[]) throws Exception {
// Pass cases
runG1ConcMarkStepDurationMillisTest(DOUBLE_1, PASS);
runG1ConcMarkStepDurationMillisTest(DOUBLE_MAX, PASS);
// Fail cases: out of range
runG1ConcMarkStepDurationMillisTest(DOUBLE_NEG_EXP, FAIL_OUT_RANGE);
runG1ConcMarkStepDurationMillisTest(NEG_DOUBLE_1, FAIL_OUT_RANGE);
// Fail cases: not double
runG1ConcMarkStepDurationMillisTest(DOUBLE_INF, FAIL_IMPROPER_VALUE);
runG1ConcMarkStepDurationMillisTest(NEG_DOUBLE_INF, FAIL_IMPROPER_VALUE);
runG1ConcMarkStepDurationMillisTest(DOUBLE_NAN, FAIL_IMPROPER_VALUE);
runG1ConcMarkStepDurationMillisTest(WRONG_DOUBLE_1, FAIL_IMPROPER_VALUE);
runG1ConcMarkStepDurationMillisTest(WRONG_DOUBLE_2, FAIL_IMPROPER_VALUE);
}
private static void runG1ConcMarkStepDurationMillisTest(String expectedValue, int expectedResult) throws Exception {
List<String> vmOpts = new ArrayList<>();
Collections.addAll(vmOpts, "-XX:+UseG1GC", "-XX:G1ConcMarkStepDurationMillis="+expectedValue, "-XX:+PrintFlagsFinal", "-version");
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(vmOpts.toArray(new String[vmOpts.size()]));
OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.shouldHaveExitValue(expectedResult == PASS ? 0 : 1);
String stdout = output.getStdout();
if (expectedResult == PASS) {
checkG1ConcMarkStepDurationMillisConsistency(stdout, expectedValue);
} else if (expectedResult == FAIL_IMPROPER_VALUE) {
output.shouldContain("Improperly specified VM option");
} else if (expectedResult == FAIL_OUT_RANGE) {
output.shouldContain("outside the allowed range");
}
}
private static void checkG1ConcMarkStepDurationMillisConsistency(String output, String expectedValue) {
double actualValue = getDoubleValue("G1ConcMarkStepDurationMillis", output);
if (Double.parseDouble(expectedValue) != actualValue) {
throw new RuntimeException(
"Actual G1ConcMarkStepDurationMillis(" + Double.toString(actualValue)
+ ") is not equal to expected value(" + expectedValue + ")");
}
}
public static double getDoubleValue(String flag, String where) {
Matcher m = Pattern.compile(flag + "\\s+:?=\\s+\\d+").matcher(where);
if (!m.find()) {
throw new RuntimeException("Could not find value for flag " + flag + " in output string");
}
String match = m.group();
return Double.parseDouble(match.substring(match.lastIndexOf(" ") + 1, match.length()));
}
}

View File

@ -25,60 +25,42 @@
* @test TestG1HeapRegionSize * @test TestG1HeapRegionSize
* @key gc * @key gc
* @bug 8021879 * @bug 8021879
* @requires vm.gc=="null" | vm.gc=="G1"
* @summary Verify that the flag G1HeapRegionSize is updated properly * @summary Verify that the flag G1HeapRegionSize is updated properly
* @modules java.management/sun.management * @modules java.management/sun.management
* @library /testlibrary * @run main/othervm -Xmx64m TestG1HeapRegionSize 1048576
* @run main TestG1HeapRegionSize * @run main/othervm -XX:G1HeapRegionSize=2m -Xmx64m TestG1HeapRegionSize 2097152
* @run main/othervm -XX:G1HeapRegionSize=3m -Xmx64m TestG1HeapRegionSize 2097152
* @run main/othervm -XX:G1HeapRegionSize=64m -Xmx256m TestG1HeapRegionSize 33554432
*/ */
import java.util.regex.Matcher; import com.sun.management.HotSpotDiagnosticMXBean;
import java.util.regex.Pattern; import com.sun.management.VMOption;
import java.lang.management.ManagementFactory;
import java.util.ArrayList;
import java.util.Arrays;
import jdk.test.lib.*;
public class TestG1HeapRegionSize { public class TestG1HeapRegionSize {
private static void checkG1HeapRegionSize(String[] flags, int expectedValue, int exitValue) throws Exception { public static void main(String[] args) {
ArrayList<String> flagList = new ArrayList<String>(); HotSpotDiagnosticMXBean diagnostic =
flagList.addAll(Arrays.asList(flags)); ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class);
flagList.add("-XX:+UseG1GC");
flagList.add("-XX:+PrintFlagsFinal");
flagList.add("-version");
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(flagList.toArray(new String[0])); String expectedValue = getExpectedValue(args);
OutputAnalyzer output = new OutputAnalyzer(pb.start()); VMOption option = diagnostic.getVMOption("UseG1GC");
output.shouldHaveExitValue(exitValue); if (option.getValue().equals("false")) {
System.out.println("Skipping this test. It is only a G1 test.");
return;
}
if (exitValue == 0) { option = diagnostic.getVMOption("G1HeapRegionSize");
String stdout = output.getStdout(); if (!expectedValue.equals(option.getValue())) {
//System.out.println(stdout); throw new RuntimeException("Wrong value for G1HeapRegionSize. Expected " + expectedValue + " but got " + option.getValue());
int flagValue = getFlagValue("G1HeapRegionSize", stdout);
if (flagValue != expectedValue) {
throw new RuntimeException("Wrong value for G1HeapRegionSize. Expected " + expectedValue + " but got " + flagValue);
}
} }
} }
private static int getFlagValue(String flag, String where) { private static String getExpectedValue(String[] args) {
Matcher m = Pattern.compile(flag + "\\s+:?=\\s+\\d+").matcher(where); if (args.length != 1) {
if (!m.find()) { throw new RuntimeException("Wrong number of arguments. Expected 1 but got " + args.length);
throw new RuntimeException("Could not find value for flag " + flag + " in output string");
} }
String match = m.group(); return args[0];
return Integer.parseInt(match.substring(match.lastIndexOf(" ") + 1, match.length()));
} }
public static void main(String args[]) throws Exception {
final int M = 1024 * 1024;
checkG1HeapRegionSize(new String[] { "-Xmx64m" /* default is 1m */ }, 1*M, 0);
checkG1HeapRegionSize(new String[] { "-Xmx64m", "-XX:G1HeapRegionSize=2m" }, 2*M, 0);
checkG1HeapRegionSize(new String[] { "-Xmx64m", "-XX:G1HeapRegionSize=3m" }, 2*M, 0);
checkG1HeapRegionSize(new String[] { "-Xmx256m", "-XX:G1HeapRegionSize=32m" }, 32*M, 0);
checkG1HeapRegionSize(new String[] { "-Xmx256m", "-XX:G1HeapRegionSize=64m" }, 32*M, 1);
}
} }

View File

@ -72,7 +72,7 @@ public class TestHeapFreeRatio {
output.shouldHaveExitValue(1); output.shouldHaveExitValue(1);
break; break;
case COMBINATION_INVALID: case COMBINATION_INVALID:
output.shouldContain("must be less than or equal to MaxHeapFreeRatio"); output.shouldContain("must be greater than or equal to MinHeapFreeRatio");
output.shouldContain("Error"); output.shouldContain("Error");
output.shouldHaveExitValue(1); output.shouldHaveExitValue(1);
break; break;

View File

@ -25,7 +25,6 @@
* @test TestInitialTenuringThreshold * @test TestInitialTenuringThreshold
* @key gc * @key gc
* @bug 8014765 * @bug 8014765
* @requires vm.gc=="Parallel"
* @summary Tests argument processing for initial tenuring threshold * @summary Tests argument processing for initial tenuring threshold
* @library /testlibrary * @library /testlibrary
* @modules java.base/sun.misc * @modules java.base/sun.misc
@ -40,7 +39,6 @@ public class TestInitialTenuringThreshold {
public static void runWithThresholds(int initial, int max, boolean shouldfail) throws Exception { public static void runWithThresholds(int initial, int max, boolean shouldfail) throws Exception {
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
"-XX:+UseParallelGC",
"-XX:InitialTenuringThreshold=" + String.valueOf(initial), "-XX:InitialTenuringThreshold=" + String.valueOf(initial),
"-XX:MaxTenuringThreshold=" + String.valueOf(max), "-XX:MaxTenuringThreshold=" + String.valueOf(max),
"-version" "-version"

View File

@ -25,7 +25,6 @@
* @test TestObjectTenuringFlags * @test TestObjectTenuringFlags
* @key gc * @key gc
* @bug 6521376 * @bug 6521376
* @requires vm.gc=="Parallel"
* @summary Tests argument processing for NeverTenure, AlwaysTenure, * @summary Tests argument processing for NeverTenure, AlwaysTenure,
* and MaxTenuringThreshold * and MaxTenuringThreshold
* @library /testlibrary * @library /testlibrary
@ -158,7 +157,7 @@ public class TestObjectTenuringFlags {
if (tenuringFlags.length > 0) { if (tenuringFlags.length > 0) {
Collections.addAll(vmOpts, tenuringFlags); Collections.addAll(vmOpts, tenuringFlags);
} }
Collections.addAll(vmOpts, "-XX:+UseParallelGC", "-XX:+PrintFlagsFinal", "-version"); Collections.addAll(vmOpts, "-XX:+PrintFlagsFinal", "-version");
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(vmOpts.toArray(new String[vmOpts.size()])); ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(vmOpts.toArray(new String[vmOpts.size()]));
OutputAnalyzer output = new OutputAnalyzer(pb.start()); OutputAnalyzer output = new OutputAnalyzer(pb.start());