490 NOT_PRODUCT(nodes_created++);
491 // Do not patch over the debug_idx of a clone, because it makes it
492 // impossible to break on the clone's moment of creation.
493 //debug_only( n->set_debug_idx( debug_idx() ) );
494
495 C->copy_node_notes_to(n, (Node*) this);
496
497 // MachNode clone
498 uint nopnds;
499 if (this->is_Mach() && (nopnds = this->as_Mach()->num_opnds()) > 0) {
500 MachNode *mach = n->as_Mach();
501 MachNode *mthis = this->as_Mach();
502 // Get address of _opnd_array.
503 // It should be the same offset since it is the clone of this node.
504 MachOper **from = mthis->_opnds;
505 MachOper **to = (MachOper **)((size_t)(&mach->_opnds) +
506 pointer_delta((const void*)from,
507 (const void*)(&mthis->_opnds), 1));
508 mach->_opnds = to;
509 for ( uint i = 0; i < nopnds; ++i ) {
510 to[i] = from[i]->clone(C);
511 }
512 }
513 // cloning CallNode may need to clone JVMState
514 if (n->is_Call()) {
515 n->as_Call()->clone_jvms(C);
516 }
517 if (n->is_SafePoint()) {
518 n->as_SafePoint()->clone_replaced_nodes();
519 }
520 return n; // Return the clone
521 }
522
523 //---------------------------setup_is_top--------------------------------------
524 // Call this when changing the top node, to reassert the invariants
525 // required by Node::is_top. See Compile::set_cached_top_node.
526 void Node::setup_is_top() {
527 if (this == (Node*)Compile::current()->top()) {
528 // This node has just become top. Kill its out array.
529 _outcnt = _outmax = 0;
530 _out = NULL; // marker value for top
|
490 NOT_PRODUCT(nodes_created++);
491 // Do not patch over the debug_idx of a clone, because it makes it
492 // impossible to break on the clone's moment of creation.
493 //debug_only( n->set_debug_idx( debug_idx() ) );
494
495 C->copy_node_notes_to(n, (Node*) this);
496
497 // MachNode clone
498 uint nopnds;
499 if (this->is_Mach() && (nopnds = this->as_Mach()->num_opnds()) > 0) {
500 MachNode *mach = n->as_Mach();
501 MachNode *mthis = this->as_Mach();
502 // Get address of _opnd_array.
503 // It should be the same offset since it is the clone of this node.
504 MachOper **from = mthis->_opnds;
505 MachOper **to = (MachOper **)((size_t)(&mach->_opnds) +
506 pointer_delta((const void*)from,
507 (const void*)(&mthis->_opnds), 1));
508 mach->_opnds = to;
509 for ( uint i = 0; i < nopnds; ++i ) {
510 to[i] = from[i]->clone();
511 }
512 }
513 // cloning CallNode may need to clone JVMState
514 if (n->is_Call()) {
515 n->as_Call()->clone_jvms(C);
516 }
517 if (n->is_SafePoint()) {
518 n->as_SafePoint()->clone_replaced_nodes();
519 }
520 return n; // Return the clone
521 }
522
523 //---------------------------setup_is_top--------------------------------------
524 // Call this when changing the top node, to reassert the invariants
525 // required by Node::is_top. See Compile::set_cached_top_node.
526 void Node::setup_is_top() {
527 if (this == (Node*)Compile::current()->top()) {
528 // This node has just become top. Kill its out array.
529 _outcnt = _outmax = 0;
530 _out = NULL; // marker value for top
|