RFR: 8262328: Templatize JVMFlag boilerplate access methods [v3]

David Holmes dholmes at openjdk.java.net
Thu Apr 8 02:09:44 UTC 2021


On Tue, 6 Apr 2021 03:56:50 GMT, Ioi Lam <iklam at openjdk.org> wrote:

>> We have a bunch of boilerplate method like:
>> 
>> JVMFlagAccess::boolAtPut (JVMFlag* f, bool* v, JVMFlagOrigin origin)
>> JVMFlagAccess::intAtPut (JVMFlag* f, int* v, JVMFlagOrigin origin)
>> JVMFlagAccess::uintAtPut (JVMFlag* f, uint* v, JVMFlagOrigin origin)
>> ...
>> 
>> Similarly, we also have 8 different functions: JVMFlag::{set_bool, set_int, set_intx, ...}
>> 
>> We should replace such patterns with
>> 
>> template <typename T>
>> JVMFlagAccess::set(JVMFlag* f, T* value, JVMFlagOrigin origin)
>> 
>> This would allow us to templatize the 8x boilerplate functions in writeableFlags.cpp.
>> 
>> The flag access code in whitebox.cpp can also be improved.
>
> Ioi Lam has updated the pull request incrementally with one additional commit since the last revision:
> 
>   reinstated JVMFlagAccess::set_{bool,int,uint,...} functions for better readability

Hi Ioi,

This latest version looks good to me.

Thanks,
David

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

Marked as reviewed by dholmes (Reviewer).

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


More information about the hotspot-dev mailing list