RFR: 8276658: Clean up JNI local handles code
Coleen Phillimore
coleenp at openjdk.java.net
Wed Nov 10 17:24:47 UTC 2021
JNI Local handles can only be created by JavaThread (there's an assert in make_local) but the fields are added to Thread.
Move the fields to JavaThread and adding JavaThread* argument.
Also, the global freelist isn't very useful now that global JNI handles don't use JNIHandleBlock, so the locking that claims incorrectly to block for safepoint is removed.
Lastly, there's at least 3 places that duplicate pushing a new JNIHandleBlock to the thread for temporarily adding JNI local handles. These have been moved to common code with a JNIHandleMark object, moved from jvmci code.
The commits are separate to help reviewing, but the entire change has been tested together with tier1-6.
The commits in this change have been performance tested individually and together with no meaningful differences from mainline.
-------------
Commit messages:
- The VM Thread creates handles on the caller thread, unless it runs out then it allocates a block on its own thread, which it never cleans up. Pass the caller thread to allocate_handle so that allocate_block will add to the right thread, which is a JavaThread.
- Refactor pushing and popping JNIHandleBlocks.
- Remove JNIHandleBlock global freelists and Mutex
- Move active_handles to JavaThread.
Changes: https://git.openjdk.java.net/jdk/pull/6336/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=6336&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8276658
Stats: 426 lines in 25 files changed: 77 ins; 302 del; 47 mod
Patch: https://git.openjdk.java.net/jdk/pull/6336.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/6336/head:pull/6336
PR: https://git.openjdk.java.net/jdk/pull/6336
More information about the serviceability-dev
mailing list