Details
Description
Many of the proposals below depend on constexpr -- see JDK-8208089 (JEP347: Enable C++14 Language Features).
(1) Reduce the complexity of ALL_FLAGS and other macros
The current code conflates "availability" (product/develop/notproduct) with "attribute" (diagnostic, experimental, manageable). It has a limited number of a cross-product of these two:
#define ALL_FLAGS( \
develop, \
develop_pd, \
product, \
product_pd, \
diagnostic, \ == product + diagnostic
diagnostic_pd, \
experimental, \ == product + experimental
notproduct, \
manageable, \ == product + manageable
product_rw, \
lp64_product, \
range, \
constraint) \
We should moved the attributes to a new "attr" parameter of the iterator macro, so now we have only 7 iterators:
#define ALL_FLAGS(develop, \
develop_pd, \
product, \
product_pd, \
notproduct, \
range, \
constraint) \
So this will make it easy to have combinations like manageable+experimental flags (JDK-7123237).
product(bool, HeapDumpBeforeFullGC, false, MANAGEABLE | EXPERIMENTAL, \
"Dump heap to file before any major stop-the-world GC") \
\
(2) Each flag can optionally belong to a group. We have 5 such groups (C1, C2, JVMCI, ARCH, and LP64). The grouping is done by an excessively large macro:
http://hg.openjdk.java.net/jdk/jdk/file/4a5a7dc9d05c/src/hotspot/share/runtime/flags/jvmFlag.cpp#l635
This can be simplified by counting the size of each group using constexpr.
(3) Constant-time access from JVMFlag to JVMFlagLimit (i.e., range/constraint).
Currently, each time a flag is specified in the command-line, we do a linear search of ~250 elements in JVMFlagRangeList::find().
In the new design, going from JVMFlag to JVMFlagLimit is a simple operation:
JVMFlag* f = ...;
int flag_enum = f - flagTable;
JVMFlagLimit* limit = flagLimitTable[flag_enum]
The flagLimitTable, as well as all JVMFlagLimit structures, are initialized at compile time with constexpr.
(4) compile-time generation of hashtable of flags for quick searching in arguments.cpp
(1) Reduce the complexity of ALL_FLAGS and other macros
The current code conflates "availability" (product/develop/notproduct) with "attribute" (diagnostic, experimental, manageable). It has a limited number of a cross-product of these two:
#define ALL_FLAGS( \
develop, \
develop_pd, \
product, \
product_pd, \
diagnostic, \ == product + diagnostic
diagnostic_pd, \
experimental, \ == product + experimental
notproduct, \
manageable, \ == product + manageable
product_rw, \
lp64_product, \
range, \
constraint) \
We should moved the attributes to a new "attr" parameter of the iterator macro, so now we have only 7 iterators:
#define ALL_FLAGS(develop, \
develop_pd, \
product, \
product_pd, \
notproduct, \
range, \
constraint) \
So this will make it easy to have combinations like manageable+experimental flags (
product(bool, HeapDumpBeforeFullGC, false, MANAGEABLE | EXPERIMENTAL, \
"Dump heap to file before any major stop-the-world GC") \
\
(2) Each flag can optionally belong to a group. We have 5 such groups (C1, C2, JVMCI, ARCH, and LP64). The grouping is done by an excessively large macro:
http://hg.openjdk.java.net/jdk/jdk/file/4a5a7dc9d05c/src/hotspot/share/runtime/flags/jvmFlag.cpp#l635
This can be simplified by counting the size of each group using constexpr.
(3) Constant-time access from JVMFlag to JVMFlagLimit (i.e., range/constraint).
Currently, each time a flag is specified in the command-line, we do a linear search of ~250 elements in JVMFlagRangeList::find().
In the new design, going from JVMFlag to JVMFlagLimit is a simple operation:
JVMFlag* f = ...;
int flag_enum = f - flagTable;
JVMFlagLimit* limit = flagLimitTable[flag_enum]
The flagLimitTable, as well as all JVMFlagLimit structures, are initialized at compile time with constexpr.
(4) compile-time generation of hashtable of flags for quick searching in arguments.cpp
Attachments
Issue Links
- blocks
-
JDK-8081833 Clean up JVMFlag getter/setter code
- Resolved
-
JDK-8243205 Modularize JVM flags declaration
- Resolved
- duplicates
-
JDK-8236741 Remove product_rw command line macro
- Resolved
-
JDK-8243209 Generate JVMFlag hashtable with constexpr
- Resolved
-
JDK-7123237 Hotspot command line switches should have multiple type attributes
- Closed
- is blocked by
-
JDK-8208089 JEP 347: Enable C++14 Language Features
- Closed
- relates to
-
JDK-8253089 Windows (MSVC 2017) build fails after JDK-8243208
- Resolved
(1 is blocked by, 1 relates to, 2 links to)