diff -r 2251ba078bec -r eb7ce841ccec src/share/vm/opto/compile.cpp --- a/src/share/vm/opto/compile.cpp Sat Oct 24 16:18:50 2020 +0800 +++ b/src/share/vm/opto/compile.cpp Sat Oct 24 16:43:47 2020 +0800 @@ -1170,6 +1170,9 @@ _expensive_nodes = new(comp_arena()) GrowableArray(comp_arena(), 8, 0, NULL); _range_check_casts = new(comp_arena()) GrowableArray(comp_arena(), 8, 0, NULL); register_library_intrinsics(); +#ifdef ASSERT + _type_verify_symmetry = true; +#endif } //---------------------------init_start---------------------------------------- @@ -2083,6 +2086,23 @@ } +// 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() { @@ -2138,6 +2158,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 @@ -3020,8 +3044,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;