-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8281322: C2: always construct strip mined loop initially (even if strip mining is disabled) #7364
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
👋 Welcome back roland! A progress list of the required criteria for merging this PR into |
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.
That looks reasonable. I'll submit some testing.
src/hotspot/share/opto/loopnode.cpp
Outdated
igvn->replace_input_of(inner_cl, LoopBackControl, in(LoopBackControl)); | ||
// make the outer loop go away | ||
igvn->replace_input_of(this, LoopBackControl, igvn->C->top()); | ||
igvn->C->print_method(PHASE_DEBUG, 2); |
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.
Probably a left-over and can be removed.
src/hotspot/share/opto/loopnode.cpp
Outdated
Node* outer_test = outer_le->in(1); | ||
|
||
// make counted loop exit test always fail to | ||
igvn->replace_input_of(cle, 1, outer_test); |
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.
Might be clearer to directly use igvn->intcon(0)
instead of outer_test
.
@rwestrel 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 |
For the record: Christian's testing found issues (he reported them to Roland already). I think it would be good to change the bug title to something more descriptive. |
8282045 (When loop strip mining fails, safepoints are removed from loop anyway) is an underlying issue that Christian's testing caught. |
@rwestrel this pull request can not be integrated into git checkout JDK-8281322
git fetch https://git.openjdk.java.net/jdk master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push |
I pushed a number of new commits that address 3 issues (with LoopStripMiningIter=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.
This looks reasonable to me. All tests passed.
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.
Apart from some minor code style things, the update looks good to me!
src/hotspot/share/opto/loopnode.cpp
Outdated
if (u->is_Store()) { | ||
int alias_idx = igvn->C->get_alias_index(u->adr_type()); | ||
Node* first = u; | ||
for(;;) { |
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.
Missing space after for
.
src/hotspot/share/opto/loopnode.cpp
Outdated
first = next; | ||
} | ||
Node* last = u; | ||
for(;;) { |
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.
Missing space after for
.
src/hotspot/share/opto/loopnode.cpp
Outdated
} | ||
#endif | ||
if (phi == NULL) { | ||
// If the an entire chains was sunk, the |
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.
If the an entire chains
-> If an entire chain
src/hotspot/share/opto/loopnode.cpp
Outdated
@@ -2623,6 +2564,123 @@ BaseCountedLoopNode* BaseCountedLoopNode::make(Node* entry, Node* backedge, Basi | |||
return new LongCountedLoopNode(entry, backedge); | |||
} | |||
|
|||
void OuterStripMinedLoopNode::fix_sunk_stores(CountedLoopEndNode* inner_cle, LoopNode* target, PhaseIterGVN* igvn, |
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 suggest to rename target
to inner_cl
as we are also using inner_cle
already. Maybe you can also add some more comments for the intermediate steps (even though most of the code was just moved in this change).
Thanks. The new commit should take care of your comments. |
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.
Thanks for the updates, looks good!
@TobiHartmann @chhagedorn thanks for the reviews |
/integrate |
Going to push as commit ea9eeea.
Your commit was automatically rebased without conflicts. |
Some of the long range check transformations take advantage of the
safepoint captured by loop strip mining to extract jvm state (in order
to add back empty predicates to the inner loop of a loop nest). As a
consequence, irTests/TestLongRangeChecks.java fails with strip mining
off and users might experience performance anomalies where changing
GCs affect purely computational code.
The strip mined loop nest creation is a 2 step process:
1- when a CountedLoop is created, an OuterStripMinedLoop is also added
but it's not fully constructed
2- at macro expansion time, the OuterStripMinedLoop is turned into an
actual loop by adding Phis and a proper exit condition
I propose always doing 1- whether loop strip mining is enabled or
not. This causes the safepoint to always be captured. Loop strip ming
is not expected to get in the way of loop transformations so this
change in itself should be performance neutral. Then at 2-, if loop
strip mining is not enabled, the OuterStripMinedLoop can be removed
and the safepoint moved back into the loop in case
LoopStripMiningIter=1 or simply removed too.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/7364/head:pull/7364
$ git checkout pull/7364
Update a local copy of the PR:
$ git checkout pull/7364
$ git pull https://git.openjdk.java.net/jdk pull/7364/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 7364
View PR using the GUI difftool:
$ git pr show -t 7364
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/7364.diff