8224201: Simplify JVM flag macro expansions

Reviewed-by: rehn, kvn, stuefe, tschatzl, coleenp, gziemski
This commit is contained in:
Stefan Karlsson 2019-05-22 13:05:37 +02:00
parent 6beb19a361
commit c9846fce19
27 changed files with 544 additions and 938 deletions

View file

@ -25,115 +25,15 @@
#ifndef SHARE_RUNTIME_GLOBALS_HPP
#define SHARE_RUNTIME_GLOBALS_HPP
#include "compiler/compiler_globals.hpp"
#include "gc/shared/gc_globals.hpp"
#include "runtime/globals_shared.hpp"
#include "utilities/align.hpp"
#include "utilities/globalDefinitions.hpp"
#include "utilities/macros.hpp"
#include <float.h> // for DBL_MAX
// The larger HeapWordSize for 64bit requires larger heaps
// for the same application running in 64bit. See bug 4967770.
// The minimum alignment to a heap word size is done. Other
// parts of the memory system may require additional alignment
// and are responsible for those alignments.
#ifdef _LP64
#define ScaleForWordSize(x) align_down_((x) * 13 / 10, HeapWordSize)
#else
#define ScaleForWordSize(x) (x)
#endif
// use this for flags that are true per default in the tiered build
// but false in non-tiered builds, and vice versa
#ifdef TIERED
#define trueInTiered true
#define falseInTiered false
#else
#define trueInTiered false
#define falseInTiered true
#endif
// Default and minimum StringTable and SymbolTable size values
// Must be powers of 2
const size_t defaultStringTableSize = NOT_LP64(1024) LP64_ONLY(65536);
const size_t minimumStringTableSize = 128;
const size_t defaultSymbolTableSize = 32768; // 2^15
const size_t minimumSymbolTableSize = 1024;
#include CPU_HEADER(globals)
#include OS_HEADER(globals)
#include OS_CPU_HEADER(globals)
#ifdef COMPILER1
#include CPU_HEADER(c1_globals)
#include OS_HEADER(c1_globals)
#endif
#ifdef COMPILER2
#include CPU_HEADER(c2_globals)
#include OS_HEADER(c2_globals)
#endif
#if !defined(COMPILER1) && !defined(COMPILER2) && !INCLUDE_JVMCI
define_pd_global(bool, BackgroundCompilation, false);
define_pd_global(bool, UseTLAB, false);
define_pd_global(bool, CICompileOSR, false);
define_pd_global(bool, UseTypeProfile, false);
define_pd_global(bool, UseOnStackReplacement, false);
define_pd_global(bool, InlineIntrinsics, false);
define_pd_global(bool, PreferInterpreterNativeStubs, true);
define_pd_global(bool, ProfileInterpreter, false);
define_pd_global(bool, ProfileTraps, false);
define_pd_global(bool, TieredCompilation, false);
define_pd_global(intx, CompileThreshold, 0);
define_pd_global(intx, OnStackReplacePercentage, 0);
define_pd_global(bool, ResizeTLAB, false);
define_pd_global(intx, FreqInlineSize, 0);
define_pd_global(size_t, NewSizeThreadIncrease, 4*K);
define_pd_global(bool, InlineClassNatives, true);
define_pd_global(bool, InlineUnsafeOps, true);
define_pd_global(uintx, InitialCodeCacheSize, 160*K);
define_pd_global(uintx, ReservedCodeCacheSize, 32*M);
define_pd_global(uintx, NonProfiledCodeHeapSize, 0);
define_pd_global(uintx, ProfiledCodeHeapSize, 0);
define_pd_global(uintx, NonNMethodCodeHeapSize, 32*M);
define_pd_global(uintx, CodeCacheExpansionSize, 32*K);
define_pd_global(uintx, CodeCacheMinBlockLength, 1);
define_pd_global(uintx, CodeCacheMinimumUseSpace, 200*K);
define_pd_global(size_t, MetaspaceSize, ScaleForWordSize(4*M));
define_pd_global(bool, NeverActAsServerClassMachine, true);
define_pd_global(uint64_t,MaxRAM, 1ULL*G);
#define CI_COMPILER_COUNT 0
#else
#if COMPILER2_OR_JVMCI
#define CI_COMPILER_COUNT 2
#else
#define CI_COMPILER_COUNT 1
#endif // COMPILER2_OR_JVMCI
#endif // no compilers
// use this for flags that are true by default in the debug version but
// false in the optimized version, and vice versa
#ifdef ASSERT
#define trueInDebug true
#define falseInDebug false
#else
#define trueInDebug false
#define falseInDebug true
#endif
// use this for flags that are true per default in the product build
// but false in development builds, and vice versa
#ifdef PRODUCT
#define trueInProduct true
#define falseInProduct false
#else
#define trueInProduct false
#define falseInProduct true
#endif
// develop flags are settable / visible only during development and are constant in the PRODUCT version
// product flags are always settable / visible
@ -216,6 +116,12 @@ define_pd_global(uint64_t,MaxRAM, 1ULL*G);
// (multiple times allowed)
//
// Default and minimum StringTable and SymbolTable size values
// Must be powers of 2
const size_t defaultStringTableSize = NOT_LP64(1024) LP64_ONLY(65536);
const size_t minimumStringTableSize = 128;
const size_t defaultSymbolTableSize = 32768; // 2^15
const size_t minimumSymbolTableSize = 1024;
#define RUNTIME_FLAGS(develop, \
develop_pd, \
@ -2560,57 +2466,6 @@ define_pd_global(uint64_t,MaxRAM, 1ULL*G);
experimental(bool, UseFastUnorderedTimeStamps, false, \
"Use platform unstable time where supported for timestamps only")
#define VM_FLAGS(develop, \
develop_pd, \
product, \
product_pd, \
diagnostic, \
diagnostic_pd, \
experimental, \
notproduct, \
manageable, \
product_rw, \
lp64_product, \
range, \
constraint, \
writeable) \
\
RUNTIME_FLAGS( \
develop, \
develop_pd, \
product, \
product_pd, \
diagnostic, \
diagnostic_pd, \
experimental, \
notproduct, \
manageable, \
product_rw, \
lp64_product, \
range, \
constraint, \
writeable) \
\
GC_FLAGS( \
develop, \
develop_pd, \
product, \
product_pd, \
diagnostic, \
diagnostic_pd, \
experimental, \
notproduct, \
manageable, \
product_rw, \
lp64_product, \
range, \
constraint, \
writeable) \
/*
* Macros for factoring of globals
*/
// Interface macros
#define DECLARE_PRODUCT_FLAG(type, name, value, doc) extern "C" type name;
#define DECLARE_PD_PRODUCT_FLAG(type, name, doc) extern "C" type name;
@ -2635,70 +2490,20 @@ define_pd_global(uint64_t,MaxRAM, 1ULL*G);
#define DECLARE_LP64_PRODUCT_FLAG(type, name, value, doc) const type name = value;
#endif // _LP64
// 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;
#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)
#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;
#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
// Only materialize src code for range checking when required, ignore otherwise
#define IGNORE_RANGE(a, b)
// Only materialize src code for contraint checking when required, ignore otherwise
#define IGNORE_CONSTRAINT(func,type)
#define IGNORE_WRITEABLE(type)
VM_FLAGS(DECLARE_DEVELOPER_FLAG, \
DECLARE_PD_DEVELOPER_FLAG, \
DECLARE_PRODUCT_FLAG, \
DECLARE_PD_PRODUCT_FLAG, \
DECLARE_DIAGNOSTIC_FLAG, \
DECLARE_PD_DIAGNOSTIC_FLAG, \
DECLARE_EXPERIMENTAL_FLAG, \
DECLARE_NOTPRODUCT_FLAG, \
DECLARE_MANAGEABLE_FLAG, \
DECLARE_PRODUCT_RW_FLAG, \
DECLARE_LP64_PRODUCT_FLAG, \
IGNORE_RANGE, \
IGNORE_CONSTRAINT, \
IGNORE_WRITEABLE)
RUNTIME_OS_FLAGS(DECLARE_DEVELOPER_FLAG, \
DECLARE_PD_DEVELOPER_FLAG, \
DECLARE_PRODUCT_FLAG, \
DECLARE_PD_PRODUCT_FLAG, \
DECLARE_DIAGNOSTIC_FLAG, \
DECLARE_PD_DIAGNOSTIC_FLAG, \
DECLARE_NOTPRODUCT_FLAG, \
IGNORE_RANGE, \
IGNORE_CONSTRAINT, \
IGNORE_WRITEABLE)
ARCH_FLAGS(DECLARE_DEVELOPER_FLAG, \
DECLARE_PRODUCT_FLAG, \
DECLARE_DIAGNOSTIC_FLAG, \
DECLARE_EXPERIMENTAL_FLAG, \
DECLARE_NOTPRODUCT_FLAG, \
IGNORE_RANGE, \
IGNORE_CONSTRAINT, \
IGNORE_WRITEABLE)
ALL_FLAGS(DECLARE_DEVELOPER_FLAG, \
DECLARE_PD_DEVELOPER_FLAG, \
DECLARE_PRODUCT_FLAG, \
DECLARE_PD_PRODUCT_FLAG, \
DECLARE_DIAGNOSTIC_FLAG, \
DECLARE_PD_DIAGNOSTIC_FLAG, \
DECLARE_EXPERIMENTAL_FLAG, \
DECLARE_NOTPRODUCT_FLAG, \
DECLARE_MANAGEABLE_FLAG, \
DECLARE_PRODUCT_RW_FLAG, \
DECLARE_LP64_PRODUCT_FLAG, \
IGNORE_RANGE, \
IGNORE_CONSTRAINT, \
IGNORE_WRITEABLE)
// Extensions