< prev index next >

src/hotspot/share/opto/phaseX.cpp

Print this page

        

@@ -428,24 +428,10 @@
   // Remove all useless nodes from future worklist
   worklist->remove_useless_nodes(_useful.member_set());
 
   // Disconnect 'useless' nodes that are adjacent to useful nodes
   C->remove_useless_nodes(_useful);
-
-  // 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.
-  Node *root = C->root();
-  if( root != NULL ) {
-    for( uint i = root->req(); i < root->len(); ++i ) {
-      Node *n = root->in(i);
-      if( n != NULL && n->is_SafePoint() ) {
-        root->rm_prec(i);
-        --i;
-      }
-    }
-  }
 }
 
 //=============================================================================
 //------------------------------PhaseRenumberLive------------------------------
 // First, remove useless nodes (equivalent to identifying live nodes).

@@ -1352,10 +1338,13 @@
   assert(_stack.is_empty(), "not empty");
   _stack.push(dead, PROCESS_INPUTS);
 
   while (_stack.is_nonempty()) {
     dead = _stack.node();
+    if (dead->Opcode() == Op_SafePoint) {
+      dead->as_SafePoint()->disconnect_from_root(this);
+    }
     uint progress_state = _stack.index();
     assert(dead != C->root(), "killing root, eh?");
     assert(!dead->is_top(), "add check for top when pushing");
     NOT_PRODUCT( set_progress(); )
     if (progress_state == PROCESS_INPUTS) {

@@ -1454,10 +1443,13 @@
 }
 
 //------------------------------subsume_node-----------------------------------
 // Remove users from node 'old' and add them to node 'nn'.
 void PhaseIterGVN::subsume_node( Node *old, Node *nn ) {
+  if (old->Opcode() == Op_SafePoint) {
+    old->as_SafePoint()->disconnect_from_root(this);
+  }
   assert( old != hash_find(old), "should already been removed" );
   assert( old != C->top(), "cannot subsume top node");
   // Copy debug or profile information to the new version:
   C->copy_node_notes_to(nn, old);
   // Move users of node 'old' to node 'nn'
< prev index next >