< prev index next >

src/hotspot/share/opto/node.cpp

Print this page
rev 54995 : 8224675: Late GC barrier insertion for ZGC
Reviewed-by:


 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------------------------------------------
 569 // Fancy destructor; eagerly attempt to reclaim Node numberings and storage
 570 void Node::destruct() {
 571   // Eagerly reclaim unique Node numberings
 572   Compile* compile = Compile::current();
 573   if ((uint)_idx+1 == compile->unique()) {
 574     compile->set_unique(compile->unique()-1);
 575   }
 576   // Clear debug info:
 577   Node_Notes* nn = compile->node_notes_at(_idx);
 578   if (nn != NULL)  nn->clear();
 579   // Walk the input array, freeing the corresponding output edges
 580   _cnt = _max;  // forget req/prec distinction
 581   uint i;
 582   for( i = 0; i < _max; i++ ) {
 583     set_req(i, NULL);
 584     //assert(def->out(def->outcnt()-1) == (Node *)this,"bad def-use hacking in reclaim");
 585   }
 586   assert(outcnt() == 0, "deleting a node must not leave a dangling use");
 587   // See if the input array was allocated just prior to the object


1437 }
1438 
1439 //------------------------------cmp--------------------------------------------
1440 // Compare special parts of simple Nodes
1441 bool Node::cmp( const Node &n ) const {
1442   return true;                  // Must be same
1443 }
1444 
1445 //------------------------------rematerialize-----------------------------------
1446 // Should we clone rather than spill this instruction?
1447 bool Node::rematerialize() const {
1448   if ( is_Mach() )
1449     return this->as_Mach()->rematerialize();
1450   else
1451     return (_flags & Flag_rematerialize) != 0;
1452 }
1453 
1454 //------------------------------needs_anti_dependence_check---------------------
1455 // Nodes which use memory without consuming it, hence need antidependences.
1456 bool Node::needs_anti_dependence_check() const {
1457   if( req() < 2 || (_flags & Flag_needs_anti_dependence_check) == 0 )
1458     return false;
1459   else




1460     return in(1)->bottom_type()->has_memory();
1461 }
1462 
1463 
1464 // Get an integer constant from a ConNode (or CastIINode).
1465 // Return a default value if there is no apparent constant here.
1466 const TypeInt* Node::find_int_type() const {
1467   if (this->is_Type()) {
1468     return this->as_Type()->type()->isa_int();
1469   } else if (this->is_Con()) {
1470     assert(is_Mach(), "should be ConNode(TypeNode) or else a MachNode");
1471     return this->bottom_type()->isa_int();
1472   }
1473   return NULL;
1474 }
1475 
1476 // Get a pointer constant from a ConstNode.
1477 // Returns the constant if it is a pointer ConstNode
1478 intptr_t Node::get_ptr() const {
1479   assert( Opcode() == Op_ConP, "" );
1480   return ((ConPNode*)this)->type()->is_ptr()->get_con();
1481 }
1482 




 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_Load()) {
 550     n->as_Load()->copy_barrier_info(this);
 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 //------------------------------~Node------------------------------------------
 571 // Fancy destructor; eagerly attempt to reclaim Node numberings and storage
 572 void Node::destruct() {
 573   // Eagerly reclaim unique Node numberings
 574   Compile* compile = Compile::current();
 575   if ((uint)_idx+1 == compile->unique()) {
 576     compile->set_unique(compile->unique()-1);
 577   }
 578   // Clear debug info:
 579   Node_Notes* nn = compile->node_notes_at(_idx);
 580   if (nn != NULL)  nn->clear();
 581   // Walk the input array, freeing the corresponding output edges
 582   _cnt = _max;  // forget req/prec distinction
 583   uint i;
 584   for( i = 0; i < _max; i++ ) {
 585     set_req(i, NULL);
 586     //assert(def->out(def->outcnt()-1) == (Node *)this,"bad def-use hacking in reclaim");
 587   }
 588   assert(outcnt() == 0, "deleting a node must not leave a dangling use");
 589   // See if the input array was allocated just prior to the object


1439 }
1440 
1441 //------------------------------cmp--------------------------------------------
1442 // Compare special parts of simple Nodes
1443 bool Node::cmp( const Node &n ) const {
1444   return true;                  // Must be same
1445 }
1446 
1447 //------------------------------rematerialize-----------------------------------
1448 // Should we clone rather than spill this instruction?
1449 bool Node::rematerialize() const {
1450   if ( is_Mach() )
1451     return this->as_Mach()->rematerialize();
1452   else
1453     return (_flags & Flag_rematerialize) != 0;
1454 }
1455 
1456 //------------------------------needs_anti_dependence_check---------------------
1457 // Nodes which use memory without consuming it, hence need antidependences.
1458 bool Node::needs_anti_dependence_check() const {
1459   if (req() < 2 || (_flags & Flag_needs_anti_dependence_check) == 0) {
1460     return false;
1461   }
1462   BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2();
1463   if (!bs->needs_anti_dependence_check(this)) {
1464     return false;
1465   }
1466   return in(1)->bottom_type()->has_memory();
1467 }

1468 
1469 // Get an integer constant from a ConNode (or CastIINode).
1470 // Return a default value if there is no apparent constant here.
1471 const TypeInt* Node::find_int_type() const {
1472   if (this->is_Type()) {
1473     return this->as_Type()->type()->isa_int();
1474   } else if (this->is_Con()) {
1475     assert(is_Mach(), "should be ConNode(TypeNode) or else a MachNode");
1476     return this->bottom_type()->isa_int();
1477   }
1478   return NULL;
1479 }
1480 
1481 // Get a pointer constant from a ConstNode.
1482 // Returns the constant if it is a pointer ConstNode
1483 intptr_t Node::get_ptr() const {
1484   assert( Opcode() == Op_ConP, "" );
1485   return ((ConPNode*)this)->type()->is_ptr()->get_con();
1486 }
1487 


< prev index next >