RFR: 8262328: Templatize JVMFlag boilerplate access methods

Ioi Lam iklam at openjdk.java.net
Mon Apr 5 17:45:20 UTC 2021


On Fri, 2 Apr 2021 03:20:51 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.
>
> I need to work on this PR some more. Closing it for now.

I've updated the patch and the JVMFlagAccess API should have identical behavior as before. Now it's ready to be reviewed again.

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

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


More information about the hotspot-dev mailing list