< prev index next >

src/hotspot/share/opto/node.cpp

Print this page

  16  * You should have received a copy of the GNU General Public License version
  17  * 2 along with this work; if not, write to the Free Software Foundation,
  18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19  *
  20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21  * or visit www.oracle.com if you need additional information or have any
  22  * questions.
  23  *
  24  */
  25 
  26 #include "gc/shared/barrierSet.hpp"
  27 #include "gc/shared/c2/barrierSetC2.hpp"
  28 #include "libadt/vectset.hpp"
  29 #include "memory/allocation.inline.hpp"
  30 #include "memory/resourceArea.hpp"
  31 #include "opto/ad.hpp"
  32 #include "opto/callGenerator.hpp"
  33 #include "opto/castnode.hpp"
  34 #include "opto/cfgnode.hpp"
  35 #include "opto/connode.hpp"

  36 #include "opto/loopnode.hpp"
  37 #include "opto/machnode.hpp"
  38 #include "opto/matcher.hpp"
  39 #include "opto/node.hpp"
  40 #include "opto/opcodes.hpp"
  41 #include "opto/regmask.hpp"
  42 #include "opto/rootnode.hpp"
  43 #include "opto/type.hpp"
  44 #include "utilities/copy.hpp"
  45 #include "utilities/macros.hpp"
  46 #include "utilities/powerOfTwo.hpp"
  47 #include "utilities/stringUtils.hpp"
  48 
  49 class RegMask;
  50 // #include "phase.hpp"
  51 class PhaseTransform;
  52 class PhaseGVN;
  53 
  54 // Arena we are currently building Nodes in
  55 const uint Node::NotAMachineReg = 0xffff0000;

 554     // externally allocated memory. Make sure to use a proper constructor
 555     // instead of just shallowly copying.
 556     MachProjNode* mach = n->as_MachProj();
 557     MachProjNode* mthis = this->as_MachProj();
 558     new (&mach->_rout) RegMask(mthis->_rout);
 559   }
 560   if (n->is_Call()) {
 561     // CallGenerator is linked to the original node.
 562     CallGenerator* cg = n->as_Call()->generator();
 563     if (cg != nullptr) {
 564       CallGenerator* cloned_cg = cg->with_call_node(n->as_Call());
 565       n->as_Call()->set_generator(cloned_cg);
 566     }
 567   }
 568   if (n->is_SafePoint()) {
 569     // Scalar replacement and macro expansion might modify the JVMState.
 570     // Clone it to make sure it's not shared between SafePointNodes.
 571     n->as_SafePoint()->clone_jvms(C);
 572     n->as_SafePoint()->clone_replaced_nodes();
 573   }






 574   Compile::current()->record_modified_node(n);
 575   return n;                     // Return the clone
 576 }
 577 
 578 //---------------------------setup_is_top--------------------------------------
 579 // Call this when changing the top node, to reassert the invariants
 580 // required by Node::is_top.  See Compile::set_cached_top_node.
 581 void Node::setup_is_top() {
 582   if (this == (Node*)Compile::current()->top()) {
 583     // This node has just become top.  Kill its out array.
 584     _outcnt = _outmax = 0;
 585     _out = nullptr;                           // marker value for top
 586     assert(is_top(), "must be top");
 587   } else {
 588     if (_out == nullptr)  _out = NO_OUT_ARRAY;
 589     assert(!is_top(), "must not be top");
 590   }
 591 }
 592 
 593 //------------------------------~Node------------------------------------------

 614     set_req(i, nullptr);
 615     //assert(def->out(def->outcnt()-1) == (Node *)this,"bad def-use hacking in reclaim");
 616   }
 617   assert(outcnt() == 0, "deleting a node must not leave a dangling use");
 618 
 619   if (is_macro()) {
 620     compile->remove_macro_node(this);
 621   }
 622   if (is_expensive()) {
 623     compile->remove_expensive_node(this);
 624   }
 625   if (is_OpaqueTemplateAssertionPredicate()) {
 626     compile->remove_template_assertion_predicate_opaque(as_OpaqueTemplateAssertionPredicate());
 627   }
 628   if (is_ParsePredicate()) {
 629     compile->remove_parse_predicate(as_ParsePredicate());
 630   }
 631   if (for_post_loop_opts_igvn()) {
 632     compile->remove_from_post_loop_opts_igvn(this);
 633   }



 634   if (for_merge_stores_igvn()) {
 635     compile->remove_from_merge_stores_igvn(this);
 636   }
 637 
 638   if (is_SafePoint()) {
 639     as_SafePoint()->delete_replaced_nodes();
 640 
 641     if (is_CallStaticJava()) {
 642       compile->remove_unstable_if_trap(as_CallStaticJava(), false);
 643     }
 644   }
 645   BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2();
 646   bs->unregister_potential_barrier_node(this);
 647 
 648   // See if the input array was allocated just prior to the object
 649   int edge_size = _max*sizeof(void*);
 650   int out_edge_size = _outmax*sizeof(void*);
 651   char *in_array = ((char*)_in);
 652   char *edge_end = in_array + edge_size;
 653   char *out_array = (char*)(_out == NO_OUT_ARRAY? nullptr: _out);

  16  * You should have received a copy of the GNU General Public License version
  17  * 2 along with this work; if not, write to the Free Software Foundation,
  18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19  *
  20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21  * or visit www.oracle.com if you need additional information or have any
  22  * questions.
  23  *
  24  */
  25 
  26 #include "gc/shared/barrierSet.hpp"
  27 #include "gc/shared/c2/barrierSetC2.hpp"
  28 #include "libadt/vectset.hpp"
  29 #include "memory/allocation.inline.hpp"
  30 #include "memory/resourceArea.hpp"
  31 #include "opto/ad.hpp"
  32 #include "opto/callGenerator.hpp"
  33 #include "opto/castnode.hpp"
  34 #include "opto/cfgnode.hpp"
  35 #include "opto/connode.hpp"
  36 #include "opto/inlinetypenode.hpp"
  37 #include "opto/loopnode.hpp"
  38 #include "opto/machnode.hpp"
  39 #include "opto/matcher.hpp"
  40 #include "opto/node.hpp"
  41 #include "opto/opcodes.hpp"
  42 #include "opto/regmask.hpp"
  43 #include "opto/rootnode.hpp"
  44 #include "opto/type.hpp"
  45 #include "utilities/copy.hpp"
  46 #include "utilities/macros.hpp"
  47 #include "utilities/powerOfTwo.hpp"
  48 #include "utilities/stringUtils.hpp"
  49 
  50 class RegMask;
  51 // #include "phase.hpp"
  52 class PhaseTransform;
  53 class PhaseGVN;
  54 
  55 // Arena we are currently building Nodes in
  56 const uint Node::NotAMachineReg = 0xffff0000;

 555     // externally allocated memory. Make sure to use a proper constructor
 556     // instead of just shallowly copying.
 557     MachProjNode* mach = n->as_MachProj();
 558     MachProjNode* mthis = this->as_MachProj();
 559     new (&mach->_rout) RegMask(mthis->_rout);
 560   }
 561   if (n->is_Call()) {
 562     // CallGenerator is linked to the original node.
 563     CallGenerator* cg = n->as_Call()->generator();
 564     if (cg != nullptr) {
 565       CallGenerator* cloned_cg = cg->with_call_node(n->as_Call());
 566       n->as_Call()->set_generator(cloned_cg);
 567     }
 568   }
 569   if (n->is_SafePoint()) {
 570     // Scalar replacement and macro expansion might modify the JVMState.
 571     // Clone it to make sure it's not shared between SafePointNodes.
 572     n->as_SafePoint()->clone_jvms(C);
 573     n->as_SafePoint()->clone_replaced_nodes();
 574   }
 575   if (n->is_InlineType()) {
 576     C->add_inline_type(n);
 577   }
 578   if (n->is_LoadFlat() || n->is_StoreFlat()) {
 579     C->add_flat_access(n);
 580   }
 581   Compile::current()->record_modified_node(n);
 582   return n;                     // Return the clone
 583 }
 584 
 585 //---------------------------setup_is_top--------------------------------------
 586 // Call this when changing the top node, to reassert the invariants
 587 // required by Node::is_top.  See Compile::set_cached_top_node.
 588 void Node::setup_is_top() {
 589   if (this == (Node*)Compile::current()->top()) {
 590     // This node has just become top.  Kill its out array.
 591     _outcnt = _outmax = 0;
 592     _out = nullptr;                           // marker value for top
 593     assert(is_top(), "must be top");
 594   } else {
 595     if (_out == nullptr)  _out = NO_OUT_ARRAY;
 596     assert(!is_top(), "must not be top");
 597   }
 598 }
 599 
 600 //------------------------------~Node------------------------------------------

 621     set_req(i, nullptr);
 622     //assert(def->out(def->outcnt()-1) == (Node *)this,"bad def-use hacking in reclaim");
 623   }
 624   assert(outcnt() == 0, "deleting a node must not leave a dangling use");
 625 
 626   if (is_macro()) {
 627     compile->remove_macro_node(this);
 628   }
 629   if (is_expensive()) {
 630     compile->remove_expensive_node(this);
 631   }
 632   if (is_OpaqueTemplateAssertionPredicate()) {
 633     compile->remove_template_assertion_predicate_opaque(as_OpaqueTemplateAssertionPredicate());
 634   }
 635   if (is_ParsePredicate()) {
 636     compile->remove_parse_predicate(as_ParsePredicate());
 637   }
 638   if (for_post_loop_opts_igvn()) {
 639     compile->remove_from_post_loop_opts_igvn(this);
 640   }
 641   if (is_InlineType()) {
 642     compile->remove_inline_type(this);
 643   }
 644   if (for_merge_stores_igvn()) {
 645     compile->remove_from_merge_stores_igvn(this);
 646   }
 647 
 648   if (is_SafePoint()) {
 649     as_SafePoint()->delete_replaced_nodes();
 650 
 651     if (is_CallStaticJava()) {
 652       compile->remove_unstable_if_trap(as_CallStaticJava(), false);
 653     }
 654   }
 655   BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2();
 656   bs->unregister_potential_barrier_node(this);
 657 
 658   // See if the input array was allocated just prior to the object
 659   int edge_size = _max*sizeof(void*);
 660   int out_edge_size = _outmax*sizeof(void*);
 661   char *in_array = ((char*)_in);
 662   char *edge_end = in_array + edge_size;
 663   char *out_array = (char*)(_out == NO_OUT_ARRAY? nullptr: _out);
< prev index next >