RFR: 8299089: Instrument global jni handles with tag to make them distinguishable [v2]
Albert Mingkun Yang
ayang at openjdk.org
Tue Jan 10 16:14:55 UTC 2023
On Tue, 10 Jan 2023 15:21:29 GMT, Axel Boldt-Christmas <aboldtch at openjdk.org> wrote:
>> Weak global jni handles are tagged so the GC can distinguish them when resolving the object. Today there is no cheap way of distinguishing global jni handles from local jni handles. For generational ZGC the OopStorage handles and the thread local handles semantical difference requires the handles to be distinguishable.
>>
>> This enhancements instruments the jni handles with a global tag similarly to the jweak tag.
>>
>> Note:
>> * the s390 implementation has minimal changes and requires improvement.
>> * There is room for enchantment here to create the same abstraction that ppc uses for all platforms, i.e. move the resolve_jobject from the MacroAssembler to the BarrierSetAssembler which allows for more optimised code for GCs that can treat local and global handles the same.
>>
>> Testing: GHA. Oracle supported platforms tier1-3. Will run higher tiers. Has also been tested on the generational branch of ZGC for over three months. Requires testing on non Oracle platforms.
>
> Axel Boldt-Christmas has updated the pull request incrementally with two additional commits since the last revision:
>
> - update copyright
> - albertnetymk feedback
I think `is_local/jweak/global` is clear enough; the `_tagged` suffix is impl-detail.
src/hotspot/share/runtime/jniHandles.hpp line 69:
> 67: enum TypeTag {
> 68: local = 0b00,
> 69: weak = 0b01,
Maybe `jweak`? Just to be less ambiguous.
src/hotspot/share/runtime/jniHandles.inline.hpp line 122:
> 120: if (handle != NULL) {
> 121: assert(!is_jweak_tagged(handle), "Invalid JNI local handle");
> 122: assert(!is_global_tagged(handle), "Invalid JNI local handle");
Why isn't `is_local_tagged` used here?
-------------
Marked as reviewed by ayang (Reviewer).
PR: https://git.openjdk.org/jdk/pull/11740
More information about the hotspot-dev
mailing list