RFR: 8262328: Templatize JVMFlag boilerplate access methods [v2]
Ioi Lam
iklam at openjdk.java.net
Mon Apr 5 17:42:49 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 two additional commits since the last revision:
- removed unnecessary #include
- Restored <JVM_FLAG_TYPE(type)> in templates so we can require exact types (i.e., cannot mix size_t and uintx even they might be the same type of some platforms)
-------------
Changes:
- all: https://git.openjdk.java.net/jdk/pull/3318/files
- new: https://git.openjdk.java.net/jdk/pull/3318/files/86ce3ce7..58160ff0
Webrevs:
- full: https://webrevs.openjdk.java.net/?repo=jdk&pr=3318&range=01
- incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=3318&range=00-01
Stats: 123 lines in 9 files changed: 32 ins; 17 del; 74 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