< prev index next >

src/hotspot/share/opto/node.cpp

Print this page

 562     }
 563   }
 564   if (n->is_Call()) {
 565     // CallGenerator is linked to the original node.
 566     CallGenerator* cg = n->as_Call()->generator();
 567     if (cg != NULL) {
 568       CallGenerator* cloned_cg = cg->with_call_node(n->as_Call());
 569       n->as_Call()->set_generator(cloned_cg);
 570 
 571       C->print_inlining_assert_ready();
 572       C->print_inlining_move_to(cg);
 573       C->print_inlining_update(cloned_cg);
 574     }
 575   }
 576   if (n->is_SafePoint()) {
 577     // Scalar replacement and macro expansion might modify the JVMState.
 578     // Clone it to make sure it's not shared between SafePointNodes.
 579     n->as_SafePoint()->clone_jvms(C);
 580     n->as_SafePoint()->clone_replaced_nodes();
 581   }



 582   return n;                     // Return the clone
 583 }
 584 
 585 //---------------------------setup_is_top--------------------------------------
 586 // Call this when changing the top node, to reassert the invariants
 587 // required by Node::is_top.  See Compile::set_cached_top_node.
 588 void Node::setup_is_top() {
 589   if (this == (Node*)Compile::current()->top()) {
 590     // This node has just become top.  Kill its out array.
 591     _outcnt = _outmax = 0;
 592     _out = NULL;                           // marker value for top
 593     assert(is_top(), "must be top");
 594   } else {
 595     if (_out == NULL)  _out = NO_OUT_ARRAY;
 596     assert(!is_top(), "must not be top");
 597   }
 598 }
 599 
 600 //------------------------------~Node------------------------------------------
 601 // Fancy destructor; eagerly attempt to reclaim Node numberings and storage

 644     // Free just the input array
 645     compile->node_arena()->Afree(_in,edge_size);
 646 
 647     // Free just the object
 648 #ifndef ASSERT
 649     compile->node_arena()->Afree(this,node_size);
 650 #endif
 651   }
 652   if (is_macro()) {
 653     compile->remove_macro_node(this);
 654   }
 655   if (is_expensive()) {
 656     compile->remove_expensive_node(this);
 657   }
 658   if (Opcode() == Op_Opaque4) {
 659     compile->remove_skeleton_predicate_opaq(this);
 660   }
 661   if (for_post_loop_opts_igvn()) {
 662     compile->remove_from_post_loop_opts_igvn(this);
 663   }



 664 
 665   if (is_SafePoint()) {
 666     as_SafePoint()->delete_replaced_nodes();
 667   }
 668   BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2();
 669   bs->unregister_potential_barrier_node(this);
 670 #ifdef ASSERT
 671   // We will not actually delete the storage, but we'll make the node unusable.
 672   *(address*)this = badAddress;  // smash the C++ vtbl, probably
 673   _in = _out = (Node**) badAddress;
 674   _max = _cnt = _outmax = _outcnt = 0;
 675   compile->remove_modified_node(this);
 676 #endif
 677 }
 678 
 679 //------------------------------grow-------------------------------------------
 680 // Grow the input array, making space for more edges
 681 void Node::grow(uint len) {
 682   Arena* arena = Compile::current()->node_arena();
 683   uint new_max = _max;

2182   if (visited.member(this))  return;
2183   visited.push(this);
2184 
2185   // Walk over all input edges, checking for correspondence
2186   for( i = 0; i < len(); i++ ) {
2187     n = in(i);
2188     if (n != NULL && !n->is_top()) {
2189       // Count instances of (Node *)this
2190       cnt = 0;
2191       for (idx = 0; idx < n->_outcnt; idx++ ) {
2192         if (n->_out[idx] == (Node *)this)  cnt++;
2193       }
2194       assert( cnt > 0,"Failed to find Def-Use edge." );
2195       // Check for duplicate edges
2196       // walk the input array downcounting the input edges to n
2197       for( j = 0; j < len(); j++ ) {
2198         if( in(j) == n ) cnt--;
2199       }
2200       assert( cnt == 0,"Mismatched edge count.");
2201     } else if (n == NULL) {
2202       assert(i >= req() || i == 0 || is_Region() || is_Phi() || is_ArrayCopy() || (is_Unlock() && i == req()-1)


2203               || (is_MemBar() && i == 5), // the precedence edge to a membar can be removed during macro node expansion
2204               "only region, phi, arraycopy, unlock or membar nodes have null data edges");
2205     } else {
2206       assert(n->is_top(), "sanity");
2207       // Nothing to check.
2208     }
2209   }
2210   // Recursive walk over all input edges
2211   for( i = 0; i < len(); i++ ) {
2212     n = in(i);
2213     if( n != NULL )
2214       in(i)->verify_edges(visited);
2215   }
2216 }
2217 
2218 // Verify all nodes if verify_depth is negative
2219 void Node::verify(int verify_depth, VectorSet& visited, Node_List& worklist) {
2220   assert(verify_depth != 0, "depth should not be 0");
2221   Compile* C = Compile::current();
2222   uint last_index_on_current_depth = worklist.size() - 1;
2223   verify_depth--; // Visiting the first node on depth 1
2224   // Only add nodes to worklist if verify_depth is negative (visit all nodes) or greater than 0

 562     }
 563   }
 564   if (n->is_Call()) {
 565     // CallGenerator is linked to the original node.
 566     CallGenerator* cg = n->as_Call()->generator();
 567     if (cg != NULL) {
 568       CallGenerator* cloned_cg = cg->with_call_node(n->as_Call());
 569       n->as_Call()->set_generator(cloned_cg);
 570 
 571       C->print_inlining_assert_ready();
 572       C->print_inlining_move_to(cg);
 573       C->print_inlining_update(cloned_cg);
 574     }
 575   }
 576   if (n->is_SafePoint()) {
 577     // Scalar replacement and macro expansion might modify the JVMState.
 578     // Clone it to make sure it's not shared between SafePointNodes.
 579     n->as_SafePoint()->clone_jvms(C);
 580     n->as_SafePoint()->clone_replaced_nodes();
 581   }
 582   if (n->is_InlineTypeBase()) {
 583     C->add_inline_type(n);
 584   }
 585   return n;                     // Return the clone
 586 }
 587 
 588 //---------------------------setup_is_top--------------------------------------
 589 // Call this when changing the top node, to reassert the invariants
 590 // required by Node::is_top.  See Compile::set_cached_top_node.
 591 void Node::setup_is_top() {
 592   if (this == (Node*)Compile::current()->top()) {
 593     // This node has just become top.  Kill its out array.
 594     _outcnt = _outmax = 0;
 595     _out = NULL;                           // marker value for top
 596     assert(is_top(), "must be top");
 597   } else {
 598     if (_out == NULL)  _out = NO_OUT_ARRAY;
 599     assert(!is_top(), "must not be top");
 600   }
 601 }
 602 
 603 //------------------------------~Node------------------------------------------
 604 // Fancy destructor; eagerly attempt to reclaim Node numberings and storage

 647     // Free just the input array
 648     compile->node_arena()->Afree(_in,edge_size);
 649 
 650     // Free just the object
 651 #ifndef ASSERT
 652     compile->node_arena()->Afree(this,node_size);
 653 #endif
 654   }
 655   if (is_macro()) {
 656     compile->remove_macro_node(this);
 657   }
 658   if (is_expensive()) {
 659     compile->remove_expensive_node(this);
 660   }
 661   if (Opcode() == Op_Opaque4) {
 662     compile->remove_skeleton_predicate_opaq(this);
 663   }
 664   if (for_post_loop_opts_igvn()) {
 665     compile->remove_from_post_loop_opts_igvn(this);
 666   }
 667   if (is_InlineTypeBase()) {
 668     compile->remove_inline_type(this);
 669   }
 670 
 671   if (is_SafePoint()) {
 672     as_SafePoint()->delete_replaced_nodes();
 673   }
 674   BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2();
 675   bs->unregister_potential_barrier_node(this);
 676 #ifdef ASSERT
 677   // We will not actually delete the storage, but we'll make the node unusable.
 678   *(address*)this = badAddress;  // smash the C++ vtbl, probably
 679   _in = _out = (Node**) badAddress;
 680   _max = _cnt = _outmax = _outcnt = 0;
 681   compile->remove_modified_node(this);
 682 #endif
 683 }
 684 
 685 //------------------------------grow-------------------------------------------
 686 // Grow the input array, making space for more edges
 687 void Node::grow(uint len) {
 688   Arena* arena = Compile::current()->node_arena();
 689   uint new_max = _max;

2188   if (visited.member(this))  return;
2189   visited.push(this);
2190 
2191   // Walk over all input edges, checking for correspondence
2192   for( i = 0; i < len(); i++ ) {
2193     n = in(i);
2194     if (n != NULL && !n->is_top()) {
2195       // Count instances of (Node *)this
2196       cnt = 0;
2197       for (idx = 0; idx < n->_outcnt; idx++ ) {
2198         if (n->_out[idx] == (Node *)this)  cnt++;
2199       }
2200       assert( cnt > 0,"Failed to find Def-Use edge." );
2201       // Check for duplicate edges
2202       // walk the input array downcounting the input edges to n
2203       for( j = 0; j < len(); j++ ) {
2204         if( in(j) == n ) cnt--;
2205       }
2206       assert( cnt == 0,"Mismatched edge count.");
2207     } else if (n == NULL) {
2208       assert(i >= req() || i == 0 || is_Region() || is_Phi() || is_ArrayCopy() ||
2209              (is_Allocate() && i >= AllocateNode::InlineTypeNode) ||
2210              (is_Unlock() && i == req()-1)
2211               || (is_MemBar() && i == 5), // the precedence edge to a membar can be removed during macro node expansion
2212              "only region, phi, arraycopy, allocate or unlock nodes have null data edges");
2213     } else {
2214       assert(n->is_top(), "sanity");
2215       // Nothing to check.
2216     }
2217   }
2218   // Recursive walk over all input edges
2219   for( i = 0; i < len(); i++ ) {
2220     n = in(i);
2221     if( n != NULL )
2222       in(i)->verify_edges(visited);
2223   }
2224 }
2225 
2226 // Verify all nodes if verify_depth is negative
2227 void Node::verify(int verify_depth, VectorSet& visited, Node_List& worklist) {
2228   assert(verify_depth != 0, "depth should not be 0");
2229   Compile* C = Compile::current();
2230   uint last_index_on_current_depth = worklist.size() - 1;
2231   verify_depth--; // Visiting the first node on depth 1
2232   // Only add nodes to worklist if verify_depth is negative (visit all nodes) or greater than 0
< prev index next >