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

Ioi Lam iklam at openjdk.java.net
Tue Apr 6 03:56:50 UTC 2021


> 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

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/3318/files
  - new: https://git.openjdk.java.net/jdk/pull/3318/files/58160ff0..4c0c8ae2

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=3318&range=02
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=3318&range=01-02

  Stats: 19 lines in 3 files changed: 9 ins; 0 del; 10 mod
  Patch: https://git.openjdk.java.net/jdk/pull/3318.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/3318/head:pull/3318

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


More information about the hotspot-dev mailing list