JDK-8140424 : don't prefix developer and notproduct flag variables with CONST_ in product builds
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 9
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2015-10-23
  • Updated: 2015-12-10
  • Resolved: 2015-11-12
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9 b96Fixed
Related Reports
Relates :  
Relates :  
Description
When working on JDK-8024545 I added code that prefixes developer and notproduct flags with CONST_.  I think I did this to be able to access the address of these variables for the flag table.  But this is not necessary because these flag cannot be written anyway.

I am proposing to remove the CONST_ prefix and define the variables as const.
Comments
[~goetz] proposed this addition: http://cr.openjdk.java.net/~goetz/webrevs/8140424-notProd/not_product_cleanups.patch
06-11-2015

diff -r bc48b669bc66 src/share/vm/runtime/globals.cpp --- a/src/share/vm/runtime/globals.cpp Mon Oct 19 00:24:58 2015 -0700 +++ b/src/share/vm/runtime/globals.cpp Fri Oct 23 08:35:34 2015 -1000 @@ -536,7 +536,7 @@ const char* Flag::flag_error_str(Flag::E // 4991491 do not "optimize out" the was_set false values: omitting them // tickles a Microsoft compiler bug causing flagTable to be malformed -#define NAME(name) NOT_PRODUCT(&name) PRODUCT_ONLY(&CONST_##name) +#define NAME(name) (void*)&name #define RUNTIME_PRODUCT_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_PRODUCT) }, #define RUNTIME_PD_PRODUCT_FLAG_STRUCT( type, name, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_PRODUCT | Flag::KIND_PLATFORM_DEPENDENT) }, diff -r bc48b669bc66 src/share/vm/runtime/globals.hpp --- a/src/share/vm/runtime/globals.hpp Mon Oct 19 00:24:58 2015 -0700 +++ b/src/share/vm/runtime/globals.hpp Fri Oct 23 08:35:34 2015 -1000 @@ -4129,9 +4129,9 @@ public: #define DECLARE_MANAGEABLE_FLAG(type, name, value, doc) extern "C" type name; #define DECLARE_PRODUCT_RW_FLAG(type, name, value, doc) extern "C" type name; #ifdef PRODUCT -#define DECLARE_DEVELOPER_FLAG(type, name, value, doc) extern "C" type CONST_##name; const type name = value; -#define DECLARE_PD_DEVELOPER_FLAG(type, name, doc) extern "C" type CONST_##name; const type name = pd_##name; -#define DECLARE_NOTPRODUCT_FLAG(type, name, value, doc) extern "C" type CONST_##name; +#define DECLARE_DEVELOPER_FLAG(type, name, value, doc) const type name = value; +#define DECLARE_PD_DEVELOPER_FLAG(type, name, doc) const type name = pd_##name; +#define DECLARE_NOTPRODUCT_FLAG(type, name, value, doc) const type name = value; #else #define DECLARE_DEVELOPER_FLAG(type, name, value, doc) extern "C" type name; #define DECLARE_PD_DEVELOPER_FLAG(type, name, doc) extern "C" type name; @@ -4152,9 +4152,9 @@ public: #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) type CONST_##name = value; -#define MATERIALIZE_PD_DEVELOPER_FLAG(type, name, doc) type CONST_##name = pd_##name; -#define MATERIALIZE_NOTPRODUCT_FLAG(type, name, value, doc) type CONST_##name = value; +#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;
23-10-2015