8144935: C2: safepoint is pruned from a non-counted loop
Reviewed-by: roland
This commit is contained in:
parent
7b54819d3e
commit
afeb87ddd8
@ -1818,10 +1818,9 @@ void PhaseIdealLoop::replace_parallel_iv(IdealLoopTree *loop) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void IdealLoopTree::remove_safepoints(PhaseIdealLoop* phase, bool keep_one) {
|
void IdealLoopTree::remove_safepoints(PhaseIdealLoop* phase, bool keep_one) {
|
||||||
// Look for a safepoint on the idom-path.
|
|
||||||
Node* keep = NULL;
|
Node* keep = NULL;
|
||||||
if (keep_one) {
|
if (keep_one) {
|
||||||
// Keep one if possible
|
// Look for a safepoint on the idom-path.
|
||||||
for (Node* i = tail(); i != _head; i = phase->idom(i)) {
|
for (Node* i = tail(); i != _head; i = phase->idom(i)) {
|
||||||
if (i->Opcode() == Op_SafePoint && phase->get_loop(i) == this) {
|
if (i->Opcode() == Op_SafePoint && phase->get_loop(i) == this) {
|
||||||
keep = i;
|
keep = i;
|
||||||
@ -1830,9 +1829,14 @@ void IdealLoopTree::remove_safepoints(PhaseIdealLoop* phase, bool keep_one) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Don't remove any safepoints if it is requested to keep a single safepoint and
|
||||||
|
// no safepoint was found on idom-path. It is not safe to remove any safepoint
|
||||||
|
// in this case since there's no safepoint dominating all paths in the loop body.
|
||||||
|
bool prune = !keep_one || keep != NULL;
|
||||||
|
|
||||||
// Delete other safepoints in this loop.
|
// Delete other safepoints in this loop.
|
||||||
Node_List* sfpts = _safepts;
|
Node_List* sfpts = _safepts;
|
||||||
if (sfpts != NULL) {
|
if (prune && sfpts != NULL) {
|
||||||
assert(keep == NULL || keep->Opcode() == Op_SafePoint, "not safepoint");
|
assert(keep == NULL || keep->Opcode() == Op_SafePoint, "not safepoint");
|
||||||
for (uint i = 0; i < sfpts->size(); i++) {
|
for (uint i = 0; i < sfpts->size(); i++) {
|
||||||
Node* n = sfpts->at(i);
|
Node* n = sfpts->at(i);
|
||||||
@ -1925,6 +1929,15 @@ void IdealLoopTree::dump_head( ) const {
|
|||||||
if (cl->is_main_loop()) tty->print(" main");
|
if (cl->is_main_loop()) tty->print(" main");
|
||||||
if (cl->is_post_loop()) tty->print(" post");
|
if (cl->is_post_loop()) tty->print(" post");
|
||||||
}
|
}
|
||||||
|
if (_has_call) tty->print(" has_call");
|
||||||
|
if (_has_sfpt) tty->print(" has_sfpt");
|
||||||
|
if (_rce_candidate) tty->print(" rce");
|
||||||
|
if (_safepts != NULL && _safepts->size() > 0) {
|
||||||
|
tty->print(" sfpts={"); _safepts->dump_simple(); tty->print(" }");
|
||||||
|
}
|
||||||
|
if (_required_safept != NULL && _required_safept->size() > 0) {
|
||||||
|
tty->print(" req={"); _required_safept->dump_simple(); tty->print(" }");
|
||||||
|
}
|
||||||
tty->cr();
|
tty->cr();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2365,6 +2365,17 @@ void Node_List::dump() const {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Node_List::dump_simple() const {
|
||||||
|
#ifndef PRODUCT
|
||||||
|
for( uint i = 0; i < _cnt; i++ )
|
||||||
|
if( _nodes[i] ) {
|
||||||
|
tty->print(" %d", _nodes[i]->_idx);
|
||||||
|
} else {
|
||||||
|
tty->print(" NULL");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
//------------------------------remove-----------------------------------------
|
//------------------------------remove-----------------------------------------
|
||||||
void Unique_Node_List::remove( Node *n ) {
|
void Unique_Node_List::remove( Node *n ) {
|
||||||
|
@ -1442,6 +1442,7 @@ public:
|
|||||||
void clear() { _cnt = 0; Node_Array::clear(); } // retain storage
|
void clear() { _cnt = 0; Node_Array::clear(); } // retain storage
|
||||||
uint size() const { return _cnt; }
|
uint size() const { return _cnt; }
|
||||||
void dump() const;
|
void dump() const;
|
||||||
|
void dump_simple() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
//------------------------------Unique_Node_List-------------------------------
|
//------------------------------Unique_Node_List-------------------------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user