RFR: 8262328: Templatize JVMFlag boilerplate access methods [v4]
Ioi Lam
iklam at openjdk.java.net
Sat Apr 10 07:12:52 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 with a new target base due to a merge or a rebase. The pull request now contains 12 commits:
- Merge branch 'master' into 8262328-templatize-jvmflag-boilerplate-methods
- reinstated JVMFlagAccess::set_{bool,int,uint,...} functions for better readability
- 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)
- added test case
- removed JVMFlag::set_##type() functions
- fixed merge
- Merge branch 'master' into 8262328-templatize-jvmflag-boilerplate-methods
- static_assert to disable SET_FLAG_XXX on ccstr flags
- more cleanup
- ... and 2 more: https://git.openjdk.java.net/jdk/compare/c15680e7...e3280b69
-------------
Changes: https://git.openjdk.java.net/jdk/pull/3318/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=3318&range=03
Stats: 337 lines in 10 files changed: 100 ins; 140 del; 97 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