Skip to content

Commit

Permalink
Review Vladimir
Browse files Browse the repository at this point in the history
  • Loading branch information
chhagedorn committed Oct 17, 2024
1 parent aeb7409 commit 9c65f9a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
15 changes: 8 additions & 7 deletions src/hotspot/share/opto/predicates.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,14 @@ Node* AssertionPredicatesWithHalt::find_entry(Node* start_proj) {
return entry;
}

// An Assertion Predicate has always a true projection on the success path.
bool may_be_assertion_predicate_if(const Node* node) {
assert(node != nullptr, "should not be null");
return node->is_IfTrue() && RegularPredicate::may_be_predicate_if(node->as_IfProj());
}

bool AssertionPredicateWithHalt::is_predicate(const Node* maybe_success_proj) {
if (!AssertionPredicate::may_be_predicate_if(maybe_success_proj)) {
if (!may_be_assertion_predicate_if(maybe_success_proj)) {
return false;
}
return has_assertion_predicate_opaque(maybe_success_proj) && has_halt(maybe_success_proj);
Expand Down Expand Up @@ -131,15 +137,10 @@ bool RuntimePredicate::is_predicate(Node* node, Deoptimization::DeoptReason deop
return RegularPredicateWithUCT::is_predicate(node, deopt_reason);
}

// An Assertion Predicate has always a true projection on the success path.
bool AssertionPredicate::may_be_predicate_if(const Node* node) {
return node->is_IfTrue() && RegularPredicate::may_be_predicate_if(node->as_IfProj());
}

// A Template Assertion Predicate has an If/RangeCheckNode and either an UCT or a halt node depending on where it
// was created.
bool TemplateAssertionPredicate::is_predicate(Node* node) {
if (!AssertionPredicate::may_be_predicate_if(node)) {
if (!may_be_assertion_predicate_if(node)) {
return false;
}
IfNode* if_node = node->in(0)->as_If();
Expand Down
6 changes: 0 additions & 6 deletions src/hotspot/share/opto/predicates.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,12 +369,6 @@ class RuntimePredicate : public Predicate {
static bool is_predicate(Node* node, Deoptimization::DeoptReason deopt_reason);
};

// Utility class to represent an Assertion Predicate.
class AssertionPredicate : public StackObj {
public:
static bool may_be_predicate_if(const Node* node);
};

// Class to represent a Template Assertion Predicate.
class TemplateAssertionPredicate : public Predicate {
IfTrueNode* _success_proj;
Expand Down

0 comments on commit 9c65f9a

Please sign in to comment.