Skip to content

Conversation

@dougxc
Copy link
Member

@dougxc dougxc commented Sep 24, 2024

JDK-8318694 limited the ability for JVMCI CompilerThreads to make Java upcalls. This is to mitigate against deadlock when an upcall does class loading. Class loading can easily create deadlock situations in -Xcomp or -Xbatch mode.

However, for Truffle, upcalls are unavoidable if Truffle partial evaluation occurs as part of JIT compilation inlining. This occurs when the Graal inliner sees a constant Truffle AST node which allows a Truffle-specific inlining extension to perform Truffle partial evaluation (PE) on the constant. Such PE involves upcalls to the Truffle runtime (running in Java).

This PR provides the escape hatch such that Truffle specific logic can put a compiler thread into "allow Java upcall" mode during the scope of the Truffle logic.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8340733: Add scope for relaxing constraint on JavaCalls from CompilerThread (Enhancement - P4)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/21171/head:pull/21171
$ git checkout pull/21171

Update a local copy of the PR:
$ git checkout pull/21171
$ git pull https://git.openjdk.org/jdk.git pull/21171/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 21171

View PR using the GUI difftool:
$ git pr show -t 21171

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/21171.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Sep 24, 2024

👋 Welcome back dnsimon! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Sep 24, 2024

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk bot changed the title JDK-8340733: Add scope for relaxing constraint on JavaCalls from CompilerThread 8340733: Add scope for relaxing constraint on JavaCalls from CompilerThread Sep 24, 2024
@openjdk
Copy link

openjdk bot commented Sep 24, 2024

@dougxc The following labels will be automatically applied to this pull request:

  • graal
  • hotspot-compiler

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added graal graal-dev@openjdk.org hotspot-compiler hotspot-compiler-dev@openjdk.org labels Sep 24, 2024
@dougxc dougxc marked this pull request as ready for review September 24, 2024 23:00
@openjdk openjdk bot added the rfr Pull request is ready for review label Sep 24, 2024
@mlbridge
Copy link

mlbridge bot commented Sep 24, 2024

Webrevs

@openjdk
Copy link

openjdk bot commented Sep 25, 2024

@dougxc Please do not rebase or force-push to an active PR as it invalidates existing review comments. Note for future reference, the bots always squash all changes into a single commit automatically as part of the integration. See OpenJDK Developers’ Guide for more information.

}

if (vm != null) {
vm.updateCompilerThreadCanCallJava(!state);
Copy link
Contributor

@tzezula tzezula Sep 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not correct.
The scope has to capture the original _can_call_java value in the constructor and restore it here in close.
Actually it works if c2v_updateCompilerThreadCanCallJava does not have C2V_BLOCK

@dougxc
Copy link
Member Author

dougxc commented Oct 1, 2024

Closing this so @tzezula can open a new one for the same issue.

@dougxc dougxc closed this Oct 1, 2024
@eregon
Copy link
Contributor

eregon commented Nov 5, 2024

Link: #21285

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

graal graal-dev@openjdk.org hotspot-compiler hotspot-compiler-dev@openjdk.org rfr Pull request is ready for review

Development

Successfully merging this pull request may close these issues.

3 participants