-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8273409: Receiver type narrowed by CCP does not always trigger post-parse call devirtualization #5418
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
…arse call devirtualization
|
👋 Welcome back thartmann! A progress list of the required criteria for merging this PR into |
|
@TobiHartmann The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
Webrevs
|
iwanowww
left a comment
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.
|
@TobiHartmann 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 3 new commits pushed to the
Please see this link for an up-to-date comparison between the source branch of this pull request and the ➡️ To integrate this PR with the above commit message to the |
|
Thanks, Vladimir! |
neliasso
left a comment
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, Nils! |
|
/integrate |
|
Going to push as commit 4866eaa.
Your commit was automatically rebased without conflicts. |
|
@TobiHartmann Pushed as commit 4866eaa. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
While working on JDK-8273323, I noticed that even if CCP is able to narrow the receiver type of a virtual call to an exact type, post-parse call devirtualization is not always triggered. The problem is that CCP only adds nodes to the IGVN worklist if their types have been improved:
jdk/src/hotspot/share/opto/phaseX.cpp
Lines 1961 to 1965 in 4023646
And in turn, IGVN only adds user nodes to the worklist if the type of the parent node could be further improved. As a result, a
CallNodeis not always added to the worklist if the type of its receiver node has been improved. Often, we are lucky and macro expansion or another optimization phase after CCP adds theCallNodeto the worklist. However, astestDynamicCallWithCCPshows, that's not always the case.The fix is to explicitly add
CallStaticJavaNodeandCallDynamicJavato the worklist after CCP to give call devirtualization a chance to run:jdk/src/hotspot/share/opto/callnode.cpp
Lines 1054 to 1057 in 4023646
jdk/src/hotspot/share/opto/callnode.cpp
Lines 1137 to 1140 in 4023646
I also considered moving the optimization from
IdealtoValue(which in contrast toIdealis already executed during CCP) but we can't trust receiver types during CCP (because CCP goes from optimistic types to pessimistic ones). Also, the current implementation relies on setting the_generatorfield which is not possible fromValuewhich is declaredconst:jdk/src/hotspot/share/opto/callnode.cpp
Lines 1169 to 1172 in 4023646
All the newly added tests fail IR verification if post-parse call devirtualization is disabled (
-XX:-IncrementalInlineVirtual -XX:-IncrementalInlineMH). Without the fix,testDynamicCallWithCCPalways fails.I filed JDK-8273496 to improve how CCP handles this.
Thanks,
Tobias
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/5418/head:pull/5418$ git checkout pull/5418Update a local copy of the PR:
$ git checkout pull/5418$ git pull https://git.openjdk.java.net/jdk pull/5418/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 5418View PR using the GUI difftool:
$ git pr show -t 5418Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/5418.diff