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
8257498: Remove useless skeleton predicates #2075
Conversation
|
@chhagedorn 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
|
useful_predicates.push(entry->in(0)->in(1)->in(1)); // good one | ||
|
||
if (UseLoopPredicate) { | ||
predicate = find_predicate_insertion_point(entry, Deoptimization::Reason_predicate); |
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.
Don't we need to do this for Deoptimization::Reason_profile_predicate as well?
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.
You're right, we need that as well. I updated it.
@@ -288,6 +275,34 @@ void PhaseIdealLoop::clone_skeleton_predicates_to_unswitched_loop(IdealLoopTree* | |||
} | |||
} | |||
|
|||
// Put all skeleton predicate projections on a list, starting at 'predicate' and going up in the tree. If 'get_opaque' | |||
// is set, then the Opaque4 nodes of the skeleton predicates are put on the list instead of the projections. | |||
void PhaseIdealLoop::get_skeleton_predicates(Node* predicate, Unique_Node_List& list, bool get_opaque) { |
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 would remove the get_opaque parameter, populate the list with projections (the get_opaque false case) and have the caller retrieve the opaque node (predicate->in(0)->in(1)) if that's what it needs.
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.
Okay, I updated it and removed the get_opaque
flag.
src/hotspot/share/opto/loopnode.cpp
Outdated
Node* n = C->skeleton_predicate_opaque4_node(idx); | ||
assert(n->Opcode() == Op_Opaque4, "must be"); | ||
if (!useful_predicates.member(n)) { // not in the useful list | ||
C->remove_skeleton_predicate_opaque4_node(idx); |
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.
Usually when nodes are kept in a global list, when a node dies, the node is removed from the list. It's the case of Compile::_predicate_opaqs for instance. So when the logic here iterates over _predicate_opaqs and removes some of them from the graph, the node is automatically removed from the _predicate_opaqs list. I don't see similar logic for skeleton Opaque4 nodes. I think it's a problem because you could end up with a node in the list that was removed from the graph (because that part of the graph is dead) and freed from memory (which could cause a crash).
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's true. I have not considered that. I updated it to remove it in the same way as we are removing other nodes as for example expensive nodes.
@chhagedorn this pull request can not be integrated into git checkout JDK-8257498
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 |
src/hotspot/share/opto/loopnode.cpp
Outdated
predicates.push(opaq); | ||
} | ||
} | ||
|
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 didn't realize you would have to go through an extra list. So I guess what you had before with the get_opaque parameter was better.
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.
Yes, we need an extra one. I reverted that part back again.
@chhagedorn This change now passes all automated pre-integration checks. 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
|
src/hotspot/share/opto/loopnode.cpp
Outdated
assert(n->Opcode() == Op_Opaque1, "must be"); | ||
if (!useful_predicates.member(n)) { // not in the useful list | ||
_igvn.replace_node(n, n->in(1)); | ||
} | ||
} | ||
|
||
for (int i = C->skeleton_predicate_count(); i > 0; i--) { | ||
const int idx = i - 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.
Could be removed for consistency with above code.
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.
Yes, that was a left over from a previous commit where we needed idx
twice. I update that.
Thanks Roland and Tobias for your reviews! |
/integrate |
@chhagedorn Since your change was applied there have been 103 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit aec0377. |
This enhancement removes useless skeleton predicates in the same way as we already remove normal useless predicates in
PhaseIdealLoop::eliminate_useless_predicates()
.Thanks,
Christian
Progress
Issue
Reviewers
Download
$ git fetch https://git.openjdk.java.net/jdk pull/2075/head:pull/2075
$ git checkout pull/2075