-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8338538: [JVMCI] Allow HotSpotJVMCIRuntime#getJObjectValue to be called by a HotSpot CompileBroker compiler thread #20620
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
…called by host compiler threads.
|
👋 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 70 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 (@dougxc) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
Webrevs
|
|
Co-authored-by: Douglas Simon <doug.simon@oracle.com>
|
/integrate |
|
/sponsor |
|
Going to push as commit a15af69.
Your commit was automatically rebased without conflicts. |
The
HotSpotJVMCIRuntime#getJObjectValuemethod is currently invoked in two distinct scenarios:Truffle Compiler: In this scenario, the method is called by a Truffle compiler thread. This thread is an ordinary Java thread that enters the shared library compiler (libgraal) via a Java native method call. Consequently, it always has a valid
JavaFrameAnchorwhen invokingHotSpotJVMCIRuntime#getJObjectValuewithin the shared library compiler.Host Compiler: In the second scenario, the method is called by a HotSpot CompileBroker compiler thread while inlining a Truffle call target into a host method. Here, the compiler thread is a JavaThread in the
_thread_in_vmstate before entering the shared library compiler (libgraal) and does not have aJavaFrameAnchor.The
HotSpotJVMCIRuntime#getJObjectValuemethod currently supports only the first scenario by asserting that the caller has aJavaFrameAnchor. However, this method should be adapted to also support the second scenario, where the caller thread lacks aJavaFrameAnchorbut has an explicitly pushed JNI handle block. It is crucial that theHotSpotJVMCIRuntime#getJObjectValuemethod ensures it does not use the top-mostJNIHandleBlock, which is never released. Utilizing this block for Java constants could potentially lead to memory leaks in the Java heap. To accommodate both scenarios, the method should be modified to allow execution also by threads without aJavaFrameAnchorprovided they have an explicitly pushed JNI handle block.Implementation Details: The method determines whether the caller thread has pushed a JNI handle block by using
THREAD->active_handles()->pop_frame_link(). Thepop_frame_linkis set when JavaThread::push_jni_handle_block is called and is reset in JavaThread::pop_jni_handle_block. Each active JavaThread has a non-null_active_handlespointer, which is initialized in JavaThread::run.Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/20620/head:pull/20620$ git checkout pull/20620Update a local copy of the PR:
$ git checkout pull/20620$ git pull https://git.openjdk.org/jdk.git pull/20620/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 20620View PR using the GUI difftool:
$ git pr show -t 20620Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/20620.diff
Webrev
Link to Webrev Comment