8243208: Clean up JVMFlag implementation

Reviewed-by: dholmes, coleenp, gziemski
This commit is contained in:
Ioi Lam 2020-09-11 04:05:18 +00:00
parent 976acddeb5
commit 5144190ea0
45 changed files with 1586 additions and 1364 deletions

View file

@ -77,8 +77,6 @@ define_pd_global(intx, InlineSmallCode, 1000);
#define ARCH_FLAGS(develop, \
product, \
diagnostic, \
experimental, \
notproduct, \
range, \
constraint) \
@ -113,4 +111,6 @@ define_pd_global(intx, InlineSmallCode, 1000);
"Value -1 means off.") \
range(-1, 4096)
// end of ARCH_FLAGS
#endif // CPU_AARCH64_GLOBALS_AARCH64_HPP

View file

@ -72,9 +72,10 @@ define_pd_global(intx, InitArrayShortSize, 8*BytesPerLong);
#define ARCH_FLAGS(develop, \
product, \
diagnostic, \
experimental, \
notproduct, \
range, \
constraint)
// end of ARCH_FLAGS
#endif // CPU_ARM_GLOBALS_ARM_HPP

View file

@ -77,8 +77,6 @@ define_pd_global(intx, InitArrayShortSize, 9*BytesPerLong);
// Platform dependent flag handling: flags only defined on this platform.
#define ARCH_FLAGS(develop, \
product, \
diagnostic, \
experimental, \
notproduct, \
range, \
constraint) \
@ -161,7 +159,7 @@ define_pd_global(intx, InitArrayShortSize, 9*BytesPerLong);
product(bool, UseRTMLocking, false, \
"Enable RTM lock eliding for inflated locks in compiled code") \
\
experimental(bool, UseRTMForStackLocks, false, \
product(bool, UseRTMForStackLocks, false, EXPERIMENTAL, \
"Enable RTM lock eliding for stack locks in compiled code") \
\
product(bool, UseRTMDeopt, false, \
@ -171,33 +169,35 @@ define_pd_global(intx, InitArrayShortSize, 9*BytesPerLong);
"Number of RTM retries on lock abort or busy") \
range(0, max_jint) \
\
experimental(int, RTMSpinLoopCount, 100, \
product(int, RTMSpinLoopCount, 100, EXPERIMENTAL, \
"Spin count for lock to become free before RTM retry") \
range(0, 32767) /* immediate operand limit on ppc */ \
\
experimental(int, RTMAbortThreshold, 1000, \
product(int, RTMAbortThreshold, 1000, EXPERIMENTAL, \
"Calculate abort ratio after this number of aborts") \
range(0, max_jint) \
\
experimental(int, RTMLockingThreshold, 10000, \
product(int, RTMLockingThreshold, 10000, EXPERIMENTAL, \
"Lock count at which to do RTM lock eliding without " \
"abort ratio calculation") \
range(0, max_jint) \
\
experimental(int, RTMAbortRatio, 50, \
product(int, RTMAbortRatio, 50, EXPERIMENTAL, \
"Lock abort ratio at which to stop use RTM lock eliding") \
range(0, 100) /* natural range */ \
\
experimental(int, RTMTotalCountIncrRate, 64, \
product(int, RTMTotalCountIncrRate, 64, EXPERIMENTAL, \
"Increment total RTM attempted lock count once every n times") \
range(1, 32767) /* immediate operand limit on ppc */ \
constraint(RTMTotalCountIncrRateConstraintFunc,AfterErgo) \
\
experimental(intx, RTMLockingCalculationDelay, 0, \
product(intx, RTMLockingCalculationDelay, 0, EXPERIMENTAL, \
"Number of milliseconds to wait before start calculating aborts " \
"for RTM locking") \
\
experimental(bool, UseRTMXendForLockBusy, true, \
"Use RTM Xend instead of Xabort when lock busy") \
product(bool, UseRTMXendForLockBusy, true, EXPERIMENTAL, \
"Use RTM Xend instead of Xabort when lock busy")
// end of ARCH_FLAGS
#endif // CPU_PPC_GLOBALS_PPC_HPP

View file

@ -77,8 +77,6 @@ define_pd_global(intx, InitArrayShortSize, 1*BytesPerLong);
#define ARCH_FLAGS(develop, \
product, \
diagnostic, \
experimental, \
notproduct, \
range, \
constraint) \
@ -117,4 +115,6 @@ define_pd_global(intx, InitArrayShortSize, 1*BytesPerLong);
product(bool, TraceTraps, false, "Trace all traps the signal handler" \
"handles.")
// end of ARCH_FLAGS
#endif // CPU_S390_GLOBALS_S390_HPP

View file

@ -91,8 +91,6 @@ define_pd_global(intx, InitArrayShortSize, 8*BytesPerLong);
#define ARCH_FLAGS(develop, \
product, \
diagnostic, \
experimental, \
notproduct, \
range, \
constraint) \
@ -114,7 +112,7 @@ define_pd_global(intx, InitArrayShortSize, 8*BytesPerLong);
product(bool, UseCLMUL, false, \
"Control whether CLMUL instructions can be used on x86/x64") \
\
diagnostic(bool, UseIncDec, true, \
product(bool, UseIncDec, true, DIAGNOSTIC, \
"Use INC, DEC instructions on x86") \
\
product(bool, UseNewLongLShift, false, \
@ -148,7 +146,7 @@ define_pd_global(intx, InitArrayShortSize, 8*BytesPerLong);
product(bool, UseRTMLocking, false, \
"Enable RTM lock eliding for inflated locks in compiled code") \
\
experimental(bool, UseRTMForStackLocks, false, \
product(bool, UseRTMForStackLocks, false, EXPERIMENTAL, \
"Enable RTM lock eliding for stack locks in compiled code") \
\
product(bool, UseRTMDeopt, false, \
@ -158,33 +156,33 @@ define_pd_global(intx, InitArrayShortSize, 8*BytesPerLong);
"Number of RTM retries on lock abort or busy") \
range(0, max_jint) \
\
experimental(int, RTMSpinLoopCount, 100, \
product(int, RTMSpinLoopCount, 100, EXPERIMENTAL, \
"Spin count for lock to become free before RTM retry") \
range(0, max_jint) \
\
experimental(int, RTMAbortThreshold, 1000, \
product(int, RTMAbortThreshold, 1000, EXPERIMENTAL, \
"Calculate abort ratio after this number of aborts") \
range(0, max_jint) \
\
experimental(int, RTMLockingThreshold, 10000, \
product(int, RTMLockingThreshold, 10000, EXPERIMENTAL, \
"Lock count at which to do RTM lock eliding without " \
"abort ratio calculation") \
range(0, max_jint) \
\
experimental(int, RTMAbortRatio, 50, \
product(int, RTMAbortRatio, 50, EXPERIMENTAL, \
"Lock abort ratio at which to stop use RTM lock eliding") \
range(0, 100) /* natural range */ \
\
experimental(int, RTMTotalCountIncrRate, 64, \
product(int, RTMTotalCountIncrRate, 64, EXPERIMENTAL, \
"Increment total RTM attempted lock count once every n times") \
range(1, max_jint) \
constraint(RTMTotalCountIncrRateConstraintFunc,AfterErgo) \
\
experimental(intx, RTMLockingCalculationDelay, 0, \
product(intx, RTMLockingCalculationDelay, 0, EXPERIMENTAL, \
"Number of milliseconds to wait before start calculating aborts " \
"for RTM locking") \
\
experimental(bool, UseRTMXendForLockBusy, true, \
product(bool, UseRTMXendForLockBusy, true, EXPERIMENTAL, \
"Use RTM Xend instead of Xabort when lock busy") \
\
/* assembler */ \
@ -203,21 +201,23 @@ define_pd_global(intx, InitArrayShortSize, 8*BytesPerLong);
product(bool, UseBMI2Instructions, false, \
"Use BMI2 instructions") \
\
diagnostic(bool, UseLibmIntrinsic, true, \
product(bool, UseLibmIntrinsic, true, DIAGNOSTIC, \
"Use Libm Intrinsics") \
\
/* Minimum array size in bytes to use AVX512 intrinsics */ \
/* for copy, inflate and fill which don't bail out early based on any */ \
/* condition. When this value is set to zero compare operations like */ \
/* compare, vectorizedMismatch, compress can also use AVX512 intrinsics.*/\
diagnostic(int, AVX3Threshold, 4096, \
product(int, AVX3Threshold, 4096, DIAGNOSTIC, \
"Minimum array size in bytes to use AVX512 intrinsics" \
"for copy, inflate and fill. When this value is set as zero" \
"compare operations can also use AVX512 intrinsics.") \
range(0, max_jint) \
\
diagnostic(bool, IntelJccErratumMitigation, true, \
product(bool, IntelJccErratumMitigation, true, DIAGNOSTIC, \
"Turn off JVM mitigations related to Intel micro code " \
"mitigations for the Intel JCC erratum")
// end of ARCH_FLAGS
#endif // CPU_X86_GLOBALS_X86_HPP

View file

@ -75,8 +75,6 @@ define_pd_global(bool, CompactStrings, false);
#define ARCH_FLAGS(develop, \
product, \
diagnostic, \
experimental, \
notproduct, \
range, \
constraint) \
@ -85,7 +83,8 @@ define_pd_global(bool, CompactStrings, false);
"Use fast method entry code for empty methods") \
\
product(bool, UseFastAccessorMethods, true, \
"Use fast method entry code for accessor methods") \
\
"Use fast method entry code for accessor methods")
// end of ARCH_FLAGS
#endif // CPU_ZERO_GLOBALS_ZERO_HPP

View file

@ -27,15 +27,13 @@
#define OS_AIX_GLOBALS_AIX_HPP
//
// Defines Aix specific flags. They are not available on other platforms.
// Declare Aix specific flags. They are not available on other platforms.
//
// (Please keep the switches sorted alphabetically.)
#define RUNTIME_OS_FLAGS(develop, \
develop_pd, \
product, \
product_pd, \
diagnostic, \
diagnostic_pd, \
notproduct, \
range, \
constraint) \
@ -77,9 +75,9 @@
/* explicit commit behaviour. This flag, if true, causes the VM to touch */ \
/* memory on os::commit_memory() (which normally is a noop). */ \
product(bool, UseExplicitCommit, false, \
"Explicit commit for virtual memory.") \
\
"Explicit commit for virtual memory.")
// end of RUNTIME_OS_FLAGS
//
// Defines Aix-specific default values. The flags are available on all

View file

@ -26,18 +26,18 @@
#define OS_BSD_GLOBALS_BSD_HPP
//
// Defines Bsd specific flags. They are not available on other platforms.
// Declare Bsd specific flags. They are not available on other platforms.
//
#define RUNTIME_OS_FLAGS(develop, \
develop_pd, \
product, \
product_pd, \
diagnostic, \
diagnostic_pd, \
notproduct, \
range, \
constraint)
// end of RUNTIME_OS_FLAGS
//
// Defines Bsd-specific default values. The flags are available on all
// platforms, but they may have different default values on other platforms.

View file

@ -26,14 +26,12 @@
#define OS_LINUX_GLOBALS_LINUX_HPP
//
// Defines Linux specific flags. They are not available on other platforms.
// Declare Linux specific flags. They are not available on other platforms.
//
#define RUNTIME_OS_FLAGS(develop, \
develop_pd, \
product, \
product_pd, \
diagnostic, \
diagnostic_pd, \
notproduct, \
range, \
constraint) \
@ -70,19 +68,21 @@
"Increase the thread stack size to include space for glibc " \
"static thread-local storage (TLS) if true") \
\
diagnostic(bool, DumpPrivateMappingsInCore, true, \
product(bool, DumpPrivateMappingsInCore, true, DIAGNOSTIC, \
"If true, sets bit 2 of /proc/PID/coredump_filter, thus " \
"resulting in file-backed private mappings of the process to "\
"be dumped into the corefile.") \
\
diagnostic(bool, DumpSharedMappingsInCore, true, \
product(bool, DumpSharedMappingsInCore, true, DIAGNOSTIC, \
"If true, sets bit 3 of /proc/PID/coredump_filter, thus " \
"resulting in file-backed shared mappings of the process to " \
"be dumped into the corefile.") \
\
diagnostic(bool, UseCpuAllocPath, false, \
product(bool, UseCpuAllocPath, false, DIAGNOSTIC, \
"Use CPU_ALLOC code path in os::active_processor_count ")
// end of RUNTIME_OS_FLAGS
//
// Defines Linux-specific default values. The flags are available on all
// platforms, but they may have different default values on other platforms.

View file

@ -26,18 +26,18 @@
#define OS_WINDOWS_GLOBALS_WINDOWS_HPP
//
// Defines Windows specific flags. They are not available on other platforms.
// Declare Windows specific flags. They are not available on other platforms.
//
#define RUNTIME_OS_FLAGS(develop, \
develop_pd, \
product, \
product_pd, \
diagnostic, \
diagnostic_pd, \
notproduct, \
range, \
constraint)
// end of RUNTIME_OS_FLAGS
//
// Defines Windows-specific default values. The flags are available on all

View file

@ -32,14 +32,12 @@
#include OS_HEADER(c1_globals)
//
// Defines all global flags used by the client compiler.
// Declare all global flags used by the client compiler.
//
#define C1_FLAGS(develop, \
develop_pd, \
product, \
product_pd, \
diagnostic, \
diagnostic_pd, \
notproduct, \
range, \
constraint) \
@ -158,7 +156,7 @@
product(bool, InlineSynchronizedMethods, true, \
"Inline synchronized methods") \
\
diagnostic(bool, InlineNIOCheckIndex, true, \
product(bool, InlineNIOCheckIndex, true, DIAGNOSTIC, \
"Intrinsify java.nio.Buffer.checkIndex") \
\
develop(bool, CanonicalizeNodes, true, \
@ -337,7 +335,8 @@
"Update MethodData*s in Tier1-generated code") \
\
develop(bool, PrintCFGToFile, false, \
"print control flow graph to a separate file during compilation") \
\
"print control flow graph to a separate file during compilation")
// end of C1_FLAGS
#endif // SHARE_C1_C1_GLOBALS_HPP

View file

@ -36,62 +36,58 @@
develop_pd, \
product, \
product_pd, \
diagnostic, \
diagnostic_pd, \
experimental, \
notproduct, \
manageable, \
product_rw, \
lp64_product, \
range, \
constraint) \
\
experimental(size_t, EpsilonPrintHeapSteps, 20, \
product(size_t, EpsilonPrintHeapSteps, 20, EXPERIMENTAL, \
"Print heap occupancy stats with this number of steps. " \
"0 turns the printing off.") \
range(0, max_intx) \
\
experimental(size_t, EpsilonUpdateCountersStep, 1 * M, \
product(size_t, EpsilonUpdateCountersStep, 1 * M, EXPERIMENTAL, \
"Update heap occupancy counters after allocating this much " \
"memory. Higher values would make allocations faster at " \
"the expense of lower resolution in heap counters.") \
range(1, max_intx) \
\
experimental(size_t, EpsilonMaxTLABSize, 4 * M, \
product(size_t, EpsilonMaxTLABSize, 4 * M, EXPERIMENTAL, \
"Max TLAB size to use with Epsilon GC. Larger value improves " \
"performance at the expense of per-thread memory waste. This " \
"asks TLAB machinery to cap TLAB sizes at this value.") \
range(1, max_intx) \
\
experimental(bool, EpsilonElasticTLAB, true, \
product(bool, EpsilonElasticTLAB, true, EXPERIMENTAL, \
"Use elastic policy to manage TLAB sizes. This conserves memory " \
"for non-actively allocating threads, even when they request " \
"large TLABs for themselves. Active threads would experience " \
"smaller TLABs until policy catches up.") \
\
experimental(bool, EpsilonElasticTLABDecay, true, \
product(bool, EpsilonElasticTLABDecay, true, EXPERIMENTAL, \
"Use timed decays to shrik TLAB sizes. This conserves memory " \
"for the threads that allocate in bursts of different sizes, " \
"for example the small/rare allocations coming after the initial "\
"large burst.") \
\
experimental(double, EpsilonTLABElasticity, 1.1, \
product(double, EpsilonTLABElasticity, 1.1, EXPERIMENTAL, \
"Multiplier to use when deciding on next TLAB size. Larger value "\
"improves performance at the expense of per-thread memory waste. "\
"Lower value improves memory footprint, but penalizes actively " \
"allocating threads.") \
range(1.0, DBL_MAX) \
\
experimental(size_t, EpsilonTLABDecayTime, 1000, \
product(size_t, EpsilonTLABDecayTime, 1000, EXPERIMENTAL, \
"TLAB sizing policy decays to initial size after thread had not " \
"allocated for this long. Time is in milliseconds. Lower value " \
"improves memory footprint, but penalizes actively allocating " \
"threads.") \
range(1, max_intx) \
\
experimental(size_t, EpsilonMinHeapExpand, 128 * M, \
product(size_t, EpsilonMinHeapExpand, 128 * M, EXPERIMENTAL, \
"Min expansion step for heap. Larger value improves performance " \
"at the potential expense of memory waste.") \
range(1, max_intx)
// end of GC_EPSILON_FLAGS
#endif // SHARE_GC_EPSILON_EPSILON_GLOBALS_HPP

View file

@ -35,13 +35,7 @@
develop_pd, \
product, \
product_pd, \
diagnostic, \
diagnostic_pd, \
experimental, \
notproduct, \
manageable, \
product_rw, \
lp64_product, \
range, \
constraint) \
\
@ -51,7 +45,7 @@
"attempts to start marking in time based on application " \
"behavior.") \
\
experimental(size_t, G1AdaptiveIHOPNumInitialSamples, 3, \
product(size_t, G1AdaptiveIHOPNumInitialSamples, 3, EXPERIMENTAL, \
"How many completed time periods from concurrent start to first " \
"mixed gc are required to use the input values for prediction " \
"of the optimal occupancy to start marking.") \
@ -61,7 +55,7 @@
"Confidence level for MMU/pause predictions") \
range(0, 100) \
\
diagnostic(intx, G1SummarizeRSetStatsPeriod, 0, \
product(intx, G1SummarizeRSetStatsPeriod, 0, DIAGNOSTIC, \
"The period (in number of GCs) at which we will generate " \
"update buffer processing info " \
"(0 means do not periodically generate this info); " \
@ -79,11 +73,11 @@
"draining concurrent marking work queues.") \
range(1, INT_MAX) \
\
experimental(bool, G1UseReferencePrecleaning, true, \
product(bool, G1UseReferencePrecleaning, true, EXPERIMENTAL, \
"Concurrently preclean java.lang.ref.references instances " \
"before the Remark pause.") \
\
experimental(double, G1LastPLABAverageOccupancy, 50.0, \
product(double, G1LastPLABAverageOccupancy, 50.0, EXPERIMENTAL, \
"The expected average occupancy of the last PLAB in " \
"percent.") \
range(0.001, 100.0) \
@ -104,7 +98,7 @@
"specifies that mutator threads should not do such filtering.") \
range(0, 100) \
\
experimental(intx, G1ExpandByPercentOfAvailable, 20, \
product(intx, G1ExpandByPercentOfAvailable, 20, EXPERIMENTAL, \
"When expanding, % of uncommitted space to claim.") \
range(0, 100) \
\
@ -212,19 +206,19 @@
"Raise a fatal VM exit out of memory failure in the event " \
" that heap expansion fails due to running out of swap.") \
\
experimental(uintx, G1MaxNewSizePercent, 60, \
product(uintx, G1MaxNewSizePercent, 60, EXPERIMENTAL, \
"Percentage (0-100) of the heap size to use as default " \
" maximum young gen size.") \
range(0, 100) \
constraint(G1MaxNewSizePercentConstraintFunc,AfterErgo) \
\
experimental(uintx, G1NewSizePercent, 5, \
product(uintx, G1NewSizePercent, 5, EXPERIMENTAL, \
"Percentage (0-100) of the heap size to use as default " \
"minimum young gen size.") \
range(0, 100) \
constraint(G1NewSizePercentConstraintFunc,AfterErgo) \
\
experimental(uintx, G1MixedGCLiveThresholdPercent, 85, \
product(uintx, G1MixedGCLiveThresholdPercent, 85, EXPERIMENTAL, \
"Threshold for regions to be considered for inclusion in the " \
"collection set of mixed GCs. " \
"Regions with live bytes exceeding this will not be collected.") \
@ -239,18 +233,18 @@
"The target number of mixed GCs after a marking cycle.") \
range(0, max_uintx) \
\
experimental(bool, G1EagerReclaimHumongousObjects, true, \
product(bool, G1EagerReclaimHumongousObjects, true, EXPERIMENTAL, \
"Try to reclaim dead large objects at every young GC.") \
\
experimental(bool, G1EagerReclaimHumongousObjectsWithStaleRefs, true, \
product(bool, G1EagerReclaimHumongousObjectsWithStaleRefs, true, EXPERIMENTAL, \
"Try to reclaim dead large objects that have a few stale " \
"references at every young GC.") \
\
experimental(size_t, G1RebuildRemSetChunkSize, 256 * K, \
product(size_t, G1RebuildRemSetChunkSize, 256 * K, EXPERIMENTAL, \
"Chunk size used for rebuilding the remembered set.") \
range(4 * K, 32 * M) \
\
experimental(uintx, G1OldCSetRegionThresholdPercent, 10, \
product(uintx, G1OldCSetRegionThresholdPercent, 10, EXPERIMENTAL, \
"An upper bound for the number of old CSet regions expressed " \
"as a percentage of the heap size.") \
range(0, 100) \
@ -283,17 +277,17 @@
"Force use of evacuation failure handling during mixed " \
"evacuation pauses") \
\
diagnostic(bool, G1VerifyRSetsDuringFullGC, false, \
product(bool, G1VerifyRSetsDuringFullGC, false, DIAGNOSTIC, \
"If true, perform verification of each heap region's " \
"remembered set when verifying the heap during a full GC.") \
\
diagnostic(bool, G1VerifyHeapRegionCodeRoots, false, \
product(bool, G1VerifyHeapRegionCodeRoots, false, DIAGNOSTIC, \
"Verify the code root lists attached to each heap region.") \
\
develop(bool, G1VerifyBitmaps, false, \
"Verifies the consistency of the marking bitmaps") \
\
manageable(uintx, G1PeriodicGCInterval, 0, \
product(uintx, G1PeriodicGCInterval, 0, MANAGEABLE, \
"Number of milliseconds after a previous GC to wait before " \
"triggering a periodic gc. A value of zero disables periodically "\
"enforced gc cycles.") \
@ -303,21 +297,22 @@
"perform a concurrent GC as periodic GC, otherwise use a STW " \
"Full GC.") \
\
manageable(double, G1PeriodicGCSystemLoadThreshold, 0.0, \
product(double, G1PeriodicGCSystemLoadThreshold, 0.0, MANAGEABLE, \
"Maximum recent system wide load as returned by the 1m value " \
"of getloadavg() at which G1 triggers a periodic GC. A load " \
"above this value cancels a given periodic GC. A value of zero " \
"disables this check.") \
range(0.0, (double)max_uintx) \
\
experimental(uintx, G1YoungExpansionBufferPercent, 10, \
product(uintx, G1YoungExpansionBufferPercent, 10, EXPERIMENTAL, \
"When heterogenous heap is enabled by AllocateOldGenAt " \
"option, after every GC, young gen is re-sized which " \
"involves system calls to commit/uncommit memory. To " \
"reduce these calls, we keep a buffer of extra regions to " \
"absorb small changes in young gen length. This flag takes " \
"the buffer size as an percentage of young gen length") \
range(0, 100) \
range(0, 100)
// end of GC_G1_FLAGS
#endif // SHARE_GC_G1_G1_GLOBALS_HPP

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2020, 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
@ -28,18 +28,21 @@
#include "runtime/flags/jvmFlag.hpp"
#include "utilities/globalDefinitions.hpp"
// G1 Flag Constraints
JVMFlag::Error G1RSetRegionEntriesConstraintFunc(intx value, bool verbose);
JVMFlag::Error G1RSetSparseRegionEntriesConstraintFunc(intx value, bool verbose);
JVMFlag::Error G1HeapRegionSizeConstraintFunc(size_t value, bool verbose);
JVMFlag::Error G1NewSizePercentConstraintFunc(uintx value, bool verbose);
JVMFlag::Error G1MaxNewSizePercentConstraintFunc(uintx value, bool verbose);
#define G1_GC_CONSTRAINTS(f) \
\
/* G1 Flag Constraints */ \
f(intx, G1RSetRegionEntriesConstraintFunc) \
f(intx, G1RSetSparseRegionEntriesConstraintFunc) \
f(size_t, G1HeapRegionSizeConstraintFunc) \
f(uintx, G1NewSizePercentConstraintFunc) \
f(uintx, G1MaxNewSizePercentConstraintFunc) \
\
/* G1 Subconstraints */ \
f(uintx, MaxGCPauseMillisConstraintFuncG1) \
f(uintx, GCPauseIntervalMillisConstraintFuncG1) \
f(size_t, NewSizeConstraintFuncG1)
// G1 Subconstraints
JVMFlag::Error MaxGCPauseMillisConstraintFuncG1(uintx value, bool verbose);
JVMFlag::Error GCPauseIntervalMillisConstraintFuncG1(uintx value, bool verbose);
JVMFlag::Error MaxSizeForHeapAlignmentG1(const char* name, size_t value, bool verbose);
JVMFlag::Error NewSizeConstraintFuncG1(size_t value, bool verbose);
G1_GC_CONSTRAINTS(DECLARE_CONSTRAINT)
size_t MaxSizeForHeapAlignmentG1();

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2020, 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
@ -29,8 +29,11 @@
#include "utilities/globalDefinitions.hpp"
// Parallel Subconstraints
JVMFlag::Error ParallelGCThreadsConstraintFuncParallel(uint value, bool verbose);
JVMFlag::Error InitialTenuringThresholdConstraintFuncParallel(uintx value, bool verbose);
JVMFlag::Error MaxTenuringThresholdConstraintFuncParallel(uintx value, bool verbose);
#define PARALLEL_GC_CONSTRAINTS(f) \
f(uint, ParallelGCThreadsConstraintFuncParallel) \
f(uintx, InitialTenuringThresholdConstraintFuncParallel) \
f(uintx, MaxTenuringThresholdConstraintFuncParallel)
PARALLEL_GC_CONSTRAINTS(DECLARE_CONSTRAINT)
#endif // SHARE_GC_PARALLEL_JVMFLAGCONSTRAINTSPARALLEL_HPP

View file

@ -29,13 +29,7 @@
develop_pd, \
product, \
product_pd, \
diagnostic, \
diagnostic_pd, \
experimental, \
notproduct, \
manageable, \
product_rw, \
lp64_product, \
range, \
constraint) \
product(uintx, HeapMaximumCompactionInterval, 20, \
@ -67,4 +61,6 @@
product(bool, PSChunkLargeArrays, true, \
"Process large arrays in chunks")
// end of GC_PARALLEL_FLAGS
#endif // SHARE_GC_PARALLEL_PARALLEL_GLOBALS_HPP

View file

@ -29,14 +29,10 @@
develop_pd, \
product, \
product_pd, \
diagnostic, \
diagnostic_pd, \
experimental, \
notproduct, \
manageable, \
product_rw, \
lp64_product, \
range, \
constraint)
// end of GC_SERIAL_FLAGS
#endif // SHARE_GC_SERIAL_SERIAL_GLOBALS_HPP

View file

@ -50,13 +50,7 @@
develop_pd, \
product, \
product_pd, \
diagnostic, \
diagnostic_pd, \
experimental, \
notproduct, \
manageable, \
product_rw, \
lp64_product, \
range, \
constraint) \
\
@ -65,13 +59,7 @@
develop_pd, \
product, \
product_pd, \
diagnostic, \
diagnostic_pd, \
experimental, \
notproduct, \
manageable, \
product_rw, \
lp64_product, \
range, \
constraint)) \
\
@ -80,13 +68,7 @@
develop_pd, \
product, \
product_pd, \
diagnostic, \
diagnostic_pd, \
experimental, \
notproduct, \
manageable, \
product_rw, \
lp64_product, \
range, \
constraint)) \
\
@ -95,13 +77,7 @@
develop_pd, \
product, \
product_pd, \
diagnostic, \
diagnostic_pd, \
experimental, \
notproduct, \
manageable, \
product_rw, \
lp64_product, \
range, \
constraint)) \
\
@ -110,13 +86,7 @@
develop_pd, \
product, \
product_pd, \
diagnostic, \
diagnostic_pd, \
experimental, \
notproduct, \
manageable, \
product_rw, \
lp64_product, \
range, \
constraint)) \
\
@ -125,13 +95,7 @@
develop_pd, \
product, \
product_pd, \
diagnostic, \
diagnostic_pd, \
experimental, \
notproduct, \
manageable, \
product_rw, \
lp64_product, \
range, \
constraint)) \
\
@ -140,13 +104,7 @@
develop_pd, \
product, \
product_pd, \
diagnostic, \
diagnostic_pd, \
experimental, \
notproduct, \
manageable, \
product_rw, \
lp64_product, \
range, \
constraint)) \
\
@ -161,7 +119,7 @@
product(bool, UseParallelGC, false, \
"Use the Parallel garbage collector.") \
\
experimental(bool, UseEpsilonGC, false, \
product(bool, UseEpsilonGC, false, EXPERIMENTAL, \
"Use the Epsilon (no-op) garbage collector") \
\
product(bool, UseZGC, false, \
@ -179,14 +137,14 @@
"ParallelGCThreads parallel collectors will use for garbage " \
"collection work") \
\
diagnostic(bool, InjectGCWorkerCreationFailure, false, \
product(bool, InjectGCWorkerCreationFailure, false, DIAGNOSTIC, \
"Inject thread creation failures for " \
"UseDynamicNumberOfGCThreads") \
\
product(size_t, HeapSizePerGCThread, ScaleForWordSize(32*M), \
"Size of heap (bytes) per GC thread used in calculating the " \
"number of GC threads") \
range((size_t)os::vm_page_size(), (size_t)max_uintx) \
constraint(VMPageSizeConstraintFunc, AtParse) \
\
product(uint, ConcGCThreads, 0, \
"Number of threads concurrent gc will use") \
@ -211,7 +169,7 @@
"is active (as a percentage)") \
range(0, 100) \
\
diagnostic(uintx, GCLockerRetryAllocationCount, 2, \
product(uintx, GCLockerRetryAllocationCount, 2, DIAGNOSTIC, \
"Number of times to retry allocations when " \
"blocked by the GC locker") \
range(0, max_uintx) \
@ -268,7 +226,7 @@
product(bool, ParallelRefProcBalancingEnabled, true, \
"Enable balancing of reference processing queues") \
\
experimental(size_t, ReferencesPerThread, 1000, \
product(size_t, ReferencesPerThread, 1000, EXPERIMENTAL, \
"Ergonomically start one thread for this amount of " \
"references for reference processing if " \
"ParallelRefProcEnabled is true. Specify 0 to disable and " \
@ -308,17 +266,17 @@
develop(uintx, PromotionFailureALotInterval, 5, \
"Total collections between promotion failures a lot") \
\
experimental(uintx, WorkStealingSleepMillis, 1, \
product(uintx, WorkStealingSleepMillis, 1, EXPERIMENTAL, \
"Sleep time when sleep is used for yields") \
\
experimental(uintx, WorkStealingYieldsBeforeSleep, 5000, \
product(uintx, WorkStealingYieldsBeforeSleep, 5000, EXPERIMENTAL, \
"Number of yields before a sleep is done during work stealing") \
\
experimental(uintx, WorkStealingHardSpins, 4096, \
product(uintx, WorkStealingHardSpins, 4096, EXPERIMENTAL, \
"Number of iterations in a spin loop between checks on " \
"time out of hard spin") \
\
experimental(uintx, WorkStealingSpinToYieldRatio, 10, \
product(uintx, WorkStealingSpinToYieldRatio, 10, EXPERIMENTAL, \
"Ratio of hard spins to calls to yield") \
\
develop(uintx, ObjArrayMarkingStride, 2048, \
@ -563,27 +521,27 @@
"How many fields ahead to prefetch in oop scan (<= 0 means off)") \
range(-1, max_jint) \
\
diagnostic(bool, VerifyDuringStartup, false, \
product(bool, VerifyDuringStartup, false, DIAGNOSTIC, \
"Verify memory system before executing any Java code " \
"during VM initialization") \
\
diagnostic(bool, VerifyBeforeExit, trueInDebug, \
product(bool, VerifyBeforeExit, trueInDebug, DIAGNOSTIC, \
"Verify system before exiting") \
\
diagnostic(bool, VerifyBeforeGC, false, \
product(bool, VerifyBeforeGC, false, DIAGNOSTIC, \
"Verify memory system before GC") \
\
diagnostic(bool, VerifyAfterGC, false, \
product(bool, VerifyAfterGC, false, DIAGNOSTIC, \
"Verify memory system after GC") \
\
diagnostic(bool, VerifyDuringGC, false, \
product(bool, VerifyDuringGC, false, DIAGNOSTIC, \
"Verify memory system during GC (between phases)") \
\
diagnostic(ccstrlist, VerifyGCType, "", \
product(ccstrlist, VerifyGCType, "", DIAGNOSTIC, \
"GC type(s) to verify when Verify*GC is enabled." \
"Available types are collector specific.") \
\
diagnostic(ccstrlist, VerifySubSet, "", \
product(ccstrlist, VerifySubSet, "", DIAGNOSTIC, \
"Memory sub-systems to verify when Verify*GC flag(s) " \
"are enabled. One or more sub-systems can be specified " \
"in a comma separated string. Sub-systems are: " \
@ -591,20 +549,20 @@
"dictionary, classloader_data_graph, metaspace, jni_handles, " \
"codecache_oops") \
\
diagnostic(bool, GCParallelVerificationEnabled, true, \
product(bool, GCParallelVerificationEnabled, true, DIAGNOSTIC, \
"Enable parallel memory system verification") \
\
diagnostic(bool, DeferInitialCardMark, false, \
product(bool, DeferInitialCardMark, false, DIAGNOSTIC, \
"When +ReduceInitialCardMarks, explicitly defer any that " \
"may arise from new_pre_store_barrier") \
\
product(bool, UseCondCardMark, false, \
"Check for already marked card before updating card table") \
\
diagnostic(bool, VerifyRememberedSets, false, \
product(bool, VerifyRememberedSets, false, DIAGNOSTIC, \
"Verify GC remembered sets") \
\
diagnostic(bool, VerifyObjectStartArray, true, \
product(bool, VerifyObjectStartArray, true, DIAGNOSTIC, \
"Verify GC object start array if verify before/after") \
\
product(bool, DisableExplicitGC, false, \
@ -649,7 +607,7 @@
"Maximum heap size (in bytes)") \
constraint(MaxHeapSizeConstraintFunc,AfterErgo) \
\
manageable(size_t, SoftMaxHeapSize, 0, \
product(size_t, SoftMaxHeapSize, 0, MANAGEABLE, \
"Soft limit for maximum heap size (in bytes)") \
constraint(SoftMaxHeapSizeConstraintFunc,AfterMemoryInit) \
\
@ -730,11 +688,11 @@
"will retry before printing a warning") \
range(0, max_uintx) \
\
diagnostic(uintx, VerifyGCStartAt, 0, \
product(uintx, VerifyGCStartAt, 0, DIAGNOSTIC, \
"GC invoke count where +VerifyBefore/AfterGC kicks in") \
range(0, max_uintx) \
\
diagnostic(intx, VerifyGCLevel, 0, \
product(intx, VerifyGCLevel, 0, DIAGNOSTIC, \
"Generation level at which to start +VerifyBefore/AfterGC") \
range(0, 1) \
\
@ -775,4 +733,6 @@
"during parallel gc") \
range(0, max_juint)
// end of GC_FLAGS
#endif // SHARE_GC_SHARED_GC_GLOBALS_HPP

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2020, 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
@ -40,38 +40,44 @@
* whenever flag's value changes. If the constraint fails the function should return
* an appropriate error value.
*/
#define SHARED_GC_CONSTRAINTS(f) \
f(uint, ParallelGCThreadsConstraintFunc) \
f(uint, ConcGCThreadsConstraintFunc) \
f(size_t, YoungPLABSizeConstraintFunc) \
f(size_t, OldPLABSizeConstraintFunc) \
f(uintx, MinHeapFreeRatioConstraintFunc) \
f(uintx, MaxHeapFreeRatioConstraintFunc) \
f(intx, SoftRefLRUPolicyMSPerMBConstraintFunc) \
f(size_t, MarkStackSizeConstraintFunc) \
f(uintx, MinMetaspaceFreeRatioConstraintFunc) \
f(uintx, MaxMetaspaceFreeRatioConstraintFunc) \
f(uintx, InitialTenuringThresholdConstraintFunc) \
f(uintx, MaxTenuringThresholdConstraintFunc) \
\
f(uintx, MaxGCPauseMillisConstraintFunc) \
f(uintx, GCPauseIntervalMillisConstraintFunc) \
f(size_t, InitialBootClassLoaderMetaspaceSizeConstraintFunc) \
f(size_t, MinHeapSizeConstraintFunc) \
f(size_t, InitialHeapSizeConstraintFunc) \
f(size_t, MaxHeapSizeConstraintFunc) \
f(size_t, SoftMaxHeapSizeConstraintFunc) \
f(size_t, HeapBaseMinAddressConstraintFunc) \
f(size_t, NewSizeConstraintFunc) \
f(size_t, MinTLABSizeConstraintFunc) \
f(size_t, TLABSizeConstraintFunc) \
f(uintx, TLABWasteIncrementConstraintFunc) \
f(uintx, SurvivorRatioConstraintFunc) \
f(size_t, MetaspaceSizeConstraintFunc) \
f(size_t, MaxMetaspaceSizeConstraintFunc) \
f(intx, SurvivorAlignmentInBytesConstraintFunc)
JVMFlag::Error ParallelGCThreadsConstraintFunc(uint value, bool verbose);
JVMFlag::Error ConcGCThreadsConstraintFunc(uint value, bool verbose);
JVMFlag::Error YoungPLABSizeConstraintFunc(size_t value, bool verbose);
JVMFlag::Error OldPLABSizeConstraintFunc(size_t value, bool verbose);
JVMFlag::Error MinHeapFreeRatioConstraintFunc(uintx value, bool verbose);
JVMFlag::Error MaxHeapFreeRatioConstraintFunc(uintx value, bool verbose);
JVMFlag::Error SoftRefLRUPolicyMSPerMBConstraintFunc(intx value, bool verbose);
JVMFlag::Error MarkStackSizeConstraintFunc(size_t value, bool verbose);
JVMFlag::Error MinMetaspaceFreeRatioConstraintFunc(uintx value, bool verbose);
JVMFlag::Error MaxMetaspaceFreeRatioConstraintFunc(uintx value, bool verbose);
JVMFlag::Error InitialTenuringThresholdConstraintFunc(uintx value, bool verbose);
JVMFlag::Error MaxTenuringThresholdConstraintFunc(uintx value, bool verbose);
SHARED_GC_CONSTRAINTS(DECLARE_CONSTRAINT)
JVMFlag::Error MaxGCPauseMillisConstraintFunc(uintx value, bool verbose);
JVMFlag::Error GCPauseIntervalMillisConstraintFunc(uintx value, bool verbose);
JVMFlag::Error InitialBootClassLoaderMetaspaceSizeConstraintFunc(size_t value, bool verbose);
JVMFlag::Error MinHeapSizeConstraintFunc(size_t value, bool verbose);
JVMFlag::Error InitialHeapSizeConstraintFunc(size_t value, bool verbose);
JVMFlag::Error MaxHeapSizeConstraintFunc(size_t value, bool verbose);
JVMFlag::Error SoftMaxHeapSizeConstraintFunc(size_t value, bool verbose);
JVMFlag::Error HeapBaseMinAddressConstraintFunc(size_t value, bool verbose);
JVMFlag::Error NewSizeConstraintFunc(size_t value, bool verbose);
JVMFlag::Error MinTLABSizeConstraintFunc(size_t value, bool verbose);
JVMFlag::Error TLABSizeConstraintFunc(size_t value, bool verbose);
JVMFlag::Error TLABWasteIncrementConstraintFunc(uintx value, bool verbose);
JVMFlag::Error SurvivorRatioConstraintFunc(uintx value, bool verbose);
JVMFlag::Error MetaspaceSizeConstraintFunc(size_t value, bool verbose);
JVMFlag::Error MaxMetaspaceSizeConstraintFunc(size_t value, bool verbose);
JVMFlag::Error SurvivorAlignmentInBytesConstraintFunc(intx value, bool verbose);
// Internal
JVMFlag::Error MaxPLABSizeBounds(const char* name, size_t value, bool verbose);
#define GC_CONSTRAINTS(f) \
SHARED_GC_CONSTRAINTS(f) \
G1GC_ONLY(G1_GC_CONSTRAINTS(f)) \
PARALLELGC_ONLY(PARALLEL_GC_CONSTRAINTS(f))
#endif // SHARE_GC_SHARED_JVMFLAGCONSTRAINTSGC_HPP

View file

@ -30,33 +30,27 @@
develop_pd, \
product, \
product_pd, \
diagnostic, \
diagnostic_pd, \
experimental, \
notproduct, \
manageable, \
product_rw, \
lp64_product, \
range, \
constraint) \
\
experimental(size_t, ShenandoahRegionSize, 0, \
product(size_t, ShenandoahRegionSize, 0, EXPERIMENTAL, \
"Static heap region size. Set zero to enable automatic sizing.") \
\
experimental(size_t, ShenandoahTargetNumRegions, 2048, \
product(size_t, ShenandoahTargetNumRegions, 2048, EXPERIMENTAL, \
"With automatic region sizing, this is the approximate number " \
"of regions that would be used, within min/max region size " \
"limits.") \
\
experimental(size_t, ShenandoahMinRegionSize, 256 * K, \
product(size_t, ShenandoahMinRegionSize, 256 * K, EXPERIMENTAL, \
"With automatic region sizing, the regions would be at least " \
"this large.") \
\
experimental(size_t, ShenandoahMaxRegionSize, 32 * M, \
product(size_t, ShenandoahMaxRegionSize, 32 * M, EXPERIMENTAL, \
"With automatic region sizing, the regions would be at most " \
"this large.") \
\
experimental(intx, ShenandoahHumongousThreshold, 100, \
product(intx, ShenandoahHumongousThreshold, 100, EXPERIMENTAL, \
"Humongous objects are allocated in separate regions. " \
"This setting defines how large the object should be to be " \
"deemed humongous. Value is in percents of heap region size. " \
@ -82,19 +76,19 @@
" compact - run GC more frequently and with deeper targets to " \
"free up more memory.") \
\
experimental(uintx, ShenandoahRefProcFrequency, 5, \
product(uintx, ShenandoahRefProcFrequency, 5, EXPERIMENTAL, \
"Process process weak (soft, phantom, finalizers) references " \
"every Nth cycle. Normally affects concurrent GC cycles only, " \
"as degenerated and full GCs would try to process references " \
"regardless. Set to zero to disable reference processing " \
"completely.") \
\
experimental(uintx, ShenandoahUnloadClassesFrequency, 1, \
product(uintx, ShenandoahUnloadClassesFrequency, 1, EXPERIMENTAL, \
"Unload the classes every Nth cycle. Normally affects concurrent "\
"GC cycles, as degenerated and full GCs would try to unload " \
"classes regardless. Set to zero to disable class unloading.") \
\
experimental(uintx, ShenandoahGarbageThreshold, 25, \
product(uintx, ShenandoahGarbageThreshold, 25, EXPERIMENTAL, \
"How much garbage a region has to contain before it would be " \
"taken for collection. This a guideline only, as GC heuristics " \
"may select the region for collection even if it has little " \
@ -102,63 +96,63 @@
"collector accepts. In percents of heap region size.") \
range(0,100) \
\
experimental(uintx, ShenandoahInitFreeThreshold, 70, \
product(uintx, ShenandoahInitFreeThreshold, 70, EXPERIMENTAL, \
"How much heap should be free before some heuristics trigger the "\
"initial (learning) cycles. Affects cycle frequency on startup " \
"and after drastic state changes, e.g. after degenerated/full " \
"GC cycles. In percents of (soft) max heap size.") \
range(0,100) \
\
experimental(uintx, ShenandoahMinFreeThreshold, 10, \
product(uintx, ShenandoahMinFreeThreshold, 10, EXPERIMENTAL, \
"How much heap should be free before most heuristics trigger the "\
"collection, even without other triggers. Provides the safety " \
"margin for many heuristics. In percents of (soft) max heap size.")\
range(0,100) \
\
experimental(uintx, ShenandoahAllocationThreshold, 0, \
product(uintx, ShenandoahAllocationThreshold, 0, EXPERIMENTAL, \
"How many new allocations should happen since the last GC cycle " \
"before some heuristics trigger the collection. In percents of " \
"(soft) max heap size. Set to zero to effectively disable.") \
range(0,100) \
\
experimental(uintx, ShenandoahAllocSpikeFactor, 5, \
product(uintx, ShenandoahAllocSpikeFactor, 5, EXPERIMENTAL, \
"How much of heap should some heuristics reserve for absorbing " \
"the allocation spikes. Larger value wastes more memory in " \
"non-emergency cases, but provides more safety in emergency " \
"cases. In percents of (soft) max heap size.") \
range(0,100) \
\
experimental(uintx, ShenandoahLearningSteps, 5, \
product(uintx, ShenandoahLearningSteps, 5, EXPERIMENTAL, \
"The number of cycles some heuristics take to collect in order " \
"to learn application and GC performance.") \
range(0,100) \
\
experimental(uintx, ShenandoahImmediateThreshold, 90, \
product(uintx, ShenandoahImmediateThreshold, 90, EXPERIMENTAL, \
"The cycle may shortcut when enough garbage can be reclaimed " \
"from the immediate garbage (completely garbage regions). " \
"In percents of total garbage found. Setting this threshold " \
"to 100 effectively disables the shortcut.") \
range(0,100) \
\
experimental(uintx, ShenandoahGuaranteedGCInterval, 5*60*1000, \
product(uintx, ShenandoahGuaranteedGCInterval, 5*60*1000, EXPERIMENTAL, \
"Many heuristics would guarantee a concurrent GC cycle at " \
"least with this interval. This is useful when large idle " \
"intervals are present, where GC can run without stealing " \
"time from active application. Time is in milliseconds. " \
"Setting this to 0 disables the feature.") \
\
experimental(bool, ShenandoahAlwaysClearSoftRefs, false, \
product(bool, ShenandoahAlwaysClearSoftRefs, false, EXPERIMENTAL, \
"Unconditionally clear soft references, instead of using any " \
"other cleanup policy. This minimizes footprint at expense of" \
"more soft reference churn in applications.") \
\
experimental(bool, ShenandoahUncommit, true, \
product(bool, ShenandoahUncommit, true, EXPERIMENTAL, \
"Allow to uncommit memory under unused regions and metadata. " \
"This optimizes footprint at expense of allocation latency in " \
"regions that require committing back. Uncommits would be " \
"disabled by some heuristics, or with static heap size.") \
\
experimental(uintx, ShenandoahUncommitDelay, 5*60*1000, \
product(uintx, ShenandoahUncommitDelay, 5*60*1000, EXPERIMENTAL, \
"Uncommit memory for regions that were not used for more than " \
"this time. First use after that would incur allocation stalls. " \
"Actively used regions would never be uncommitted, because they " \
@ -166,37 +160,37 @@
"milliseconds. Setting this delay to 0 effectively uncommits " \
"regions almost immediately after they become unused.") \
\
experimental(bool, ShenandoahRegionSampling, false, \
product(bool, ShenandoahRegionSampling, false, EXPERIMENTAL, \
"Provide heap region sampling data via jvmstat.") \
\
experimental(int, ShenandoahRegionSamplingRate, 40, \
product(int, ShenandoahRegionSamplingRate, 40, EXPERIMENTAL, \
"Sampling rate for heap region sampling. In milliseconds between "\
"the samples. Higher values provide more fidelity, at expense " \
"of more sampling overhead.") \
\
experimental(uintx, ShenandoahControlIntervalMin, 1, \
product(uintx, ShenandoahControlIntervalMin, 1, EXPERIMENTAL, \
"The minimum sleep interval for the control loop that drives " \
"the cycles. Lower values would increase GC responsiveness " \
"to changing heap conditions, at the expense of higher perf " \
"overhead. Time is in milliseconds.") \
\
experimental(uintx, ShenandoahControlIntervalMax, 10, \
product(uintx, ShenandoahControlIntervalMax, 10, EXPERIMENTAL, \
"The maximum sleep interval for control loop that drives " \
"the cycles. Lower values would increase GC responsiveness " \
"to changing heap conditions, at the expense of higher perf " \
"overhead. Time is in milliseconds.") \
\
experimental(uintx, ShenandoahControlIntervalAdjustPeriod, 1000, \
product(uintx, ShenandoahControlIntervalAdjustPeriod, 1000, EXPERIMENTAL, \
"The time period for one step in control loop interval " \
"adjustment. Lower values make adjustments faster, at the " \
"expense of higher perf overhead. Time is in milliseconds.") \
\
diagnostic(bool, ShenandoahVerify, false, \
product(bool, ShenandoahVerify, false, DIAGNOSTIC, \
"Enable internal verification. This would catch many GC bugs, " \
"but it would also stall the collector during the verification, " \
"which prolongs the pauses and might hide other bugs.") \
\
diagnostic(intx, ShenandoahVerifyLevel, 4, \
product(intx, ShenandoahVerifyLevel, 4, DIAGNOSTIC, \
"Verification level, higher levels check more, taking more time. "\
"Accepted values are:" \
" 0 = basic heap checks; " \
@ -205,34 +199,34 @@
" 3 = previous level, plus all reachable objects; " \
" 4 = previous level, plus all marked objects") \
\
diagnostic(bool, ShenandoahElasticTLAB, true, \
product(bool, ShenandoahElasticTLAB, true, DIAGNOSTIC, \
"Use Elastic TLABs with Shenandoah") \
\
experimental(uintx, ShenandoahEvacReserve, 5, \
product(uintx, ShenandoahEvacReserve, 5, EXPERIMENTAL, \
"How much of heap to reserve for evacuations. Larger values make "\
"GC evacuate more live objects on every cycle, while leaving " \
"less headroom for application to allocate in. In percents of " \
"total heap size.") \
range(1,100) \
\
experimental(double, ShenandoahEvacWaste, 1.2, \
product(double, ShenandoahEvacWaste, 1.2, EXPERIMENTAL, \
"How much waste evacuations produce within the reserved space. " \
"Larger values make evacuations more resilient against " \
"evacuation conflicts, at expense of evacuating less on each " \
"GC cycle.") \
range(1.0,100.0) \
\
experimental(bool, ShenandoahEvacReserveOverflow, true, \
product(bool, ShenandoahEvacReserveOverflow, true, EXPERIMENTAL, \
"Allow evacuations to overflow the reserved space. Enabling it " \
"will make evacuations more resilient when evacuation " \
"reserve/waste is incorrect, at the risk that application " \
"runs out of memory too early.") \
\
experimental(bool, ShenandoahPacing, true, \
product(bool, ShenandoahPacing, true, EXPERIMENTAL, \
"Pace application allocations to give GC chance to start " \
"and complete before allocation failure is reached.") \
\
experimental(uintx, ShenandoahPacingMaxDelay, 10, \
product(uintx, ShenandoahPacingMaxDelay, 10, EXPERIMENTAL, \
"Max delay for pacing application allocations. Larger values " \
"provide more resilience against out of memory, at expense at " \
"hiding the GC latencies in the allocation path. Time is in " \
@ -240,7 +234,7 @@
"GC effectively stall the threads indefinitely instead of going " \
"to degenerated or Full GC.") \
\
experimental(uintx, ShenandoahPacingIdleSlack, 2, \
product(uintx, ShenandoahPacingIdleSlack, 2, EXPERIMENTAL, \
"How much of heap counted as non-taxable allocations during idle "\
"phases. Larger value makes the pacing milder when collector is " \
"idle, requiring less rendezvous with control thread. Lower " \
@ -248,101 +242,101 @@
"allocs. In percent of total heap size.") \
range(0, 100) \
\
experimental(uintx, ShenandoahPacingCycleSlack, 10, \
product(uintx, ShenandoahPacingCycleSlack, 10, EXPERIMENTAL, \
"How much of free space to take as non-taxable allocations " \
"the GC cycle. Larger value makes the pacing milder at the " \
"beginning of the GC cycle. Lower value makes the pacing less " \
"uniform during the cycle. In percent of free space.") \
range(0, 100) \
\
experimental(double, ShenandoahPacingSurcharge, 1.1, \
product(double, ShenandoahPacingSurcharge, 1.1, EXPERIMENTAL, \
"Additional pacing tax surcharge to help unclutter the heap. " \
"Larger values makes the pacing more aggressive. Lower values " \
"risk GC cycles finish with less memory than were available at " \
"the beginning of it.") \
range(1.0, 100.0) \
\
experimental(uintx, ShenandoahCriticalFreeThreshold, 1, \
product(uintx, ShenandoahCriticalFreeThreshold, 1, EXPERIMENTAL, \
"How much of the heap needs to be free after recovery cycles, " \
"either Degenerated or Full GC to be claimed successful. If this "\
"much space is not available, next recovery step would be " \
"triggered.") \
range(0, 100) \
\
diagnostic(bool, ShenandoahDegeneratedGC, true, \
product(bool, ShenandoahDegeneratedGC, true, DIAGNOSTIC, \
"Enable Degenerated GC as the graceful degradation step. " \
"Disabling this option leads to degradation to Full GC instead. " \
"When running in passive mode, this can be toggled to measure " \
"either Degenerated GC or Full GC costs.") \
\
experimental(uintx, ShenandoahFullGCThreshold, 3, \
product(uintx, ShenandoahFullGCThreshold, 3, EXPERIMENTAL, \
"How many back-to-back Degenerated GCs should happen before " \
"going to a Full GC.") \
\
experimental(bool, ShenandoahImplicitGCInvokesConcurrent, false, \
product(bool, ShenandoahImplicitGCInvokesConcurrent, false, EXPERIMENTAL, \
"Should internally-caused GC requests invoke concurrent cycles, " \
"should they do the stop-the-world (Degenerated / Full GC)? " \
"Many heuristics automatically enable this. This option is " \
"similar to global ExplicitGCInvokesConcurrent.") \
\
diagnostic(bool, ShenandoahHumongousMoves, true, \
product(bool, ShenandoahHumongousMoves, true, DIAGNOSTIC, \
"Allow moving humongous regions. This makes GC more resistant " \
"to external fragmentation that may otherwise fail other " \
"humongous allocations, at the expense of higher GC copying " \
"costs. Currently affects stop-the-world (Full) cycle only.") \
\
diagnostic(bool, ShenandoahOOMDuringEvacALot, false, \
product(bool, ShenandoahOOMDuringEvacALot, false, DIAGNOSTIC, \
"Testing: simulate OOM during evacuation.") \
\
diagnostic(bool, ShenandoahAllocFailureALot, false, \
product(bool, ShenandoahAllocFailureALot, false, DIAGNOSTIC, \
"Testing: make lots of artificial allocation failures.") \
\
experimental(intx, ShenandoahMarkScanPrefetch, 32, \
product(intx, ShenandoahMarkScanPrefetch, 32, EXPERIMENTAL, \
"How many objects to prefetch ahead when traversing mark bitmaps."\
"Set to 0 to disable prefetching.") \
range(0, 256) \
\
experimental(uintx, ShenandoahMarkLoopStride, 1000, \
product(uintx, ShenandoahMarkLoopStride, 1000, EXPERIMENTAL, \
"How many items to process during one marking iteration before " \
"checking for cancellation, yielding, etc. Larger values improve "\
"marking performance at expense of responsiveness.") \
\
experimental(uintx, ShenandoahParallelRegionStride, 1024, \
product(uintx, ShenandoahParallelRegionStride, 1024, EXPERIMENTAL, \
"How many regions to process at once during parallel region " \
"iteration. Affects heaps with lots of regions.") \
\
experimental(size_t, ShenandoahSATBBufferSize, 1 * K, \
product(size_t, ShenandoahSATBBufferSize, 1 * K, EXPERIMENTAL, \
"Number of entries in an SATB log buffer.") \
range(1, max_uintx) \
\
experimental(uintx, ShenandoahSATBBufferFlushInterval, 100, \
product(uintx, ShenandoahSATBBufferFlushInterval, 100, EXPERIMENTAL, \
"Forcefully flush non-empty SATB buffers at this interval. " \
"Time is in milliseconds.") \
\
diagnostic(bool, ShenandoahPreclean, true, \
product(bool, ShenandoahPreclean, true, DIAGNOSTIC, \
"Do concurrent preclean phase before final mark: process " \
"definitely alive references to avoid dealing with them during " \
"pause.") \
\
experimental(bool, ShenandoahSuspendibleWorkers, false, \
product(bool, ShenandoahSuspendibleWorkers, false, EXPERIMENTAL, \
"Suspend concurrent GC worker threads at safepoints") \
\
diagnostic(bool, ShenandoahSATBBarrier, true, \
product(bool, ShenandoahSATBBarrier, true, DIAGNOSTIC, \
"Turn on/off SATB barriers in Shenandoah") \
\
diagnostic(bool, ShenandoahStoreValEnqueueBarrier, false, \
product(bool, ShenandoahStoreValEnqueueBarrier, false, DIAGNOSTIC, \
"Turn on/off enqueuing of oops for storeval barriers") \
\
diagnostic(bool, ShenandoahCASBarrier, true, \
product(bool, ShenandoahCASBarrier, true, DIAGNOSTIC, \
"Turn on/off CAS barriers in Shenandoah") \
\
diagnostic(bool, ShenandoahCloneBarrier, true, \
product(bool, ShenandoahCloneBarrier, true, DIAGNOSTIC, \
"Turn on/off clone barriers in Shenandoah") \
\
diagnostic(bool, ShenandoahLoadRefBarrier, true, \
product(bool, ShenandoahLoadRefBarrier, true, DIAGNOSTIC, \
"Turn on/off load-reference barriers in Shenandoah") \
\
diagnostic(uintx, ShenandoahCodeRootsStyle, 2, \
product(uintx, ShenandoahCodeRootsStyle, 2, DIAGNOSTIC, \
"Use this style to scan the code cache roots:" \
" 0 - sequential iterator;" \
" 1 - parallel iterator;" \
@ -351,12 +345,13 @@
develop(bool, ShenandoahVerifyOptoBarriers, false, \
"Verify no missing barriers in C2.") \
\
diagnostic(bool, ShenandoahLoopOptsAfterExpansion, true, \
product(bool, ShenandoahLoopOptsAfterExpansion, true, DIAGNOSTIC, \
"Attempt more loop opts after barrier expansion.") \
\
diagnostic(bool, ShenandoahSelfFixing, true, \
product(bool, ShenandoahSelfFixing, true, DIAGNOSTIC, \
"Fix references with load reference barrier. Disabling this " \
"might degrade performance.") \
"might degrade performance.")
// end of GC_SHENANDOAH_FLAGS
#endif // SHARE_GC_SHENANDOAH_SHENANDOAH_GLOBALS_HPP

View file

@ -28,13 +28,7 @@
develop_pd, \
product, \
product_pd, \
diagnostic, \
diagnostic_pd, \
experimental, \
notproduct, \
manageable, \
product_rw, \
lp64_product, \
range, \
constraint) \
\
@ -61,23 +55,25 @@
"Uncommit memory if it has been unused for the specified " \
"amount of time (in seconds)") \
\
diagnostic(uint, ZStatisticsInterval, 10, \
product(uint, ZStatisticsInterval, 10, DIAGNOSTIC, \
"Time between statistics print outs (in seconds)") \
range(1, (uint)-1) \
\
diagnostic(bool, ZVerifyViews, false, \
product(bool, ZVerifyViews, false, DIAGNOSTIC, \
"Verify heap view accesses") \
\
diagnostic(bool, ZVerifyRoots, trueInDebug, \
product(bool, ZVerifyRoots, trueInDebug, DIAGNOSTIC, \
"Verify roots") \
\
diagnostic(bool, ZVerifyObjects, false, \
product(bool, ZVerifyObjects, false, DIAGNOSTIC, \
"Verify objects") \
\
diagnostic(bool, ZVerifyMarking, trueInDebug, \
product(bool, ZVerifyMarking, trueInDebug, DIAGNOSTIC, \
"Verify marking stacks") \
\
diagnostic(bool, ZVerifyForwarding, false, \
product(bool, ZVerifyForwarding, false, DIAGNOSTIC, \
"Verify forwarding tables")
// end of GC_Z_FLAGS
#endif // SHARE_GC_Z_Z_GLOBALS_HPP

View file

@ -38,9 +38,9 @@ bool JVMCIGlobals::check_jvmci_flags_are_consistent() {
#ifndef PRODUCT
#define APPLY_JVMCI_FLAGS(params3, params4) \
JVMCI_FLAGS(params4, params3, params4, params3, params4, params3, params4, params4, IGNORE_RANGE, IGNORE_CONSTRAINT)
#define JVMCI_DECLARE_CHECK4(type, name, value, doc) bool name##checked = false;
#define JVMCI_DECLARE_CHECK3(type, name, doc) bool name##checked = false;
JVMCI_FLAGS(params4, params3, params4, params3, params4, IGNORE_RANGE, IGNORE_CONSTRAINT)
#define JVMCI_DECLARE_CHECK4(type, name, value, ...) bool name##checked = false;
#define JVMCI_DECLARE_CHECK3(type, name, ...) bool name##checked = false;
#define JVMCI_FLAG_CHECKED(name) name##checked = true;
APPLY_JVMCI_FLAGS(JVMCI_DECLARE_CHECK3, JVMCI_DECLARE_CHECK4)
#else
@ -131,8 +131,8 @@ bool JVMCIGlobals::check_jvmci_flags_are_consistent() {
#endif // !COMPILER2
#ifndef PRODUCT
#define JVMCI_CHECK4(type, name, value, doc) assert(name##checked, #name " flag not checked");
#define JVMCI_CHECK3(type, name, doc) assert(name##checked, #name " flag not checked");
#define JVMCI_CHECK4(type, name, value, ...) assert(name##checked, #name " flag not checked");
#define JVMCI_CHECK3(type, name, ...) assert(name##checked, #name " flag not checked");
// Ensures that all JVMCI flags are checked by this method.
APPLY_JVMCI_FLAGS(JVMCI_CHECK3, JVMCI_CHECK4)
#undef APPLY_JVMCI_FLAGS

View file

@ -30,54 +30,51 @@
class fileStream;
//
// Defines all global flags used by the JVMCI compiler. Only flags that need
// Declare all global flags used by the JVMCI compiler. Only flags that need
// to be accessible to the JVMCI C++ code should be defined here.
//
#define JVMCI_FLAGS(develop, \
develop_pd, \
product, \
product_pd, \
diagnostic, \
diagnostic_pd, \
experimental, \
notproduct, \
range, \
constraint) \
\
experimental(bool, EnableJVMCI, false, \
product(bool, EnableJVMCI, false, EXPERIMENTAL, \
"Enable JVMCI") \
\
experimental(bool, EnableJVMCIProduct, false, \
product(bool, EnableJVMCIProduct, false, EXPERIMENTAL, \
"Allow JVMCI to be used in product mode. This alters a subset of "\
"JVMCI flags to be non-experimental, defaults UseJVMCICompiler " \
"and EnableJVMCI to true and defaults UseJVMCINativeLibrary " \
"to true if a JVMCI native library is available.") \
\
experimental(bool, UseJVMCICompiler, false, \
product(bool, UseJVMCICompiler, false, EXPERIMENTAL, \
"Use JVMCI as the default compiler. Defaults to true if " \
"EnableJVMCIProduct is true.") \
\
experimental(bool, JVMCIPrintProperties, false, \
product(bool, JVMCIPrintProperties, false, EXPERIMENTAL, \
"Prints properties used by the JVMCI compiler and exits") \
\
experimental(bool, BootstrapJVMCI, false, \
product(bool, BootstrapJVMCI, false, EXPERIMENTAL, \
"Bootstrap JVMCI before running Java main method. This " \
"initializes the compile queue with a small set of methods " \
"and processes the queue until it is empty. Combining this with " \
"-XX:-TieredCompilation makes JVMCI compile more of itself.") \
\
experimental(bool, EagerJVMCI, false, \
product(bool, EagerJVMCI, false, EXPERIMENTAL, \
"Force eager JVMCI initialization") \
\
experimental(bool, PrintBootstrap, true, \
product(bool, PrintBootstrap, true, EXPERIMENTAL, \
"Print JVMCI bootstrap progress and summary") \
\
experimental(intx, JVMCIThreads, 1, \
product(intx, JVMCIThreads, 1, EXPERIMENTAL, \
"Force number of JVMCI compiler threads to use. Ignored if " \
"UseJVMCICompiler is false.") \
range(1, max_jint) \
\
experimental(intx, JVMCIHostThreads, 1, \
product(intx, JVMCIHostThreads, 1, EXPERIMENTAL, \
"Force number of C1 compiler threads. Ignored if " \
"UseJVMCICompiler is false.") \
range(1, max_jint) \
@ -90,56 +87,58 @@ class fileStream;
NOT_COMPILER2(product(bool, ReduceInitialCardMarks, true, \
"Defer write barriers of young objects")) \
\
experimental(intx, JVMCIEventLogLevel, 1, \
product(intx, JVMCIEventLogLevel, 1, EXPERIMENTAL, \
"Event log level for JVMCI") \
range(0, 4) \
\
experimental(intx, JVMCITraceLevel, 0, \
product(intx, JVMCITraceLevel, 0, EXPERIMENTAL, \
"Trace level for JVMCI") \
range(0, 4) \
\
experimental(intx, JVMCICounterSize, 0, \
product(intx, JVMCICounterSize, 0, EXPERIMENTAL, \
"Reserved size for benchmark counters") \
range(0, 1000000) \
\
experimental(bool, JVMCICountersExcludeCompiler, true, \
product(bool, JVMCICountersExcludeCompiler, true, EXPERIMENTAL, \
"Exclude JVMCI compiler threads from benchmark counters") \
\
develop(bool, JVMCIUseFastLocking, true, \
"Use fast inlined locking code") \
\
experimental(intx, JVMCINMethodSizeLimit, (80*K)*wordSize, \
product(intx, JVMCINMethodSizeLimit, (80*K)*wordSize, EXPERIMENTAL, \
"Maximum size of a compiled method.") \
range(0, max_jint) \
\
experimental(ccstr, JVMCILibPath, NULL, \
product(ccstr, JVMCILibPath, NULL, EXPERIMENTAL, \
"LD path for loading the JVMCI shared library") \
\
experimental(ccstr, JVMCILibDumpJNIConfig, NULL, \
product(ccstr, JVMCILibDumpJNIConfig, NULL, EXPERIMENTAL, \
"Dumps to the given file a description of the classes, fields " \
"and methods the JVMCI shared library must provide") \
\
experimental(bool, UseJVMCINativeLibrary, false, \
product(bool, UseJVMCINativeLibrary, false, EXPERIMENTAL, \
"Execute JVMCI Java code from a shared library " \
"instead of loading it from class files and executing it " \
"on the HotSpot heap. Defaults to true if EnableJVMCIProduct is " \
"true and a JVMCI native library is available.") \
\
NOT_COMPILER2(diagnostic(bool, UseMultiplyToLenIntrinsic, false, \
NOT_COMPILER2(product(bool, UseMultiplyToLenIntrinsic, false, DIAGNOSTIC, \
"Enables intrinsification of BigInteger.multiplyToLen()")) \
\
NOT_COMPILER2(diagnostic(bool, UseSquareToLenIntrinsic, false, \
NOT_COMPILER2(product(bool, UseSquareToLenIntrinsic, false, DIAGNOSTIC, \
"Enables intrinsification of BigInteger.squareToLen()")) \
\
NOT_COMPILER2(diagnostic(bool, UseMulAddIntrinsic, false, \
NOT_COMPILER2(product(bool, UseMulAddIntrinsic, false, DIAGNOSTIC, \
"Enables intrinsification of BigInteger.mulAdd()")) \
\
NOT_COMPILER2(diagnostic(bool, UseMontgomeryMultiplyIntrinsic, false, \
NOT_COMPILER2(product(bool, UseMontgomeryMultiplyIntrinsic, false, DIAGNOSTIC, \
"Enables intrinsification of BigInteger.montgomeryMultiply()")) \
\
NOT_COMPILER2(diagnostic(bool, UseMontgomerySquareIntrinsic, false, \
NOT_COMPILER2(product(bool, UseMontgomerySquareIntrinsic, false, DIAGNOSTIC, \
"Enables intrinsification of BigInteger.montgomerySquare()"))
// end of JVMCI_FLAGS
// The base name for the shared library containing the JVMCI based compiler
#define JVMCI_SHARED_LIBRARY_NAME "jvmcicompiler"

View file

@ -149,12 +149,6 @@
nonstatic_field(ExceptionTableElement, handler_pc, u2) \
nonstatic_field(ExceptionTableElement, catch_type_index, u2) \
\
nonstatic_field(JVMFlag, _type, const char*) \
nonstatic_field(JVMFlag, _name, const char*) \
unchecked_nonstatic_field(JVMFlag, _addr, sizeof(void*)) \
nonstatic_field(JVMFlag, _flags, JVMFlag::Flags) \
static_field(JVMFlag, flags, JVMFlag*) \
\
nonstatic_field(InstanceKlass, _fields, Array<u2>*) \
nonstatic_field(InstanceKlass, _constants, ConstantPool*) \
nonstatic_field(InstanceKlass, _init_state, u1) \

View file

@ -39,17 +39,14 @@
develop_pd, \
product, \
product_pd, \
diagnostic, \
diagnostic_pd, \
experimental, \
notproduct, \
range, \
constraint) \
\
diagnostic(bool, StressLCM, false, \
product(bool, StressLCM, false, DIAGNOSTIC, \
"Randomize instruction scheduling in LCM") \
\
diagnostic(bool, StressGCM, false, \
product(bool, StressGCM, false, DIAGNOSTIC, \
"Randomize instruction scheduling in GCM") \
\
develop(bool, StressMethodHandleLinkerInlining, false, \
@ -116,7 +113,7 @@
"Check performance difference allowing FP " \
"associativity and commutativity...") \
\
diagnostic_pd(bool, IdealizeClearArrayNode, \
product_pd(bool, IdealizeClearArrayNode, DIAGNOSTIC, \
"Replace ClearArrayNode by subgraph of basic operations.") \
\
develop(bool, OptoBreakpoint, false, \
@ -137,7 +134,7 @@
notproduct(bool, PrintOptoStatistics, false, \
"Print New compiler statistics") \
\
diagnostic(bool, PrintOptoAssembly, false, \
product(bool, PrintOptoAssembly, false, DIAGNOSTIC, \
"Print New compiler assembly output") \
\
develop_pd(bool, OptoPeephole, \
@ -177,13 +174,13 @@
"Map number of unrolls for main loop via " \
"Superword Level Parallelism analysis") \
\
experimental(bool, PostLoopMultiversioning, false, \
product(bool, PostLoopMultiversioning, false, EXPERIMENTAL, \
"Multi versioned post loops to eliminate range checks") \
\
notproduct(bool, TraceSuperWordLoopUnrollAnalysis, false, \
"Trace what Superword Level Parallelism analysis applies") \
\
diagnostic(bool, UseVectorMacroLogic, true, \
product(bool, UseVectorMacroLogic, true, DIAGNOSTIC, \
"Use ternary macro logic instructions") \
\
product(intx, LoopUnrollMin, 4, \
@ -482,11 +479,11 @@
notproduct(bool, PrintLockStatistics, false, \
"Print precise statistics on the dynamic lock usage") \
\
diagnostic(bool, PrintPreciseBiasedLockingStatistics, false, \
product(bool, PrintPreciseBiasedLockingStatistics, false, DIAGNOSTIC, \
"(Deprecated) Print per-lock-site statistics of biased locking " \
"in JVM") \
\
diagnostic(bool, PrintPreciseRTMLockingStatistics, false, \
product(bool, PrintPreciseRTMLockingStatistics, false, DIAGNOSTIC, \
"Print per-lock-site statistics of rtm locking in JVM") \
\
notproduct(bool, PrintEliminateLocks, false, \
@ -499,7 +496,7 @@
"Sets max value cached by the java.lang.Integer autobox cache") \
range(0, max_jint) \
\
diagnostic(bool, AggressiveUnboxing, true, \
product(bool, AggressiveUnboxing, true, DIAGNOSTIC, \
"Control optimizations for aggressive boxing elimination") \
\
develop(bool, TracePostallocExpand, false, "Trace expanding nodes after" \
@ -554,7 +551,7 @@
"Maximum times call Label_Root to prevent stack overflow") \
range(100, max_jint) \
\
diagnostic(intx, DominatorSearchLimit, 1000, \
product(intx, DominatorSearchLimit, 1000, DIAGNOSTIC, \
"Iterations limit in Node::dominates") \
range(0, max_jint) \
\
@ -569,26 +566,26 @@
product(bool, BlockLayoutRotateLoops, true, \
"Allow back branches to be fall throughs in the block layout") \
\
diagnostic(bool, InlineReflectionGetCallerClass, true, \
product(bool, InlineReflectionGetCallerClass, true, DIAGNOSTIC, \
"inline sun.reflect.Reflection.getCallerClass(), known to be " \
"part of base library DLL") \
\
diagnostic(bool, InlineObjectCopy, true, \
product(bool, InlineObjectCopy, true, DIAGNOSTIC, \
"inline Object.clone and Arrays.copyOf[Range] intrinsics") \
\
diagnostic(bool, SpecialStringCompareTo, true, \
product(bool, SpecialStringCompareTo, true, DIAGNOSTIC, \
"special version of string compareTo") \
\
diagnostic(bool, SpecialStringIndexOf, true, \
product(bool, SpecialStringIndexOf, true, DIAGNOSTIC, \
"special version of string indexOf") \
\
diagnostic(bool, SpecialStringEquals, true, \
product(bool, SpecialStringEquals, true, DIAGNOSTIC, \
"special version of string equals") \
\
diagnostic(bool, SpecialArraysEquals, true, \
product(bool, SpecialArraysEquals, true, DIAGNOSTIC, \
"special version of Arrays.equals(char[],char[])") \
\
diagnostic(bool, SpecialEncodeISOArray, true, \
product(bool, SpecialEncodeISOArray, true, DIAGNOSTIC, \
"special version of ISO_8859_1$Encoder.encodeISOArray") \
\
develop(bool, BailoutToInterpreterForThrows, false, \
@ -610,10 +607,10 @@
develop(bool, PrintDominators, false, \
"Print out dominator trees for GVN") \
\
diagnostic(bool, TraceSpilling, false, \
product(bool, TraceSpilling, false, DIAGNOSTIC, \
"Trace spilling") \
\
diagnostic(bool, TraceTypeProfile, false, \
product(bool, TraceTypeProfile, false, DIAGNOSTIC, \
"Trace type profile") \
\
develop(bool, PoisonOSREntry, true, \
@ -629,19 +626,19 @@
"% of major receiver type to all profiled receivers") \
range(0, 100) \
\
diagnostic(bool, PrintIntrinsics, false, \
product(bool, PrintIntrinsics, false, DIAGNOSTIC, \
"prints attempted and successful inlining of intrinsics") \
\
develop(bool, StressReflectiveCode, false, \
"Use inexact types at allocations, etc., to test reflection") \
\
diagnostic(bool, DebugInlinedCalls, true, \
product(bool, DebugInlinedCalls, true, DIAGNOSTIC, \
"If false, restricts profiled locations to the root method only") \
\
notproduct(bool, VerifyLoopOptimizations, false, \
"verify major loop optimizations") \
\
diagnostic(bool, ProfileDynamicTypes, true, \
product(bool, ProfileDynamicTypes, true, DIAGNOSTIC, \
"do extra type profiling and use it more aggressively") \
\
develop(bool, TraceIterativeGVN, false, \
@ -710,34 +707,34 @@
"max number of live nodes in a method") \
range(0, max_juint / 8) \
\
diagnostic(bool, OptimizeExpensiveOps, true, \
product(bool, OptimizeExpensiveOps, true, DIAGNOSTIC, \
"Find best control for expensive operations") \
\
diagnostic(bool, UseMathExactIntrinsics, true, \
product(bool, UseMathExactIntrinsics, true, DIAGNOSTIC, \
"Enables intrinsification of various java.lang.Math functions") \
\
diagnostic(bool, UseCharacterCompareIntrinsics, false, \
product(bool, UseCharacterCompareIntrinsics, false, DIAGNOSTIC, \
"Enables intrinsification of java.lang.Character functions") \
\
diagnostic(bool, UseMultiplyToLenIntrinsic, false, \
product(bool, UseMultiplyToLenIntrinsic, false, DIAGNOSTIC, \
"Enables intrinsification of BigInteger.multiplyToLen()") \
\
diagnostic(bool, UseSquareToLenIntrinsic, false, \
product(bool, UseSquareToLenIntrinsic, false, DIAGNOSTIC, \
"Enables intrinsification of BigInteger.squareToLen()") \
\
diagnostic(bool, UseMulAddIntrinsic, false, \
product(bool, UseMulAddIntrinsic, false, DIAGNOSTIC, \
"Enables intrinsification of BigInteger.mulAdd()") \
\
diagnostic(bool, UseMontgomeryMultiplyIntrinsic, false, \
product(bool, UseMontgomeryMultiplyIntrinsic, false, DIAGNOSTIC, \
"Enables intrinsification of BigInteger.montgomeryMultiply()") \
\
diagnostic(bool, UseMontgomerySquareIntrinsic, false, \
product(bool, UseMontgomerySquareIntrinsic, false, DIAGNOSTIC, \
"Enables intrinsification of BigInteger.montgomerySquare()") \
\
product(bool, UseTypeSpeculation, true, \
"Speculatively propagate types from profiles") \
\
diagnostic(bool, UseInlineDepthForSpeculativeTypes, true, \
product(bool, UseInlineDepthForSpeculativeTypes, true, DIAGNOSTIC, \
"Carry inline depth of profile point with speculative type " \
"and give priority to profiling from lower inline depth") \
\
@ -768,7 +765,9 @@
product(bool, UseProfiledLoopPredicate, true, \
"Move predicates out of loops based on profiling data") \
\
diagnostic(bool, ExpandSubTypeCheckAtParseTime, false, \
"Do not use subtype check macro node") \
product(bool, ExpandSubTypeCheckAtParseTime, false, DIAGNOSTIC, \
"Do not use subtype check macro node")
// end of C2_FLAGS
#endif // SHARE_OPTO_C2_GLOBALS_HPP

View file

@ -3898,10 +3898,7 @@ bool Arguments::handle_deprecated_print_gc_flags() {
jint Arguments::parse(const JavaVMInitArgs* initial_cmd_args) {
assert(verify_special_jvm_flags(false), "deprecated and obsolete flag table inconsistent");
// Initialize ranges and constraints
JVMFlagRangeList::init();
JVMFlagConstraintList::init();
JVMFlag::check_all_flag_declarations();
// If flag "-XX:Flags=flags-file" is used it will be the first option to be processed.
const char* hotspotrc = ".hotspotrc";

View file

@ -28,6 +28,7 @@
#include "runtime/arguments.hpp"
#include "runtime/flags/jvmFlag.hpp"
#include "runtime/flags/jvmFlagConstraintList.hpp"
#include "runtime/flags/jvmFlagLookup.hpp"
#include "runtime/flags/jvmFlagRangeList.hpp"
#include "runtime/globals_extension.hpp"
#include "utilities/defaultStream.hpp"
@ -131,7 +132,7 @@ bool JVMFlag::ccstr_accumulates() const {
return strcmp(_type, "ccstrlist") == 0;
}
JVMFlag::Flags JVMFlag::get_origin() {
JVMFlag::Flags JVMFlag::get_origin() const {
return Flags(_flags & VALUE_ORIGIN_MASK);
}
@ -141,19 +142,19 @@ void JVMFlag::set_origin(Flags origin) {
_flags = Flags((_flags & ~VALUE_ORIGIN_MASK) | new_origin);
}
bool JVMFlag::is_default() {
bool JVMFlag::is_default() const {
return (get_origin() == DEFAULT);
}
bool JVMFlag::is_ergonomic() {
bool JVMFlag::is_ergonomic() const {
return (get_origin() == ERGONOMIC);
}
bool JVMFlag::is_command_line() {
bool JVMFlag::is_command_line() const {
return (_flags & ORIG_COMMAND_LINE) != 0;
}
bool JVMFlag::is_jimage_resource() {
bool JVMFlag::is_jimage_resource() const {
return (get_origin() == JIMAGE_RESOURCE);
}
@ -185,10 +186,6 @@ bool JVMFlag::is_develop() const {
return (_flags & KIND_DEVELOP) != 0;
}
bool JVMFlag::is_read_write() const {
return (_flags & KIND_READ_WRITE) != 0;
}
/**
* Returns if this flag is a constant in the binary. Right now this is
* true for notproduct and develop flags in product builds.
@ -266,7 +263,7 @@ JVMFlag::MsgType JVMFlag::get_locked_message(char* buf, int buflen) const {
}
bool JVMFlag::is_writeable() const {
return is_manageable() || (is_product() && is_read_write());
return is_manageable();
}
// All flags except "manageable" are assumed to be internal flags.
@ -288,7 +285,7 @@ void fill_to_pos(outputStream* st, unsigned int req_pos) {
}
}
void JVMFlag::print_on(outputStream* st, bool withComments, bool printRanges) {
void JVMFlag::print_on(outputStream* st, bool withComments, bool printRanges) const {
// Don't print notproduct and develop flags in a product build.
if (is_constant_in_binary()) {
return;
@ -496,7 +493,7 @@ void JVMFlag::print_on(outputStream* st, bool withComments, bool printRanges) {
}
}
void JVMFlag::print_kind(outputStream* st, unsigned int width) {
void JVMFlag::print_kind(outputStream* st, unsigned int width) const {
struct Data {
int flag;
const char* name;
@ -515,7 +512,6 @@ void JVMFlag::print_kind(outputStream* st, unsigned int width) {
{ KIND_NOT_PRODUCT, "notproduct" },
{ KIND_DEVELOP, "develop" },
{ KIND_LP64_PRODUCT, "lp64_product" },
{ KIND_READ_WRITE, "rw" },
{ -1, "" }
};
@ -549,7 +545,7 @@ void JVMFlag::print_kind(outputStream* st, unsigned int width) {
}
}
void JVMFlag::print_origin(outputStream* st, unsigned int width) {
void JVMFlag::print_origin(outputStream* st, unsigned int width) const {
int origin = _flags & VALUE_ORIGIN_MASK;
st->print("{");
switch(origin) {
@ -578,7 +574,7 @@ void JVMFlag::print_origin(outputStream* st, unsigned int width) {
st->print("}");
}
void JVMFlag::print_as_flag(outputStream* st) {
void JVMFlag::print_as_flag(outputStream* st) const {
if (is_bool()) {
st->print("-XX:%s%s", get_bool() ? "+" : "-", _name);
} else if (is_int()) {
@ -633,167 +629,125 @@ const char* JVMFlag::flag_error_str(JVMFlag::Error error) {
}
}
// 4991491 do not "optimize out" the was_set false values: omitting them
// tickles a Microsoft compiler bug causing flagTable to be malformed
//----------------------------------------------------------------------
// Build flagTable[]
#define RUNTIME_PRODUCT_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_PRODUCT) },
#define RUNTIME_PD_PRODUCT_FLAG_STRUCT( type, name, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_PRODUCT | JVMFlag::KIND_PLATFORM_DEPENDENT) },
#define RUNTIME_DIAGNOSTIC_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_DIAGNOSTIC) },
#define RUNTIME_PD_DIAGNOSTIC_FLAG_STRUCT(type, name, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_DIAGNOSTIC | JVMFlag::KIND_PLATFORM_DEPENDENT) },
#define RUNTIME_EXPERIMENTAL_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_EXPERIMENTAL) },
#define RUNTIME_MANAGEABLE_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_MANAGEABLE) },
#define RUNTIME_PRODUCT_RW_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_PRODUCT | JVMFlag::KIND_READ_WRITE) },
#define RUNTIME_DEVELOP_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), (void*) &name, NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_DEVELOP) },
#define RUNTIME_PD_DEVELOP_FLAG_STRUCT( type, name, doc) { #type, XSTR(name), (void*) &name, NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_DEVELOP | JVMFlag::KIND_PLATFORM_DEPENDENT) },
#define RUNTIME_NOTPRODUCT_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), (void*) &name, NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_NOT_PRODUCT) },
// Find out the number of LP64/JVMCI/COMPILER1/COMPILER1/ARCH flags,
// for JVMFlag::flag_group()
#define JVMCI_PRODUCT_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_JVMCI | JVMFlag::KIND_PRODUCT) },
#define JVMCI_PD_PRODUCT_FLAG_STRUCT( type, name, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_JVMCI | JVMFlag::KIND_PRODUCT | JVMFlag::KIND_PLATFORM_DEPENDENT) },
#define JVMCI_DIAGNOSTIC_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_JVMCI | JVMFlag::KIND_DIAGNOSTIC) },
#define JVMCI_PD_DIAGNOSTIC_FLAG_STRUCT( type, name, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_JVMCI | JVMFlag::KIND_DIAGNOSTIC | JVMFlag::KIND_PLATFORM_DEPENDENT) },
#define JVMCI_EXPERIMENTAL_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_JVMCI | JVMFlag::KIND_EXPERIMENTAL) },
#define JVMCI_DEVELOP_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), (void*) &name, NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_JVMCI | JVMFlag::KIND_DEVELOP) },
#define JVMCI_PD_DEVELOP_FLAG_STRUCT( type, name, doc) { #type, XSTR(name), (void*) &name, NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_JVMCI | JVMFlag::KIND_DEVELOP | JVMFlag::KIND_PLATFORM_DEPENDENT) },
#define JVMCI_NOTPRODUCT_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), (void*) &name, NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_JVMCI | JVMFlag::KIND_NOT_PRODUCT) },
#define ENUM_F(type, name, ...) enum_##name,
#define IGNORE_F(...)
#ifdef _LP64
#define RUNTIME_LP64_PRODUCT_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_LP64_PRODUCT) },
#else
#define RUNTIME_LP64_PRODUCT_FLAG_STRUCT(type, name, value, doc) /* flag is constant */
#endif // _LP64
// dev dev-pd pro pro-pd notpro range constraint
enum FlagCounter_LP64 { LP64_RUNTIME_FLAGS( ENUM_F, ENUM_F, ENUM_F, ENUM_F, ENUM_F, IGNORE_F, IGNORE_F) num_flags_LP64 };
enum FlagCounter_JVMCI { JVMCI_ONLY(JVMCI_FLAGS( ENUM_F, ENUM_F, ENUM_F, ENUM_F, ENUM_F, IGNORE_F, IGNORE_F)) num_flags_JVMCI };
enum FlagCounter_C1 { COMPILER1_PRESENT(C1_FLAGS(ENUM_F, ENUM_F, ENUM_F, ENUM_F, ENUM_F, IGNORE_F, IGNORE_F)) num_flags_C1 };
enum FlagCounter_C2 { COMPILER2_PRESENT(C2_FLAGS(ENUM_F, ENUM_F, ENUM_F, ENUM_F, ENUM_F, IGNORE_F, IGNORE_F)) num_flags_C2 };
enum FlagCounter_ARCH { ARCH_FLAGS( ENUM_F, ENUM_F, ENUM_F, IGNORE_F, IGNORE_F) num_flags_ARCH };
#define C1_PRODUCT_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_C1 | JVMFlag::KIND_PRODUCT) },
#define C1_PD_PRODUCT_FLAG_STRUCT( type, name, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_C1 | JVMFlag::KIND_PRODUCT | JVMFlag::KIND_PLATFORM_DEPENDENT) },
#define C1_DIAGNOSTIC_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_C1 | JVMFlag::KIND_DIAGNOSTIC) },
#define C1_PD_DIAGNOSTIC_FLAG_STRUCT( type, name, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_C1 | JVMFlag::KIND_DIAGNOSTIC | JVMFlag::KIND_PLATFORM_DEPENDENT) },
#define C1_DEVELOP_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), (void*) &name, NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_C1 | JVMFlag::KIND_DEVELOP) },
#define C1_PD_DEVELOP_FLAG_STRUCT( type, name, doc) { #type, XSTR(name), (void*) &name, NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_C1 | JVMFlag::KIND_DEVELOP | JVMFlag::KIND_PLATFORM_DEPENDENT) },
#define C1_NOTPRODUCT_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), (void*) &name, NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_C1 | JVMFlag::KIND_NOT_PRODUCT) },
const int first_flag_enum_LP64 = 0;
const int first_flag_enum_JVMCI = first_flag_enum_LP64 + num_flags_LP64;
const int first_flag_enum_C1 = first_flag_enum_JVMCI + num_flags_JVMCI;
const int first_flag_enum_C2 = first_flag_enum_C1 + num_flags_C1;
const int first_flag_enum_ARCH = first_flag_enum_C2 + num_flags_C2;
const int first_flag_enum_other = first_flag_enum_ARCH + num_flags_ARCH;
#define C2_PRODUCT_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_C2 | JVMFlag::KIND_PRODUCT) },
#define C2_PD_PRODUCT_FLAG_STRUCT( type, name, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_C2 | JVMFlag::KIND_PRODUCT | JVMFlag::KIND_PLATFORM_DEPENDENT) },
#define C2_DIAGNOSTIC_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_C2 | JVMFlag::KIND_DIAGNOSTIC) },
#define C2_PD_DIAGNOSTIC_FLAG_STRUCT( type, name, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_C2 | JVMFlag::KIND_DIAGNOSTIC | JVMFlag::KIND_PLATFORM_DEPENDENT) },
#define C2_EXPERIMENTAL_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_C2 | JVMFlag::KIND_EXPERIMENTAL) },
#define C2_DEVELOP_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), (void*) &name, NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_C2 | JVMFlag::KIND_DEVELOP) },
#define C2_PD_DEVELOP_FLAG_STRUCT( type, name, doc) { #type, XSTR(name), (void*) &name, NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_C2 | JVMFlag::KIND_DEVELOP | JVMFlag::KIND_PLATFORM_DEPENDENT) },
#define C2_NOTPRODUCT_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), (void*) &name, NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_C2 | JVMFlag::KIND_NOT_PRODUCT) },
static constexpr int flag_group(int flag_enum) {
if (flag_enum < first_flag_enum_JVMCI) return JVMFlag::KIND_LP64_PRODUCT;
if (flag_enum < first_flag_enum_C1) return JVMFlag::KIND_JVMCI;
if (flag_enum < first_flag_enum_C2) return JVMFlag::KIND_C1;
if (flag_enum < first_flag_enum_ARCH) return JVMFlag::KIND_C2;
if (flag_enum < first_flag_enum_other) return JVMFlag::KIND_ARCH;
#define ARCH_PRODUCT_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_ARCH | JVMFlag::KIND_PRODUCT) },
#define ARCH_DIAGNOSTIC_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_ARCH | JVMFlag::KIND_DIAGNOSTIC) },
#define ARCH_EXPERIMENTAL_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_ARCH | JVMFlag::KIND_EXPERIMENTAL) },
#define ARCH_DEVELOP_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), (void*) &name, NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_ARCH | JVMFlag::KIND_DEVELOP) },
#define ARCH_NOTPRODUCT_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), (void*) &name, NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_ARCH | JVMFlag::KIND_NOT_PRODUCT) },
return 0;
}
static JVMFlag flagTable[] = {
VM_FLAGS(RUNTIME_DEVELOP_FLAG_STRUCT, \
RUNTIME_PD_DEVELOP_FLAG_STRUCT, \
RUNTIME_PRODUCT_FLAG_STRUCT, \
RUNTIME_PD_PRODUCT_FLAG_STRUCT, \
RUNTIME_DIAGNOSTIC_FLAG_STRUCT, \
RUNTIME_PD_DIAGNOSTIC_FLAG_STRUCT, \
RUNTIME_EXPERIMENTAL_FLAG_STRUCT, \
RUNTIME_NOTPRODUCT_FLAG_STRUCT, \
RUNTIME_MANAGEABLE_FLAG_STRUCT, \
RUNTIME_PRODUCT_RW_FLAG_STRUCT, \
RUNTIME_LP64_PRODUCT_FLAG_STRUCT, \
constexpr JVMFlag::JVMFlag(int flag_enum, const char* type, const char* name,
void* addr, int flags, int extra_flags, const char* doc) :
_type(type), _name(name), _addr(addr), _flags() NOT_PRODUCT(COMMA _doc(doc)) {
flags = flags | extra_flags | JVMFlag::DEFAULT | flag_group(flag_enum);
if ((flags & JVMFlag::KIND_PRODUCT) != 0) {
if (flags & (JVMFlag::KIND_DIAGNOSTIC | JVMFlag::KIND_MANAGEABLE | JVMFlag::KIND_EXPERIMENTAL)) {
// Backwards compatibility. This will be relaxed in JDK-7123237.
flags &= ~(JVMFlag::KIND_PRODUCT);
}
}
_flags = static_cast<Flags>(flags);
}
constexpr JVMFlag::JVMFlag(int flag_enum, const char* type, const char* name,
void* addr, int flags, const char* doc) :
JVMFlag(flag_enum, type, name, addr, flags, /*extra_flags*/0, doc) {}
const int PRODUCT_KIND = JVMFlag::KIND_PRODUCT;
const int PRODUCT_KIND_PD = JVMFlag::KIND_PRODUCT | JVMFlag::KIND_PLATFORM_DEPENDENT;
const int DEVELOP_KIND = JVMFlag::KIND_DEVELOP;
const int DEVELOP_KIND_PD = JVMFlag::KIND_DEVELOP | JVMFlag::KIND_PLATFORM_DEPENDENT;
const int NOTPROD_KIND = JVMFlag::KIND_NOT_PRODUCT;
#define DEVELOP_FLAG_INIT( type, name, value, ...) JVMFlag(FLAG_MEMBER_ENUM(name), #type, XSTR(name), (void*)&name, DEVELOP_KIND, __VA_ARGS__),
#define DEVELOP_FLAG_INIT_PD(type, name, ...) JVMFlag(FLAG_MEMBER_ENUM(name), #type, XSTR(name), (void*)&name, DEVELOP_KIND_PD, __VA_ARGS__),
#define PRODUCT_FLAG_INIT( type, name, value, ...) JVMFlag(FLAG_MEMBER_ENUM(name), #type, XSTR(name), (void*)&name, PRODUCT_KIND, __VA_ARGS__),
#define PRODUCT_FLAG_INIT_PD(type, name, ...) JVMFlag(FLAG_MEMBER_ENUM(name), #type, XSTR(name), (void*)&name, PRODUCT_KIND_PD, __VA_ARGS__),
#define NOTPROD_FLAG_INIT( type, name, value, ...) JVMFlag(FLAG_MEMBER_ENUM(name), #type, XSTR(name), (void*)&name, NOTPROD_KIND, __VA_ARGS__),
// Handy aliases to match the symbols used in the flag specification macros.
const int DIAGNOSTIC = JVMFlag::KIND_DIAGNOSTIC;
const int MANAGEABLE = JVMFlag::KIND_MANAGEABLE;
const int EXPERIMENTAL = JVMFlag::KIND_EXPERIMENTAL;
#define MATERIALIZE_ALL_FLAGS \
ALL_FLAGS(DEVELOP_FLAG_INIT, \
DEVELOP_FLAG_INIT_PD, \
PRODUCT_FLAG_INIT, \
PRODUCT_FLAG_INIT_PD, \
NOTPROD_FLAG_INIT, \
IGNORE_RANGE, \
IGNORE_CONSTRAINT)
RUNTIME_OS_FLAGS(RUNTIME_DEVELOP_FLAG_STRUCT, \
RUNTIME_PD_DEVELOP_FLAG_STRUCT, \
RUNTIME_PRODUCT_FLAG_STRUCT, \
RUNTIME_PD_PRODUCT_FLAG_STRUCT, \
RUNTIME_DIAGNOSTIC_FLAG_STRUCT, \
RUNTIME_PD_DIAGNOSTIC_FLAG_STRUCT, \
RUNTIME_NOTPRODUCT_FLAG_STRUCT, \
IGNORE_RANGE, \
IGNORE_CONSTRAINT)
#if INCLUDE_JVMCI
JVMCI_FLAGS(JVMCI_DEVELOP_FLAG_STRUCT, \
JVMCI_PD_DEVELOP_FLAG_STRUCT, \
JVMCI_PRODUCT_FLAG_STRUCT, \
JVMCI_PD_PRODUCT_FLAG_STRUCT, \
JVMCI_DIAGNOSTIC_FLAG_STRUCT, \
JVMCI_PD_DIAGNOSTIC_FLAG_STRUCT, \
JVMCI_EXPERIMENTAL_FLAG_STRUCT, \
JVMCI_NOTPRODUCT_FLAG_STRUCT, \
IGNORE_RANGE, \
IGNORE_CONSTRAINT)
#endif // INCLUDE_JVMCI
#ifdef COMPILER1
C1_FLAGS(C1_DEVELOP_FLAG_STRUCT, \
C1_PD_DEVELOP_FLAG_STRUCT, \
C1_PRODUCT_FLAG_STRUCT, \
C1_PD_PRODUCT_FLAG_STRUCT, \
C1_DIAGNOSTIC_FLAG_STRUCT, \
C1_PD_DIAGNOSTIC_FLAG_STRUCT, \
C1_NOTPRODUCT_FLAG_STRUCT, \
IGNORE_RANGE, \
IGNORE_CONSTRAINT)
#endif // COMPILER1
#ifdef COMPILER2
C2_FLAGS(C2_DEVELOP_FLAG_STRUCT, \
C2_PD_DEVELOP_FLAG_STRUCT, \
C2_PRODUCT_FLAG_STRUCT, \
C2_PD_PRODUCT_FLAG_STRUCT, \
C2_DIAGNOSTIC_FLAG_STRUCT, \
C2_PD_DIAGNOSTIC_FLAG_STRUCT, \
C2_EXPERIMENTAL_FLAG_STRUCT, \
C2_NOTPRODUCT_FLAG_STRUCT, \
IGNORE_RANGE, \
IGNORE_CONSTRAINT)
#endif // COMPILER2
ARCH_FLAGS(ARCH_DEVELOP_FLAG_STRUCT, \
ARCH_PRODUCT_FLAG_STRUCT, \
ARCH_DIAGNOSTIC_FLAG_STRUCT, \
ARCH_EXPERIMENTAL_FLAG_STRUCT, \
ARCH_NOTPRODUCT_FLAG_STRUCT, \
IGNORE_RANGE, \
IGNORE_CONSTRAINT)
{0, NULL, NULL}
static JVMFlag flagTable[NUM_JVMFlagsEnum + 1] = {
MATERIALIZE_ALL_FLAGS
JVMFlag() // The iteration code wants a flag with a NULL name at the end of the table.
};
// We want flagTable[] to be completely initialized at C++ compilation time, which requires
// that all arguments passed to JVMFlag() constructors be constexpr. The following line
// checks for this -- if any non-constexpr arguments are passed, the C++ compiler will
// generate an error.
//
// constexpr implies internal linkage. This means the flagTable_verify_constexpr[] variable
// will not be included in jvmFlag.o, so there's no footprint cost for having this variable.
//
// Note that we cannot declare flagTable[] as constexpr because JVMFlag::_flags is modified
// at runtime.
constexpr JVMFlag flagTable_verify_constexpr[] = { MATERIALIZE_ALL_FLAGS };
JVMFlag* JVMFlag::flags = flagTable;
size_t JVMFlag::numFlags = (sizeof(flagTable) / sizeof(JVMFlag));
inline bool str_equal(const char* s, size_t s_len, const char* q, size_t q_len) {
if (s_len != q_len) return false;
return memcmp(s, q, q_len) == 0;
}
// Search the flag table for a named flag
JVMFlag* JVMFlag::find_flag(const char* name, size_t length, bool allow_locked, bool return_flag) {
for (JVMFlag* current = &flagTable[0]; current->_name != NULL; current++) {
if (str_equal(current->_name, current->get_name_length(), name, length)) {
JVMFlag* flag = JVMFlagLookup::find(name, length);
if (flag != NULL) {
// Found a matching entry.
// Don't report notproduct and develop flags in product builds.
if (current->is_constant_in_binary()) {
return (return_flag ? current : NULL);
if (flag->is_constant_in_binary()) {
return (return_flag ? flag : NULL);
}
// Report locked flags only if allowed.
if (!(current->is_unlocked() || current->is_unlocker())) {
if (!(flag->is_unlocked() || flag->is_unlocker())) {
if (!allow_locked) {
// disable use of locked flags, e.g. diagnostic, experimental,
// etc. until they are explicitly unlocked
return NULL;
}
}
return current;
}
return flag;
}
// JVMFlag name is not in the flag table
return NULL;
}
// Get or compute the flag name length
size_t JVMFlag::get_name_length() {
if (_name_len == 0) {
_name_len = strlen(_name);
}
return _name_len;
}
JVMFlag* JVMFlag::fuzzy_match(const char* name, size_t length, bool allow_locked) {
float VMOptionsFuzzyMatchSimilarity = 0.7f;
JVMFlag* match = NULL;
@ -856,7 +810,7 @@ void JVMFlagEx::setOnCmdLine(JVMFlagsEnum flag) {
}
template<class E, class T>
static void trace_flag_changed(const JVMFlag* flag, const T old_value, const T new_value, const JVMFlag::Flags origin) {
static void trace_flag_changed(JVMFlag* flag, const T old_value, const T new_value, const JVMFlag::Flags origin) {
E e;
e.set_name(flag->_name);
e.set_oldValue(old_value);
@ -865,11 +819,11 @@ static void trace_flag_changed(const JVMFlag* flag, const T old_value, const T n
e.commit();
}
static JVMFlag::Error apply_constraint_and_check_range_bool(const JVMFlag* flag, bool new_value, bool verbose) {
static JVMFlag::Error apply_constraint_and_check_range_bool(JVMFlag* flag, bool new_value, bool verbose) {
JVMFlag::Error status = JVMFlag::SUCCESS;
JVMFlagConstraint* constraint = JVMFlagConstraintList::find_if_needs_check(flag);
if (constraint != NULL) {
status = constraint->apply_bool(new_value, verbose);
JVMFlagConstraintChecker constraint = JVMFlagConstraintList::find_if_needs_check(flag);
if (constraint.exists()) {
status = constraint.apply_bool(new_value, verbose);
}
return status;
}
@ -900,16 +854,16 @@ JVMFlag::Error JVMFlagEx::boolAtPut(JVMFlagsEnum flag, bool value, JVMFlag::Flag
return JVMFlag::boolAtPut(faddr, &value, origin);
}
static JVMFlag::Error apply_constraint_and_check_range_int(const JVMFlag* flag, int new_value, bool verbose) {
static JVMFlag::Error apply_constraint_and_check_range_int(JVMFlag* flag, int new_value, bool verbose) {
JVMFlag::Error status = JVMFlag::SUCCESS;
JVMFlagRange* range = JVMFlagRangeList::find(flag);
if (range != NULL) {
status = range->check_int(new_value, verbose);
JVMFlagRangeChecker range = JVMFlagRangeList::find(flag);
if (range.exists()) {
status = range.check_int(new_value, verbose);
}
if (status == JVMFlag::SUCCESS) {
JVMFlagConstraint* constraint = JVMFlagConstraintList::find_if_needs_check(flag);
if (constraint != NULL) {
status = constraint->apply_int(new_value, verbose);
JVMFlagConstraintChecker constraint = JVMFlagConstraintList::find_if_needs_check(flag);
if (constraint.exists()) {
status = constraint.apply_int(new_value, verbose);
}
}
return status;
@ -941,16 +895,16 @@ JVMFlag::Error JVMFlagEx::intAtPut(JVMFlagsEnum flag, int value, JVMFlag::Flags
return JVMFlag::intAtPut(faddr, &value, origin);
}
static JVMFlag::Error apply_constraint_and_check_range_uint(const JVMFlag* flag, uint new_value, bool verbose) {
static JVMFlag::Error apply_constraint_and_check_range_uint(JVMFlag* flag, uint new_value, bool verbose) {
JVMFlag::Error status = JVMFlag::SUCCESS;
JVMFlagRange* range = JVMFlagRangeList::find(flag);
if (range != NULL) {
status = range->check_uint(new_value, verbose);
JVMFlagRangeChecker range = JVMFlagRangeList::find(flag);
if (range.exists()) {
status = range.check_uint(new_value, verbose);
}
if (status == JVMFlag::SUCCESS) {
JVMFlagConstraint* constraint = JVMFlagConstraintList::find_if_needs_check(flag);
if (constraint != NULL) {
status = constraint->apply_uint(new_value, verbose);
JVMFlagConstraintChecker constraint = JVMFlagConstraintList::find_if_needs_check(flag);
if (constraint.exists()) {
status = constraint.apply_uint(new_value, verbose);
}
}
return status;
@ -989,16 +943,16 @@ JVMFlag::Error JVMFlag::intxAt(const JVMFlag* flag, intx* value) {
return JVMFlag::SUCCESS;
}
static JVMFlag::Error apply_constraint_and_check_range_intx(const JVMFlag* flag, intx new_value, bool verbose) {
static JVMFlag::Error apply_constraint_and_check_range_intx(JVMFlag* flag, intx new_value, bool verbose) {
JVMFlag::Error status = JVMFlag::SUCCESS;
JVMFlagRange* range = JVMFlagRangeList::find(flag);
if (range != NULL) {
status = range->check_intx(new_value, verbose);
JVMFlagRangeChecker range = JVMFlagRangeList::find(flag);
if (range.exists()) {
status = range.check_intx(new_value, verbose);
}
if (status == JVMFlag::SUCCESS) {
JVMFlagConstraint* constraint = JVMFlagConstraintList::find_if_needs_check(flag);
if (constraint != NULL) {
status = constraint->apply_intx(new_value, verbose);
JVMFlagConstraintChecker constraint = JVMFlagConstraintList::find_if_needs_check(flag);
if (constraint.exists()) {
status = constraint.apply_intx(new_value, verbose);
}
}
return status;
@ -1030,16 +984,16 @@ JVMFlag::Error JVMFlag::uintxAt(const JVMFlag* flag, uintx* value) {
return JVMFlag::SUCCESS;
}
static JVMFlag::Error apply_constraint_and_check_range_uintx(const JVMFlag* flag, uintx new_value, bool verbose) {
static JVMFlag::Error apply_constraint_and_check_range_uintx(JVMFlag* flag, uintx new_value, bool verbose) {
JVMFlag::Error status = JVMFlag::SUCCESS;
JVMFlagRange* range = JVMFlagRangeList::find(flag);
if (range != NULL) {
status = range->check_uintx(new_value, verbose);
JVMFlagRangeChecker range = JVMFlagRangeList::find(flag);
if (range.exists()) {
status = range.check_uintx(new_value, verbose);
}
if (status == JVMFlag::SUCCESS) {
JVMFlagConstraint* constraint = JVMFlagConstraintList::find_if_needs_check(flag);
if (constraint != NULL) {
status = constraint->apply_uintx(new_value, verbose);
JVMFlagConstraintChecker constraint = JVMFlagConstraintList::find_if_needs_check(flag);
if (constraint.exists()) {
status = constraint.apply_uintx(new_value, verbose);
}
}
return status;
@ -1071,16 +1025,16 @@ JVMFlag::Error JVMFlag::uint64_tAt(const JVMFlag* flag, uint64_t* value) {
return JVMFlag::SUCCESS;
}
static JVMFlag::Error apply_constraint_and_check_range_uint64_t(const JVMFlag* flag, uint64_t new_value, bool verbose) {
static JVMFlag::Error apply_constraint_and_check_range_uint64_t(JVMFlag* flag, uint64_t new_value, bool verbose) {
JVMFlag::Error status = JVMFlag::SUCCESS;
JVMFlagRange* range = JVMFlagRangeList::find(flag);
if (range != NULL) {
status = range->check_uint64_t(new_value, verbose);
JVMFlagRangeChecker range = JVMFlagRangeList::find(flag);
if (range.exists()) {
status = range.check_uint64_t(new_value, verbose);
}
if (status == JVMFlag::SUCCESS) {
JVMFlagConstraint* constraint = JVMFlagConstraintList::find_if_needs_check(flag);
if (constraint != NULL) {
status = constraint->apply_uint64_t(new_value, verbose);
JVMFlagConstraintChecker constraint = JVMFlagConstraintList::find_if_needs_check(flag);
if (constraint.exists()) {
status = constraint.apply_uint64_t(new_value, verbose);
}
}
return status;
@ -1112,16 +1066,16 @@ JVMFlag::Error JVMFlag::size_tAt(const JVMFlag* flag, size_t* value) {
return JVMFlag::SUCCESS;
}
static JVMFlag::Error apply_constraint_and_check_range_size_t(const JVMFlag* flag, size_t new_value, bool verbose) {
static JVMFlag::Error apply_constraint_and_check_range_size_t(JVMFlag* flag, size_t new_value, bool verbose) {
JVMFlag::Error status = JVMFlag::SUCCESS;
JVMFlagRange* range = JVMFlagRangeList::find(flag);
if (range != NULL) {
status = range->check_size_t(new_value, verbose);
JVMFlagRangeChecker range = JVMFlagRangeList::find(flag);
if (range.exists()) {
status = range.check_size_t(new_value, verbose);
}
if (status == JVMFlag::SUCCESS) {
JVMFlagConstraint* constraint = JVMFlagConstraintList::find_if_needs_check(flag);
if (constraint != NULL) {
status = constraint->apply_size_t(new_value, verbose);
JVMFlagConstraintChecker constraint = JVMFlagConstraintList::find_if_needs_check(flag);
if (constraint.exists()) {
status = constraint.apply_size_t(new_value, verbose);
}
}
return status;
@ -1154,16 +1108,16 @@ JVMFlag::Error JVMFlag::doubleAt(const JVMFlag* flag, double* value) {
return JVMFlag::SUCCESS;
}
static JVMFlag::Error apply_constraint_and_check_range_double(const JVMFlag* flag, double new_value, bool verbose) {
static JVMFlag::Error apply_constraint_and_check_range_double(JVMFlag* flag, double new_value, bool verbose) {
JVMFlag::Error status = JVMFlag::SUCCESS;
JVMFlagRange* range = JVMFlagRangeList::find(flag);
if (range != NULL) {
status = range->check_double(new_value, verbose);
JVMFlagRangeChecker range = JVMFlagRangeList::find(flag);
if (range.exists()) {
status = range.check_double(new_value, verbose);
}
if (status == JVMFlag::SUCCESS) {
JVMFlagConstraint* constraint = JVMFlagConstraintList::find_if_needs_check(flag);
if (constraint != NULL) {
status = constraint->apply_double(new_value, verbose);
JVMFlagConstraintChecker constraint = JVMFlagConstraintList::find_if_needs_check(flag);
if (constraint.exists()) {
status = constraint.apply_double(new_value, verbose);
}
}
return status;
@ -1269,6 +1223,33 @@ void JVMFlag::verify() {
#endif // PRODUCT
#ifdef ASSERT
void JVMFlag::assert_valid_flag_enum(int i) {
assert(0 <= i && i < NUM_JVMFlagsEnum, "must be");
}
void JVMFlag::check_all_flag_declarations() {
for (JVMFlag* current = &flagTable[0]; current->_name != NULL; current++) {
int flags = static_cast<int>(current->_flags);
// Backwards compatibility. This will be relaxed/removed in JDK-7123237.
int mask = JVMFlag::KIND_DIAGNOSTIC | JVMFlag::KIND_MANAGEABLE | JVMFlag::KIND_EXPERIMENTAL;
if ((flags & mask) != 0) {
assert((flags & mask) == JVMFlag::KIND_DIAGNOSTIC ||
(flags & mask) == JVMFlag::KIND_MANAGEABLE ||
(flags & mask) == JVMFlag::KIND_EXPERIMENTAL,
"%s can be declared with at most one of "
"DIAGNOSTIC, MANAGEABLE or EXPERIMENTAL", current->_name);
assert((flags & KIND_NOT_PRODUCT) == 0 &&
(flags & KIND_DEVELOP) == 0,
"%s has an optional DIAGNOSTIC, MANAGEABLE or EXPERIMENTAL "
"attribute; it must be declared as a product flag", current->_name);
}
}
}
#endif // ASSERT
void JVMFlag::printFlags(outputStream* out, bool withComments, bool printRanges, bool skipDefaults) {
// Print the flags sorted by name
// Note: This method may be called before the thread structure is in place

View file

@ -34,7 +34,7 @@ class outputStream;
typedef const char* (*RangeStrFunc)(void);
struct JVMFlag {
enum Flags {
enum Flags : int {
// latest value origin
DEFAULT = 0,
COMMAND_LINE = 1,
@ -58,12 +58,11 @@ struct JVMFlag {
KIND_NOT_PRODUCT = 1 << 8,
KIND_DEVELOP = 1 << 9,
KIND_PLATFORM_DEPENDENT = 1 << 10,
KIND_READ_WRITE = 1 << 11,
KIND_C1 = 1 << 12,
KIND_C2 = 1 << 13,
KIND_ARCH = 1 << 14,
KIND_LP64_PRODUCT = 1 << 15,
KIND_JVMCI = 1 << 16,
KIND_C1 = 1 << 11,
KIND_C2 = 1 << 12,
KIND_ARCH = 1 << 13,
KIND_LP64_PRODUCT = 1 << 14,
KIND_JVMCI = 1 << 15,
// set this bit if the flag was set on the command line
ORIG_COMMAND_LINE = 1 << 17,
@ -109,9 +108,8 @@ struct JVMFlag {
const char* _type;
const char* _name;
void* _addr;
NOT_PRODUCT(const char* _doc;)
Flags _flags;
size_t _name_len;
NOT_PRODUCT(const char* _doc;)
// points to all Flags static array
static JVMFlag* flags;
@ -123,13 +121,21 @@ private:
static JVMFlag* find_flag(const char* name, size_t length, bool allow_locked, bool return_flag);
public:
constexpr JVMFlag() : _type(), _name(), _addr(), _flags() NOT_PRODUCT(COMMA _doc()) {}
constexpr JVMFlag(int flag_enum, const char* type, const char* name,
void* addr, int flags, int extra_flags, const char* doc);
constexpr JVMFlag(int flag_enum, const char* type, const char* name,
void* addr, int flags, const char* doc);
static JVMFlag* find_flag(const char* name) {
return find_flag(name, strlen(name), false, false);
}
static const JVMFlag* find_declared_flag(const char* name, size_t length) {
static JVMFlag* find_declared_flag(const char* name, size_t length) {
return find_flag(name, length, true, true);
}
static const JVMFlag* find_declared_flag(const char* name) {
static JVMFlag* find_declared_flag(const char* name) {
return find_declared_flag(name, strlen(name));
}
@ -143,52 +149,64 @@ public:
static const char* get_size_t_default_range_str();
static const char* get_double_default_range_str();
static void assert_valid_flag_enum(int i) NOT_DEBUG_RETURN;
static void check_all_flag_declarations() NOT_DEBUG_RETURN;
inline int flag_enum() const {
int i = this - JVMFlag::flags;
assert_valid_flag_enum(i);
return i;
}
static JVMFlag* flag_from_enum(int flag_enum) {
assert_valid_flag_enum(flag_enum);
return &JVMFlag::flags[flag_enum];
}
bool is_bool() const;
bool get_bool() const { return *((bool*) _addr); }
void set_bool(bool value) { *((bool*) _addr) = value; }
void set_bool(bool value) const { *((bool*) _addr) = value; }
bool is_int() const;
int get_int() const { return *((int*) _addr); }
void set_int(int value) { *((int*) _addr) = value; }
void set_int(int value) const { *((int*) _addr) = value; }
bool is_uint() const;
uint get_uint() const { return *((uint*) _addr); }
void set_uint(uint value) { *((uint*) _addr) = value; }
void set_uint(uint value) const { *((uint*) _addr) = value; }
bool is_intx() const;
intx get_intx() const { return *((intx*) _addr); }
void set_intx(intx value) { *((intx*) _addr) = value; }
void set_intx(intx value) const { *((intx*) _addr) = value; }
bool is_uintx() const;
uintx get_uintx() const { return *((uintx*) _addr); }
void set_uintx(uintx value) { *((uintx*) _addr) = value; }
void set_uintx(uintx value) const { *((uintx*) _addr) = value; }
bool is_uint64_t() const;
uint64_t get_uint64_t() const { return *((uint64_t*) _addr); }
void set_uint64_t(uint64_t value) { *((uint64_t*) _addr) = value; }
void set_uint64_t(uint64_t value) const { *((uint64_t*) _addr) = value; }
bool is_size_t() const;
size_t get_size_t() const { return *((size_t*) _addr); }
void set_size_t(size_t value) { *((size_t*) _addr) = value; }
void set_size_t(size_t value) const { *((size_t*) _addr) = value; }
bool is_double() const;
double get_double() const { return *((double*) _addr); }
void set_double(double value) { *((double*) _addr) = value; }
void set_double(double value) const { *((double*) _addr) = value; }
bool is_ccstr() const;
bool ccstr_accumulates() const;
ccstr get_ccstr() const { return *((ccstr*) _addr); }
void set_ccstr(ccstr value) { *((ccstr*) _addr) = value; }
void set_ccstr(ccstr value) const { *((ccstr*) _addr) = value; }
Flags get_origin();
Flags get_origin() const;
void set_origin(Flags origin);
size_t get_name_length();
bool is_default();
bool is_ergonomic();
bool is_jimage_resource();
bool is_command_line();
bool is_default() const;
bool is_ergonomic() const;
bool is_jimage_resource() const;
bool is_command_line() const;
void set_command_line();
bool is_product() const;
@ -197,7 +215,6 @@ public:
bool is_experimental() const;
bool is_notproduct() const;
bool is_develop() const;
bool is_read_write() const;
bool is_constant_in_binary() const;
@ -214,10 +231,10 @@ public:
JVMFlag::MsgType get_locked_message_ext(char*, int) const;
// printRanges will print out flags type, name and range values as expected by -XX:+PrintFlagsRanges
void print_on(outputStream* st, bool withComments = false, bool printRanges = false);
void print_kind(outputStream* st, unsigned int width);
void print_origin(outputStream* st, unsigned int width);
void print_as_flag(outputStream* st);
void print_on(outputStream* st, bool withComments = false, bool printRanges = false) const;
void print_kind(outputStream* st, unsigned int width) const;
void print_origin(outputStream* st, unsigned int width) const;
void print_as_flag(outputStream* st) const;
static const char* flag_error_str(JVMFlag::Error error);
@ -260,4 +277,6 @@ public:
static void verify() PRODUCT_RETURN;
};
#define DECLARE_CONSTRAINT(type, func) JVMFlag::Error func(type value, bool verbose);
#endif // SHARE_RUNTIME_FLAGS_JVMFLAG_HPP

View file

@ -172,125 +172,43 @@ public:
}
};
// No constraint emitting
void emit_constraint_no(...) { /* NOP */ }
// No constraint emitting if function argument is NOT provided
void emit_constraint_bool(const JVMFlag* /*flag*/) { /* NOP */ }
void emit_constraint_ccstr(const JVMFlag* /*flag*/) { /* NOP */ }
void emit_constraint_ccstrlist(const JVMFlag* /*flag*/) { /* NOP */ }
void emit_constraint_int(const JVMFlag* /*flag*/) { /* NOP */ }
void emit_constraint_intx(const JVMFlag* /*flag*/) { /* NOP */ }
void emit_constraint_uint(const JVMFlag* /*flag*/) { /* NOP */ }
void emit_constraint_uintx(const JVMFlag* /*flag*/) { /* NOP */ }
void emit_constraint_uint64_t(const JVMFlag* /*flag*/) { /* NOP */ }
void emit_constraint_size_t(const JVMFlag* /*flag*/) { /* NOP */ }
void emit_constraint_double(const JVMFlag* /*flag*/) { /* NOP */ }
// JVMFlagConstraint emitting code functions if function argument is provided
void emit_constraint_bool(const JVMFlag* flag, JVMFlagConstraintFunc_bool func, JVMFlagConstraint::ConstraintType type) {
JVMFlagConstraintList::add(new JVMFlagConstraint_bool(flag, func, type));
}
void emit_constraint_int(const JVMFlag* flag, JVMFlagConstraintFunc_int func, JVMFlagConstraint::ConstraintType type) {
JVMFlagConstraintList::add(new JVMFlagConstraint_int(flag, func, type));
}
void emit_constraint_intx(const JVMFlag* flag, JVMFlagConstraintFunc_intx func, JVMFlagConstraint::ConstraintType type) {
JVMFlagConstraintList::add(new JVMFlagConstraint_intx(flag, func, type));
}
void emit_constraint_uint(const JVMFlag* flag, JVMFlagConstraintFunc_uint func, JVMFlagConstraint::ConstraintType type) {
JVMFlagConstraintList::add(new JVMFlagConstraint_uint(flag, func, type));
}
void emit_constraint_uintx(const JVMFlag* flag, JVMFlagConstraintFunc_uintx func, JVMFlagConstraint::ConstraintType type) {
JVMFlagConstraintList::add(new JVMFlagConstraint_uintx(flag, func, type));
}
void emit_constraint_uint64_t(const JVMFlag* flag, JVMFlagConstraintFunc_uint64_t func, JVMFlagConstraint::ConstraintType type) {
JVMFlagConstraintList::add(new JVMFlagConstraint_uint64_t(flag, func, type));
}
void emit_constraint_size_t(const JVMFlag* flag, JVMFlagConstraintFunc_size_t func, JVMFlagConstraint::ConstraintType type) {
JVMFlagConstraintList::add(new JVMFlagConstraint_size_t(flag, func, type));
}
void emit_constraint_double(const JVMFlag* flag, JVMFlagConstraintFunc_double func, JVMFlagConstraint::ConstraintType type) {
JVMFlagConstraintList::add(new JVMFlagConstraint_double(flag, func, type));
#define DEFINE_CONSTRAINT_APPLY(T) \
JVMFlag::Error JVMFlagConstraintChecker::apply_ ## T(T value, bool verbose) const { \
assert(exists(), "must be"); \
JVMFlagConstraint_ ## T constraint(_flag, \
(JVMFlagConstraintFunc_ ## T)_limit->constraint_func(), \
(JVMFlagConstraint::ConstraintType)_limit->phase()); \
return constraint.apply_ ## T(value, verbose); \
}
// Generate code to call emit_constraint_xxx function
#define EMIT_CONSTRAINT_START (void)(0
#define EMIT_CONSTRAINT(type, name) ); emit_constraint_##type(JVMFlagEx::flag_from_enum(FLAG_MEMBER_ENUM(name))
#define EMIT_CONSTRAINT_NO ); emit_constraint_no(0
#define EMIT_CONSTRAINT_PRODUCT_FLAG(type, name, value, doc) EMIT_CONSTRAINT(type, name)
#define EMIT_CONSTRAINT_DIAGNOSTIC_FLAG(type, name, value, doc) EMIT_CONSTRAINT(type, name)
#define EMIT_CONSTRAINT_EXPERIMENTAL_FLAG(type, name, value, doc) EMIT_CONSTRAINT(type, name)
#define EMIT_CONSTRAINT_MANAGEABLE_FLAG(type, name, value, doc) EMIT_CONSTRAINT(type, name)
#define EMIT_CONSTRAINT_PRODUCT_RW_FLAG(type, name, value, doc) EMIT_CONSTRAINT(type, name)
#define EMIT_CONSTRAINT_PD_PRODUCT_FLAG(type, name, doc) EMIT_CONSTRAINT(type, name)
#define EMIT_CONSTRAINT_PD_DIAGNOSTIC_FLAG(type, name, doc) EMIT_CONSTRAINT(type, name)
#ifndef PRODUCT
#define EMIT_CONSTRAINT_DEVELOPER_FLAG(type, name, value, doc) EMIT_CONSTRAINT(type, name)
#define EMIT_CONSTRAINT_PD_DEVELOPER_FLAG(type, name, doc) EMIT_CONSTRAINT(type, name)
#define EMIT_CONSTRAINT_NOTPRODUCT_FLAG(type, name, value, doc) EMIT_CONSTRAINT(type, name)
#else
#define EMIT_CONSTRAINT_DEVELOPER_FLAG(type, name, value, doc) EMIT_CONSTRAINT_NO
#define EMIT_CONSTRAINT_PD_DEVELOPER_FLAG(type, name, doc) EMIT_CONSTRAINT_NO
#define EMIT_CONSTRAINT_NOTPRODUCT_FLAG(type, name, value, doc) EMIT_CONSTRAINT_NO
#endif
#ifdef _LP64
#define EMIT_CONSTRAINT_LP64_PRODUCT_FLAG(type, name, value, doc) EMIT_CONSTRAINT(type, name)
#else
#define EMIT_CONSTRAINT_LP64_PRODUCT_FLAG(type, name, value, doc) EMIT_CONSTRAINT_NO
#endif
#define EMIT_CONSTRAINT_END );
ALL_CONSTRAINT_TYPES(DEFINE_CONSTRAINT_APPLY)
JVMFlag::Error JVMFlagConstraintChecker::apply(bool verbose) const {
#define APPLY_CONSTRAINT(T) \
if (_flag->is_ ## T()) { \
JVMFlagConstraint_ ## T constraint(_flag, \
(JVMFlagConstraintFunc_ ## T)_limit->constraint_func(), \
(JVMFlagConstraint::ConstraintType)_limit->phase()); \
return constraint.apply(verbose); \
}
ALL_CONSTRAINT_TYPES(APPLY_CONSTRAINT);
ShouldNotReachHere();
return JVMFlag::INVALID_FLAG;
}
// Generate func argument to pass into emit_constraint_xxx functions
#define EMIT_CONSTRAINT_CHECK(func, type) , func, JVMFlagConstraint::type
// the "name" argument must be a string literal
#define INITIAL_CONSTRAINTS_SIZE 72
GrowableArray<JVMFlagConstraint*>* JVMFlagConstraintList::_constraints = NULL;
JVMFlagConstraint::ConstraintType JVMFlagConstraintList::_validating_type = JVMFlagConstraint::AtParse;
// Check the ranges of all flags that have them or print them out and exit if requested
void JVMFlagConstraintList::init(void) {
_constraints = new (ResourceObj::C_HEAP, mtArguments) GrowableArray<JVMFlagConstraint*>(INITIAL_CONSTRAINTS_SIZE, mtArguments);
EMIT_CONSTRAINT_START
ALL_FLAGS(EMIT_CONSTRAINT_DEVELOPER_FLAG,
EMIT_CONSTRAINT_PD_DEVELOPER_FLAG,
EMIT_CONSTRAINT_PRODUCT_FLAG,
EMIT_CONSTRAINT_PD_PRODUCT_FLAG,
EMIT_CONSTRAINT_DIAGNOSTIC_FLAG,
EMIT_CONSTRAINT_PD_DIAGNOSTIC_FLAG,
EMIT_CONSTRAINT_EXPERIMENTAL_FLAG,
EMIT_CONSTRAINT_NOTPRODUCT_FLAG,
EMIT_CONSTRAINT_MANAGEABLE_FLAG,
EMIT_CONSTRAINT_PRODUCT_RW_FLAG,
EMIT_CONSTRAINT_LP64_PRODUCT_FLAG,
IGNORE_RANGE,
EMIT_CONSTRAINT_CHECK)
EMIT_CONSTRAINT_END
}
JVMFlagConstraint* JVMFlagConstraintList::find(const JVMFlag* flag) {
JVMFlagConstraint* found = NULL;
for (int i=0; i<length(); i++) {
JVMFlagConstraint* constraint = at(i);
if (constraint->flag() == flag) {
found = constraint;
break;
}
}
return found;
}
// Find constraints and return only if found constraint's type is equal or lower than current validating type.
JVMFlagConstraint* JVMFlagConstraintList::find_if_needs_check(const JVMFlag* flag) {
JVMFlagConstraint* found = NULL;
JVMFlagConstraint* constraint = find(flag);
if (constraint != NULL && (constraint->type() <= _validating_type)) {
found = constraint;
JVMFlagConstraintChecker JVMFlagConstraintList::find_if_needs_check(const JVMFlag* flag) {
JVMFlagConstraintChecker constraint = JVMFlagConstraintList::find(flag);
if (constraint.exists() && (constraint.type() <= _validating_type)) {
return constraint;
}
return found;
return JVMFlagConstraintChecker(flag, NULL);
}
// Check constraints for specific constraint type.
@ -299,10 +217,11 @@ bool JVMFlagConstraintList::check_constraints(JVMFlagConstraint::ConstraintType
_validating_type = type;
bool status = true;
for (int i=0; i<length(); i++) {
JVMFlagConstraint* constraint = at(i);
if (type != constraint->type()) continue;
if (constraint->apply(true) != JVMFlag::SUCCESS) status = false;
for (int i = 0; i < NUM_JVMFlagsEnum; i++) {
JVMFlagConstraintChecker constraint(&JVMFlag::flags[i], JVMFlagLimit::get_constraint_at(i));
if (!constraint.exists()) continue;
if (type != constraint.type()) continue;
if (constraint.apply(true) != JVMFlag::SUCCESS) status = false;
}
return status;
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2020, 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
@ -26,7 +26,7 @@
#define SHARE_RUNTIME_FLAGS_JVMFLAGCONSTRAINTLIST_HPP
#include "runtime/flags/jvmFlag.hpp"
#include "utilities/growableArray.hpp"
#include "runtime/flags/jvmFlagLimit.hpp"
/*
* Here we have a mechanism for extracting constraints (as custom functions) for flags,
@ -83,18 +83,28 @@ public:
virtual JVMFlag::Error apply_double(double value, bool verbose = true) { ShouldNotReachHere(); return JVMFlag::ERR_OTHER; };
};
class JVMFlagConstraintChecker {
const JVMFlag* _flag;
const JVMFlagLimit* _limit;
public:
JVMFlagConstraintChecker(const JVMFlag* flag, const JVMFlagLimit* limit) : _flag(flag), _limit(limit) {}
bool exists() const { return _limit != NULL; }
JVMFlag::Error apply(bool verbose = true) const;
JVMFlagConstraint::ConstraintType type() const { return (JVMFlagConstraint::ConstraintType)_limit->phase(); }
#define DECLARE_CONSTRAINT_APPLY(T) JVMFlag::Error apply_ ## T(T new_value, bool verbose = true) const;
ALL_CONSTRAINT_TYPES(DECLARE_CONSTRAINT_APPLY)
};
class JVMFlagConstraintList : public AllStatic {
private:
static GrowableArray<JVMFlagConstraint*>* _constraints;
// Latest constraint validation type.
static JVMFlagConstraint::ConstraintType _validating_type;
public:
static void init();
static int length() { return (_constraints != NULL) ? _constraints->length() : 0; }
static JVMFlagConstraint* at(int i) { return (_constraints != NULL) ? _constraints->at(i) : NULL; }
static JVMFlagConstraint* find(const JVMFlag* flag);
static JVMFlagConstraint* find_if_needs_check(const JVMFlag* flag);
static void add(JVMFlagConstraint* constraint) { _constraints->append(constraint); }
static JVMFlagConstraintChecker find(const JVMFlag* flag) { return JVMFlagConstraintChecker(flag, JVMFlagLimit::get_constraint(flag)); }
static JVMFlagConstraintChecker find_if_needs_check(const JVMFlag* flag);
// True if 'AfterErgo' or later constraint functions are validated.
static bool validated_after_ergo() { return _validating_type >= JVMFlagConstraint::AfterErgo; };
static bool check_constraints(JVMFlagConstraint::ConstraintType type);

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2020, 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
@ -26,6 +26,7 @@
#define SHARE_RUNTIME_FLAGS_JVMFLAGCONSTRAINTSCOMPILER_HPP
#include "runtime/flags/jvmFlag.hpp"
#include "utilities/macros.hpp"
/*
* Here we have compiler arguments constraints functions, which are called automatically
@ -33,46 +34,28 @@
* an appropriate error value.
*/
JVMFlag::Error AliasLevelConstraintFunc(intx value, bool verbose);
#define COMPILER_CONSTRAINTS(f) \
f(intx, AliasLevelConstraintFunc) \
f(intx, CICompilerCountConstraintFunc) \
f(intx, AllocatePrefetchDistanceConstraintFunc) \
f(intx, AllocatePrefetchInstrConstraintFunc) \
f(intx, AllocatePrefetchStepSizeConstraintFunc) \
f(intx, CompileThresholdConstraintFunc) \
f(intx, OnStackReplacePercentageConstraintFunc) \
f(uintx, CodeCacheSegmentSizeConstraintFunc) \
f(intx, CodeEntryAlignmentConstraintFunc) \
f(intx, OptoLoopAlignmentConstraintFunc) \
f(uintx, ArraycopyDstPrefetchDistanceConstraintFunc) \
f(uintx, ArraycopySrcPrefetchDistanceConstraintFunc) \
f(uintx, TypeProfileLevelConstraintFunc) \
f(intx, InitArrayShortSizeConstraintFunc) \
f(int , RTMTotalCountIncrRateConstraintFunc) \
COMPILER2_PRESENT( \
f(intx, InteriorEntryAlignmentConstraintFunc) \
f(intx, NodeLimitFudgeFactorConstraintFunc) \
f(uintx, LoopStripMiningIterConstraintFunc) \
)
JVMFlag::Error CICompilerCountConstraintFunc(intx value, bool verbose);
JVMFlag::Error AllocatePrefetchDistanceConstraintFunc(intx value, bool verbose);
JVMFlag::Error AllocatePrefetchInstrConstraintFunc(intx value, bool verbose);
JVMFlag::Error AllocatePrefetchStepSizeConstraintFunc(intx value, bool verbose);
JVMFlag::Error CompileThresholdConstraintFunc(intx value, bool verbose);
JVMFlag::Error OnStackReplacePercentageConstraintFunc(intx value, bool verbose);
JVMFlag::Error CodeCacheSegmentSizeConstraintFunc(uintx value, bool verbose);
JVMFlag::Error CompilerThreadPriorityConstraintFunc(intx value, bool verbose);
JVMFlag::Error CodeEntryAlignmentConstraintFunc(intx value, bool verbose);
JVMFlag::Error OptoLoopAlignmentConstraintFunc(intx value, bool verbose);
JVMFlag::Error ArraycopyDstPrefetchDistanceConstraintFunc(uintx value, bool verbose);
JVMFlag::Error ArraycopySrcPrefetchDistanceConstraintFunc(uintx value, bool verbose);
JVMFlag::Error TypeProfileLevelConstraintFunc(uintx value, bool verbose);
JVMFlag::Error InitArrayShortSizeConstraintFunc(intx value, bool verbose);
#ifdef COMPILER2
JVMFlag::Error InteriorEntryAlignmentConstraintFunc(intx value, bool verbose);
JVMFlag::Error NodeLimitFudgeFactorConstraintFunc(intx value, bool verbose);
#endif
JVMFlag::Error RTMTotalCountIncrRateConstraintFunc(int value, bool verbose);
#ifdef COMPILER2
JVMFlag::Error LoopStripMiningIterConstraintFunc(uintx value, bool verbose);
#endif
COMPILER_CONSTRAINTS(DECLARE_CONSTRAINT)
#endif // SHARE_RUNTIME_FLAGS_JVMFLAGCONSTRAINTSCOMPILER_HPP

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2020, 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
@ -25,6 +25,7 @@
#include "precompiled.hpp"
#include "runtime/arguments.hpp"
#include "runtime/flags/jvmFlag.hpp"
#include "runtime/flags/jvmFlagLimit.hpp"
#include "runtime/flags/jvmFlagConstraintsRuntime.hpp"
#include "runtime/globals.hpp"
#include "runtime/safepointMechanism.hpp"
@ -131,3 +132,32 @@ JVMFlag::Error PerfDataSamplingIntervalFunc(intx value, bool verbose) {
return JVMFlag::SUCCESS;
}
}
JVMFlag::Error VMPageSizeConstraintFunc(uintx value, bool verbose) {
uintx min = (uintx)os::vm_page_size();
if (value < min) {
JVMFlag::printError(verbose,
"%s %s=" UINTX_FORMAT " is outside the allowed range [ " UINTX_FORMAT
" ... " UINTX_FORMAT " ]\n",
JVMFlagLimit::last_checked_flag()->_type,
JVMFlagLimit::last_checked_flag()->_name,
value, min, max_uintx);
return JVMFlag::VIOLATES_CONSTRAINT;
}
return JVMFlag::SUCCESS;
}
JVMFlag::Error NUMAInterleaveGranularityConstraintFunc(size_t value, bool verbose) {
size_t min = os::vm_allocation_granularity();
size_t max = NOT_LP64(2*G) LP64_ONLY(8192*G);
if (value < min || value > max) {
JVMFlag::printError(verbose,
"size_t NUMAInterleaveGranularity=" UINTX_FORMAT " is outside the allowed range [ " UINTX_FORMAT
" ... " UINTX_FORMAT " ]\n", value, min, max);
return JVMFlag::VIOLATES_CONSTRAINT;
}
return JVMFlag::SUCCESS;
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2020, 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
@ -33,15 +33,17 @@
* an appropriate error value.
*/
JVMFlag::Error ObjectAlignmentInBytesConstraintFunc(intx value, bool verbose);
#define RUNTIME_CONSTRAINTS(f) \
f(intx, ObjectAlignmentInBytesConstraintFunc) \
f(intx, ContendedPaddingWidthConstraintFunc) \
f(intx, BiasedLockingBulkRebiasThresholdFunc) \
f(intx, BiasedLockingStartupDelayFunc) \
f(intx, BiasedLockingBulkRevokeThresholdFunc) \
f(intx, BiasedLockingDecayTimeFunc) \
f(intx, PerfDataSamplingIntervalFunc) \
f(uintx, VMPageSizeConstraintFunc) \
f(size_t, NUMAInterleaveGranularityConstraintFunc)
JVMFlag::Error ContendedPaddingWidthConstraintFunc(intx value, bool verbose);
JVMFlag::Error BiasedLockingBulkRebiasThresholdFunc(intx value, bool verbose);
JVMFlag::Error BiasedLockingStartupDelayFunc(intx value, bool verbose);
JVMFlag::Error BiasedLockingBulkRevokeThresholdFunc(intx value, bool verbose);
JVMFlag::Error BiasedLockingDecayTimeFunc(intx value, bool verbose);
JVMFlag::Error PerfDataSamplingIntervalFunc(intx value, bool verbose);
RUNTIME_CONSTRAINTS(DECLARE_CONSTRAINT)
#endif // SHARE_RUNTIME_FLAGS_JVMFLAGCONSTRAINTSRUNTIME_HPP

View file

@ -0,0 +1,150 @@
/*
* Copyright (c) 1997, 2020, 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.
*
*/
#include "precompiled.hpp"
#include "memory/allocation.inline.hpp"
#include "gc/shared/jvmFlagConstraintsGC.hpp"
#include "runtime/flags/jvmFlag.hpp"
#include "runtime/flags/jvmFlagLimit.hpp"
#include "runtime/flags/jvmFlagConstraintList.hpp"
#include "runtime/flags/jvmFlagConstraintsCompiler.hpp"
#include "runtime/flags/jvmFlagConstraintsRuntime.hpp"
#include "runtime/flags/jvmFlagRangeList.hpp"
#include "runtime/globals_extension.hpp"
#include "gc/shared/referenceProcessor.hpp"
#include "oops/markWord.hpp"
#include "runtime/task.hpp"
//----------------------------------------------------------------------
// Build flagLimitTable[]
#define CONSTRAINT_ENUM(func) constraint_enum_ ## func
#define CONSTRAINT_ENUM_(type, func) CONSTRAINT_ENUM(func),
#define CONSTRAINT_FUNC(type, func) (void*)&func,
enum JVMFlagConstraintsEnum : int {
ALL_CONSTRAINTS(CONSTRAINT_ENUM_)
NUM_JVMFlagConstraintsEnum
};
static void* const flagConstraintTable[NUM_JVMFlagConstraintsEnum] = {
ALL_CONSTRAINTS(CONSTRAINT_FUNC)
};
void* JVMFlagLimit::constraint_func() const {
int i = _constraint_func;
assert(0 <= i && i < NUM_JVMFlagConstraintsEnum, "sanity");
return flagConstraintTable[i];
}
struct DummyLimit {
char dummy;
constexpr DummyLimit(...) : dummy() {}
};
template <typename T>
class LimitGetter {
public:
// These functions return NULL for develop flags in a PRODUCT build
static constexpr const JVMFlagLimit* no_limit(...) {
return NULL;
}
// This is for flags that have neither range no constraint. We don't need the JVMFlagLimit struct.
static constexpr const JVMFlagLimit* get_limit(const JVMTypedFlagLimit<T>* p, int dummy) {
return NULL;
}
static constexpr const JVMFlagLimit* get_limit(const JVMTypedFlagLimit<T>* p, int dummy, T min, T max) {
return p;
}
static constexpr const JVMFlagLimit* get_limit(const JVMTypedFlagLimit<T>* p, int dummy, ConstraintMarker dummy2, short func, int phase) {
return p;
}
static constexpr const JVMFlagLimit* get_limit(const JVMTypedFlagLimit<T>* p, int dummy, T min, T max, ConstraintMarker dummy2, short func, int phase) {
return p;
}
static constexpr const JVMFlagLimit* get_limit(const JVMTypedFlagLimit<T>* p, int dummy, ConstraintMarker dummy2, short func, int phase, T min, T max) {
return p;
}
};
// macro body starts here -------------------+
// |
// v
#define FLAG_LIMIT_DEFINE( type, name, ...) ); constexpr JVMTypedFlagLimit<type> limit_##name(0
#define FLAG_LIMIT_DEFINE_DUMMY(type, name, ...) ); constexpr DummyLimit nolimit_##name(0
#define FLAG_LIMIT_PTR( type, name, ...) ), LimitGetter<type>::get_limit(&limit_##name, 0
#define FLAG_LIMIT_PTR_NONE( type, name, ...) ), LimitGetter<type>::no_limit(0
#define APPLY_FLAG_RANGE(...) , __VA_ARGS__
#define APPLY_FLAG_CONSTRAINT(func, phase) , next_two_args_are_constraint, (short)CONSTRAINT_ENUM(func), int(JVMFlagConstraint::phase)
constexpr JVMTypedFlagLimit<int> limit_dummy
(
#ifdef PRODUCT
ALL_FLAGS(FLAG_LIMIT_DEFINE_DUMMY,
FLAG_LIMIT_DEFINE_DUMMY,
FLAG_LIMIT_DEFINE,
FLAG_LIMIT_DEFINE,
FLAG_LIMIT_DEFINE_DUMMY,
APPLY_FLAG_RANGE,
APPLY_FLAG_CONSTRAINT)
#else
ALL_FLAGS(FLAG_LIMIT_DEFINE,
FLAG_LIMIT_DEFINE,
FLAG_LIMIT_DEFINE,
FLAG_LIMIT_DEFINE,
FLAG_LIMIT_DEFINE,
APPLY_FLAG_RANGE,
APPLY_FLAG_CONSTRAINT)
#endif
);
static constexpr const JVMFlagLimit* const flagLimitTable[1 + NUM_JVMFlagsEnum] = {
// Because FLAG_LIMIT_PTR must start with an "),", we have to place a dummy element here.
LimitGetter<int>::get_limit(NULL, 0
#ifdef PRODUCT
ALL_FLAGS(FLAG_LIMIT_PTR_NONE,
FLAG_LIMIT_PTR_NONE,
FLAG_LIMIT_PTR,
FLAG_LIMIT_PTR,
FLAG_LIMIT_PTR_NONE,
APPLY_FLAG_RANGE,
APPLY_FLAG_CONSTRAINT)
#else
ALL_FLAGS(FLAG_LIMIT_PTR,
FLAG_LIMIT_PTR,
FLAG_LIMIT_PTR,
FLAG_LIMIT_PTR,
FLAG_LIMIT_PTR,
APPLY_FLAG_RANGE,
APPLY_FLAG_CONSTRAINT)
#endif
)
};
int JVMFlagLimit::_last_checked = -1;
const JVMFlagLimit* const* JVMFlagLimit::flagLimits = &flagLimitTable[1]; // excludes dummy

View file

@ -0,0 +1,155 @@
/*
* Copyright (c) 2020, 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.
*
*/
#ifndef SHARE_RUNTIME_FLAGS_JVMFLAGLIMIT_HPP
#define SHARE_RUNTIME_FLAGS_JVMFLAGLIMIT_HPP
#include "runtime/flags/jvmFlag.hpp"
#define ALL_LIMIT_TYPES(f) \
f(int) \
f(intx) \
f(uint) \
f(uintx) \
f(uint64_t) \
f(size_t) \
f(double)
#define ALL_RANGE_TYPES(f) ALL_LIMIT_TYPES(f)
#define ALL_CONSTRAINT_TYPES(f) ALL_LIMIT_TYPES(f) f(bool)
template <typename T> class JVMTypedFlagLimit;
// A JVMFlagLimit is created for each JVMFlag that has a range() and/or constraint() in its declaration in
// the globals_xxx.hpp file.
//
// To query the range information of a JVMFlag:
// JVMFlagLimit::get_range(JVMFlag*)
// JVMFlagLimit::get_range_at(int flag_enum)
// If the given flag doesn't have a range, NULL is returned.
//
// To query the constraint information of a JVMFlag:
// JVMFlagLimit::get_constraint(JVMFlag*)
// JVMFlagLimit::get_constraint_at(int flag_enum)
// If the given flag doesn't have a constraint, NULL is returned.
class JVMFlagLimit {
short _constraint_func;
char _phase;
char _kind;
static const JVMFlagLimit* const* flagLimits;
static int _last_checked;
protected:
static constexpr int HAS_RANGE = 1;
static constexpr int HAS_CONSTRAINT = 2;
private:
static const JVMFlagLimit* get_kind_at(int flag_enum, int required_kind) {
const JVMFlagLimit* limit = at(flag_enum);
if (limit != NULL && (limit->_kind & required_kind) != 0) {
_last_checked = flag_enum;
return limit;
} else {
return NULL;
}
}
static const JVMFlagLimit* at(int flag_enum) {
JVMFlag::assert_valid_flag_enum(flag_enum);
return flagLimits[flag_enum];
}
public:
void* constraint_func() const;
char phase() const { return _phase; }
char kind() const { return _kind; }
constexpr JVMFlagLimit(short func, short phase, short kind) : _constraint_func(func), _phase(phase), _kind(kind) {}
static const JVMFlagLimit* get_range(const JVMFlag* flag) {
return get_range_at(flag->flag_enum());
}
static const JVMFlagLimit* get_range_at(int flag_enum) {
return get_kind_at(flag_enum, HAS_RANGE);
}
static const JVMFlagLimit* get_constraint(const JVMFlag* flag) {
return get_constraint_at(flag->flag_enum());
}
static const JVMFlagLimit* get_constraint_at(int flag_enum) {
return get_kind_at(flag_enum, HAS_CONSTRAINT);
}
static const JVMFlag* last_checked_flag() {
if (_last_checked >= 0) {
return JVMFlag::flag_from_enum(_last_checked);
} else {
return NULL;
}
}
#define AS_TYPED_LIMIT(type) inline JVMTypedFlagLimit<type>* as_ ## type() const { return (JVMTypedFlagLimit<type>*)this; }
ALL_RANGE_TYPES(AS_TYPED_LIMIT)
};
enum ConstraintMarker {
next_two_args_are_constraint,
};
template <typename T>
class JVMTypedFlagLimit : public JVMFlagLimit {
const T _min;
const T _max;
public:
// dummy - no range or constraint. This object will not be emitted into the .o file
// because we declare it as "const" but has no reference to it.
constexpr JVMTypedFlagLimit(int dummy) :
JVMFlagLimit(0, 0, 0), _min(0), _max(0) {}
// range only
constexpr JVMTypedFlagLimit(int dummy, T min, T max) :
JVMFlagLimit(0, 0, HAS_RANGE), _min(min), _max(max) {}
// constraint only
constexpr JVMTypedFlagLimit(int dummy, ConstraintMarker dummy2, short func, int phase) :
JVMFlagLimit(func, phase, HAS_CONSTRAINT), _min(0), _max(0) {}
// range and constraint
constexpr JVMTypedFlagLimit(int dummy, T min, T max, ConstraintMarker dummy2, short func, int phase) :
JVMFlagLimit(func, phase, HAS_RANGE | HAS_CONSTRAINT), _min(min), _max(max) {}
// constraint and range
constexpr JVMTypedFlagLimit(int dummy, ConstraintMarker dummy2, short func, int phase, T min, T max) :
JVMFlagLimit(func, phase, HAS_RANGE | HAS_CONSTRAINT), _min(min), _max(max) {}
T min() const { return _min; }
T max() const { return _max; }
};
#endif // SHARE_RUNTIME_FLAGS_JVMFLAGLIMIT_HPP

View file

@ -0,0 +1,78 @@
/*
* Copyright (c) 2020, 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.
*
*/
#include "precompiled.hpp"
#include "runtime/flags/jvmFlag.hpp"
#include "runtime/flags/jvmFlagLookup.hpp"
#include "utilities/defaultStream.hpp"
#define DO_FLAG(type, name,...) DO_HASH(FLAG_MEMBER_ENUM(name), XSTR(name))
#define DO_HASH(flag_enum, flag_name) { \
unsigned int hash = hash_code(flag_name); \
int bucket_index = (int)(hash % NUM_BUCKETS); \
_hashes[flag_enum] = (u2)(hash); \
_table[flag_enum] = _buckets[bucket_index]; \
_buckets[bucket_index] = (short)flag_enum; \
}
constexpr JVMFlagLookup::JVMFlagLookup() : _buckets(), _table(), _hashes() {
for (int i = 0; i < NUM_BUCKETS; i++) {
_buckets[i] = -1;
}
ALL_FLAGS(DO_FLAG,
DO_FLAG,
DO_FLAG,
DO_FLAG,
DO_FLAG,
IGNORE_RANGE,
IGNORE_CONSTRAINT)
}
constexpr JVMFlagLookup _flag_lookup_table;
JVMFlag* JVMFlagLookup::find_impl(const char* name, size_t length) const {
unsigned int hash = hash_code(name, length);
int bucket_index = (int)(hash % NUM_BUCKETS);
for (int flag_enum = _buckets[bucket_index]; flag_enum >= 0; ) {
if (_hashes[flag_enum] == (u2)hash) {
JVMFlag* flag = JVMFlag::flags + flag_enum;
if (strncmp(name, flag->_name, length) == 0) {
// We know flag->_name has at least <length> bytes.
// Make sure it has exactly <length> bytes
if (flag->_name[length] == 0) {
return flag;
}
}
}
flag_enum = (int)_table[flag_enum];
}
return NULL;
}
JVMFlag* JVMFlagLookup::find(const char* name, size_t length) {
return _flag_lookup_table.find_impl(name, length);
}

View file

@ -0,0 +1,74 @@
/*
* Copyright (c) 2020, 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.
*
*/
#ifndef SHARE_RUNTIME_FLAGS_JVMFLAGLOOKUP_HPP
#define SHARE_RUNTIME_FLAGS_JVMFLAGLOOKUP_HPP
#include "runtime/globals_extension.hpp"
#include "runtime/flags/jvmFlag.hpp"
// This is a hashtable that maps from (const char*) to (JVMFlag*) to speed up
// the processing of JVM command-line arguments at runtime.
//
// With constexpr, this table is generated at C++ compile time so there's
// no set up cost at runtime.
class JVMFlagLookup {
static constexpr int NUM_BUCKETS = 277;
short _buckets[NUM_BUCKETS];
short _table[NUM_JVMFlagsEnum];
u2 _hashes[NUM_JVMFlagsEnum];
// Cannot use strlen() -- it's not constexpr.
static constexpr size_t string_len(const char* s) {
size_t len = 0;
while (*s != 0) {
len++;
s++;
}
return len;
}
// This is executed at build-time only, so it doesn't matter if we walk
// the string twice.
static constexpr unsigned int hash_code(const char* s) {
return hash_code(s, string_len(s));
}
static constexpr unsigned int hash_code(const char* s, size_t len) {
unsigned int h = 0;
while (len -- > 0) {
h = 31*h + (unsigned int) *s;
s++;
}
return h;
}
JVMFlag* find_impl(const char* flag_name, size_t length) const;
public:
constexpr JVMFlagLookup();
static JVMFlag* find(const char* flag_name, size_t length);
};
#endif // SHARE_RUNTIME_FLAGS_JVMFLAGLOOKUP_HPP

View file

@ -31,6 +31,7 @@
#include "runtime/arguments.hpp"
#include "runtime/flags/jvmFlag.hpp"
#include "runtime/flags/jvmFlagConstraintList.hpp"
#include "runtime/flags/jvmFlagConstraintsRuntime.hpp"
#include "runtime/flags/jvmFlagRangeList.hpp"
#include "runtime/globals.hpp"
#include "runtime/globals_extension.hpp"
@ -241,122 +242,69 @@ public:
}
};
// No constraint emitting
void emit_range_no(...) { /* NOP */ }
// No constraint emitting if function argument is NOT provided
void emit_range_bool(const JVMFlag* /*flag*/) { /* NOP */ }
void emit_range_ccstr(const JVMFlag* /*flag*/) { /* NOP */ }
void emit_range_ccstrlist(const JVMFlag* /*flag*/) { /* NOP */ }
void emit_range_int(const JVMFlag* /*flag*/) { /* NOP */ }
void emit_range_intx(const JVMFlag* /*flag*/) { /* NOP */ }
void emit_range_uint(const JVMFlag* /*flag*/) { /* NOP */ }
void emit_range_uintx(const JVMFlag* /*flag*/) { /* NOP */ }
void emit_range_uint64_t(const JVMFlag* /*flag*/) { /* NOP */ }
void emit_range_size_t(const JVMFlag* /*flag*/) { /* NOP */ }
void emit_range_double(const JVMFlag* /*flag*/) { /* NOP */ }
// JVMFlagRange emitting code functions if range arguments are provided
void emit_range_int(const JVMFlag* flag, int min, int max) {
JVMFlagRangeList::add(new JVMFlagRange_int(flag, min, max));
}
void emit_range_intx(const JVMFlag* flag, intx min, intx max) {
JVMFlagRangeList::add(new JVMFlagRange_intx(flag, min, max));
}
void emit_range_uint(const JVMFlag* flag, uint min, uint max) {
JVMFlagRangeList::add(new JVMFlagRange_uint(flag, min, max));
}
void emit_range_uintx(const JVMFlag* flag, uintx min, uintx max) {
JVMFlagRangeList::add(new JVMFlagRange_uintx(flag, min, max));
}
void emit_range_uint64_t(const JVMFlag* flag, uint64_t min, uint64_t max) {
JVMFlagRangeList::add(new JVMFlagRange_uint64_t(flag, min, max));
}
void emit_range_size_t(const JVMFlag* flag, size_t min, size_t max) {
JVMFlagRangeList::add(new JVMFlagRange_size_t(flag, min, max));
}
void emit_range_double(const JVMFlag* flag, double min, double max) {
JVMFlagRangeList::add(new JVMFlagRange_double(flag, min, max));
#define DEFINE_RANGE_CHECK(T) \
JVMFlag::Error JVMFlagRangeChecker::check_ ## T(T value, bool verbose) const { \
assert(exists(), "must be"); \
JVMFlagRange_ ## T range(_flag, _limit->as_ ## T()->min(), _limit->as_ ## T()->max()); \
return range.check_ ## T(value, verbose); \
}
// Generate code to call emit_range_xxx function
#define EMIT_RANGE_START (void)(0
#define EMIT_RANGE(type, name) ); emit_range_##type(JVMFlagEx::flag_from_enum(FLAG_MEMBER_ENUM(name))
#define EMIT_RANGE_NO ); emit_range_no(0
#define EMIT_RANGE_PRODUCT_FLAG(type, name, value, doc) EMIT_RANGE(type, name)
#define EMIT_RANGE_DIAGNOSTIC_FLAG(type, name, value, doc) EMIT_RANGE(type, name)
#define EMIT_RANGE_EXPERIMENTAL_FLAG(type, name, value, doc) EMIT_RANGE(type, name)
#define EMIT_RANGE_MANAGEABLE_FLAG(type, name, value, doc) EMIT_RANGE(type, name)
#define EMIT_RANGE_PRODUCT_RW_FLAG(type, name, value, doc) EMIT_RANGE(type, name)
#define EMIT_RANGE_PD_PRODUCT_FLAG(type, name, doc) EMIT_RANGE(type, name)
#define EMIT_RANGE_PD_DIAGNOSTIC_FLAG(type, name, doc) EMIT_RANGE(type, name)
#ifndef PRODUCT
#define EMIT_RANGE_DEVELOPER_FLAG(type, name, value, doc) EMIT_RANGE(type, name)
#define EMIT_RANGE_PD_DEVELOPER_FLAG(type, name, doc) EMIT_RANGE(type, name)
#define EMIT_RANGE_NOTPRODUCT_FLAG(type, name, value, doc) EMIT_RANGE(type, name)
#else
#define EMIT_RANGE_DEVELOPER_FLAG(type, name, value, doc) EMIT_RANGE_NO
#define EMIT_RANGE_PD_DEVELOPER_FLAG(type, name, doc) EMIT_RANGE_NO
#define EMIT_RANGE_NOTPRODUCT_FLAG(type, name, value, doc) EMIT_RANGE_NO
#endif
#ifdef _LP64
#define EMIT_RANGE_LP64_PRODUCT_FLAG(type, name, value, doc) EMIT_RANGE(type, name)
#else
#define EMIT_RANGE_LP64_PRODUCT_FLAG(type, name, value, doc) EMIT_RANGE_NO
#endif
#define EMIT_RANGE_END );
ALL_RANGE_TYPES(DEFINE_RANGE_CHECK)
// Generate func argument to pass into emit_range_xxx functions
#define EMIT_RANGE_CHECK(a, b) , a, b
#define INITIAL_RANGES_SIZE 379
GrowableArray<JVMFlagRange*>* JVMFlagRangeList::_ranges = NULL;
// Check the ranges of all flags that have them
void JVMFlagRangeList::init(void) {
_ranges = new (ResourceObj::C_HEAP, mtArguments) GrowableArray<JVMFlagRange*>(INITIAL_RANGES_SIZE, mtArguments);
EMIT_RANGE_START
ALL_FLAGS(EMIT_RANGE_DEVELOPER_FLAG,
EMIT_RANGE_PD_DEVELOPER_FLAG,
EMIT_RANGE_PRODUCT_FLAG,
EMIT_RANGE_PD_PRODUCT_FLAG,
EMIT_RANGE_DIAGNOSTIC_FLAG,
EMIT_RANGE_PD_DIAGNOSTIC_FLAG,
EMIT_RANGE_EXPERIMENTAL_FLAG,
EMIT_RANGE_NOTPRODUCT_FLAG,
EMIT_RANGE_MANAGEABLE_FLAG,
EMIT_RANGE_PRODUCT_RW_FLAG,
EMIT_RANGE_LP64_PRODUCT_FLAG,
EMIT_RANGE_CHECK,
IGNORE_CONSTRAINT)
EMIT_RANGE_END
JVMFlag::Error JVMFlagRangeChecker::check(bool verbose) const {
#define CHECK_RANGE(T) \
if (_flag->is_ ## T()) { \
JVMFlagRange_ ## T range(_flag, _limit->as_ ## T()->min(), _limit->as_ ## T()->max()); \
return range.check(verbose); \
}
JVMFlagRange* JVMFlagRangeList::find(const JVMFlag* flag) {
JVMFlagRange* found = NULL;
for (int i=0; i<length(); i++) {
JVMFlagRange* range = at(i);
if (range->flag() == flag) {
found = range;
break;
ALL_RANGE_TYPES(CHECK_RANGE);
ShouldNotReachHere();
return JVMFlag::INVALID_FLAG;
}
void JVMFlagRangeChecker::print(outputStream* out) const {
#define PRINT_RANGE(T) \
if (_flag->is_ ## T()) { \
JVMFlagRange_ ## T range(_flag, _limit->as_ ## T()->min(), _limit->as_ ## T()->max()); \
range.print(out); \
return; \
}
return found;
ALL_RANGE_TYPES(PRINT_RANGE);
ShouldNotReachHere();
}
void JVMFlagRangeList::print(outputStream* st, const JVMFlag* flag, RangeStrFunc default_range_str_func) {
JVMFlagRange* range = JVMFlagRangeList::find(flag);
if (range != NULL) {
range->print(st);
JVMFlagRangeChecker range = JVMFlagRangeList::find(flag);
if (range.exists()) {
range.print(st);
} else {
const JVMFlagLimit* limit = JVMFlagLimit::get_constraint(flag);
if (limit != NULL) {
void* func = limit->constraint_func();
// Two special cases where the lower limit of the range is defined by an os:: function call
// and cannot be initialized at compile time with constexpr.
if (func == (void*)VMPageSizeConstraintFunc) {
uintx min = (uintx)os::vm_page_size();
uintx max = max_uintx;
JVMFlagRange_uintx tmp(flag, min, max);
tmp.print(st);
} else if (func == (void*)NUMAInterleaveGranularityConstraintFunc) {
size_t min = os::vm_allocation_granularity();
size_t max = NOT_LP64(2*G) LP64_ONLY(8192*G);
JVMFlagRange_size_t tmp(flag, min, max);
tmp.print(st);
} else {
JVMFlagConstraint* constraint = JVMFlagConstraintList::find(flag);
if (constraint != NULL) {
assert(default_range_str_func!=NULL, "default_range_str_func must be provided");
st->print("%s", default_range_str_func());
}
} else {
st->print("[ ... ]");
}
@ -365,9 +313,9 @@ void JVMFlagRangeList::print(outputStream* st, const JVMFlag* flag, RangeStrFunc
bool JVMFlagRangeList::check_ranges() {
bool status = true;
for (int i=0; i<length(); i++) {
JVMFlagRange* range = at(i);
if (range->check(true) != JVMFlag::SUCCESS) status = false;
for (int i = 0; i < NUM_JVMFlagsEnum; i++) {
JVMFlagRangeChecker range(&JVMFlag::flags[i], JVMFlagLimit::get_range_at(i));
if (range.exists() && range.check(true) != JVMFlag::SUCCESS) status = false;
}
return status;
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2020, 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
@ -26,7 +26,7 @@
#define SHARE_RUNTIME_FLAGS_JVMFLAGRANGELIST_HPP
#include "runtime/flags/jvmFlag.hpp"
#include "utilities/growableArray.hpp"
#include "runtime/flags/jvmFlagLimit.hpp"
/*
* Here we have a mechanism for extracting ranges specified in flag macro tables.
@ -58,14 +58,23 @@ public:
virtual void print(outputStream* st) { ; }
};
class JVMFlagRangeList : public AllStatic {
static GrowableArray<JVMFlagRange*>* _ranges;
class JVMFlagRangeChecker {
const JVMFlag* _flag;
const JVMFlagLimit* _limit;
public:
static void init();
static int length() { return (_ranges != NULL) ? _ranges->length() : 0; }
static JVMFlagRange* at(int i) { return (_ranges != NULL) ? _ranges->at(i) : NULL; }
static JVMFlagRange* find(const JVMFlag* flag);
static void add(JVMFlagRange* range) { _ranges->append(range); }
JVMFlagRangeChecker(const JVMFlag* flag, const JVMFlagLimit* limit) : _flag(flag), _limit(limit) {}
bool exists() const { return _limit != NULL; }
JVMFlag::Error check(bool verbose = true) const;
void print(outputStream* st) const;
#define DECLARE_RANGE_CHECK(T) JVMFlag::Error check_ ## T(T new_value, bool verbose = true) const;
ALL_RANGE_TYPES(DECLARE_RANGE_CHECK)
};
class JVMFlagRangeList : public AllStatic {
public:
static JVMFlagRangeChecker find(const JVMFlag* flag) { return JVMFlagRangeChecker(flag, JVMFlagLimit::get_range(flag)); }
static void print(outputStream* st, const JVMFlag* flag, RangeStrFunc default_range_str_func);
// Check the final values of all flags for ranges.
static bool check_ranges();

View file

@ -40,39 +40,22 @@
#include "utilities/stringUtils.hpp"
// Implementation macros
#define MATERIALIZE_PRODUCT_FLAG(type, name, value, doc) type name = value;
#define MATERIALIZE_PD_PRODUCT_FLAG(type, name, doc) type name = pd_##name;
#define MATERIALIZE_DIAGNOSTIC_FLAG(type, name, value, doc) type name = value;
#define MATERIALIZE_PD_DIAGNOSTIC_FLAG(type, name, doc) type name = pd_##name;
#define MATERIALIZE_EXPERIMENTAL_FLAG(type, name, value, doc) type name = value;
#define MATERIALIZE_MANAGEABLE_FLAG(type, name, value, doc) type name = value;
#define MATERIALIZE_PRODUCT_RW_FLAG(type, name, value, doc) type name = value;
#define MATERIALIZE_PRODUCT_FLAG(type, name, value, ...) type name = value;
#define MATERIALIZE_PD_PRODUCT_FLAG(type, name, ...) type name = pd_##name;
#ifdef PRODUCT
#define MATERIALIZE_DEVELOPER_FLAG(type, name, value, doc)
#define MATERIALIZE_PD_DEVELOPER_FLAG(type, name, doc)
#define MATERIALIZE_NOTPRODUCT_FLAG(type, name, value, doc)
#define MATERIALIZE_DEVELOPER_FLAG(type, name, value, ...)
#define MATERIALIZE_PD_DEVELOPER_FLAG(type, name, ...)
#define MATERIALIZE_NOTPRODUCT_FLAG(type, name, value, ...)
#else
#define MATERIALIZE_DEVELOPER_FLAG(type, name, value, doc) type name = value;
#define MATERIALIZE_PD_DEVELOPER_FLAG(type, name, doc) type name = pd_##name;
#define MATERIALIZE_NOTPRODUCT_FLAG(type, name, value, doc) type name = value;
#define MATERIALIZE_DEVELOPER_FLAG(type, name, value, ...) type name = value;
#define MATERIALIZE_PD_DEVELOPER_FLAG(type, name, ...) type name = pd_##name;
#define MATERIALIZE_NOTPRODUCT_FLAG(type, name, value, ...) type name = value;
#endif // PRODUCT
#ifdef _LP64
#define MATERIALIZE_LP64_PRODUCT_FLAG(type, name, value, doc) type name = value;
#else
#define MATERIALIZE_LP64_PRODUCT_FLAG(type, name, value, doc) /* flag is constant */
#endif // _LP64
ALL_FLAGS(MATERIALIZE_DEVELOPER_FLAG, \
MATERIALIZE_PD_DEVELOPER_FLAG, \
MATERIALIZE_PRODUCT_FLAG, \
MATERIALIZE_PD_PRODUCT_FLAG, \
MATERIALIZE_DIAGNOSTIC_FLAG, \
MATERIALIZE_PD_DIAGNOSTIC_FLAG, \
MATERIALIZE_EXPERIMENTAL_FLAG, \
MATERIALIZE_NOTPRODUCT_FLAG, \
MATERIALIZE_MANAGEABLE_FLAG, \
MATERIALIZE_PRODUCT_RW_FLAG, \
MATERIALIZE_LP64_PRODUCT_FLAG, \
IGNORE_RANGE, \
ALL_FLAGS(MATERIALIZE_DEVELOPER_FLAG,
MATERIALIZE_PD_DEVELOPER_FLAG,
MATERIALIZE_PRODUCT_FLAG,
MATERIALIZE_PD_PRODUCT_FLAG,
MATERIALIZE_NOTPRODUCT_FLAG,
IGNORE_RANGE,
IGNORE_CONSTRAINT)

File diff suppressed because it is too large Load diff

View file

@ -34,34 +34,18 @@
#define FLAG_MEMBER_ENUM(name) Flag_##name##_enum
#define FLAG_MEMBER_ENUM_(name) FLAG_MEMBER_ENUM(name),
#define FLAG_MEMBER_ENUM_PRODUCT(type, name, value, doc) FLAG_MEMBER_ENUM_(name)
#define FLAG_MEMBER_ENUM_PD_PRODUCT(type, name, doc) FLAG_MEMBER_ENUM_(name)
#define FLAG_MEMBER_ENUM_DIAGNOSTIC(type, name, value, doc) FLAG_MEMBER_ENUM_(name)
#define FLAG_MEMBER_ENUM_PD_DIAGNOSTIC(type, name, doc) FLAG_MEMBER_ENUM_(name)
#define FLAG_MEMBER_ENUM_EXPERIMENTAL(type, name, value, doc) FLAG_MEMBER_ENUM_(name)
#define FLAG_MEMBER_ENUM_MANAGEABLE(type, name, value, doc) FLAG_MEMBER_ENUM_(name)
#define FLAG_MEMBER_ENUM_PRODUCT_RW(type, name, value, doc) FLAG_MEMBER_ENUM_(name)
#define FLAG_MEMBER_ENUM_DEVELOP(type, name, value, doc) FLAG_MEMBER_ENUM_(name)
#define FLAG_MEMBER_ENUM_PD_DEVELOP(type, name, doc) FLAG_MEMBER_ENUM_(name)
#define FLAG_MEMBER_ENUM_NOTPRODUCT(type, name, value, doc) FLAG_MEMBER_ENUM_(name)
#ifdef _LP64
#define FLAG_MEMBER_ENUM_LP64_PRODUCT(type, name, value, doc) FLAG_MEMBER_ENUM_(name)
#else
#define FLAG_MEMBER_ENUM_LP64_PRODUCT(type, name, value, doc) /* flag is constant */
#endif // _LP64
#define FLAG_MEMBER_ENUM_PRODUCT(type, name, value, ...) FLAG_MEMBER_ENUM_(name)
#define FLAG_MEMBER_ENUM_PD_PRODUCT(type, name, ...) FLAG_MEMBER_ENUM_(name)
#define FLAG_MEMBER_ENUM_DEVELOP(type, name, value, ...) FLAG_MEMBER_ENUM_(name)
#define FLAG_MEMBER_ENUM_PD_DEVELOP(type, name, ...) FLAG_MEMBER_ENUM_(name)
#define FLAG_MEMBER_ENUM_NOTPRODUCT(type, name, value, ...) FLAG_MEMBER_ENUM_(name)
typedef enum {
typedef enum : int {
ALL_FLAGS(FLAG_MEMBER_ENUM_DEVELOP,
FLAG_MEMBER_ENUM_PD_DEVELOP,
FLAG_MEMBER_ENUM_PRODUCT,
FLAG_MEMBER_ENUM_PD_PRODUCT,
FLAG_MEMBER_ENUM_DIAGNOSTIC,
FLAG_MEMBER_ENUM_PD_DIAGNOSTIC,
FLAG_MEMBER_ENUM_EXPERIMENTAL,
FLAG_MEMBER_ENUM_NOTPRODUCT,
FLAG_MEMBER_ENUM_MANAGEABLE,
FLAG_MEMBER_ENUM_PRODUCT_RW,
FLAG_MEMBER_ENUM_LP64_PRODUCT,
IGNORE_RANGE,
IGNORE_CONSTRAINT)
NUM_JVMFlagsEnum
@ -100,33 +84,17 @@ class JVMFlagEx : JVMFlag {
#define FLAG_MEMBER_SET(name) Flag_##name##_set
#define FLAG_MEMBER_SET_(type, name) inline JVMFlag::Error FLAG_MEMBER_SET(name)(type value, JVMFlag::Flags origin) { return JVMFlagEx::type##AtPut(FLAG_MEMBER_ENUM(name), value, origin); }
#define FLAG_MEMBER_SET_PRODUCT(type, name, value, doc) FLAG_MEMBER_SET_(type, name)
#define FLAG_MEMBER_SET_PD_PRODUCT(type, name, doc) FLAG_MEMBER_SET_(type, name)
#define FLAG_MEMBER_SET_DIAGNOSTIC(type, name, value, doc) FLAG_MEMBER_SET_(type, name)
#define FLAG_MEMBER_SET_PD_DIAGNOSTIC(type, name, doc) FLAG_MEMBER_SET_(type, name)
#define FLAG_MEMBER_SET_EXPERIMENTAL(type, name, value, doc) FLAG_MEMBER_SET_(type, name)
#define FLAG_MEMBER_SET_MANAGEABLE(type, name, value, doc) FLAG_MEMBER_SET_(type, name)
#define FLAG_MEMBER_SET_PRODUCT_RW(type, name, value, doc) FLAG_MEMBER_SET_(type, name)
#define FLAG_MEMBER_SET_DEVELOP(type, name, value, doc) FLAG_MEMBER_SET_(type, name)
#define FLAG_MEMBER_SET_PD_DEVELOP(type, name, doc) FLAG_MEMBER_SET_(type, name)
#define FLAG_MEMBER_SET_NOTPRODUCT(type, name, value, doc) FLAG_MEMBER_SET_(type, name)
#ifdef _LP64
#define FLAG_MEMBER_SET_LP64_PRODUCT(type, name, value, doc) FLAG_MEMBER_SET_(type, name)
#else
#define FLAG_MEMBER_SET_LP64_PRODUCT(type, name, value, doc) /* flag is constant */
#endif // _LP64
#define FLAG_MEMBER_SET_PRODUCT(type, name, value, ...) FLAG_MEMBER_SET_(type, name)
#define FLAG_MEMBER_SET_PD_PRODUCT(type, name, ...) FLAG_MEMBER_SET_(type, name)
#define FLAG_MEMBER_SET_DEVELOP(type, name, value, ...) FLAG_MEMBER_SET_(type, name)
#define FLAG_MEMBER_SET_PD_DEVELOP(type, name, ...) FLAG_MEMBER_SET_(type, name)
#define FLAG_MEMBER_SET_NOTPRODUCT(type, name, value, ...) FLAG_MEMBER_SET_(type, name)
ALL_FLAGS(FLAG_MEMBER_SET_DEVELOP,
FLAG_MEMBER_SET_PD_DEVELOP,
FLAG_MEMBER_SET_PRODUCT,
FLAG_MEMBER_SET_PD_PRODUCT,
FLAG_MEMBER_SET_DIAGNOSTIC,
FLAG_MEMBER_SET_PD_DIAGNOSTIC,
FLAG_MEMBER_SET_EXPERIMENTAL,
FLAG_MEMBER_SET_NOTPRODUCT,
FLAG_MEMBER_SET_MANAGEABLE,
FLAG_MEMBER_SET_PRODUCT_RW,
FLAG_MEMBER_SET_LP64_PRODUCT,
IGNORE_RANGE,
IGNORE_CONSTRAINT)

View file

@ -77,18 +77,14 @@
// Only materialize src code for contraint checking when required, ignore otherwise
#define IGNORE_CONSTRAINT(func,type)
#define IGNORE_FLAG(...)
#define VM_FLAGS( \
develop, \
develop_pd, \
product, \
product_pd, \
diagnostic, \
diagnostic_pd, \
experimental, \
notproduct, \
manageable, \
product_rw, \
lp64_product, \
range, \
constraint) \
\
@ -97,13 +93,7 @@
develop_pd, \
product, \
product_pd, \
diagnostic, \
diagnostic_pd, \
experimental, \
notproduct, \
manageable, \
product_rw, \
lp64_product, \
range, \
constraint) \
\
@ -112,54 +102,28 @@
develop_pd, \
product, \
product_pd, \
diagnostic, \
diagnostic_pd, \
experimental, \
notproduct, \
manageable, \
product_rw, \
lp64_product, \
range, \
constraint) \
// Put the LP64/JVMCI/COMPILER1/COMPILER1/ARCH at
// the top, as they are processed by jvmFlags.cpp in that
// order.
#define ALL_FLAGS( \
develop, \
develop_pd, \
product, \
product_pd, \
diagnostic, \
diagnostic_pd, \
experimental, \
notproduct, \
manageable, \
product_rw, \
lp64_product, \
range, \
constraint) \
\
VM_FLAGS( \
LP64_RUNTIME_FLAGS( \
develop, \
develop_pd, \
product, \
product_pd, \
diagnostic, \
diagnostic_pd, \
experimental, \
notproduct, \
manageable, \
product_rw, \
lp64_product, \
range, \
constraint) \
\
RUNTIME_OS_FLAGS( \
develop, \
develop_pd, \
product, \
product_pd, \
diagnostic, \
diagnostic_pd, \
notproduct, \
range, \
constraint) \
@ -169,9 +133,6 @@
develop_pd, \
product, \
product_pd, \
diagnostic, \
diagnostic_pd, \
experimental, \
notproduct, \
range, \
constraint)) \
@ -181,8 +142,6 @@
develop_pd, \
product, \
product_pd, \
diagnostic, \
diagnostic_pd, \
notproduct, \
range, \
constraint)) \
@ -192,9 +151,6 @@
develop_pd, \
product, \
product_pd, \
diagnostic, \
diagnostic_pd, \
experimental, \
notproduct, \
range, \
constraint)) \
@ -202,10 +158,31 @@
ARCH_FLAGS( \
develop, \
product, \
diagnostic, \
experimental, \
notproduct, \
range, \
constraint) \
\
VM_FLAGS( \
develop, \
develop_pd, \
product, \
product_pd, \
notproduct, \
range, \
constraint) \
\
RUNTIME_OS_FLAGS( \
develop, \
develop_pd, \
product, \
product_pd, \
notproduct, \
range, \
constraint)
#define ALL_CONSTRAINTS(f) \
COMPILER_CONSTRAINTS(f) \
RUNTIME_CONSTRAINTS(f) \
GC_CONSTRAINTS(f)
#endif // SHARE_RUNTIME_GLOBALS_SHARED_HPP

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2020, 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
@ -39,12 +39,12 @@ static void buffer_concat(char* buffer, const char* src) {
}
static void print_flag_error_message_bounds(const JVMFlag* flag, char* buffer) {
JVMFlagRange* range = JVMFlagRangeList::find(flag);
if (range != NULL) {
JVMFlagRangeChecker range = JVMFlagRangeList::find(flag);
if (range.exists()) {
buffer_concat(buffer, "must have value in range ");
stringStream stream;
range->print(&stream);
range.print(&stream);
const char* range_string = stream.as_string();
size_t j = strlen(buffer);
for (size_t i=0; j<TEMP_BUF_SIZE-1; i++) {

View file

@ -972,12 +972,12 @@ inline intptr_t bitfield(intptr_t x, int start_bit_no, int field_length) {
// and 64-bit overloaded functions, which does not work, and having
// explicitly-typed versions of these routines (i.e., MAX2I, MAX2L)
// will be even more error-prone than macros.
template<class T> inline T MAX2(T a, T b) { return (a > b) ? a : b; }
template<class T> inline T MIN2(T a, T b) { return (a < b) ? a : b; }
template<class T> inline T MAX3(T a, T b, T c) { return MAX2(MAX2(a, b), c); }
template<class T> inline T MIN3(T a, T b, T c) { return MIN2(MIN2(a, b), c); }
template<class T> inline T MAX4(T a, T b, T c, T d) { return MAX2(MAX3(a, b, c), d); }
template<class T> inline T MIN4(T a, T b, T c, T d) { return MIN2(MIN3(a, b, c), d); }
template<class T> constexpr T MAX2(T a, T b) { return (a > b) ? a : b; }
template<class T> constexpr T MIN2(T a, T b) { return (a < b) ? a : b; }
template<class T> constexpr T MAX3(T a, T b, T c) { return MAX2(MAX2(a, b), c); }
template<class T> constexpr T MIN3(T a, T b, T c) { return MIN2(MIN2(a, b), c); }
template<class T> constexpr T MAX4(T a, T b, T c, T d) { return MAX2(MAX3(a, b, c), d); }
template<class T> constexpr T MIN4(T a, T b, T c, T d) { return MIN2(MIN3(a, b, c), d); }
template<class T> inline T ABS(T x) { return (x > 0) ? x : -x; }