Skip to content
Permalink
Browse files
8240315: Shenandoah: Rename ShLBN::get_barrier_strength()
Reviewed-by: shade
  • Loading branch information
rkennke committed Mar 6, 2020
1 parent 375d0c1 commit 8c1204de6b72d8102a1a0e71963b684d252e01da
Showing with 18 additions and 22 deletions.
  1. +17 −17 src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.cpp
  2. +1 −5 src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.hpp
@@ -1144,7 +1144,7 @@ void ShenandoahBarrierC2Support::pin_and_expand(PhaseIdealLoop* phase) {
Node_List clones;
for (int i = state->load_reference_barriers_count() - 1; i >= 0; i--) {
ShenandoahLoadReferenceBarrierNode* lrb = state->load_reference_barrier(i);
if (lrb->get_barrier_strength() == ShenandoahLoadReferenceBarrierNode::NONE) {
if (lrb->is_redundant()) {
continue;
}

@@ -1375,7 +1375,7 @@ void ShenandoahBarrierC2Support::pin_and_expand(PhaseIdealLoop* phase) {

for (int i = 0; i < state->load_reference_barriers_count(); i++) {
ShenandoahLoadReferenceBarrierNode* lrb = state->load_reference_barrier(i);
if (lrb->get_barrier_strength() == ShenandoahLoadReferenceBarrierNode::NONE) {
if (lrb->is_redundant()) {
continue;
}
Node* ctrl = phase->get_ctrl(lrb);
@@ -1394,7 +1394,7 @@ void ShenandoahBarrierC2Support::pin_and_expand(PhaseIdealLoop* phase) {
Unique_Node_List uses_to_ignore;
for (int i = state->load_reference_barriers_count() - 1; i >= 0; i--) {
ShenandoahLoadReferenceBarrierNode* lrb = state->load_reference_barrier(i);
if (lrb->get_barrier_strength() == ShenandoahLoadReferenceBarrierNode::NONE) {
if (lrb->is_redundant()) {
phase->igvn().replace_node(lrb, lrb->in(ShenandoahLoadReferenceBarrierNode::ValueIn));
continue;
}
@@ -3190,16 +3190,15 @@ bool ShenandoahLoadReferenceBarrierNode::needs_barrier_impl(PhaseGVN* phase, Nod
return true;
}

ShenandoahLoadReferenceBarrierNode::Strength ShenandoahLoadReferenceBarrierNode::get_barrier_strength() {
bool ShenandoahLoadReferenceBarrierNode::is_redundant() {
Unique_Node_List visited;
Node_Stack stack(0);
stack.push(this, 0);

// Look for strongest strength: go over nodes looking for STRONG ones.
// Stop once we encountered STRONG. Otherwise, walk until we ran out of nodes,
// and then the overall strength is NONE.
Strength strength = NONE;
while (strength != STRONG && stack.size() > 0) {
// Check if the barrier is actually useful: go over nodes looking for useful uses
// (e.g. memory accesses). Stop once we detected a required use. Otherwise, walk
// until we ran out of nodes, and then declare the barrier redundant.
while (stack.size() > 0) {
Node* n = stack.node();
if (visited.member(n)) {
stack.pop();
@@ -3275,14 +3274,13 @@ ShenandoahLoadReferenceBarrierNode::Strength ShenandoahLoadReferenceBarrierNode:
case Op_StrIndexOfChar:
case Op_HasNegatives:
// Known to require barriers
strength = STRONG;
break;
return false;
case Op_CmpP: {
if (n->in(1)->bottom_type()->higher_equal(TypePtr::NULL_PTR) ||
n->in(2)->bottom_type()->higher_equal(TypePtr::NULL_PTR)) {
// One of the sides is known null, no need for barrier.
} else {
strength = STRONG;
return false;
}
break;
}
@@ -3308,7 +3306,7 @@ ShenandoahLoadReferenceBarrierNode::Strength ShenandoahLoadReferenceBarrierNode:
// Loading the constant does not require barriers: it should be handled
// as part of GC roots already.
} else {
strength = STRONG;
return false;
}
break;
}
@@ -3329,10 +3327,10 @@ ShenandoahLoadReferenceBarrierNode::Strength ShenandoahLoadReferenceBarrierNode:
break;
default: {
#ifdef ASSERT
fatal("Unknown node in get_barrier_strength: %s", NodeClassNames[n->Opcode()]);
fatal("Unknown node in is_redundant: %s", NodeClassNames[n->Opcode()]);
#else
// Default to strong: better to have excess barriers, rather than miss some.
strength = STRONG;
// Default to have excess barriers, rather than miss some.
return false;
#endif
}
}
@@ -3347,7 +3345,9 @@ ShenandoahLoadReferenceBarrierNode::Strength ShenandoahLoadReferenceBarrierNode:
}
}
}
return strength;

// No need for barrier found.
return true;
}

CallStaticJavaNode* ShenandoahLoadReferenceBarrierNode::pin_and_expand_null_check(PhaseIterGVN& igvn) {
@@ -231,10 +231,6 @@ class ShenandoahLoadReferenceBarrierNode : public Node {
ValueIn
};

enum Strength {
NONE, STRONG
};

private:
bool _native;

@@ -257,7 +253,7 @@ class ShenandoahLoadReferenceBarrierNode : public Node {
virtual uint hash() const;
virtual bool cmp( const Node &n ) const;

Strength get_barrier_strength();
bool is_redundant();
CallStaticJavaNode* pin_and_expand_null_check(PhaseIterGVN& igvn);

private:

0 comments on commit 8c1204d

Please sign in to comment.