8257057: C2: Improve safepoint processing during vector scalarization pass

Reviewed-by: kvn, thartmann
This commit is contained in:
Vladimir Ivanov 2020-11-30 10:30:47 +00:00
parent e77aed624e
commit 4e55d0f31e

@ -219,12 +219,19 @@ void PhaseVector::scalarize_vbox_node(VectorBoxNode* vec_box) {
// Process debug uses at safepoints // Process debug uses at safepoints
Unique_Node_List safepoints(C->comp_arena()); Unique_Node_List safepoints(C->comp_arena());
for (DUIterator_Fast imax, i = vec_box->fast_outs(imax); i < imax; i++) { Unique_Node_List worklist(C->comp_arena());
Node* use = vec_box->fast_out(i); worklist.push(vec_box);
if (use->is_SafePoint()) { while (worklist.size() > 0) {
SafePointNode* sfpt = use->as_SafePoint(); Node* n = worklist.pop();
if (!sfpt->is_Call() || !sfpt->as_Call()->has_non_debug_use(vec_box)) { for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) {
safepoints.push(sfpt); Node* use = n->fast_out(i);
if (use->is_SafePoint()) {
SafePointNode* sfpt = use->as_SafePoint();
if (!sfpt->is_Call() || !sfpt->as_Call()->has_non_debug_use(n)) {
safepoints.push(sfpt);
}
} else if (use->is_ConstraintCast()) {
worklist.push(use); // reversed version of Node::uncast()
} }
} }
} }
@ -251,11 +258,13 @@ void PhaseVector::scalarize_vbox_node(VectorBoxNode* vec_box) {
jvms->set_endoff(sfpt->req()); jvms->set_endoff(sfpt->req());
// Now make a pass over the debug information replacing any references // Now make a pass over the debug information replacing any references
// to the allocated object with "sobj" // to the allocated object with vector value.
int start = jvms->debug_start(); for (uint i = jvms->debug_start(); i < jvms->debug_end(); i++) {
int end = jvms->debug_end(); Node* debug = sfpt->in(i);
sfpt->replace_edges_in_range(vec_box, sobj, start, end); if (debug != NULL && debug->uncast(/*keep_deps*/false) == vec_box) {
sfpt->set_req(i, sobj);
}
}
C->record_for_igvn(sfpt); C->record_for_igvn(sfpt);
} }
} }