src/hotspot/share/opto/phaseX.cpp
changeset 53220 c14b7b6a9b2f
parent 52654 95ce45e0249f
child 53623 83b40a7bf00d
equal deleted inserted replaced
53219:ef41d615b3f0 53220:c14b7b6a9b2f
   428   // Remove all useless nodes from future worklist
   428   // Remove all useless nodes from future worklist
   429   worklist->remove_useless_nodes(_useful.member_set());
   429   worklist->remove_useless_nodes(_useful.member_set());
   430 
   430 
   431   // Disconnect 'useless' nodes that are adjacent to useful nodes
   431   // Disconnect 'useless' nodes that are adjacent to useful nodes
   432   C->remove_useless_nodes(_useful);
   432   C->remove_useless_nodes(_useful);
   433 
       
   434   // Remove edges from "root" to each SafePoint at a backward branch.
       
   435   // They were inserted during parsing (see add_safepoint()) to make infinite
       
   436   // loops without calls or exceptions visible to root, i.e., useful.
       
   437   Node *root = C->root();
       
   438   if( root != NULL ) {
       
   439     for( uint i = root->req(); i < root->len(); ++i ) {
       
   440       Node *n = root->in(i);
       
   441       if( n != NULL && n->is_SafePoint() ) {
       
   442         root->rm_prec(i);
       
   443         --i;
       
   444       }
       
   445     }
       
   446   }
       
   447 }
   433 }
   448 
   434 
   449 //=============================================================================
   435 //=============================================================================
   450 //------------------------------PhaseRenumberLive------------------------------
   436 //------------------------------PhaseRenumberLive------------------------------
   451 // First, remove useless nodes (equivalent to identifying live nodes).
   437 // First, remove useless nodes (equivalent to identifying live nodes).
  1352   assert(_stack.is_empty(), "not empty");
  1338   assert(_stack.is_empty(), "not empty");
  1353   _stack.push(dead, PROCESS_INPUTS);
  1339   _stack.push(dead, PROCESS_INPUTS);
  1354 
  1340 
  1355   while (_stack.is_nonempty()) {
  1341   while (_stack.is_nonempty()) {
  1356     dead = _stack.node();
  1342     dead = _stack.node();
       
  1343     if (dead->Opcode() == Op_SafePoint) {
       
  1344       dead->as_SafePoint()->disconnect_from_root(this);
       
  1345     }
  1357     uint progress_state = _stack.index();
  1346     uint progress_state = _stack.index();
  1358     assert(dead != C->root(), "killing root, eh?");
  1347     assert(dead != C->root(), "killing root, eh?");
  1359     assert(!dead->is_top(), "add check for top when pushing");
  1348     assert(!dead->is_top(), "add check for top when pushing");
  1360     NOT_PRODUCT( set_progress(); )
  1349     NOT_PRODUCT( set_progress(); )
  1361     if (progress_state == PROCESS_INPUTS) {
  1350     if (progress_state == PROCESS_INPUTS) {
  1454 }
  1443 }
  1455 
  1444 
  1456 //------------------------------subsume_node-----------------------------------
  1445 //------------------------------subsume_node-----------------------------------
  1457 // Remove users from node 'old' and add them to node 'nn'.
  1446 // Remove users from node 'old' and add them to node 'nn'.
  1458 void PhaseIterGVN::subsume_node( Node *old, Node *nn ) {
  1447 void PhaseIterGVN::subsume_node( Node *old, Node *nn ) {
       
  1448   if (old->Opcode() == Op_SafePoint) {
       
  1449     old->as_SafePoint()->disconnect_from_root(this);
       
  1450   }
  1459   assert( old != hash_find(old), "should already been removed" );
  1451   assert( old != hash_find(old), "should already been removed" );
  1460   assert( old != C->top(), "cannot subsume top node");
  1452   assert( old != C->top(), "cannot subsume top node");
  1461   // Copy debug or profile information to the new version:
  1453   // Copy debug or profile information to the new version:
  1462   C->copy_node_notes_to(nn, old);
  1454   C->copy_node_notes_to(nn, old);
  1463   // Move users of node 'old' to node 'nn'
  1455   // Move users of node 'old' to node 'nn'