< 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;

 546                                   (const void*)(&mthis->_opnds), 1));
 547     mach->_opnds = to;
 548     for ( uint i = 0; i < nopnds; ++i ) {
 549       to[i] = from[i]->clone();
 550     }
 551   }
 552   if (n->is_Call()) {
 553     // CallGenerator is linked to the original node.
 554     CallGenerator* cg = n->as_Call()->generator();
 555     if (cg != nullptr) {
 556       CallGenerator* cloned_cg = cg->with_call_node(n->as_Call());
 557       n->as_Call()->set_generator(cloned_cg);
 558     }
 559   }
 560   if (n->is_SafePoint()) {
 561     // Scalar replacement and macro expansion might modify the JVMState.
 562     // Clone it to make sure it's not shared between SafePointNodes.
 563     n->as_SafePoint()->clone_jvms(C);
 564     n->as_SafePoint()->clone_replaced_nodes();
 565   }



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

 606     set_req(i, nullptr);
 607     //assert(def->out(def->outcnt()-1) == (Node *)this,"bad def-use hacking in reclaim");
 608   }
 609   assert(outcnt() == 0, "deleting a node must not leave a dangling use");
 610 
 611   if (is_macro()) {
 612     compile->remove_macro_node(this);
 613   }
 614   if (is_expensive()) {
 615     compile->remove_expensive_node(this);
 616   }
 617   if (is_OpaqueTemplateAssertionPredicate()) {
 618     compile->remove_template_assertion_predicate_opaque(as_OpaqueTemplateAssertionPredicate());
 619   }
 620   if (is_ParsePredicate()) {
 621     compile->remove_parse_predicate(as_ParsePredicate());
 622   }
 623   if (for_post_loop_opts_igvn()) {
 624     compile->remove_from_post_loop_opts_igvn(this);
 625   }



 626   if (for_merge_stores_igvn()) {
 627     compile->remove_from_merge_stores_igvn(this);
 628   }
 629 
 630   if (is_SafePoint()) {
 631     as_SafePoint()->delete_replaced_nodes();
 632 
 633     if (is_CallStaticJava()) {
 634       compile->remove_unstable_if_trap(as_CallStaticJava(), false);
 635     }
 636   }
 637   BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2();
 638   bs->unregister_potential_barrier_node(this);
 639 
 640   // See if the input array was allocated just prior to the object
 641   int edge_size = _max*sizeof(void*);
 642   int out_edge_size = _outmax*sizeof(void*);
 643   char *in_array = ((char*)_in);
 644   char *edge_end = in_array + edge_size;
 645   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;

 547                                   (const void*)(&mthis->_opnds), 1));
 548     mach->_opnds = to;
 549     for ( uint i = 0; i < nopnds; ++i ) {
 550       to[i] = from[i]->clone();
 551     }
 552   }
 553   if (n->is_Call()) {
 554     // CallGenerator is linked to the original node.
 555     CallGenerator* cg = n->as_Call()->generator();
 556     if (cg != nullptr) {
 557       CallGenerator* cloned_cg = cg->with_call_node(n->as_Call());
 558       n->as_Call()->set_generator(cloned_cg);
 559     }
 560   }
 561   if (n->is_SafePoint()) {
 562     // Scalar replacement and macro expansion might modify the JVMState.
 563     // Clone it to make sure it's not shared between SafePointNodes.
 564     n->as_SafePoint()->clone_jvms(C);
 565     n->as_SafePoint()->clone_replaced_nodes();
 566   }
 567   if (n->is_InlineType()) {
 568     C->add_inline_type(n);
 569   }
 570   Compile::current()->record_modified_node(n);
 571   return n;                     // Return the clone
 572 }
 573 
 574 //---------------------------setup_is_top--------------------------------------
 575 // Call this when changing the top node, to reassert the invariants
 576 // required by Node::is_top.  See Compile::set_cached_top_node.
 577 void Node::setup_is_top() {
 578   if (this == (Node*)Compile::current()->top()) {
 579     // This node has just become top.  Kill its out array.
 580     _outcnt = _outmax = 0;
 581     _out = nullptr;                           // marker value for top
 582     assert(is_top(), "must be top");
 583   } else {
 584     if (_out == nullptr)  _out = NO_OUT_ARRAY;
 585     assert(!is_top(), "must not be top");
 586   }
 587 }
 588 
 589 //------------------------------~Node------------------------------------------

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