-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
JDK-8317299: safepoint scalarization doesn't keep track of the depth of the JVM state #17500
Conversation
👋 Welcome back dfenacci! 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.
Great work, Damon. When we discussed this, I always wondered why we don't hit the same issue in Valhalla, where we perform even more aggressive scalarization during IGVN. Turns out that I postponed scalarization to after inlining, to work around that exact problem:
https://github.com/openjdk/valhalla/blob/c48006dfc05bb0c41ab9ae55ead226356259c46d/src/hotspot/share/opto/compile.cpp#L2002
With your fix, we can remove that limitation. I filed JDK-8324605 for this.
Interesting. Could it resolve the issue JDK-8276112 so we can REDO DK-8276998? |
Good catch, Vladimir. I completely forgot about JDK-8276112 but from re-reading my old analysis in #6333, it's most likely the exact same issue. |
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 fix looks good to me.
@dafedafe 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 135 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 |
Co-authored-by: Tobias Hartmann <tobias.hartmann@oracle.com>
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.
Looks good.
Thanks for pointing this out @vnkozlov. I've tried reapplying JDK-8261137 to reproduce the JDK-8276998 issue before applying this change but couldn't reproduce it anymore. I'll mention this issue in the REDO anyway. |
@TobiHartmann @iwanowww thanks a lot for reviewing! |
/integrate |
Going to push as commit 6d911f6.
Your commit was automatically rebased without conflicts. |
/backport jdk22u |
@TobiHartmann the backport was successfully created on the branch backport-TobiHartmann-6d911f68 in my personal fork of openjdk/jdk22u. To create a pull request with this backport targeting openjdk/jdk22u:master, just click the following link: The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:
If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk22u:
|
Issue
The origin of the problem is tied to the fact that, when C2 optimizes vector boxes, it performs safepoint object scalarization before late inlining.
This can lead to situations in which scalarization adds scalarized values to the JVM state and late inlining of further methods adds further JVM state entries on top for each inlined method.
With the example of the reported bug (TestIntrinsicBailOut.java) we get to a situation like this:
JVMS depth=9
shows 2 scalars but 2 further inlines added 2 more JVM states (with no scalars).The corresponding node looks like this:
To keep track of its scalarized inputs,
SafePointScalarObjectNode
keeps a field_first_index
, which is supposed to be "relative to the last (youngest) jvms->_scloff"...jdk/src/hotspot/share/opto/callnode.hpp
Lines 509 to 511 in c5e7245
but if there are late inlined methods, this field is going to be relative to the JVM state at the depth before inlining happened (e.g. depth=9 in the example) and not relative to the youngest depth.
Solution
In order to keep track of the right depth a
_depth
field is added toSafePointScalarObjectNode
, which refers to the depth of the JVM state the_first_index
field refers to. The methoduint first_index(JVMState* jvms)
is adapted accordingly.Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/17500/head:pull/17500
$ git checkout pull/17500
Update a local copy of the PR:
$ git checkout pull/17500
$ git pull https://git.openjdk.org/jdk.git pull/17500/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 17500
View PR using the GUI difftool:
$ git pr show -t 17500
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/17500.diff
Webrev
Link to Webrev Comment