529 MachNode *mach = n->as_Mach(); 530 MachNode *mthis = this->as_Mach(); 531 // Get address of _opnd_array. 532 // It should be the same offset since it is the clone of this node. 533 MachOper **from = mthis->_opnds; 534 MachOper **to = (MachOper **)((size_t)(&mach->_opnds) + 535 pointer_delta((const void*)from, 536 (const void*)(&mthis->_opnds), 1)); 537 mach->_opnds = to; 538 for ( uint i = 0; i < nopnds; ++i ) { 539 to[i] = from[i]->clone(); 540 } 541 } 542 // cloning CallNode may need to clone JVMState 543 if (n->is_Call()) { 544 n->as_Call()->clone_jvms(C); 545 } 546 if (n->is_SafePoint()) { 547 n->as_SafePoint()->clone_replaced_nodes(); 548 } 549 return n; // Return the clone 550 } 551 552 //---------------------------setup_is_top-------------------------------------- 553 // Call this when changing the top node, to reassert the invariants 554 // required by Node::is_top. See Compile::set_cached_top_node. 555 void Node::setup_is_top() { 556 if (this == (Node*)Compile::current()->top()) { 557 // This node has just become top. Kill its out array. 558 _outcnt = _outmax = 0; 559 _out = NULL; // marker value for top 560 assert(is_top(), "must be top"); 561 } else { 562 if (_out == NULL) _out = NO_OUT_ARRAY; 563 assert(!is_top(), "must not be top"); 564 } 565 } 566 567 568 //------------------------------~Node------------------------------------------ 607 compile->node_arena()->Afree(_in,edge_size); 608 609 // Free just the object 610 #ifndef ASSERT 611 compile->node_arena()->Afree(this,node_size); 612 #endif 613 } 614 if (is_macro()) { 615 compile->remove_macro_node(this); 616 } 617 if (is_expensive()) { 618 compile->remove_expensive_node(this); 619 } 620 CastIINode* cast = isa_CastII(); 621 if (cast != NULL && cast->has_range_check()) { 622 compile->remove_range_check_cast(cast); 623 } 624 if (Opcode() == Op_Opaque4) { 625 compile->remove_opaque4_node(this); 626 } 627 628 if (is_SafePoint()) { 629 as_SafePoint()->delete_replaced_nodes(); 630 } 631 BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2(); 632 bs->unregister_potential_barrier_node(this); 633 #ifdef ASSERT 634 // We will not actually delete the storage, but we'll make the node unusable. 635 *(address*)this = badAddress; // smash the C++ vtbl, probably 636 _in = _out = (Node**) badAddress; 637 _max = _cnt = _outmax = _outcnt = 0; 638 compile->remove_modified_node(this); 639 #endif 640 } 641 642 //------------------------------grow------------------------------------------- 643 // Grow the input array, making space for more edges 644 void Node::grow( uint len ) { 645 Arena* arena = Compile::current()->node_arena(); 646 uint new_max = _max; 1355 k = dead->last_outs(kmin); 1356 } 1357 } else { // (dead->outcnt() == 0) 1358 // Done with outputs. 1359 igvn->hash_delete(dead); 1360 igvn->_worklist.remove(dead); 1361 igvn->C->remove_modified_node(dead); 1362 igvn->set_type(dead, Type::TOP); 1363 if (dead->is_macro()) { 1364 igvn->C->remove_macro_node(dead); 1365 } 1366 if (dead->is_expensive()) { 1367 igvn->C->remove_expensive_node(dead); 1368 } 1369 CastIINode* cast = dead->isa_CastII(); 1370 if (cast != NULL && cast->has_range_check()) { 1371 igvn->C->remove_range_check_cast(cast); 1372 } 1373 if (dead->Opcode() == Op_Opaque4) { 1374 igvn->C->remove_opaque4_node(dead); 1375 } 1376 BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2(); 1377 bs->unregister_potential_barrier_node(dead); 1378 igvn->C->record_dead_node(dead->_idx); 1379 // Kill all inputs to the dead guy 1380 for (uint i=0; i < dead->req(); i++) { 1381 Node *n = dead->in(i); // Get input to dead guy 1382 if (n != NULL && !n->is_top()) { // Input is valid? 1383 dead->set_req(i, top); // Smash input away 1384 if (n->outcnt() == 0) { // Input also goes dead? 1385 if (!n->is_Con()) 1386 nstack.push(n); // Clear it out as well 1387 } else if (n->outcnt() == 1 && 1388 n->has_special_unique_user()) { 1389 igvn->add_users_to_worklist( n ); 1390 } else if (n->outcnt() <= 2 && n->is_Store()) { 1391 // Push store's uses on worklist to enable folding optimization for 1392 // store/store and store/load to the same address. 1393 // The restriction (outcnt() <= 2) is the same as in set_req_X() 1394 // and remove_globally_dead_node(). | 529 MachNode *mach = n->as_Mach(); 530 MachNode *mthis = this->as_Mach(); 531 // Get address of _opnd_array. 532 // It should be the same offset since it is the clone of this node. 533 MachOper **from = mthis->_opnds; 534 MachOper **to = (MachOper **)((size_t)(&mach->_opnds) + 535 pointer_delta((const void*)from, 536 (const void*)(&mthis->_opnds), 1)); 537 mach->_opnds = to; 538 for ( uint i = 0; i < nopnds; ++i ) { 539 to[i] = from[i]->clone(); 540 } 541 } 542 // cloning CallNode may need to clone JVMState 543 if (n->is_Call()) { 544 n->as_Call()->clone_jvms(C); 545 } 546 if (n->is_SafePoint()) { 547 n->as_SafePoint()->clone_replaced_nodes(); 548 } 549 if (n->is_ValueTypeBase()) { 550 C->add_value_type(n); 551 } 552 return n; // Return the clone 553 } 554 555 //---------------------------setup_is_top-------------------------------------- 556 // Call this when changing the top node, to reassert the invariants 557 // required by Node::is_top. See Compile::set_cached_top_node. 558 void Node::setup_is_top() { 559 if (this == (Node*)Compile::current()->top()) { 560 // This node has just become top. Kill its out array. 561 _outcnt = _outmax = 0; 562 _out = NULL; // marker value for top 563 assert(is_top(), "must be top"); 564 } else { 565 if (_out == NULL) _out = NO_OUT_ARRAY; 566 assert(!is_top(), "must not be top"); 567 } 568 } 569 570 571 //------------------------------~Node------------------------------------------ 610 compile->node_arena()->Afree(_in,edge_size); 611 612 // Free just the object 613 #ifndef ASSERT 614 compile->node_arena()->Afree(this,node_size); 615 #endif 616 } 617 if (is_macro()) { 618 compile->remove_macro_node(this); 619 } 620 if (is_expensive()) { 621 compile->remove_expensive_node(this); 622 } 623 CastIINode* cast = isa_CastII(); 624 if (cast != NULL && cast->has_range_check()) { 625 compile->remove_range_check_cast(cast); 626 } 627 if (Opcode() == Op_Opaque4) { 628 compile->remove_opaque4_node(this); 629 } 630 if (is_ValueTypeBase()) { 631 compile->remove_value_type(this); 632 } 633 634 if (is_SafePoint()) { 635 as_SafePoint()->delete_replaced_nodes(); 636 } 637 BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2(); 638 bs->unregister_potential_barrier_node(this); 639 #ifdef ASSERT 640 // We will not actually delete the storage, but we'll make the node unusable. 641 *(address*)this = badAddress; // smash the C++ vtbl, probably 642 _in = _out = (Node**) badAddress; 643 _max = _cnt = _outmax = _outcnt = 0; 644 compile->remove_modified_node(this); 645 #endif 646 } 647 648 //------------------------------grow------------------------------------------- 649 // Grow the input array, making space for more edges 650 void Node::grow( uint len ) { 651 Arena* arena = Compile::current()->node_arena(); 652 uint new_max = _max; 1361 k = dead->last_outs(kmin); 1362 } 1363 } else { // (dead->outcnt() == 0) 1364 // Done with outputs. 1365 igvn->hash_delete(dead); 1366 igvn->_worklist.remove(dead); 1367 igvn->C->remove_modified_node(dead); 1368 igvn->set_type(dead, Type::TOP); 1369 if (dead->is_macro()) { 1370 igvn->C->remove_macro_node(dead); 1371 } 1372 if (dead->is_expensive()) { 1373 igvn->C->remove_expensive_node(dead); 1374 } 1375 CastIINode* cast = dead->isa_CastII(); 1376 if (cast != NULL && cast->has_range_check()) { 1377 igvn->C->remove_range_check_cast(cast); 1378 } 1379 if (dead->Opcode() == Op_Opaque4) { 1380 igvn->C->remove_opaque4_node(dead); 1381 } 1382 if (dead->is_ValueTypeBase()) { 1383 igvn->C->remove_value_type(dead); 1384 } 1385 BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2(); 1386 bs->unregister_potential_barrier_node(dead); 1387 igvn->C->record_dead_node(dead->_idx); 1388 // Kill all inputs to the dead guy 1389 for (uint i=0; i < dead->req(); i++) { 1390 Node *n = dead->in(i); // Get input to dead guy 1391 if (n != NULL && !n->is_top()) { // Input is valid? 1392 dead->set_req(i, top); // Smash input away 1393 if (n->outcnt() == 0) { // Input also goes dead? 1394 if (!n->is_Con()) 1395 nstack.push(n); // Clear it out as well 1396 } else if (n->outcnt() == 1 && 1397 n->has_special_unique_user()) { 1398 igvn->add_users_to_worklist( n ); 1399 } else if (n->outcnt() <= 2 && n->is_Store()) { 1400 // Push store's uses on worklist to enable folding optimization for 1401 // store/store and store/load to the same address. 1402 // The restriction (outcnt() <= 2) is the same as in set_req_X() 1403 // and remove_globally_dead_node(). |