Tue, 29 Nov 2011 17:00:46 -0500
7116481: Commercial features in Hotspot must be gated by a switch
Summary: Add -XX:+UnlockCommercialVMOptions to gate use of commercial feature switches in the same way as -XX:UnlockDiagnosticVMOptions gates use of diagnostic feature switches.
Reviewed-by: jwilhelm, kamg
1.1 --- a/src/share/vm/runtime/globals.cpp Tue Nov 29 09:21:02 2011 -0500 1.2 +++ b/src/share/vm/runtime/globals.cpp Tue Nov 29 17:00:46 2011 -0500 1.3 @@ -46,8 +46,8 @@ 1.4 1.5 RUNTIME_FLAGS(MATERIALIZE_DEVELOPER_FLAG, MATERIALIZE_PD_DEVELOPER_FLAG, \ 1.6 MATERIALIZE_PRODUCT_FLAG, MATERIALIZE_PD_PRODUCT_FLAG, \ 1.7 - MATERIALIZE_DIAGNOSTIC_FLAG, MATERIALIZE_EXPERIMENTAL_FLAG, \ 1.8 - MATERIALIZE_NOTPRODUCT_FLAG, \ 1.9 + MATERIALIZE_COMMERCIAL_FLAG, MATERIALIZE_DIAGNOSTIC_FLAG, \ 1.10 + MATERIALIZE_EXPERIMENTAL_FLAG, MATERIALIZE_NOTPRODUCT_FLAG, \ 1.11 MATERIALIZE_MANAGEABLE_FLAG, MATERIALIZE_PRODUCT_RW_FLAG, \ 1.12 MATERIALIZE_LP64_PRODUCT_FLAG) 1.13 1.14 @@ -56,13 +56,16 @@ 1.15 MATERIALIZE_DIAGNOSTIC_FLAG, MATERIALIZE_NOTPRODUCT_FLAG) 1.16 1.17 bool Flag::is_unlocker() const { 1.18 - return strcmp(name, "UnlockDiagnosticVMOptions") == 0 || 1.19 + return strcmp(name, "UnlockCommercialVMOptions") == 0 || 1.20 + strcmp(name, "UnlockDiagnosticVMOptions") == 0 || 1.21 strcmp(name, "UnlockExperimentalVMOptions") == 0; 1.22 1.23 } 1.24 1.25 bool Flag::is_unlocked() const { 1.26 - if (strcmp(kind, "{diagnostic}") == 0) { 1.27 + if (strcmp(kind, "{commercial}") == 0) { 1.28 + return UnlockCommercialVMOptions; 1.29 + } else if (strcmp(kind, "{diagnostic}") == 0) { 1.30 if (strcmp(name, "EnableInvokeDynamic") == 0 && UnlockExperimentalVMOptions && !UnlockDiagnosticVMOptions) { 1.31 // transitional logic to allow tests to run until they are changed 1.32 static int warned; 1.33 @@ -165,6 +168,7 @@ 1.34 1.35 #define RUNTIME_PRODUCT_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) "{product}", DEFAULT }, 1.36 #define RUNTIME_PD_PRODUCT_FLAG_STRUCT(type, name, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) "{pd product}", DEFAULT }, 1.37 +#define RUNTIME_COMMERCIAL_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) "{commercial}", DEFAULT }, 1.38 #define RUNTIME_DIAGNOSTIC_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) "{diagnostic}", DEFAULT }, 1.39 #define RUNTIME_EXPERIMENTAL_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) "{experimental}", DEFAULT }, 1.40 #define RUNTIME_MANAGEABLE_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) "{manageable}", DEFAULT }, 1.41 @@ -227,7 +231,7 @@ 1.42 #endif 1.43 1.44 static Flag flagTable[] = { 1.45 - RUNTIME_FLAGS(RUNTIME_DEVELOP_FLAG_STRUCT, RUNTIME_PD_DEVELOP_FLAG_STRUCT, RUNTIME_PRODUCT_FLAG_STRUCT, RUNTIME_PD_PRODUCT_FLAG_STRUCT, RUNTIME_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) 1.46 + RUNTIME_FLAGS(RUNTIME_DEVELOP_FLAG_STRUCT, RUNTIME_PD_DEVELOP_FLAG_STRUCT, RUNTIME_PRODUCT_FLAG_STRUCT, RUNTIME_PD_PRODUCT_FLAG_STRUCT, RUNTIME_COMMERCIAL_FLAG_STRUCT, RUNTIME_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) 1.47 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_NOTPRODUCT_FLAG_STRUCT) 1.48 #ifndef SERIALGC 1.49 G1_FLAGS(RUNTIME_DEVELOP_FLAG_STRUCT, RUNTIME_PD_DEVELOP_FLAG_STRUCT, RUNTIME_PRODUCT_FLAG_STRUCT, RUNTIME_PD_PRODUCT_FLAG_STRUCT, RUNTIME_DIAGNOSTIC_FLAG_STRUCT, RUNTIME_EXPERIMENTAL_FLAG_STRUCT, RUNTIME_NOTPRODUCT_FLAG_STRUCT, RUNTIME_MANAGEABLE_FLAG_STRUCT, RUNTIME_PRODUCT_RW_FLAG_STRUCT) 1.50 @@ -257,8 +261,8 @@ 1.51 for (Flag* current = &flagTable[0]; current->name; current++) { 1.52 if (str_equal(current->name, name, length)) { 1.53 if (!(current->is_unlocked() || current->is_unlocker())) { 1.54 - // disable use of diagnostic or experimental flags until they 1.55 - // are explicitly unlocked 1.56 + // disable use of commercial, diagnostic or experimental 1.57 + // flags until they are explicitly unlocked 1.58 return NULL; 1.59 } 1.60 return current;
2.1 --- a/src/share/vm/runtime/globals.hpp Tue Nov 29 09:21:02 2011 -0500 2.2 +++ b/src/share/vm/runtime/globals.hpp Tue Nov 29 17:00:46 2011 -0500 2.3 @@ -373,7 +373,7 @@ 2.4 // The type "ccstr" is an alias for "const char*" and is used 2.5 // only in this file, because the macrology requires single-token type names. 2.6 2.7 -// Note: Diagnostic options not meant for VM tuning or for product modes. 2.8 +// Note: Diagnostic options are not meant for VM tuning or for product modes. 2.9 // They are to be used for VM quality assurance or field diagnosis 2.10 // of VM bugs. They are hidden so that users will not be encouraged to 2.11 // try them as if they were VM ordinary execution options. However, they 2.12 @@ -383,6 +383,12 @@ 2.13 // option, you must first specify +UnlockDiagnosticVMOptions. 2.14 // (This master switch also affects the behavior of -Xprintflags.) 2.15 // 2.16 +// 2.17 +// commercial flags support features for which Oracle charges a fee for 2.18 +// production use, though they're free for development and/or evaluation. 2.19 +// There's no enforcement mechanism in Hotspot other than that 2.20 +// -XX:+UnlockCommercialVMOptions must first be specified in order to use them. 2.21 +// 2.22 // experimental flags are in support of features that are not 2.23 // part of the officially supported product, but are available 2.24 // for experimenting with. They could, for example, be performance 2.25 @@ -428,7 +434,7 @@ 2.26 // Note that when there is a need to support develop flags to be writeable, 2.27 // it can be done in the same way as product_rw. 2.28 2.29 -#define RUNTIME_FLAGS(develop, develop_pd, product, product_pd, diagnostic, experimental, notproduct, manageable, product_rw, lp64_product) \ 2.30 +#define RUNTIME_FLAGS(develop, develop_pd, product, product_pd, commercial, diagnostic, experimental, notproduct, manageable, product_rw, lp64_product) \ 2.31 \ 2.32 lp64_product(bool, UseCompressedOops, false, \ 2.33 "Use 32-bit object references in 64-bit VM. " \ 2.34 @@ -462,15 +468,20 @@ 2.35 develop(bool, CleanChunkPoolAsync, falseInEmbedded, \ 2.36 "Whether to clean the chunk pool asynchronously") \ 2.37 \ 2.38 - /* Temporary: See 6948537 */ \ 2.39 + /* Temporary: See 6948537 */ \ 2.40 experimental(bool, UseMemSetInBOT, true, \ 2.41 "(Unstable) uses memset in BOT updates in GC code") \ 2.42 \ 2.43 + commercial(bool, UnlockCommercialVMOptions, false, \ 2.44 + "Enable normal processing of flags relating to commercial " \ 2.45 + "features") \ 2.46 + \ 2.47 diagnostic(bool, UnlockDiagnosticVMOptions, trueInDebug, \ 2.48 "Enable normal processing of flags relating to field diagnostics")\ 2.49 \ 2.50 experimental(bool, UnlockExperimentalVMOptions, false, \ 2.51 - "Enable normal processing of flags relating to experimental features")\ 2.52 + "Enable normal processing of flags relating to experimental " \ 2.53 + "features") \ 2.54 \ 2.55 product(bool, JavaMonitorsInStackTrace, true, \ 2.56 "Print info. about Java monitor locks when the stacks are dumped")\ 2.57 @@ -578,7 +589,8 @@ 2.58 "Verify stack of each thread when it is entering a runtime call") \ 2.59 \ 2.60 diagnostic(bool, ForceUnreachable, false, \ 2.61 - "Make all non code cache addresses to be unreachable with forcing use of 64bit literal fixups") \ 2.62 + "Make all non code cache addresses unreachable by forcing use of "\ 2.63 + "64-bit literal fixups") \ 2.64 \ 2.65 notproduct(bool, StressDerivedPointers, false, \ 2.66 "Force scavenge when a derived pointers is detected on stack " \ 2.67 @@ -3852,7 +3864,11 @@ 2.68 product(bool, UseVMInterruptibleIO, false, \ 2.69 "(Unstable, Solaris-specific) Thread interrupt before or with " \ 2.70 "EINTR for I/O operations results in OS_INTRPT. The default value"\ 2.71 - " of this flag is true for JDK 6 and earliers") 2.72 + " of this flag is true for JDK 6 and earlier") \ 2.73 + \ 2.74 + commercial(bool, FlightRecorder, false, \ 2.75 + "Enable Java Flight Recorder") 2.76 + 2.77 2.78 /* 2.79 * Macros for factoring of globals 2.80 @@ -3861,6 +3877,7 @@ 2.81 // Interface macros 2.82 #define DECLARE_PRODUCT_FLAG(type, name, value, doc) extern "C" type name; 2.83 #define DECLARE_PD_PRODUCT_FLAG(type, name, doc) extern "C" type name; 2.84 +#define DECLARE_COMMERCIAL_FLAG(type, name, value, doc) extern "C" type name; 2.85 #define DECLARE_DIAGNOSTIC_FLAG(type, name, value, doc) extern "C" type name; 2.86 #define DECLARE_EXPERIMENTAL_FLAG(type, name, value, doc) extern "C" type name; 2.87 #define DECLARE_MANAGEABLE_FLAG(type, name, value, doc) extern "C" type name; 2.88 @@ -3884,6 +3901,7 @@ 2.89 // Implementation macros 2.90 #define MATERIALIZE_PRODUCT_FLAG(type, name, value, doc) type name = value; 2.91 #define MATERIALIZE_PD_PRODUCT_FLAG(type, name, doc) type name = pd_##name; 2.92 +#define MATERIALIZE_COMMERCIAL_FLAG(type, name, value, doc) type name = value; 2.93 #define MATERIALIZE_DIAGNOSTIC_FLAG(type, name, value, doc) type name = value; 2.94 #define MATERIALIZE_EXPERIMENTAL_FLAG(type, name, value, doc) type name = value; 2.95 #define MATERIALIZE_MANAGEABLE_FLAG(type, name, value, doc) type name = value; 2.96 @@ -3903,7 +3921,7 @@ 2.97 #define MATERIALIZE_LP64_PRODUCT_FLAG(type, name, value, doc) /* flag is constant */ 2.98 #endif // _LP64 2.99 2.100 -RUNTIME_FLAGS(DECLARE_DEVELOPER_FLAG, DECLARE_PD_DEVELOPER_FLAG, DECLARE_PRODUCT_FLAG, DECLARE_PD_PRODUCT_FLAG, DECLARE_DIAGNOSTIC_FLAG, DECLARE_EXPERIMENTAL_FLAG, DECLARE_NOTPRODUCT_FLAG, DECLARE_MANAGEABLE_FLAG, DECLARE_PRODUCT_RW_FLAG, DECLARE_LP64_PRODUCT_FLAG) 2.101 +RUNTIME_FLAGS(DECLARE_DEVELOPER_FLAG, DECLARE_PD_DEVELOPER_FLAG, DECLARE_PRODUCT_FLAG, DECLARE_PD_PRODUCT_FLAG, DECLARE_COMMERCIAL_FLAG, DECLARE_DIAGNOSTIC_FLAG, DECLARE_EXPERIMENTAL_FLAG, DECLARE_NOTPRODUCT_FLAG, DECLARE_MANAGEABLE_FLAG, DECLARE_PRODUCT_RW_FLAG, DECLARE_LP64_PRODUCT_FLAG) 2.102 2.103 RUNTIME_OS_FLAGS(DECLARE_DEVELOPER_FLAG, DECLARE_PD_DEVELOPER_FLAG, DECLARE_PRODUCT_FLAG, DECLARE_PD_PRODUCT_FLAG, DECLARE_DIAGNOSTIC_FLAG, DECLARE_NOTPRODUCT_FLAG) 2.104
3.1 --- a/src/share/vm/runtime/globals_extension.hpp Tue Nov 29 09:21:02 2011 -0500 3.2 +++ b/src/share/vm/runtime/globals_extension.hpp Tue Nov 29 17:00:46 2011 -0500 3.3 @@ -35,6 +35,7 @@ 3.4 3.5 #define RUNTIME_PRODUCT_FLAG_MEMBER(type, name, value, doc) FLAG_MEMBER(name), 3.6 #define RUNTIME_PD_PRODUCT_FLAG_MEMBER(type, name, doc) FLAG_MEMBER(name), 3.7 +#define RUNTIME_COMMERCIAL_FLAG_MEMBER(type, name, value, doc) FLAG_MEMBER(name), 3.8 #define RUNTIME_DIAGNOSTIC_FLAG_MEMBER(type, name, value, doc) FLAG_MEMBER(name), 3.9 #define RUNTIME_EXPERIMENTAL_FLAG_MEMBER(type, name, value, doc) FLAG_MEMBER(name), 3.10 #define RUNTIME_MANAGEABLE_FLAG_MEMBER(type, name, value, doc) FLAG_MEMBER(name), 3.11 @@ -82,7 +83,7 @@ 3.12 #endif 3.13 3.14 typedef enum { 3.15 - RUNTIME_FLAGS(RUNTIME_DEVELOP_FLAG_MEMBER, RUNTIME_PD_DEVELOP_FLAG_MEMBER, RUNTIME_PRODUCT_FLAG_MEMBER, RUNTIME_PD_PRODUCT_FLAG_MEMBER, RUNTIME_DIAGNOSTIC_FLAG_MEMBER, RUNTIME_EXPERIMENTAL_FLAG_MEMBER, RUNTIME_NOTPRODUCT_FLAG_MEMBER, RUNTIME_MANAGEABLE_FLAG_MEMBER, RUNTIME_PRODUCT_RW_FLAG_MEMBER, RUNTIME_LP64_PRODUCT_FLAG_MEMBER) 3.16 + RUNTIME_FLAGS(RUNTIME_DEVELOP_FLAG_MEMBER, RUNTIME_PD_DEVELOP_FLAG_MEMBER, RUNTIME_PRODUCT_FLAG_MEMBER, RUNTIME_PD_PRODUCT_FLAG_MEMBER, RUNTIME_COMMERCIAL_FLAG_MEMBER, RUNTIME_DIAGNOSTIC_FLAG_MEMBER, RUNTIME_EXPERIMENTAL_FLAG_MEMBER, RUNTIME_NOTPRODUCT_FLAG_MEMBER, RUNTIME_MANAGEABLE_FLAG_MEMBER, RUNTIME_PRODUCT_RW_FLAG_MEMBER, RUNTIME_LP64_PRODUCT_FLAG_MEMBER) 3.17 RUNTIME_OS_FLAGS(RUNTIME_DEVELOP_FLAG_MEMBER, RUNTIME_PD_DEVELOP_FLAG_MEMBER, RUNTIME_PRODUCT_FLAG_MEMBER, RUNTIME_PD_PRODUCT_FLAG_MEMBER, RUNTIME_DIAGNOSTIC_FLAG_MEMBER, RUNTIME_NOTPRODUCT_FLAG_MEMBER) 3.18 #ifndef KERNEL 3.19 G1_FLAGS(RUNTIME_DEVELOP_FLAG_MEMBER, RUNTIME_PD_DEVELOP_FLAG_MEMBER, RUNTIME_PRODUCT_FLAG_MEMBER, RUNTIME_PD_PRODUCT_FLAG_MEMBER, RUNTIME_DIAGNOSTIC_FLAG_MEMBER, RUNTIME_EXPERIMENTAL_FLAG_MEMBER, RUNTIME_NOTPRODUCT_FLAG_MEMBER, RUNTIME_MANAGEABLE_FLAG_MEMBER, RUNTIME_PRODUCT_RW_FLAG_MEMBER) 3.20 @@ -102,6 +103,7 @@ 3.21 3.22 #define RUNTIME_PRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, value, doc) FLAG_MEMBER_WITH_TYPE(name,type), 3.23 #define RUNTIME_PD_PRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, doc) FLAG_MEMBER_WITH_TYPE(name,type), 3.24 +#define RUNTIME_COMMERCIAL_FLAG_MEMBER_WITH_TYPE(type, name, value, doc) FLAG_MEMBER_WITH_TYPE(name,type), 3.25 #define RUNTIME_DIAGNOSTIC_FLAG_MEMBER_WITH_TYPE(type, name, value, doc) FLAG_MEMBER_WITH_TYPE(name,type), 3.26 #define RUNTIME_EXPERIMENTAL_FLAG_MEMBER_WITH_TYPE(type, name, value, doc) FLAG_MEMBER_WITH_TYPE(name,type), 3.27 #define RUNTIME_MANAGEABLE_FLAG_MEMBER_WITH_TYPE(type, name, value, doc) FLAG_MEMBER_WITH_TYPE(name,type), 3.28 @@ -153,6 +155,7 @@ 3.29 RUNTIME_PD_DEVELOP_FLAG_MEMBER_WITH_TYPE, 3.30 RUNTIME_PRODUCT_FLAG_MEMBER_WITH_TYPE, 3.31 RUNTIME_PD_PRODUCT_FLAG_MEMBER_WITH_TYPE, 3.32 + RUNTIME_COMMERCIAL_FLAG_MEMBER_WITH_TYPE, 3.33 RUNTIME_DIAGNOSTIC_FLAG_MEMBER_WITH_TYPE, 3.34 RUNTIME_EXPERIMENTAL_FLAG_MEMBER_WITH_TYPE, 3.35 RUNTIME_NOTPRODUCT_FLAG_MEMBER_WITH_TYPE,