8154836: VM crash due to "Base pointers must match"

Improve the handling of AddP nodes in final graph reshaping.

Reviewed-by: kvn, zmajo
This commit is contained in:
Martin Doerr 2016-04-28 10:32:12 +02:00
parent 593cf3fb16
commit 8f2a47ba2e

View File

@ -2846,7 +2846,7 @@ void Compile::final_graph_reshaping_impl( Node *n, Final_Reshape_Counts &frc) {
assert( !addp->is_AddP() ||
addp->in(AddPNode::Base)->is_top() || // Top OK for allocation
addp->in(AddPNode::Base) == n->in(AddPNode::Base),
"Base pointers must match" );
"Base pointers must match (addp %u)", addp->_idx );
#ifdef _LP64
if ((UseCompressedOops || UseCompressedClassPointers) &&
addp->Opcode() == Op_ConP &&
@ -2881,6 +2881,21 @@ void Compile::final_graph_reshaping_impl( Node *n, Final_Reshape_Counts &frc) {
} else {
nn = new DecodeNKlassNode(nn, t);
}
// Check for succeeding AddP which uses the same Base.
// Otherwise we will run into the assertion above when visiting that guy.
for (uint i = 0; i < n->outcnt(); ++i) {
Node *out_i = n->raw_out(i);
if (out_i && out_i->is_AddP() && out_i->in(AddPNode::Base) == addp) {
out_i->set_req(AddPNode::Base, nn);
#ifdef ASSERT
for (uint j = 0; j < out_i->outcnt(); ++j) {
Node *out_j = out_i->raw_out(j);
assert(out_j == NULL || !out_j->is_AddP() || out_j->in(AddPNode::Base) != addp,
"more than 2 AddP nodes in a chain (out_j %u)", out_j->_idx);
}
#endif
}
}
n->set_req(AddPNode::Base, nn);
n->set_req(AddPNode::Address, nn);
if (addp->outcnt() == 0) {