518 // MachNode clone
519 uint nopnds;
520 if (this->is_Mach() && (nopnds = this->as_Mach()->num_opnds()) > 0) {
521 MachNode *mach = n->as_Mach();
522 MachNode *mthis = this->as_Mach();
523 // Get address of _opnd_array.
524 // It should be the same offset since it is the clone of this node.
525 MachOper **from = mthis->_opnds;
526 MachOper **to = (MachOper **)((size_t)(&mach->_opnds) +
527 pointer_delta((const void*)from,
528 (const void*)(&mthis->_opnds), 1));
529 mach->_opnds = to;
530 for ( uint i = 0; i < nopnds; ++i ) {
531 to[i] = from[i]->clone(C);
532 }
533 }
534 // cloning CallNode may need to clone JVMState
535 if (n->is_Call()) {
536 n->as_Call()->clone_jvms(C);
537 }
538 return n; // Return the clone
539 }
540
541 //---------------------------setup_is_top--------------------------------------
542 // Call this when changing the top node, to reassert the invariants
543 // required by Node::is_top. See Compile::set_cached_top_node.
544 void Node::setup_is_top() {
545 if (this == (Node*)Compile::current()->top()) {
546 // This node has just become top. Kill its out array.
547 _outcnt = _outmax = 0;
548 _out = NULL; // marker value for top
549 assert(is_top(), "must be top");
550 } else {
551 if (_out == NULL) _out = NO_OUT_ARRAY;
552 assert(!is_top(), "must not be top");
553 }
554 }
555
556
557 //------------------------------~Node------------------------------------------
|
518 // MachNode clone
519 uint nopnds;
520 if (this->is_Mach() && (nopnds = this->as_Mach()->num_opnds()) > 0) {
521 MachNode *mach = n->as_Mach();
522 MachNode *mthis = this->as_Mach();
523 // Get address of _opnd_array.
524 // It should be the same offset since it is the clone of this node.
525 MachOper **from = mthis->_opnds;
526 MachOper **to = (MachOper **)((size_t)(&mach->_opnds) +
527 pointer_delta((const void*)from,
528 (const void*)(&mthis->_opnds), 1));
529 mach->_opnds = to;
530 for ( uint i = 0; i < nopnds; ++i ) {
531 to[i] = from[i]->clone(C);
532 }
533 }
534 // cloning CallNode may need to clone JVMState
535 if (n->is_Call()) {
536 n->as_Call()->clone_jvms(C);
537 }
538 if (n->is_SafePoint()) {
539 n->as_SafePoint()->clone_replaced_nodes();
540 }
541 return n; // Return the clone
542 }
543
544 //---------------------------setup_is_top--------------------------------------
545 // Call this when changing the top node, to reassert the invariants
546 // required by Node::is_top. See Compile::set_cached_top_node.
547 void Node::setup_is_top() {
548 if (this == (Node*)Compile::current()->top()) {
549 // This node has just become top. Kill its out array.
550 _outcnt = _outmax = 0;
551 _out = NULL; // marker value for top
552 assert(is_top(), "must be top");
553 } else {
554 if (_out == NULL) _out = NO_OUT_ARRAY;
555 assert(!is_top(), "must not be top");
556 }
557 }
558
559
560 //------------------------------~Node------------------------------------------
|