src/share/vm/opto/node.cpp

changeset 5110
6f3fd5150b67
parent 4657
6931f425c517
child 5111
70120f47d403
     1.1 --- a/src/share/vm/opto/node.cpp	Mon May 06 19:49:23 2013 -0700
     1.2 +++ b/src/share/vm/opto/node.cpp	Wed May 08 15:08:01 2013 -0700
     1.3 @@ -67,7 +67,8 @@
     1.4    }
     1.5    Compile::set_debug_idx(new_debug_idx);
     1.6    set_debug_idx( new_debug_idx );
     1.7 -  assert(Compile::current()->unique() < (UINT_MAX - 1), "Node limit exceeded UINT_MAX");
     1.8 +  assert(Compile::current()->unique() < (INT_MAX - 1), "Node limit exceeded INT_MAX");
     1.9 +  assert(Compile::current()->live_nodes() < (uint)MaxNodeLimit, "Live Node limit exceeded limit");
    1.10    if (BreakAtNode != 0 && (_debug_idx == BreakAtNode || (int)_idx == BreakAtNode)) {
    1.11      tty->print_cr("BreakAtNode: _idx=%d _debug_idx=%d", _idx, _debug_idx);
    1.12      BREAKPOINT;
    1.13 @@ -471,9 +472,9 @@
    1.14  //------------------------------clone------------------------------------------
    1.15  // Clone a Node.
    1.16  Node *Node::clone() const {
    1.17 -  Compile *compile = Compile::current();
    1.18 +  Compile* C = Compile::current();
    1.19    uint s = size_of();           // Size of inherited Node
    1.20 -  Node *n = (Node*)compile->node_arena()->Amalloc_D(size_of() + _max*sizeof(Node*));
    1.21 +  Node *n = (Node*)C->node_arena()->Amalloc_D(size_of() + _max*sizeof(Node*));
    1.22    Copy::conjoint_words_to_lower((HeapWord*)this, (HeapWord*)n, s);
    1.23    // Set the new input pointer array
    1.24    n->_in = (Node**)(((char*)n)+s);
    1.25 @@ -492,18 +493,18 @@
    1.26      if (x != NULL) x->add_out(n);
    1.27    }
    1.28    if (is_macro())
    1.29 -    compile->add_macro_node(n);
    1.30 +    C->add_macro_node(n);
    1.31    if (is_expensive())
    1.32 -    compile->add_expensive_node(n);
    1.33 +    C->add_expensive_node(n);
    1.34  
    1.35 -  n->set_idx(compile->next_unique()); // Get new unique index as well
    1.36 +  n->set_idx(C->next_unique()); // Get new unique index as well
    1.37    debug_only( n->verify_construction() );
    1.38    NOT_PRODUCT(nodes_created++);
    1.39    // Do not patch over the debug_idx of a clone, because it makes it
    1.40    // impossible to break on the clone's moment of creation.
    1.41    //debug_only( n->set_debug_idx( debug_idx() ) );
    1.42  
    1.43 -  compile->copy_node_notes_to(n, (Node*) this);
    1.44 +  C->copy_node_notes_to(n, (Node*) this);
    1.45  
    1.46    // MachNode clone
    1.47    uint nopnds;
    1.48 @@ -518,13 +519,12 @@
    1.49                                    (const void*)(&mthis->_opnds), 1));
    1.50      mach->_opnds = to;
    1.51      for ( uint i = 0; i < nopnds; ++i ) {
    1.52 -      to[i] = from[i]->clone(compile);
    1.53 +      to[i] = from[i]->clone(C);
    1.54      }
    1.55    }
    1.56    // cloning CallNode may need to clone JVMState
    1.57    if (n->is_Call()) {
    1.58 -    CallNode *call = n->as_Call();
    1.59 -    call->clone_jvms();
    1.60 +    n->as_Call()->clone_jvms(C);
    1.61    }
    1.62    return n;                     // Return the clone
    1.63  }
    1.64 @@ -811,6 +811,21 @@
    1.65    return nrep;
    1.66  }
    1.67  
    1.68 +/**
    1.69 + * Replace input edges in the range pointing to 'old' node.
    1.70 + */
    1.71 +int Node::replace_edges_in_range(Node* old, Node* neww, int start, int end) {
    1.72 +  if (old == neww)  return 0;  // nothing to do
    1.73 +  uint nrep = 0;
    1.74 +  for (int i = start; i < end; i++) {
    1.75 +    if (in(i) == old) {
    1.76 +      set_req(i, neww);
    1.77 +      nrep++;
    1.78 +    }
    1.79 +  }
    1.80 +  return nrep;
    1.81 +}
    1.82 +
    1.83  //-------------------------disconnect_inputs-----------------------------------
    1.84  // NULL out all inputs to eliminate incoming Def-Use edges.
    1.85  // Return the number of edges between 'n' and 'this'

mercurial