src/share/vm/opto/compile.cpp

changeset 9957
d2ec2776ad0c
parent 9858
b985cbb00e68
child 9985
8712be1ae49a
     1.1 --- a/src/share/vm/opto/compile.cpp	Thu Jul 02 16:51:57 2020 -0400
     1.2 +++ b/src/share/vm/opto/compile.cpp	Mon Mar 09 17:41:30 2020 +0100
     1.3 @@ -2075,6 +2075,23 @@
     1.4  }
     1.5  
     1.6  
     1.7 +// Remove edges from "root" to each SafePoint at a backward branch.
     1.8 +// They were inserted during parsing (see add_safepoint()) to make
     1.9 +// infinite loops without calls or exceptions visible to root, i.e.,
    1.10 +// useful.
    1.11 +void Compile::remove_root_to_sfpts_edges() {
    1.12 +  Node *r = root();
    1.13 +  if (r != NULL) {
    1.14 +    for (uint i = r->req(); i < r->len(); ++i) {
    1.15 +      Node *n = r->in(i);
    1.16 +      if (n != NULL && n->is_SafePoint()) {
    1.17 +        r->rm_prec(i);
    1.18 +        --i;
    1.19 +      }
    1.20 +    }
    1.21 +  }
    1.22 +}
    1.23 +
    1.24  //------------------------------Optimize---------------------------------------
    1.25  // Given a graph, optimize it.
    1.26  void Compile::Optimize() {
    1.27 @@ -2130,6 +2147,10 @@
    1.28      if (failing())  return;
    1.29    }
    1.30  
    1.31 +  // Now that all inlining is over, cut edge from root to loop
    1.32 +  // safepoints
    1.33 +  remove_root_to_sfpts_edges();
    1.34 +
    1.35    // Remove the speculative part of types and clean up the graph from
    1.36    // the extra CastPP nodes whose only purpose is to carry them. Do
    1.37    // that early so that optimizations are not disrupted by the extra
    1.38 @@ -3012,8 +3033,10 @@
    1.39              break;
    1.40            }
    1.41          }
    1.42 -        assert(proj != NULL, "must be found");
    1.43 -        p->subsume_by(proj, this);
    1.44 +        assert(proj != NULL || p->_con == TypeFunc::I_O, "io may be dropped at an infinite loop");
    1.45 +        if (proj != NULL) {
    1.46 +          p->subsume_by(proj, this);
    1.47 +        }
    1.48        }
    1.49      }
    1.50      break;

mercurial