-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8336663: [JVMCI] VM Crash on ZGC due to incompatible handle returned by HotSpotJVMCIRuntime#getJObjectValue #20219
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
Conversation
…ned by HotSpotJVMCIRuntime#getConstantValue.
|
👋 Welcome back tzezula! A progress list of the required criteria for merging this PR into |
|
@tzezula 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 106 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. As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@tkrodriguez, @dougxc) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
Webrevs
|
src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java
Outdated
Show resolved
Hide resolved
src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java
Outdated
Show resolved
Hide resolved
|
Would you mind explaining on a higher level what this code tries to do? If I understand the fix correctly, we are creating a hotspot JNI local from some Graal constant with getJObjectValue and expose a raw pointer to the HotSpot JNI handle to the caller. Looking at the only use I can find for this API, that raw pointer is then used to create yet another JNI local by calling NewLocalRef in some JNI environment. That seems either redundant, if it's the HotSpot JNI environment (as we just created a JNI local handle), or possibly dangerous if this is some libgraal JNI environment instead, as resolving the JNI local handle is only allowed when the thread is in the in_vm state. Otherwise the reference might become invalid between creating the JNI handle and resolving it in libgraal which is running in_native from HotSpot point of view. What am I missing? |
|
Does "JVMCI shared library" mean libgraal? I thought it was its own separate logical VM and used it's own internal GC, not ZGC. How is Truffle shared library compiler different from libgraal? |
|
I believe there is a misunderstanding regarding the method's usage. I need to extend the Javadoc, as the current documentation only states that the method can be called when The method is used to "unwrap" the object held by the
|
Yes, it's now redundant. The original |
Yes
Yes, the JVMCI shared library uses its own serial GC. However, the JVMCI shared library interacts with objects in the HotSpot heap through IndirectHotSpotObjectConstantImpl. The updated getJObjectValue method unwraps the IndirectHotSpotObjectConstantImpl to a jobject that points to an object in the HotSpot heap.
It's basically the same thing. Truffle compiler is a part of JVMCI shared library. The only difference is the entry point. |
Ah, okay. I guess you will fix that separately in the Graal repo. Good. |
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.
The latest version looks ok to me.
|
|
/integrate |
|
@tzezula This pull request has not yet been marked as ready for integration. |
|
/integrate |
|
/sponsor |
|
Going to push as commit 3abe8a6.
Your commit was automatically rebased without conflicts. |
The
HotSpotJVMCIRuntime#getJObjectValuemethod returns a real JNI local handle instead of a JVMCI handle to prevent random crashes on ZGC.Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/20219/head:pull/20219$ git checkout pull/20219Update a local copy of the PR:
$ git checkout pull/20219$ git pull https://git.openjdk.org/jdk.git pull/20219/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 20219View PR using the GUI difftool:
$ git pr show -t 20219Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/20219.diff
Webrev
Link to Webrev Comment