-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
8262837: handle split_USE correctly #2791
Conversation
👋 Welcome back kuaiwei! A progress list of the required criteria for merging this PR into |
/label add hotspot-compiler |
@kuaiwei The |
Webrevs
|
src/hotspot/share/opto/reg_split.cpp
Outdated
@@ -272,15 +273,15 @@ uint PhaseChaitin::split_USE(MachSpillCopyNode::SpillType spill_type, Node *def, | |||
} | |||
|
|||
Node *spill = get_spillcopy_wide(spill_type, def, use, useidx ); | |||
if( !spill ) return 0; // Bailed out | |||
if( !spill ) return -1; // Bailed out | |||
// Insert SpillCopy before the USE, which uses the reaching DEF as | |||
// its input, and defs a new live range, which is used by this node. | |||
insert_proj( b, bindex, spill, maxlrg++ ); |
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.
maxlrg++
again
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.
Remove post-increment
@@ -1099,12 +1105,13 @@ uint PhaseChaitin::Split(uint maxlrg, ResourceArea* split_arena) { | |||
Node *spill = new MachSpillCopyNode(MachSpillCopyNode::MemToReg, def, dmask, *tmp_rm); | |||
insert_proj( b, insidx, spill, maxlrg ); |
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.
I think it missed maxlrg
increment. May be also use insidx++
here so in the following code you need to increment only by delta
.
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.
added maxlrg++ and insidx++, the following insidx is added with delta
src/hotspot/share/opto/reg_split.cpp
Outdated
@@ -497,6 +498,7 @@ uint PhaseChaitin::Split(uint maxlrg, ResourceArea* split_arena) { | |||
|
|||
uint bidx, pidx, slidx, insidx, inpidx, twoidx; | |||
uint non_phi = 1, spill_cnt = 0; | |||
int delta; |
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.
I think it should be local variable where it is used.
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.
changed to local variable.
src/hotspot/share/opto/reg_split.cpp
Outdated
// Insert SpillCopy before the USE, which uses the reaching DEF as | ||
// its input, and defs a new live range, which is used by this node. | ||
insert_proj( b, bindex, spill, maxlrg++ ); | ||
// Use the spill/clone | ||
use->set_req(useidx,spill); | ||
|
||
// return updated live range count | ||
return maxlrg; | ||
// return generated node count |
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 comment is confusing. I would suggest to add comment at the header of this method to describe all returned values [-1, 0, 1].
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.
Add comment in method header of split_USE and remove this 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.
Good.
Passed tier1-4 testing.
@kuaiwei 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 33 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 (@vnkozlov) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
Thanks for your help. |
/integrate |
/sponsor |
@vnkozlov @kuaiwei Since your change was applied there have been 44 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit f56c918. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
I look into reg_split.cpp and found a potential issue.
Function split_USE usually creates a new spill copy node, but in some cases it just connect def to use and no new node created. But in caller side, they will assume it will create a new node. The code is like:
So if no node is created, the iterator index is updated and the next instruction will be skipped.
The change is let split_USE return the new node count, so the caller can update its index and maxlrg.
Progress
Issue
Reviewers
Download
$ git fetch https://git.openjdk.java.net/jdk pull/2791/head:pull/2791
$ git checkout pull/2791