RFR: 8264285: Clean the modification of ccstr JVM flags [v2]

Ioi Lam iklam at openjdk.java.net
Thu Apr 1 04:31:26 UTC 2021


On Thu, 1 Apr 2021 00:25:53 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> I had to use a `product` flag due to the following code, which should have been removed as part of [JDK-8243208](https://bugs.openjdk.java.net/browse/JDK-8243208), but I was afraid to do so because I didn't have a test case. I.e., all of our diagnostic/manageable/experimental flags were `product` flags.
>> 
>> With this PR, now I have a test case -- I changed `DummyManageableStringFlag` to a `notproduct` flag, and removed the following code. I am re-running tiers1-4 now.
>> 
>> 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);
>>     }
>>   }
>> }
>
> What's the difference between notproduct and develop again?  Do we run tests with the optimized build and why would this flag be available in that build?  ie. why not develop?

>From the top of globals.hpp: 

- `develop` flags are settable / visible only during development and are constant in the PRODUCT version
- `notproduct` flags are settable / visible only during development and are not declared in the PRODUCT version

Since this flag is only used in test cases, and specifically for modifying its value, it doesn't make sense to expose this flag to the PRODUCT version at all. So I chose `notproduct`, so we can save a few bytes for the PRODUCT as well.

-------------

PR: https://git.openjdk.java.net/jdk/pull/3254


More information about the serviceability-dev mailing list