< prev index next >
src/hotspot/share/opto/compile.cpp
Print this page
*** 2182,2191 ****
--- 2182,2208 ----
}
}
return true;
}
+ // Remove edges from "root" to each SafePoint at a backward branch.
+ // They were inserted during parsing (see add_safepoint()) to make
+ // infinite loops without calls or exceptions visible to root, i.e.,
+ // useful.
+ void Compile::remove_root_to_sfpts_edges() {
+ Node *r = root();
+ if (r != NULL) {
+ for (uint i = r->req(); i < r->len(); ++i) {
+ Node *n = r->in(i);
+ if (n != NULL && n->is_SafePoint()) {
+ r->rm_prec(i);
+ --i;
+ }
+ }
+ }
+ }
+
//------------------------------Optimize---------------------------------------
// Given a graph, optimize it.
void Compile::Optimize() {
TracePhase tp("optimizer", &timers[_t_optimizer]);
*** 2242,2251 ****
--- 2259,2272 ----
print_method(PHASE_INCREMENTAL_BOXING_INLINE, 2);
if (failing()) return;
}
+ // Now that all inlining is over, cut edge from root to loop
+ // safepoints
+ remove_root_to_sfpts_edges();
+
// Remove the speculative part of types and clean up the graph from
// the extra CastPP nodes whose only purpose is to carry them. Do
// that early so that optimizations are not disrupted by the extra
// CastPP nodes.
remove_speculative_types(igvn);
*** 3246,3259 ****
if (use->is_Proj() && p != use && use->as_Proj()->_con == p->_con) {
proj = use;
break;
}
}
! assert(proj != NULL, "must be found");
p->subsume_by(proj, this);
}
}
break;
}
case Op_Phi:
if (n->as_Phi()->bottom_type()->isa_narrowoop() || n->as_Phi()->bottom_type()->isa_narrowklass()) {
--- 3267,3282 ----
if (use->is_Proj() && p != use && use->as_Proj()->_con == p->_con) {
proj = use;
break;
}
}
! assert(proj != NULL || p->_con == TypeFunc::I_O, "io may be dropped at an infinite loop");
! if (proj != NULL) {
p->subsume_by(proj, this);
}
}
+ }
break;
}
case Op_Phi:
if (n->as_Phi()->bottom_type()->isa_narrowoop() || n->as_Phi()->bottom_type()->isa_narrowklass()) {
< prev index next >