< prev index next >

src/hotspot/share/opto/lcm.cpp

Print this page
rev 50904 : Move Shenandoah stubs generation into ShenandoahBarrierSetAssembler


  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "asm/macroAssembler.inline.hpp"
  27 #include "memory/allocation.inline.hpp"
  28 #include "opto/ad.hpp"
  29 #include "opto/block.hpp"
  30 #include "opto/c2compiler.hpp"
  31 #include "opto/callnode.hpp"
  32 #include "opto/cfgnode.hpp"
  33 #include "opto/machnode.hpp"
  34 #include "opto/runtime.hpp"
  35 #include "opto/chaitin.hpp"
  36 #include "runtime/sharedRuntime.hpp"



  37 
  38 // Optimization - Graph Style
  39 
  40 // Check whether val is not-null-decoded compressed oop,
  41 // i.e. will grab into the base of the heap if it represents NULL.
  42 static bool accesses_heap_base_zone(Node *val) {
  43   if (Universe::narrow_oop_base() != NULL) { // Implies UseCompressedOops.
  44     if (val && val->is_Mach()) {
  45       if (val->as_Mach()->ideal_Opcode() == Op_DecodeN) {
  46         // This assumes all Decodes with TypePtr::NotNull are matched to nodes that
  47         // decode NULL to point to the heap base (Decode_NN).
  48         if (val->bottom_type()->is_oopptr()->ptr() == TypePtr::NotNull) {
  49           return true;
  50         }
  51       }
  52       // Must recognize load operation with Decode matched in memory operand.
  53       // We should not reach here exept for PPC/AIX, as os::zero_page_read_protected()
  54       // returns true everywhere else. On PPC, no such memory operands
  55       // exist, therefore we did not yet implement a check for such operands.
  56       NOT_AIX(Unimplemented());


 876   // When using CallRuntime mark SOE registers as killed by the call
 877   // so values that could show up in the RegisterMap aren't live in a
 878   // callee saved register since the register wouldn't know where to
 879   // find them.  CallLeaf and CallLeafNoFP are ok because they can't
 880   // have debug info on them.  Strictly speaking this only needs to be
 881   // done for oops since idealreg2debugmask takes care of debug info
 882   // references but there no way to handle oops differently than other
 883   // pointers as far as the kill mask goes.
 884   bool exclude_soe = op == Op_CallRuntime;
 885 
 886   // If the call is a MethodHandle invoke, we need to exclude the
 887   // register which is used to save the SP value over MH invokes from
 888   // the mask.  Otherwise this register could be used for
 889   // deoptimization information.
 890   if (op == Op_CallStaticJava) {
 891     MachCallStaticJavaNode* mcallstaticjava = (MachCallStaticJavaNode*) mcall;
 892     if (mcallstaticjava->_method_handle_invoke)
 893       proj->_rout.OR(Matcher::method_handle_invoke_SP_save_mask());
 894   }
 895 
 896   if (UseShenandoahGC && mcall->entry_point() == StubRoutines::shenandoah_wb_C()) {

 897     assert(op == Op_CallLeafNoFP, "shenandoah_wb_C should be called with Op_CallLeafNoFP");
 898     add_call_kills(proj, regs, save_policy, exclude_soe, true);
 899   } else {

 900     add_call_kills(proj, regs, save_policy, exclude_soe, false);
 901   }
 902 
 903   return node_cnt;
 904 }
 905 
 906 void PhaseCFG::push_ready_nodes(Node* n, Node* m, Block* block, GrowableArray<int>& ready_cnt, Node_List& worklist, uint max_idx, int c) {
 907   if (get_block_for_node(m) != block) {
 908     return;
 909   }
 910   if (m->is_Phi()) {
 911     return;
 912   }
 913   if (m->_idx >= max_idx) { // new node, skip it
 914     assert(m->is_MachProj() && n->is_Mach() && n->as_Mach()->has_call(), "unexpected node types");
 915     return;
 916   }
 917   int m_cnt = ready_cnt.at(m->_idx) - c;
 918   ready_cnt.at_put(m->_idx, m_cnt);
 919   if (m_cnt == 0) {
 920     worklist.push(m);
 921   }




  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "asm/macroAssembler.inline.hpp"
  27 #include "memory/allocation.inline.hpp"
  28 #include "opto/ad.hpp"
  29 #include "opto/block.hpp"
  30 #include "opto/c2compiler.hpp"
  31 #include "opto/callnode.hpp"
  32 #include "opto/cfgnode.hpp"
  33 #include "opto/machnode.hpp"
  34 #include "opto/runtime.hpp"
  35 #include "opto/chaitin.hpp"
  36 #include "runtime/sharedRuntime.hpp"
  37 #if INCLUDE_SHENANDOAHGC
  38 #include "gc/shenandoah/shenandoahBarrierSetAssembler.hpp"
  39 #endif
  40 
  41 // Optimization - Graph Style
  42 
  43 // Check whether val is not-null-decoded compressed oop,
  44 // i.e. will grab into the base of the heap if it represents NULL.
  45 static bool accesses_heap_base_zone(Node *val) {
  46   if (Universe::narrow_oop_base() != NULL) { // Implies UseCompressedOops.
  47     if (val && val->is_Mach()) {
  48       if (val->as_Mach()->ideal_Opcode() == Op_DecodeN) {
  49         // This assumes all Decodes with TypePtr::NotNull are matched to nodes that
  50         // decode NULL to point to the heap base (Decode_NN).
  51         if (val->bottom_type()->is_oopptr()->ptr() == TypePtr::NotNull) {
  52           return true;
  53         }
  54       }
  55       // Must recognize load operation with Decode matched in memory operand.
  56       // We should not reach here exept for PPC/AIX, as os::zero_page_read_protected()
  57       // returns true everywhere else. On PPC, no such memory operands
  58       // exist, therefore we did not yet implement a check for such operands.
  59       NOT_AIX(Unimplemented());


 879   // When using CallRuntime mark SOE registers as killed by the call
 880   // so values that could show up in the RegisterMap aren't live in a
 881   // callee saved register since the register wouldn't know where to
 882   // find them.  CallLeaf and CallLeafNoFP are ok because they can't
 883   // have debug info on them.  Strictly speaking this only needs to be
 884   // done for oops since idealreg2debugmask takes care of debug info
 885   // references but there no way to handle oops differently than other
 886   // pointers as far as the kill mask goes.
 887   bool exclude_soe = op == Op_CallRuntime;
 888 
 889   // If the call is a MethodHandle invoke, we need to exclude the
 890   // register which is used to save the SP value over MH invokes from
 891   // the mask.  Otherwise this register could be used for
 892   // deoptimization information.
 893   if (op == Op_CallStaticJava) {
 894     MachCallStaticJavaNode* mcallstaticjava = (MachCallStaticJavaNode*) mcall;
 895     if (mcallstaticjava->_method_handle_invoke)
 896       proj->_rout.OR(Matcher::method_handle_invoke_SP_save_mask());
 897   }
 898 
 899 #if INCLUDE_SHENANDOAHGC
 900   if (UseShenandoahGC && mcall->entry_point() == ShenandoahBarrierSetAssembler::shenandoah_wb_C()) {
 901     assert(op == Op_CallLeafNoFP, "shenandoah_wb_C should be called with Op_CallLeafNoFP");
 902     add_call_kills(proj, regs, save_policy, exclude_soe, true);
 903   } else
 904 #endif
 905     add_call_kills(proj, regs, save_policy, exclude_soe, false);

 906 
 907   return node_cnt;
 908 }
 909 
 910 void PhaseCFG::push_ready_nodes(Node* n, Node* m, Block* block, GrowableArray<int>& ready_cnt, Node_List& worklist, uint max_idx, int c) {
 911   if (get_block_for_node(m) != block) {
 912     return;
 913   }
 914   if (m->is_Phi()) {
 915     return;
 916   }
 917   if (m->_idx >= max_idx) { // new node, skip it
 918     assert(m->is_MachProj() && n->is_Mach() && n->as_Mach()->has_call(), "unexpected node types");
 919     return;
 920   }
 921   int m_cnt = ready_cnt.at(m->_idx) - c;
 922   ready_cnt.at_put(m->_idx, m_cnt);
 923   if (m_cnt == 0) {
 924     worklist.push(m);
 925   }


< prev index next >