# HG changeset patch # User gziemski # Date 1444934061 18000 # Node ID e0a340f4ab6e1c71d015e0bcdaa022c626e4928b # Parent 08f642d9214f81546c903eff306bc23c50fbeffa 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing. Summary: JEP 245: implement ranges and constraints for runtime flags. Reviewed-by: coleenp, ddmitriev, jiangli, goetz Contributed-by: goetz.lindenmaier@sap.com, gerard.ziemski@oracle.com diff -r 08f642d9214f -r e0a340f4ab6e hotspot/src/cpu/aarch64/vm/globals_aarch64.hpp --- a/hotspot/src/cpu/aarch64/vm/globals_aarch64.hpp Thu Oct 15 17:35:42 2015 +0200 +++ b/hotspot/src/cpu/aarch64/vm/globals_aarch64.hpp Thu Oct 15 13:34:21 2015 -0500 @@ -55,10 +55,17 @@ define_pd_global(intx, OptoLoopAlignment, 16); define_pd_global(intx, InlineFrequencyCount, 100); -define_pd_global(intx, StackYellowPages, 2); -define_pd_global(intx, StackRedPages, 1); +#define DEFAULT_STACK_YELLOW_PAGES (2) +#define DEFAULT_STACK_RED_PAGES (1) +#define DEFAULT_STACK_SHADOW_PAGES (4 DEBUG_ONLY(+5)) -define_pd_global(intx, StackShadowPages, 4 DEBUG_ONLY(+5)); +#define MIN_STACK_YELLOW_PAGES DEFAULT_STACK_YELLOW_PAGES +#define MIN_STACK_RED_PAGES DEFAULT_STACK_RED_PAGES +#define MIN_STACK_SHADOW_PAGES DEFAULT_STACK_SHADOW_PAGES + +define_pd_global(intx, StackYellowPages, DEFAULT_STACK_YELLOW_PAGES); +define_pd_global(intx, StackRedPages, DEFAULT_STACK_RED_PAGES); +define_pd_global(intx, StackShadowPages, DEFAULT_STACK_SHADOW_PAGES); define_pd_global(bool, RewriteBytecodes, true); define_pd_global(bool, RewriteFrequentPairs, true); diff -r 08f642d9214f -r e0a340f4ab6e hotspot/src/cpu/ppc/vm/globals_ppc.hpp --- a/hotspot/src/cpu/ppc/vm/globals_ppc.hpp Thu Oct 15 17:35:42 2015 +0200 +++ b/hotspot/src/cpu/ppc/vm/globals_ppc.hpp Thu Oct 15 13:34:21 2015 -0500 @@ -41,6 +41,18 @@ define_pd_global(bool, TrapBasedNullChecks, true); define_pd_global(bool, UncommonNullCast, true); // Uncommon-trap NULLs passed to check cast. +#define DEFAULT_STACK_YELLOW_PAGES (6) +#define DEFAULT_STACK_RED_PAGES (1) +#define DEFAULT_STACK_SHADOW_PAGES (6 DEBUG_ONLY(+2)) + +#define MIN_STACK_YELLOW_PAGES (1) +#define MIN_STACK_RED_PAGES DEFAULT_STACK_RED_PAGES +#define MIN_STACK_SHADOW_PAGES (1) + +define_pd_global(intx, StackYellowPages, DEFAULT_STACK_YELLOW_PAGES); +define_pd_global(intx, StackRedPages, DEFAULT_STACK_RED_PAGES); +define_pd_global(intx, StackShadowPages, DEFAULT_STACK_SHADOW_PAGES); + // Use large code-entry alignment. define_pd_global(intx, CodeEntryAlignment, 128); define_pd_global(intx, OptoLoopAlignment, 16); diff -r 08f642d9214f -r e0a340f4ab6e hotspot/src/cpu/sparc/vm/globals_sparc.hpp --- a/hotspot/src/cpu/sparc/vm/globals_sparc.hpp Thu Oct 15 17:35:42 2015 +0200 +++ b/hotspot/src/cpu/sparc/vm/globals_sparc.hpp Thu Oct 15 13:34:21 2015 -0500 @@ -52,19 +52,27 @@ define_pd_global(intx, InlineFrequencyCount, 50); // we can use more inlining on the SPARC define_pd_global(intx, InlineSmallCode, 1500); +#define DEFAULT_STACK_YELLOW_PAGES (2) +#define DEFAULT_STACK_RED_PAGES (1) + #ifdef _LP64 // Stack slots are 2X larger in LP64 than in the 32 bit VM. define_pd_global(intx, ThreadStackSize, 1024); define_pd_global(intx, VMThreadStackSize, 1024); -define_pd_global(intx, StackShadowPages, 10 DEBUG_ONLY(+1)); +#define DEFAULT_STACK_SHADOW_PAGES (10 DEBUG_ONLY(+1)) #else define_pd_global(intx, ThreadStackSize, 512); define_pd_global(intx, VMThreadStackSize, 512); -define_pd_global(intx, StackShadowPages, 3 DEBUG_ONLY(+1)); -#endif +#define DEFAULT_STACK_SHADOW_PAGES (3 DEBUG_ONLY(+1)) +#endif // _LP64 -define_pd_global(intx, StackYellowPages, 2); -define_pd_global(intx, StackRedPages, 1); +#define MIN_STACK_YELLOW_PAGES DEFAULT_STACK_YELLOW_PAGES +#define MIN_STACK_RED_PAGES DEFAULT_STACK_RED_PAGES +#define MIN_STACK_SHADOW_PAGES DEFAULT_STACK_SHADOW_PAGES + +define_pd_global(intx, StackYellowPages, DEFAULT_STACK_YELLOW_PAGES); +define_pd_global(intx, StackRedPages, DEFAULT_STACK_RED_PAGES); +define_pd_global(intx, StackShadowPages, DEFAULT_STACK_SHADOW_PAGES); define_pd_global(bool, RewriteBytecodes, true); define_pd_global(bool, RewriteFrequentPairs, true); diff -r 08f642d9214f -r e0a340f4ab6e hotspot/src/cpu/x86/vm/globals_x86.hpp --- a/hotspot/src/cpu/x86/vm/globals_x86.hpp Thu Oct 15 17:35:42 2015 +0200 +++ b/hotspot/src/cpu/x86/vm/globals_x86.hpp Thu Oct 15 13:34:21 2015 -0500 @@ -55,16 +55,28 @@ define_pd_global(intx, InlineFrequencyCount, 100); define_pd_global(intx, InlineSmallCode, 1000); -define_pd_global(intx, StackYellowPages, NOT_WINDOWS(2) WINDOWS_ONLY(3)); -define_pd_global(intx, StackRedPages, 1); +#define DEFAULT_STACK_YELLOW_PAGES (NOT_WINDOWS(2) WINDOWS_ONLY(3)) +#define DEFAULT_STACK_RED_PAGES (1) + +#define MIN_STACK_YELLOW_PAGES DEFAULT_STACK_YELLOW_PAGES +#define MIN_STACK_RED_PAGES DEFAULT_STACK_RED_PAGES + #ifdef AMD64 // Very large C++ stack frames using solaris-amd64 optimized builds // due to lack of optimization caused by C++ compiler bugs -define_pd_global(intx, StackShadowPages, NOT_WIN64(20) WIN64_ONLY(6) DEBUG_ONLY(+2)); +#define DEFAULT_STACK_SHADOW_PAGES (NOT_WIN64(20) WIN64_ONLY(6) DEBUG_ONLY(+2)) +// For those clients that do not use write socket, we allow +// the min range value to be below that of the default +#define MIN_STACK_SHADOW_PAGES (NOT_WIN64(10) WIN64_ONLY(6) DEBUG_ONLY(+2)) #else -define_pd_global(intx, StackShadowPages, 4 DEBUG_ONLY(+5)); +#define DEFAULT_STACK_SHADOW_PAGES (4 DEBUG_ONLY(+5)) +#define MIN_STACK_SHADOW_PAGES DEFAULT_STACK_SHADOW_PAGES #endif // AMD64 +define_pd_global(intx, StackYellowPages, DEFAULT_STACK_YELLOW_PAGES); +define_pd_global(intx, StackRedPages, DEFAULT_STACK_RED_PAGES); +define_pd_global(intx, StackShadowPages, DEFAULT_STACK_SHADOW_PAGES); + define_pd_global(bool, RewriteBytecodes, true); define_pd_global(bool, RewriteFrequentPairs, true); @@ -134,6 +146,7 @@ \ product(uintx, RTMRetryCount, 5, \ "Number of RTM retries on lock abort or busy") \ + range(0, max_uintx) \ \ experimental(intx, RTMSpinLoopCount, 100, \ "Spin count for lock to become free before RTM retry") \ diff -r 08f642d9214f -r e0a340f4ab6e hotspot/src/cpu/zero/vm/globals_zero.hpp --- a/hotspot/src/cpu/zero/vm/globals_zero.hpp Thu Oct 15 17:35:42 2015 +0200 +++ b/hotspot/src/cpu/zero/vm/globals_zero.hpp Thu Oct 15 13:34:21 2015 -0500 @@ -45,9 +45,17 @@ define_pd_global(intx, InlineFrequencyCount, 100); define_pd_global(intx, InlineSmallCode, 1000 ); -define_pd_global(intx, StackYellowPages, 2); -define_pd_global(intx, StackRedPages, 1); -define_pd_global(intx, StackShadowPages, 5 LP64_ONLY(+1) DEBUG_ONLY(+3)); +#define DEFAULT_STACK_YELLOW_PAGES (2) +#define DEFAULT_STACK_RED_PAGES (1) +#define DEFAULT_STACK_SHADOW_PAGES (5 LP64_ONLY(+1) DEBUG_ONLY(+3)) + +#define MIN_STACK_YELLOW_PAGES DEFAULT_STACK_YELLOW_PAGES +#define MIN_STACK_RED_PAGES DEFAULT_STACK_RED_PAGES +#define MIN_STACK_SHADOW_PAGES DEFAULT_STACK_SHADOW_PAGES + +define_pd_global(intx, StackYellowPages, DEFAULT_STACK_YELLOW_PAGES); +define_pd_global(intx, StackRedPages, DEFAULT_STACK_RED_PAGES); +define_pd_global(intx, StackShadowPages, DEFAULT_STACK_SHADOW_PAGES); define_pd_global(bool, RewriteBytecodes, true); define_pd_global(bool, RewriteFrequentPairs, true); diff -r 08f642d9214f -r e0a340f4ab6e hotspot/src/os/aix/vm/globals_aix.hpp --- a/hotspot/src/os/aix/vm/globals_aix.hpp Thu Oct 15 17:35:42 2015 +0200 +++ b/hotspot/src/os/aix/vm/globals_aix.hpp Thu Oct 15 13:34:21 2015 -0500 @@ -39,15 +39,16 @@ /* a scarce resource and there may be situations where we do not want the VM */ \ /* to run with 16M pages. (Will fall back to 64K pages). */ \ product_pd(bool, Use16MPages, \ - "Use 16M pages if available.") \ + "Use 16M pages if available.") \ \ /* use optimized addresses for the polling page, */ \ /* e.g. map it to a special 32-bit address. */ \ product_pd(bool, OptimizePollingPageLocation, \ - "Optimize the location of the polling page used for Safepoints") \ + "Optimize the location of the polling page used for Safepoints") \ \ product_pd(intx, AttachListenerTimeout, \ - "Timeout in ms the attach listener waits for a request") \ + "Timeout in ms the attach listener waits for a request") \ + range(0, 2147483) \ \ // Per default, do not allow 16M pages. 16M pages have to be switched on specifically. diff -r 08f642d9214f -r e0a340f4ab6e hotspot/src/os_cpu/aix_ppc/vm/globals_aix_ppc.hpp --- a/hotspot/src/os_cpu/aix_ppc/vm/globals_aix_ppc.hpp Thu Oct 15 17:35:42 2015 +0200 +++ b/hotspot/src/os_cpu/aix_ppc/vm/globals_aix_ppc.hpp Thu Oct 15 13:34:21 2015 -0500 @@ -42,10 +42,6 @@ // Allow extra space in DEBUG builds for asserts. define_pd_global(size_t, JVMInvokeMethodSlack, 8192); -define_pd_global(intx, StackYellowPages, 6); -define_pd_global(intx, StackRedPages, 1); -define_pd_global(intx, StackShadowPages, 6 DEBUG_ONLY(+2)); - // Only used on 64 bit platforms define_pd_global(size_t, HeapBaseMinAddress, 2*G); diff -r 08f642d9214f -r e0a340f4ab6e hotspot/src/share/vm/runtime/arguments.cpp --- a/hotspot/src/share/vm/runtime/arguments.cpp Thu Oct 15 17:35:42 2015 +0200 +++ b/hotspot/src/share/vm/runtime/arguments.cpp Thu Oct 15 13:34:21 2015 -0500 @@ -3329,19 +3329,6 @@ return JNI_EINVAL; } #endif - } else if (match_option(option, "-XX:MaxDirectMemorySize=", &tail)) { - julong max_direct_memory_size = 0; - ArgsRange errcode = parse_memory_size(tail, &max_direct_memory_size, 0); - if (errcode != arg_in_range) { - jio_fprintf(defaultStream::error_stream(), - "Invalid maximum direct memory size: %s\n", - option->optionString); - describe_range_error(errcode); - return JNI_EINVAL; - } - if (FLAG_SET_CMDLINE(size_t, MaxDirectMemorySize, max_direct_memory_size) != Flag::SUCCESS) { - return JNI_EINVAL; - } #if !INCLUDE_MANAGEMENT } else if (match_option(option, "-XX:+ManagementServer")) { jio_fprintf(defaultStream::error_stream(), diff -r 08f642d9214f -r e0a340f4ab6e hotspot/src/share/vm/runtime/commandLineFlagConstraintList.cpp --- a/hotspot/src/share/vm/runtime/commandLineFlagConstraintList.cpp Thu Oct 15 17:35:42 2015 +0200 +++ b/hotspot/src/share/vm/runtime/commandLineFlagConstraintList.cpp Thu Oct 15 13:34:21 2015 -0500 @@ -220,7 +220,7 @@ #define EMIT_CONSTRAINT_CHECK(func, type) , func, CommandLineFlagConstraint::type // the "name" argument must be a string literal -#define INITIAL_CONSTRAINTS_SIZE 40 +#define INITIAL_CONSTRAINTS_SIZE 45 GrowableArray* CommandLineFlagConstraintList::_constraints = NULL; CommandLineFlagConstraint::ConstraintType CommandLineFlagConstraintList::_validating_type = CommandLineFlagConstraint::AtParse; diff -r 08f642d9214f -r e0a340f4ab6e hotspot/src/share/vm/runtime/commandLineFlagConstraintList.hpp --- a/hotspot/src/share/vm/runtime/commandLineFlagConstraintList.hpp Thu Oct 15 17:35:42 2015 +0200 +++ b/hotspot/src/share/vm/runtime/commandLineFlagConstraintList.hpp Thu Oct 15 13:34:21 2015 -0500 @@ -54,9 +54,9 @@ enum ConstraintType { // Will be validated during argument processing (Arguments::parse_argument). AtParse = 0, - // Will be validated by CommandLineFlagConstraintList::check_constraints(AfterErgo). + // Will be validated inside Threads::create_vm(), right after Arguments::apply_ergo(). AfterErgo = 1, - // Will be validated by CommandLineFlagConstraintList::check_constraints(AfterMemoryInit). + // Will be validated inside universe_init(), right after Metaspace::global_initialize(). AfterMemoryInit = 2 }; diff -r 08f642d9214f -r e0a340f4ab6e hotspot/src/share/vm/runtime/commandLineFlagConstraintsRuntime.cpp --- a/hotspot/src/share/vm/runtime/commandLineFlagConstraintsRuntime.cpp Thu Oct 15 17:35:42 2015 +0200 +++ b/hotspot/src/share/vm/runtime/commandLineFlagConstraintsRuntime.cpp Thu Oct 15 13:34:21 2015 -0500 @@ -27,6 +27,7 @@ #include "runtime/commandLineFlagConstraintsRuntime.hpp" #include "runtime/commandLineFlagRangeList.hpp" #include "runtime/globals.hpp" +#include "runtime/task.hpp" #include "utilities/defaultStream.hpp" Flag::Error ObjectAlignmentInBytesConstraintFunc(intx value, bool verbose) { @@ -41,7 +42,7 @@ if (value >= (intx)os::vm_page_size()) { CommandLineError::print(verbose, "ObjectAlignmentInBytes (" INTX_FORMAT ") must be " - "less than page size " INTX_FORMAT "\n", + "less than page size (" INTX_FORMAT ")\n", value, (intx)os::vm_page_size()); return Flag::VIOLATES_CONSTRAINT; } @@ -51,7 +52,7 @@ // Need to enforce the padding not to break the existing field alignments. // It is sufficient to check against the largest type size. Flag::Error ContendedPaddingWidthConstraintFunc(intx value, bool verbose) { - if ((value != 0) && ((value % BytesPerLong) != 0)) { + if ((value % BytesPerLong) != 0) { CommandLineError::print(verbose, "ContendedPaddingWidth (" INTX_FORMAT ") must be " "a multiple of %d\n", @@ -61,3 +62,71 @@ return Flag::SUCCESS; } } + +Flag::Error BiasedLockingBulkRebiasThresholdFunc(intx value, bool verbose) { + if (value > BiasedLockingBulkRevokeThreshold) { + CommandLineError::print(verbose, + "BiasedLockingBulkRebiasThreshold (" INTX_FORMAT ") must be " + "less than or equal to BiasedLockingBulkRevokeThreshold (" INTX_FORMAT ")\n", + value, BiasedLockingBulkRevokeThreshold); + return Flag::VIOLATES_CONSTRAINT; + } else { + return Flag::SUCCESS; + } +} + +Flag::Error BiasedLockingStartupDelayFunc(intx value, bool verbose) { + if ((value % PeriodicTask::interval_gran) != 0) { + CommandLineError::print(verbose, + "BiasedLockingStartupDelay (" INTX_FORMAT ") must be " + "evenly divisible by PeriodicTask::interval_gran (" INTX_FORMAT ")\n", + value, PeriodicTask::interval_gran); + return Flag::VIOLATES_CONSTRAINT; + } else { + return Flag::SUCCESS; + } +} + +Flag::Error BiasedLockingBulkRevokeThresholdFunc(intx value, bool verbose) { + if (value < BiasedLockingBulkRebiasThreshold) { + CommandLineError::print(verbose, + "BiasedLockingBulkRevokeThreshold (" INTX_FORMAT ") must be " + "greater than or equal to BiasedLockingBulkRebiasThreshold (" INTX_FORMAT ")\n", + value, BiasedLockingBulkRebiasThreshold); + return Flag::VIOLATES_CONSTRAINT; + } else if ((double)value/(double)BiasedLockingDecayTime > 0.1) { + CommandLineError::print(verbose, + "The ratio of BiasedLockingBulkRevokeThreshold (" INTX_FORMAT ")" + " to BiasedLockingDecayTime (" INTX_FORMAT ") must be " + "less than or equal to 0.1\n", + value, BiasedLockingBulkRebiasThreshold); + return Flag::VIOLATES_CONSTRAINT; + } else { + return Flag::SUCCESS; + } +} + +Flag::Error BiasedLockingDecayTimeFunc(intx value, bool verbose) { + if (BiasedLockingBulkRebiasThreshold/(double)value > 0.1) { + CommandLineError::print(verbose, + "The ratio of BiasedLockingBulkRebiasThreshold (" INTX_FORMAT ")" + " to BiasedLockingDecayTime (" INTX_FORMAT ") must be " + "less than or equal to 0.1\n", + BiasedLockingBulkRebiasThreshold, value); + return Flag::VIOLATES_CONSTRAINT; + } else { + return Flag::SUCCESS; + } +} + +Flag::Error PerfDataSamplingIntervalFunc(intx value, bool verbose) { + if ((value % PeriodicTask::interval_gran != 0)) { + CommandLineError::print(verbose, + "PerfDataSamplingInterval (" INTX_FORMAT ") must be " + "evenly divisible by PeriodicTask::interval_gran (" INTX_FORMAT ")\n", + value, PeriodicTask::interval_gran); + return Flag::VIOLATES_CONSTRAINT; + } else { + return Flag::SUCCESS; + } +} diff -r 08f642d9214f -r e0a340f4ab6e hotspot/src/share/vm/runtime/commandLineFlagConstraintsRuntime.hpp --- a/hotspot/src/share/vm/runtime/commandLineFlagConstraintsRuntime.hpp Thu Oct 15 17:35:42 2015 +0200 +++ b/hotspot/src/share/vm/runtime/commandLineFlagConstraintsRuntime.hpp Thu Oct 15 13:34:21 2015 -0500 @@ -38,4 +38,11 @@ Flag::Error ContendedPaddingWidthConstraintFunc(intx value, bool verbose); +Flag::Error BiasedLockingBulkRebiasThresholdFunc(intx value, bool verbose); +Flag::Error BiasedLockingStartupDelayFunc(intx value, bool verbose); +Flag::Error BiasedLockingBulkRevokeThresholdFunc(intx value, bool verbose); +Flag::Error BiasedLockingDecayTimeFunc(intx value, bool verbose); + +Flag::Error PerfDataSamplingIntervalFunc(intx value, bool verbose); + #endif /* SHARE_VM_RUNTIME_COMMANDLINEFLAGCONSTRAINTSRUNTIME_HPP */ diff -r 08f642d9214f -r e0a340f4ab6e hotspot/src/share/vm/runtime/commandLineFlagRangeList.cpp --- a/hotspot/src/share/vm/runtime/commandLineFlagRangeList.cpp Thu Oct 15 17:35:42 2015 +0200 +++ b/hotspot/src/share/vm/runtime/commandLineFlagRangeList.cpp Thu Oct 15 13:34:21 2015 -0500 @@ -29,6 +29,7 @@ #include "runtime/arguments.hpp" #include "runtime/commandLineFlagRangeList.hpp" #include "runtime/os.hpp" +#include "runtime/task.hpp" #include "utilities/defaultStream.hpp" #include "utilities/macros.hpp" @@ -278,7 +279,7 @@ // Generate func argument to pass into emit_range_xxx functions #define EMIT_RANGE_CHECK(a, b) , a, b -#define INITIAL_RANGES_SIZE 165 +#define INITIAL_RANGES_SIZE 204 GrowableArray* CommandLineFlagRangeList::_ranges = NULL; // Check the ranges of all flags that have them diff -r 08f642d9214f -r e0a340f4ab6e hotspot/src/share/vm/runtime/globals.hpp --- a/hotspot/src/share/vm/runtime/globals.hpp Thu Oct 15 17:35:42 2015 +0200 +++ b/hotspot/src/share/vm/runtime/globals.hpp Thu Oct 15 13:34:21 2015 -0500 @@ -891,9 +891,11 @@ /* typically, at most a few retries are needed */ \ product(intx, SuspendRetryCount, 50, \ "Maximum retry count for an external suspend request") \ + range(0, max_intx) \ \ product(intx, SuspendRetryDelay, 5, \ "Milliseconds to delay per retry (* current_retry_count)") \ + range(0, max_intx) \ \ product(bool, AssertOnSuspendWaitFailure, false, \ "Assert/Guarantee on external suspend wait failure") \ @@ -1332,6 +1334,7 @@ "Maximum allowable local JNI handle capacity to " \ "EnsureLocalCapacity() and PushLocalFrame(), " \ "where <= 0 is unlimited, default: 65536") \ + range(min_intx, max_intx) \ \ product(bool, EagerXrunInit, false, \ "Eagerly initialize -Xrun libraries; allows startup profiling, " \ @@ -1367,7 +1370,7 @@ product(intx, ContendedPaddingWidth, 128, \ "How many bytes to pad the fields/classes marked @Contended with")\ range(0, 8192) \ - constraint(ContendedPaddingWidthConstraintFunc,AtParse) \ + constraint(ContendedPaddingWidthConstraintFunc,AfterErgo) \ \ product(bool, EnableContended, true, \ "Enable @Contended annotation support") \ @@ -1380,6 +1383,8 @@ \ product(intx, BiasedLockingStartupDelay, 4000, \ "Number of milliseconds to wait before enabling biased locking") \ + range(0, (intx)(max_jint-(max_jint%PeriodicTask::interval_gran))) \ + constraint(BiasedLockingStartupDelayFunc,AfterErgo) \ \ diagnostic(bool, PrintBiasedLockingStatistics, false, \ "Print statistics of biased locking in JVM") \ @@ -1387,14 +1392,20 @@ product(intx, BiasedLockingBulkRebiasThreshold, 20, \ "Threshold of number of revocations per type to try to " \ "rebias all objects in the heap of that type") \ + range(0, max_intx) \ + constraint(BiasedLockingBulkRebiasThresholdFunc,AfterErgo) \ \ product(intx, BiasedLockingBulkRevokeThreshold, 40, \ "Threshold of number of revocations per type to permanently " \ "revoke biases of all objects in the heap of that type") \ + range(0, max_intx) \ + constraint(BiasedLockingBulkRevokeThresholdFunc,AfterErgo) \ \ product(intx, BiasedLockingDecayTime, 25000, \ "Decay time (in milliseconds) to re-enable bulk rebiasing of a " \ "type after previous bulk rebias") \ + range(500, max_intx) \ + constraint(BiasedLockingDecayTimeFunc,AfterErgo) \ \ /* tracing */ \ \ @@ -1419,8 +1430,9 @@ product(bool, StressLdcRewrite, false, \ "Force ldc -> ldc_w rewrite during RedefineClasses") \ \ - product(intx, TraceRedefineClasses, 0, \ + product(uintx, TraceRedefineClasses, 0, \ "Trace level for JVMTI RedefineClasses") \ + range(0, 0xFFFFFFFF) \ \ /* change to false by default sometime after Mustang */ \ product(bool, VerifyMergedCPBytecodes, true, \ @@ -2169,6 +2181,7 @@ \ product_pd(uint64_t, MaxRAM, \ "Real memory size (in bytes) used to set maximum heap size") \ + range(0, 0XFFFFFFFFFFFFFFFF) \ \ product(size_t, ErgoHeapSizeLimit, 0, \ "Maximum ergonomically set heap size (in bytes); zero means use " \ @@ -2677,10 +2690,13 @@ product(intx, PrintSafepointStatisticsCount, 300, \ "Total number of safepoint statistics collected " \ "before printing them out") \ + range(1, max_intx) \ \ product(intx, PrintSafepointStatisticsTimeout, -1, \ "Print safepoint statistics only when safepoint takes " \ "more than PrintSafepointSatisticsTimeout in millis") \ + LP64_ONLY(range(-1, max_intx/MICROUNITS)) \ + NOT_LP64(range(-1, max_intx)) \ \ product(bool, TraceSafepointCleanupTime, false, \ "Print the break down of clean up tasks performed during " \ @@ -2729,6 +2745,7 @@ diagnostic(intx, MinPassesBeforeFlush, 10, \ "Minimum number of sweeper passes before an nmethod " \ "can be flushed") \ + range(0, max_intx) \ \ product(bool, UseCodeAging, true, \ "Insert counter to detect warm methods") \ @@ -3089,21 +3106,29 @@ product(intx, SelfDestructTimer, 0, \ "Will cause VM to terminate after a given time (in minutes) " \ "(0 means off)") \ + range(0, max_intx) \ \ product(intx, MaxJavaStackTraceDepth, 1024, \ "The maximum number of lines in the stack trace for Java " \ "exceptions (0 means all)") \ - \ + range(0, max_jint/2) \ + \ + /* notice: the max range value here is max_jint, not max_intx */ \ + /* because of overflow issue */ \ NOT_EMBEDDED(diagnostic(intx, GuaranteedSafepointInterval, 1000, \ "Guarantee a safepoint (at least) every so many milliseconds " \ "(0 means none)")) \ + NOT_EMBEDDED(range(0, max_jint)) \ \ EMBEDDED_ONLY(product(intx, GuaranteedSafepointInterval, 0, \ "Guarantee a safepoint (at least) every so many milliseconds " \ "(0 means none)")) \ + EMBEDDED_ONLY(range(0, max_jint)) \ \ product(intx, SafepointTimeoutDelay, 10000, \ "Delay in milliseconds for option SafepointTimeout") \ + LP64_ONLY(range(0, max_intx/MICROUNITS)) \ + NOT_LP64(range(0, max_intx)) \ \ product(intx, NmethodSweepActivity, 10, \ "Removes cold nmethods from code cache if > 0. Higher values " \ @@ -3187,6 +3212,7 @@ product(intx, ProfileIntervalsTicks, 100, \ "Number of ticks between printing of interval profile " \ "(+ProfileIntervals)") \ + range(0, max_intx) \ \ notproduct(intx, ScavengeALotInterval, 1, \ "Interval between which scavenge will occur with +ScavengeALot") \ @@ -3220,14 +3246,17 @@ diagnostic(intx, MallocVerifyInterval, 0, \ "If non-zero, verify C heap after every N calls to " \ "malloc/realloc/free") \ + range(0, max_intx) \ \ diagnostic(intx, MallocVerifyStart, 0, \ "If non-zero, start verifying C heap after Nth call to " \ "malloc/realloc/free") \ + range(0, max_intx) \ \ diagnostic(uintx, MallocMaxTestWords, 0, \ "If non-zero, maximum number of words that malloc/realloc can " \ "allocate (for testing only)") \ + range(0, max_uintx) \ \ product(intx, TypeProfileWidth, 2, \ "Number of receiver types to record in call/cast profile") \ @@ -3459,10 +3488,12 @@ product(intx, DeferThrSuspendLoopCount, 4000, \ "(Unstable) Number of times to iterate in safepoint loop " \ "before blocking VM threads ") \ + range(-1, max_jint-1) \ \ product(intx, DeferPollingPageLoopCount, -1, \ "(Unsafe,Unstable) Number of iterations in safepoint loop " \ "before changing safepoint polling page to RO ") \ + range(-1, max_jint-1) \ \ product(intx, SafepointSpinBeforeYield, 2000, "(Unstable)") \ range(0, max_intx) \ @@ -3477,23 +3508,25 @@ /* stack parameters */ \ product_pd(intx, StackYellowPages, \ "Number of yellow zone (recoverable overflows) pages") \ - range(1, max_intx) \ + range(MIN_STACK_YELLOW_PAGES, (DEFAULT_STACK_YELLOW_PAGES+5)) \ \ product_pd(intx, StackRedPages, \ "Number of red zone (unrecoverable overflows) pages") \ - range(1, max_intx) \ + range(MIN_STACK_RED_PAGES, (DEFAULT_STACK_RED_PAGES+2)) \ \ /* greater stack shadow pages can't generate instruction to bang stack */ \ product_pd(intx, StackShadowPages, \ "Number of shadow zone (for overflow checking) pages " \ "this should exceed the depth of the VM and native call stack") \ - range(1, 50) \ + range(MIN_STACK_SHADOW_PAGES, (DEFAULT_STACK_SHADOW_PAGES+30)) \ \ product_pd(intx, ThreadStackSize, \ "Thread Stack Size (in Kbytes)") \ + range(0, max_intx-os::vm_page_size()) \ \ product_pd(intx, VMThreadStackSize, \ "Non-Java Thread Stack Size (in Kbytes)") \ + range(0, max_intx/(1 * K)) \ \ product_pd(intx, CompilerThreadStackSize, \ "Compiler Thread Stack Size (in Kbytes)") \ @@ -3503,7 +3536,8 @@ \ /* code cache parameters */ \ /* ppc64/tiered compilation has large code-entry alignment. */ \ - develop(uintx, CodeCacheSegmentSize, 64 PPC64_ONLY(+64) NOT_PPC64(TIERED_ONLY(+64)),\ + develop(uintx, CodeCacheSegmentSize, \ + 64 PPC64_ONLY(+64) NOT_PPC64(TIERED_ONLY(+64)), \ "Code cache segment size (in bytes) - smallest unit of " \ "allocation") \ range(1, 1024) \ @@ -3670,6 +3704,7 @@ product(intx, VMThreadPriority, -1, \ "The native priority at which the VM thread should run " \ "(-1 means no change)") \ + range(-1, 127) \ \ product(bool, CompilerThreadHintNoPreempt, true, \ "(Solaris only) Give compiler threads an extra quanta") \ @@ -3679,33 +3714,43 @@ \ product(intx, JavaPriority1_To_OSPriority, -1, \ "Map Java priorities to OS priorities") \ + range(-1, 127) \ \ product(intx, JavaPriority2_To_OSPriority, -1, \ "Map Java priorities to OS priorities") \ + range(-1, 127) \ \ product(intx, JavaPriority3_To_OSPriority, -1, \ "Map Java priorities to OS priorities") \ + range(-1, 127) \ \ product(intx, JavaPriority4_To_OSPriority, -1, \ "Map Java priorities to OS priorities") \ + range(-1, 127) \ \ product(intx, JavaPriority5_To_OSPriority, -1, \ "Map Java priorities to OS priorities") \ + range(-1, 127) \ \ product(intx, JavaPriority6_To_OSPriority, -1, \ "Map Java priorities to OS priorities") \ + range(-1, 127) \ \ product(intx, JavaPriority7_To_OSPriority, -1, \ "Map Java priorities to OS priorities") \ + range(-1, 127) \ \ product(intx, JavaPriority8_To_OSPriority, -1, \ "Map Java priorities to OS priorities") \ + range(-1, 127) \ \ product(intx, JavaPriority9_To_OSPriority, -1, \ "Map Java priorities to OS priorities") \ + range(-1, 127) \ \ product(intx, JavaPriority10_To_OSPriority,-1, \ "Map Java priorities to OS priorities") \ + range(-1, 127) \ \ experimental(bool, UseCriticalJavaThreadPriority, false, \ "Java thread priority 10 maps to critical scheduling priority") \ @@ -3886,6 +3931,7 @@ \ product(size_t, MaxDirectMemorySize, 0, \ "Maximum total size of NIO direct-buffer allocations") \ + range(0, (size_t)SIZE_MAX) \ \ /* Flags used for temporary code during development */ \ \ @@ -3914,6 +3960,8 @@ \ product(intx, PerfDataSamplingInterval, 50, \ "Data sampling interval (in milliseconds)") \ + range(PeriodicTask::min_interval, max_jint) \ + constraint(PerfDataSamplingIntervalFunc, AfterErgo) \ \ develop(bool, PerfTraceDataCreation, false, \ "Trace creation of Performance Data Entries") \ @@ -3927,9 +3975,11 @@ product(intx, PerfDataMemorySize, 64*K, \ "Size of performance data memory region. Will be rounded " \ "up to a multiple of the native os page size.") \ + range(128, 32*64*K) \ \ product(intx, PerfMaxStringConstLength, 1024, \ "Maximum PerfStringConstant string length before truncation") \ + range(32, 32*K) \ \ product(bool, PerfAllowAtExitRegistration, false, \ "Allow registration of atexit() methods") \ @@ -3989,10 +4039,10 @@ "If PrintSharedArchiveAndExit is true, also print the shared " \ "dictionary") \ \ - product(size_t, SharedReadWriteSize, NOT_LP64(12*M) LP64_ONLY(16*M), \ + product(size_t, SharedReadWriteSize, NOT_LP64(12*M) LP64_ONLY(16*M), \ "Size of read-write space for metadata (in bytes)") \ \ - product(size_t, SharedReadOnlySize, NOT_LP64(12*M) LP64_ONLY(16*M), \ + product(size_t, SharedReadOnlySize, NOT_LP64(12*M) LP64_ONLY(16*M), \ "Size of read-only space for metadata (in bytes)") \ \ product(uintx, SharedMiscDataSize, NOT_LP64(2*M) LP64_ONLY(4*M), \ @@ -4007,6 +4057,7 @@ \ product(uintx, SharedSymbolTableBucketSize, 4, \ "Average number of symbols per bucket in shared table") \ + range(2, 246) \ \ diagnostic(bool, IgnoreUnverifiableClassesDuringDump, false, \ "Do not quit -Xshare:dump even if we encounter unverifiable " \ diff -r 08f642d9214f -r e0a340f4ab6e hotspot/src/share/vm/runtime/safepoint.cpp --- a/hotspot/src/share/vm/runtime/safepoint.cpp Thu Oct 15 17:35:42 2015 +0200 +++ b/hotspot/src/share/vm/runtime/safepoint.cpp Thu Oct 15 13:34:21 2015 -0500 @@ -338,7 +338,7 @@ tty->print_cr("# SafepointSynchronize: Finished after " INT64_FORMAT_W(6) " ms", ((current_time - safepoint_limit_time) / MICROUNITS + - SafepointTimeoutDelay)); + (jlong)SafepointTimeoutDelay)); } } #endif @@ -1050,10 +1050,6 @@ void SafepointSynchronize::deferred_initialize_stat() { if (init_done) return; - if (PrintSafepointStatisticsCount <= 0) { - fatal("Wrong PrintSafepointStatisticsCount"); - } - // If PrintSafepointStatisticsTimeout is specified, the statistics data will // be printed right away, in which case, _safepoint_stats will regress to // a single element array. Otherwise, it is a circular ring buffer with default @@ -1164,7 +1160,7 @@ // PrintSafepointStatisticsTimeout will be printed out right away. // By default, it is -1 meaning all samples will be put into the list. if ( PrintSafepointStatisticsTimeout > 0) { - if (spstat->_time_to_sync > PrintSafepointStatisticsTimeout * MICROUNITS) { + if (spstat->_time_to_sync > (jlong)PrintSafepointStatisticsTimeout * MICROUNITS) { print_statistics(); } } else { @@ -1230,7 +1226,7 @@ os::javaTimeNanos() - cleanup_end_time; if ( PrintSafepointStatisticsTimeout < 0 || - spstat->_time_to_sync > PrintSafepointStatisticsTimeout * MICROUNITS) { + spstat->_time_to_sync > (jlong)PrintSafepointStatisticsTimeout * MICROUNITS) { print_statistics(); } tty->cr(); diff -r 08f642d9214f -r e0a340f4ab6e hotspot/src/share/vm/runtime/vmThread.cpp --- a/hotspot/src/share/vm/runtime/vmThread.cpp Thu Oct 15 17:35:42 2015 +0200 +++ b/hotspot/src/share/vm/runtime/vmThread.cpp Thu Oct 15 13:34:21 2015 -0500 @@ -419,7 +419,7 @@ // Support for self destruction if ((SelfDestructTimer != 0) && !is_error_reported() && - (os::elapsedTime() > SelfDestructTimer * 60)) { + (os::elapsedTime() > (double)SelfDestructTimer * 60.0)) { tty->print_cr("VM self-destructed"); exit(-1); } diff -r 08f642d9214f -r e0a340f4ab6e hotspot/test/runtime/CommandLine/OptionsValidation/TestOptionsWithRanges.java --- a/hotspot/test/runtime/CommandLine/OptionsValidation/TestOptionsWithRanges.java Thu Oct 15 17:35:42 2015 +0200 +++ b/hotspot/test/runtime/CommandLine/OptionsValidation/TestOptionsWithRanges.java Thu Oct 15 13:34:21 2015 -0500 @@ -52,6 +52,18 @@ allOptionsAsMap.remove("CICompilerCount"); /* + * JDK-8136766 + * Temporarily remove ThreadStackSize from testing because Windows can set it to 0 + * (for default OS size) but other platforms insist it must be greater than 0 + */ + allOptionsAsMap.remove("ThreadStackSize"); + + /* + * Exclude MallocMaxTestWords as it is expected to exit VM at small values (>=0) + */ + allOptionsAsMap.remove("MallocMaxTestWords"); + + /* * Exclude below options as their maximum value would consume too much memory * and would affect other tests that run in parallel. */