< prev index next >

src/share/vm/opto/node.cpp

Print this page




 504   // Set the new input pointer array
 505   n->_in = (Node**)(((char*)n)+s);
 506   // Cannot share the old output pointer array, so kill it
 507   n->_out = NO_OUT_ARRAY;
 508   // And reset the counters to 0
 509   n->_outcnt = 0;
 510   n->_outmax = 0;
 511   // Unlock this guy, since he is not in any hash table.
 512   debug_only(n->_hash_lock = 0);
 513   // Walk the old node's input list to duplicate its edges
 514   uint i;
 515   for( i = 0; i < len(); i++ ) {
 516     Node *x = in(i);
 517     n->_in[i] = x;
 518     if (x != NULL) x->add_out(n);
 519   }
 520   if (is_macro())
 521     C->add_macro_node(n);
 522   if (is_expensive())
 523     C->add_expensive_node(n);





 524 
 525   n->set_idx(C->next_unique()); // Get new unique index as well
 526   debug_only( n->verify_construction() );
 527   NOT_PRODUCT(nodes_created++);
 528   // Do not patch over the debug_idx of a clone, because it makes it
 529   // impossible to break on the clone's moment of creation.
 530   //debug_only( n->set_debug_idx( debug_idx() ) );
 531 
 532   C->copy_node_notes_to(n, (Node*) this);
 533 
 534   // MachNode clone
 535   uint nopnds;
 536   if (this->is_Mach() && (nopnds = this->as_Mach()->num_opnds()) > 0) {
 537     MachNode *mach  = n->as_Mach();
 538     MachNode *mthis = this->as_Mach();
 539     // Get address of _opnd_array.
 540     // It should be the same offset since it is the clone of this node.
 541     MachOper **from = mthis->_opnds;
 542     MachOper **to = (MachOper **)((size_t)(&mach->_opnds) +
 543                     pointer_delta((const void*)from,


 632 #ifdef ASSERT
 633     if( edge_end == compile->node_arena()->hwm() )
 634       reclaim_in  += edge_size;
 635 #endif
 636     compile->node_arena()->Afree(_in,edge_size);
 637 
 638     // Free just the object
 639 #ifdef ASSERT
 640     if( ((char*)this) + node_size == compile->node_arena()->hwm() )
 641       reclaim_node+= node_size;
 642 #else
 643     compile->node_arena()->Afree(this,node_size);
 644 #endif
 645   }
 646   if (is_macro()) {
 647     compile->remove_macro_node(this);
 648   }
 649   if (is_expensive()) {
 650     compile->remove_expensive_node(this);
 651   }





 652   if (is_SafePoint()) {
 653     as_SafePoint()->delete_replaced_nodes();
 654   }
 655 #ifdef ASSERT
 656   // We will not actually delete the storage, but we'll make the node unusable.
 657   *(address*)this = badAddress;  // smash the C++ vtbl, probably
 658   _in = _out = (Node**) badAddress;
 659   _max = _cnt = _outmax = _outcnt = 0;
 660 #endif
 661 }
 662 
 663 //------------------------------grow-------------------------------------------
 664 // Grow the input array, making space for more edges
 665 void Node::grow( uint len ) {
 666   Arena* arena = Compile::current()->node_arena();
 667   uint new_max = _max;
 668   if( new_max == 0 ) {
 669     _max = 4;
 670     _in = (Node**)arena->Amalloc(4*sizeof(Node*));
 671     Node** to = _in;


1326               use->set_req(0, top);   // Cut self edge
1327             }
1328             nstack.push(use);
1329           } else {
1330             igvn->_worklist.push(use);
1331           }
1332         }
1333         // Refresh the iterator, since any number of kills might have happened.
1334         k = dead->last_outs(kmin);
1335       }
1336     } else { // (dead->outcnt() == 0)
1337       // Done with outputs.
1338       igvn->hash_delete(dead);
1339       igvn->_worklist.remove(dead);
1340       igvn->set_type(dead, Type::TOP);
1341       if (dead->is_macro()) {
1342         igvn->C->remove_macro_node(dead);
1343       }
1344       if (dead->is_expensive()) {
1345         igvn->C->remove_expensive_node(dead);




1346       }
1347       igvn->C->record_dead_node(dead->_idx);
1348       // Kill all inputs to the dead guy
1349       for (uint i=0; i < dead->req(); i++) {
1350         Node *n = dead->in(i);      // Get input to dead guy
1351         if (n != NULL && !n->is_top()) { // Input is valid?
1352           dead->set_req(i, top);    // Smash input away
1353           if (n->outcnt() == 0) {   // Input also goes dead?
1354             if (!n->is_Con())
1355               nstack.push(n);       // Clear it out as well
1356           } else if (n->outcnt() == 1 &&
1357                      n->has_special_unique_user()) {
1358             igvn->add_users_to_worklist( n );
1359           } else if (n->outcnt() <= 2 && n->is_Store()) {
1360             // Push store's uses on worklist to enable folding optimization for
1361             // store/store and store/load to the same address.
1362             // The restriction (outcnt() <= 2) is the same as in set_req_X()
1363             // and remove_globally_dead_node().
1364             igvn->add_users_to_worklist( n );
1365           }




 504   // Set the new input pointer array
 505   n->_in = (Node**)(((char*)n)+s);
 506   // Cannot share the old output pointer array, so kill it
 507   n->_out = NO_OUT_ARRAY;
 508   // And reset the counters to 0
 509   n->_outcnt = 0;
 510   n->_outmax = 0;
 511   // Unlock this guy, since he is not in any hash table.
 512   debug_only(n->_hash_lock = 0);
 513   // Walk the old node's input list to duplicate its edges
 514   uint i;
 515   for( i = 0; i < len(); i++ ) {
 516     Node *x = in(i);
 517     n->_in[i] = x;
 518     if (x != NULL) x->add_out(n);
 519   }
 520   if (is_macro())
 521     C->add_macro_node(n);
 522   if (is_expensive())
 523     C->add_expensive_node(n);
 524   // If the cloned node is a range check dependent CastII, add it to the list.
 525   CastIINode* cast = n->isa_CastII();
 526   if (cast != NULL && cast->has_range_check()) {
 527     C->add_range_check_cast(cast);
 528   }
 529 
 530   n->set_idx(C->next_unique()); // Get new unique index as well
 531   debug_only( n->verify_construction() );
 532   NOT_PRODUCT(nodes_created++);
 533   // Do not patch over the debug_idx of a clone, because it makes it
 534   // impossible to break on the clone's moment of creation.
 535   //debug_only( n->set_debug_idx( debug_idx() ) );
 536 
 537   C->copy_node_notes_to(n, (Node*) this);
 538 
 539   // MachNode clone
 540   uint nopnds;
 541   if (this->is_Mach() && (nopnds = this->as_Mach()->num_opnds()) > 0) {
 542     MachNode *mach  = n->as_Mach();
 543     MachNode *mthis = this->as_Mach();
 544     // Get address of _opnd_array.
 545     // It should be the same offset since it is the clone of this node.
 546     MachOper **from = mthis->_opnds;
 547     MachOper **to = (MachOper **)((size_t)(&mach->_opnds) +
 548                     pointer_delta((const void*)from,


 637 #ifdef ASSERT
 638     if( edge_end == compile->node_arena()->hwm() )
 639       reclaim_in  += edge_size;
 640 #endif
 641     compile->node_arena()->Afree(_in,edge_size);
 642 
 643     // Free just the object
 644 #ifdef ASSERT
 645     if( ((char*)this) + node_size == compile->node_arena()->hwm() )
 646       reclaim_node+= node_size;
 647 #else
 648     compile->node_arena()->Afree(this,node_size);
 649 #endif
 650   }
 651   if (is_macro()) {
 652     compile->remove_macro_node(this);
 653   }
 654   if (is_expensive()) {
 655     compile->remove_expensive_node(this);
 656   }
 657   CastIINode* cast = isa_CastII();
 658   if (cast != NULL && cast->has_range_check()) {
 659     compile->remove_range_check_cast(cast);
 660   }
 661 
 662   if (is_SafePoint()) {
 663     as_SafePoint()->delete_replaced_nodes();
 664   }
 665 #ifdef ASSERT
 666   // We will not actually delete the storage, but we'll make the node unusable.
 667   *(address*)this = badAddress;  // smash the C++ vtbl, probably
 668   _in = _out = (Node**) badAddress;
 669   _max = _cnt = _outmax = _outcnt = 0;
 670 #endif
 671 }
 672 
 673 //------------------------------grow-------------------------------------------
 674 // Grow the input array, making space for more edges
 675 void Node::grow( uint len ) {
 676   Arena* arena = Compile::current()->node_arena();
 677   uint new_max = _max;
 678   if( new_max == 0 ) {
 679     _max = 4;
 680     _in = (Node**)arena->Amalloc(4*sizeof(Node*));
 681     Node** to = _in;


1336               use->set_req(0, top);   // Cut self edge
1337             }
1338             nstack.push(use);
1339           } else {
1340             igvn->_worklist.push(use);
1341           }
1342         }
1343         // Refresh the iterator, since any number of kills might have happened.
1344         k = dead->last_outs(kmin);
1345       }
1346     } else { // (dead->outcnt() == 0)
1347       // Done with outputs.
1348       igvn->hash_delete(dead);
1349       igvn->_worklist.remove(dead);
1350       igvn->set_type(dead, Type::TOP);
1351       if (dead->is_macro()) {
1352         igvn->C->remove_macro_node(dead);
1353       }
1354       if (dead->is_expensive()) {
1355         igvn->C->remove_expensive_node(dead);
1356       }
1357       CastIINode* cast = dead->isa_CastII();
1358       if (cast != NULL && cast->has_range_check()) {
1359         igvn->C->remove_range_check_cast(cast);
1360       }
1361       igvn->C->record_dead_node(dead->_idx);
1362       // Kill all inputs to the dead guy
1363       for (uint i=0; i < dead->req(); i++) {
1364         Node *n = dead->in(i);      // Get input to dead guy
1365         if (n != NULL && !n->is_top()) { // Input is valid?
1366           dead->set_req(i, top);    // Smash input away
1367           if (n->outcnt() == 0) {   // Input also goes dead?
1368             if (!n->is_Con())
1369               nstack.push(n);       // Clear it out as well
1370           } else if (n->outcnt() == 1 &&
1371                      n->has_special_unique_user()) {
1372             igvn->add_users_to_worklist( n );
1373           } else if (n->outcnt() <= 2 && n->is_Store()) {
1374             // Push store's uses on worklist to enable folding optimization for
1375             // store/store and store/load to the same address.
1376             // The restriction (outcnt() <= 2) is the same as in set_req_X()
1377             // and remove_globally_dead_node().
1378             igvn->add_users_to_worklist( n );
1379           }


< prev index next >