-
Notifications
You must be signed in to change notification settings - Fork 5.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8276658: Clean up JNI local handles code #6336
Conversation
…t 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.
👋 Welcome back coleenp! A progress list of the required criteria for merging this PR into |
Webrevs
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Coleen,
Nice cleanup and refactoring! I'm not familiar with all the details but the reshuffling looks good to me.
One query and one minor issue below.
Thanks,
David
@@ -59,6 +60,8 @@ class VMOperationTimeoutTask : public PeriodicTask { | |||
|
|||
class VMThread: public NamedThread { | |||
private: | |||
volatile bool _is_running; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see this being initialized to false.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch!
@coleenp This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 59 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
Thank you for the code review, David. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Coleen,
Cleanup looks good to me.
Thanks,
Patricio
JNIHandleBlockManager jni_handle_management(THREAD); | ||
JNIHandleMark jni_handle_management(THREAD); | ||
|
||
DEBUG_ONLY(JfrJavaSupport::check_java_thread_in_vm(THREAD)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method will call into Java below which already checks the thread is in vm so maybe this is not necessary. Even construct_dcmd_instance() has that assert.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, it's doubly redundant. I'll remove it.
Thanks for the review, Patricio and David. |
Going to push as commit 3b2585c.
Your commit was automatically rebased without conflicts. |
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.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/6336/head:pull/6336
$ git checkout pull/6336
Update a local copy of the PR:
$ git checkout pull/6336
$ git pull https://git.openjdk.java.net/jdk pull/6336/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 6336
View PR using the GUI difftool:
$ git pr show -t 6336
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/6336.diff