--- a/src/hotspot/share/opto/compile.cpp Wed Jan 09 00:25:41 2019 -0800
+++ b/src/hotspot/share/opto/compile.cpp Fri Dec 07 17:56:51 2018 +0100
@@ -2184,6 +2184,23 @@
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() {
@@ -2244,6 +2261,10 @@
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
@@ -3248,8 +3269,10 @@
break;
}
}
- assert(proj != NULL, "must be found");
- p->subsume_by(proj, this);
+ 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;