On Thu, 1 Apr 2021 06:08:52 GMT, Ioi Lam <ik...@openjdk.org> wrote:

>> There are two versions of JVMFlagAccess::ccstrAtPut() for modifying JVM 
>> flags of the ccstr type (i.e., strings).
>> 
>> - One version requires the caller to free the old value, but some callers 
>> don't do that (writeableFlags.cpp).
>> - The other version frees the old value on behalf of the caller. However, 
>> this version is accessible only via FLAG_SET_XXX macros and is currently 
>> unused. So it's unclear whether it actually works.
>> 
>> We should combine these two versions into a single function, fix problems in 
>> the callers, and add test cases. The old value should be freed 
>> automatically, because typically the caller isn't interested in the old 
>> value.
>> 
>> Note that the FLAG_SET_XXX macros do not return the old value. Requiring the 
>> caller of FLAG_SET_XXX to free the old value would be tedious and error 
>> prone.
>
> Ioi Lam has updated the pull request incrementally with one additional commit 
> since the last revision:
> 
>   Revert "relax flag attributions (ala JDK-7123237)"
>   
>   This reverts commit 673aaafc4860dd7f70a3f222422ae84e85fd4219.

src/hotspot/share/runtime/flags/debug_globals.hpp line 63:

> 61:                                                                           
>   \
> 62:   product(ccstr, DummyManageableStringFlag, NULL, MANAGEABLE,             
>   \
> 63:           "Dummy flag for testing string handling in WriteableFlags")     
>   \

So this is in essence a product/manageable flag in debug only mode, which 
doesn't make sense at all, necessitating another macro that looks honestly 
bizarre.  So I think that means a non-product manageable flag or even a develop 
manageable flag is something that we want, we want to be able to write a 
develop flag by the management interface.  I agree diagnostic and experimental 
flags only seem to make sense as product flags.

The doc could simply be updated.  Also the doc at the top of this file refers 
to CCC which is no longer  -> CSR.

// MANAGEABLE flags are writeable external product flags.
//    They are dynamically writeable through the JDK management interface
//    (com.sun.management.HotSpotDiagnosticMXBean API) and also through 
JConsole.
//    These flags are external exported interface (see CCC).  The list of
//    manageable flags can be queried programmatically through the management
//    interface.

I'm not going to spend time typing about this minor point.  The improvement is 
good and should be checked in.

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

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

Reply via email to