equal
deleted
inserted
replaced
65 assert(bump >= 0 && bump < mod, ""); |
65 assert(bump >= 0 && bump < mod, ""); |
66 new_debug_idx += bump; |
66 new_debug_idx += bump; |
67 } |
67 } |
68 Compile::set_debug_idx(new_debug_idx); |
68 Compile::set_debug_idx(new_debug_idx); |
69 set_debug_idx( new_debug_idx ); |
69 set_debug_idx( new_debug_idx ); |
70 assert(Compile::current()->unique() < (UINT_MAX - 1), "Node limit exceeded UINT_MAX"); |
70 assert(Compile::current()->unique() < (INT_MAX - 1), "Node limit exceeded INT_MAX"); |
|
71 assert(Compile::current()->live_nodes() < (uint)MaxNodeLimit, "Live Node limit exceeded limit"); |
71 if (BreakAtNode != 0 && (_debug_idx == BreakAtNode || (int)_idx == BreakAtNode)) { |
72 if (BreakAtNode != 0 && (_debug_idx == BreakAtNode || (int)_idx == BreakAtNode)) { |
72 tty->print_cr("BreakAtNode: _idx=%d _debug_idx=%d", _idx, _debug_idx); |
73 tty->print_cr("BreakAtNode: _idx=%d _debug_idx=%d", _idx, _debug_idx); |
73 BREAKPOINT; |
74 BREAKPOINT; |
74 } |
75 } |
75 #if OPTO_DU_ITERATOR_ASSERT |
76 #if OPTO_DU_ITERATOR_ASSERT |
469 |
470 |
470 |
471 |
471 //------------------------------clone------------------------------------------ |
472 //------------------------------clone------------------------------------------ |
472 // Clone a Node. |
473 // Clone a Node. |
473 Node *Node::clone() const { |
474 Node *Node::clone() const { |
474 Compile *compile = Compile::current(); |
475 Compile* C = Compile::current(); |
475 uint s = size_of(); // Size of inherited Node |
476 uint s = size_of(); // Size of inherited Node |
476 Node *n = (Node*)compile->node_arena()->Amalloc_D(size_of() + _max*sizeof(Node*)); |
477 Node *n = (Node*)C->node_arena()->Amalloc_D(size_of() + _max*sizeof(Node*)); |
477 Copy::conjoint_words_to_lower((HeapWord*)this, (HeapWord*)n, s); |
478 Copy::conjoint_words_to_lower((HeapWord*)this, (HeapWord*)n, s); |
478 // Set the new input pointer array |
479 // Set the new input pointer array |
479 n->_in = (Node**)(((char*)n)+s); |
480 n->_in = (Node**)(((char*)n)+s); |
480 // Cannot share the old output pointer array, so kill it |
481 // Cannot share the old output pointer array, so kill it |
481 n->_out = NO_OUT_ARRAY; |
482 n->_out = NO_OUT_ARRAY; |
490 Node *x = in(i); |
491 Node *x = in(i); |
491 n->_in[i] = x; |
492 n->_in[i] = x; |
492 if (x != NULL) x->add_out(n); |
493 if (x != NULL) x->add_out(n); |
493 } |
494 } |
494 if (is_macro()) |
495 if (is_macro()) |
495 compile->add_macro_node(n); |
496 C->add_macro_node(n); |
496 if (is_expensive()) |
497 if (is_expensive()) |
497 compile->add_expensive_node(n); |
498 C->add_expensive_node(n); |
498 |
499 |
499 n->set_idx(compile->next_unique()); // Get new unique index as well |
500 n->set_idx(C->next_unique()); // Get new unique index as well |
500 debug_only( n->verify_construction() ); |
501 debug_only( n->verify_construction() ); |
501 NOT_PRODUCT(nodes_created++); |
502 NOT_PRODUCT(nodes_created++); |
502 // Do not patch over the debug_idx of a clone, because it makes it |
503 // Do not patch over the debug_idx of a clone, because it makes it |
503 // impossible to break on the clone's moment of creation. |
504 // impossible to break on the clone's moment of creation. |
504 //debug_only( n->set_debug_idx( debug_idx() ) ); |
505 //debug_only( n->set_debug_idx( debug_idx() ) ); |
505 |
506 |
506 compile->copy_node_notes_to(n, (Node*) this); |
507 C->copy_node_notes_to(n, (Node*) this); |
507 |
508 |
508 // MachNode clone |
509 // MachNode clone |
509 uint nopnds; |
510 uint nopnds; |
510 if (this->is_Mach() && (nopnds = this->as_Mach()->num_opnds()) > 0) { |
511 if (this->is_Mach() && (nopnds = this->as_Mach()->num_opnds()) > 0) { |
511 MachNode *mach = n->as_Mach(); |
512 MachNode *mach = n->as_Mach(); |
516 MachOper **to = (MachOper **)((size_t)(&mach->_opnds) + |
517 MachOper **to = (MachOper **)((size_t)(&mach->_opnds) + |
517 pointer_delta((const void*)from, |
518 pointer_delta((const void*)from, |
518 (const void*)(&mthis->_opnds), 1)); |
519 (const void*)(&mthis->_opnds), 1)); |
519 mach->_opnds = to; |
520 mach->_opnds = to; |
520 for ( uint i = 0; i < nopnds; ++i ) { |
521 for ( uint i = 0; i < nopnds; ++i ) { |
521 to[i] = from[i]->clone(compile); |
522 to[i] = from[i]->clone(C); |
522 } |
523 } |
523 } |
524 } |
524 // cloning CallNode may need to clone JVMState |
525 // cloning CallNode may need to clone JVMState |
525 if (n->is_Call()) { |
526 if (n->is_Call()) { |
526 CallNode *call = n->as_Call(); |
527 n->as_Call()->clone_jvms(C); |
527 call->clone_jvms(); |
|
528 } |
528 } |
529 return n; // Return the clone |
529 return n; // Return the clone |
530 } |
530 } |
531 |
531 |
532 //---------------------------setup_is_top-------------------------------------- |
532 //---------------------------setup_is_top-------------------------------------- |
803 if (in(i) == old) { |
803 if (in(i) == old) { |
804 if (i < req()) |
804 if (i < req()) |
805 set_req(i, neww); |
805 set_req(i, neww); |
806 else |
806 else |
807 set_prec(i, neww); |
807 set_prec(i, neww); |
|
808 nrep++; |
|
809 } |
|
810 } |
|
811 return nrep; |
|
812 } |
|
813 |
|
814 /** |
|
815 * Replace input edges in the range pointing to 'old' node. |
|
816 */ |
|
817 int Node::replace_edges_in_range(Node* old, Node* neww, int start, int end) { |
|
818 if (old == neww) return 0; // nothing to do |
|
819 uint nrep = 0; |
|
820 for (int i = start; i < end; i++) { |
|
821 if (in(i) == old) { |
|
822 set_req(i, neww); |
808 nrep++; |
823 nrep++; |
809 } |
824 } |
810 } |
825 } |
811 return nrep; |
826 return nrep; |
812 } |
827 } |