< prev index next >

src/hotspot/cpu/ppc/ppc.ad

Print this page

 2045     return MacroAssembler::bl64_patchable_size;
 2046   }
 2047 
 2048 };
 2049 
 2050 class Node::PD {
 2051 public:
 2052   enum NodeFlags {
 2053     _last_flag = Node::_last_flag
 2054   };
 2055 };
 2056 
 2057 %} // end source_hpp
 2058 
 2059 source %{
 2060 
 2061 int HandlerImpl::emit_exception_handler(CodeBuffer &cbuf) {
 2062   C2_MacroAssembler _masm(&cbuf);
 2063 
 2064   address base = __ start_a_stub(size_exception_handler());
 2065   if (base == NULL) return 0; // CodeBuffer::expand failed



 2066 
 2067   int offset = __ offset();
 2068   __ b64_patchable((address)OptoRuntime::exception_blob()->content_begin(),
 2069                        relocInfo::runtime_call_type);
 2070   assert(__ offset() - offset == (int)size_exception_handler(), "must be fixed size");
 2071   __ end_a_stub();
 2072 
 2073   return offset;
 2074 }
 2075 
 2076 // The deopt_handler is like the exception handler, but it calls to
 2077 // the deoptimization blob instead of jumping to the exception blob.
 2078 int HandlerImpl::emit_deopt_handler(CodeBuffer& cbuf) {
 2079   C2_MacroAssembler _masm(&cbuf);
 2080 
 2081   address base = __ start_a_stub(size_deopt_handler());
 2082   if (base == NULL) return 0; // CodeBuffer::expand failed



 2083 
 2084   int offset = __ offset();
 2085   __ bl64_patchable((address)SharedRuntime::deopt_blob()->unpack(),
 2086                         relocInfo::runtime_call_type);
 2087   assert(__ offset() - offset == (int) size_deopt_handler(), "must be fixed size");
 2088   __ end_a_stub();
 2089 
 2090   return offset;
 2091 }
 2092 
 2093 //=============================================================================
 2094 
 2095 // Use a frame slots bias for frameless methods if accessing the stack.
 2096 static int frame_slots_bias(int reg_enc, PhaseRegAlloc* ra_) {
 2097   if (as_Register(reg_enc) == R1_SP) {
 2098     return 0; // TODO: PPC port ra_->C->frame_slots_sp_bias_in_bytes();
 2099   }
 2100   return 0;
 2101 }
 2102 

 2781       loadConLNodesTuple_create(ra_, n_toc, op_src,
 2782                                 ra_->get_reg_second(this), ra_->get_reg_first(this));
 2783 
 2784     // Push new nodes.
 2785     if (loadConLNodes._large_hi) nodes->push(loadConLNodes._large_hi);
 2786     if (loadConLNodes._last)     nodes->push(loadConLNodes._last);
 2787 
 2788     // some asserts
 2789     assert(nodes->length() >= 1, "must have created at least 1 node");
 2790     assert(loadConLNodes._last->bottom_type()->isa_long(), "must be long");
 2791   %}
 2792 
 2793   enc_class enc_load_long_constP(iRegLdst dst, immP src, iRegLdst toc) %{
 2794 
 2795     C2_MacroAssembler _masm(&cbuf);
 2796     int toc_offset = 0;
 2797 
 2798     intptr_t val = $src$$constant;
 2799     relocInfo::relocType constant_reloc = $src->constant_reloc();  // src
 2800     address const_toc_addr;

 2801     if (constant_reloc == relocInfo::oop_type) {
 2802       // Create an oop constant and a corresponding relocation.
 2803       AddressLiteral a = __ allocate_oop_address((jobject)val);
 2804       const_toc_addr = __ address_constant((address)a.value(), RelocationHolder::none);
 2805       __ relocate(a.rspec());
 2806     } else if (constant_reloc == relocInfo::metadata_type) {

 2807       AddressLiteral a = __ constant_metadata_address((Metadata *)val);
 2808       const_toc_addr = __ address_constant((address)a.value(), RelocationHolder::none);
 2809       __ relocate(a.rspec());
 2810     } else {
 2811       // Create a non-oop constant, no relocation needed.
 2812       const_toc_addr = __ long_constant((jlong)$src$$constant);
 2813     }
 2814 
 2815     if (const_toc_addr == NULL) {
 2816       ciEnv::current()->record_out_of_memory_failure();
 2817       return;
 2818     }

 2819     // Get the constant's TOC offset.
 2820     toc_offset = __ offset_to_method_toc(const_toc_addr);
 2821 
 2822     __ ld($dst$$Register, toc_offset, $toc$$Register);
 2823   %}
 2824 
 2825   enc_class enc_load_long_constP_hi(iRegLdst dst, immP src, iRegLdst toc) %{
 2826 
 2827     C2_MacroAssembler _masm(&cbuf);
 2828     if (!ra_->C->output()->in_scratch_emit_size()) {
 2829       intptr_t val = $src$$constant;
 2830       relocInfo::relocType constant_reloc = $src->constant_reloc();  // src
 2831       address const_toc_addr;

 2832       if (constant_reloc == relocInfo::oop_type) {
 2833         // Create an oop constant and a corresponding relocation.
 2834         AddressLiteral a = __ allocate_oop_address((jobject)val);
 2835         const_toc_addr = __ address_constant((address)a.value(), RelocationHolder::none);
 2836         __ relocate(a.rspec());
 2837       } else if (constant_reloc == relocInfo::metadata_type) {

 2838         AddressLiteral a = __ constant_metadata_address((Metadata *)val);
 2839         const_toc_addr = __ address_constant((address)a.value(), RelocationHolder::none);
 2840         __ relocate(a.rspec());
 2841       } else {  // non-oop pointers, e.g. card mark base, heap top
 2842         // Create a non-oop constant, no relocation needed.
 2843         const_toc_addr = __ long_constant((jlong)$src$$constant);
 2844       }
 2845 
 2846       if (const_toc_addr == NULL) {
 2847         ciEnv::current()->record_out_of_memory_failure();
 2848         return;
 2849       }

 2850       // Get the constant's TOC offset.
 2851       const int toc_offset = __ offset_to_method_toc(const_toc_addr);
 2852       // Store the toc offset of the constant.
 2853       ((loadConP_hiNode*)this)->_const_toc_offset = toc_offset;
 2854     }
 2855 
 2856     __ addis($dst$$Register, $toc$$Register, MacroAssembler::largeoffset_si16_si16_hi(_const_toc_offset));
 2857   %}
 2858 
 2859   // Postalloc expand emitter for loading a ptr constant from the method's TOC.
 2860   // Enc_class needed as consttanttablebase is not supported by postalloc
 2861   // expand.
 2862   enc_class postalloc_expand_load_ptr_constant(iRegPdst dst, immP src, iRegLdst toc) %{
 2863     const bool large_constant_pool = true; // TODO: PPC port C->cfg()->_consts_size > 4000;
 2864     if (large_constant_pool) {
 2865       // Create new nodes.
 2866       loadConP_hiNode *m1 = new loadConP_hiNode();
 2867       loadConP_loNode *m2 = new loadConP_loNode();
 2868 
 2869       // inputs for new nodes

 2045     return MacroAssembler::bl64_patchable_size;
 2046   }
 2047 
 2048 };
 2049 
 2050 class Node::PD {
 2051 public:
 2052   enum NodeFlags {
 2053     _last_flag = Node::_last_flag
 2054   };
 2055 };
 2056 
 2057 %} // end source_hpp
 2058 
 2059 source %{
 2060 
 2061 int HandlerImpl::emit_exception_handler(CodeBuffer &cbuf) {
 2062   C2_MacroAssembler _masm(&cbuf);
 2063 
 2064   address base = __ start_a_stub(size_exception_handler());
 2065   if (base == nullptr) {
 2066     ciEnv::current()->record_failure("CodeCache is full");
 2067     return 0;  // CodeBuffer::expand failed
 2068   }
 2069 
 2070   int offset = __ offset();
 2071   __ b64_patchable((address)OptoRuntime::exception_blob()->content_begin(),
 2072                        relocInfo::runtime_call_type);
 2073   assert(__ offset() - offset == (int)size_exception_handler(), "must be fixed size");
 2074   __ end_a_stub();
 2075 
 2076   return offset;
 2077 }
 2078 
 2079 // The deopt_handler is like the exception handler, but it calls to
 2080 // the deoptimization blob instead of jumping to the exception blob.
 2081 int HandlerImpl::emit_deopt_handler(CodeBuffer& cbuf) {
 2082   C2_MacroAssembler _masm(&cbuf);
 2083 
 2084   address base = __ start_a_stub(size_deopt_handler());
 2085   if (base == nullptr) {
 2086     ciEnv::current()->record_failure("CodeCache is full");
 2087     return 0;  // CodeBuffer::expand failed
 2088   }
 2089 
 2090   int offset = __ offset();
 2091   __ bl64_patchable((address)SharedRuntime::deopt_blob()->unpack(),
 2092                         relocInfo::runtime_call_type);
 2093   assert(__ offset() - offset == (int) size_deopt_handler(), "must be fixed size");
 2094   __ end_a_stub();
 2095 
 2096   return offset;
 2097 }
 2098 
 2099 //=============================================================================
 2100 
 2101 // Use a frame slots bias for frameless methods if accessing the stack.
 2102 static int frame_slots_bias(int reg_enc, PhaseRegAlloc* ra_) {
 2103   if (as_Register(reg_enc) == R1_SP) {
 2104     return 0; // TODO: PPC port ra_->C->frame_slots_sp_bias_in_bytes();
 2105   }
 2106   return 0;
 2107 }
 2108 

 2787       loadConLNodesTuple_create(ra_, n_toc, op_src,
 2788                                 ra_->get_reg_second(this), ra_->get_reg_first(this));
 2789 
 2790     // Push new nodes.
 2791     if (loadConLNodes._large_hi) nodes->push(loadConLNodes._large_hi);
 2792     if (loadConLNodes._last)     nodes->push(loadConLNodes._last);
 2793 
 2794     // some asserts
 2795     assert(nodes->length() >= 1, "must have created at least 1 node");
 2796     assert(loadConLNodes._last->bottom_type()->isa_long(), "must be long");
 2797   %}
 2798 
 2799   enc_class enc_load_long_constP(iRegLdst dst, immP src, iRegLdst toc) %{
 2800 
 2801     C2_MacroAssembler _masm(&cbuf);
 2802     int toc_offset = 0;
 2803 
 2804     intptr_t val = $src$$constant;
 2805     relocInfo::relocType constant_reloc = $src->constant_reloc();  // src
 2806     address const_toc_addr;
 2807     RelocationHolder r; // Initializes type to none.
 2808     if (constant_reloc == relocInfo::oop_type) {
 2809       // Create an oop constant and a corresponding relocation.
 2810       AddressLiteral a = __ constant_oop_address((jobject)val);
 2811       const_toc_addr = __ address_constant((address)a.value(), RelocationHolder::none);
 2812       r = a.rspec();
 2813     } else if (constant_reloc == relocInfo::metadata_type) {
 2814       // Notify OOP recorder (don't need the relocation)
 2815       AddressLiteral a = __ constant_metadata_address((Metadata *)val);
 2816       const_toc_addr = __ address_constant((address)a.value(), RelocationHolder::none);

 2817     } else {
 2818       // Create a non-oop constant, no relocation needed.
 2819       const_toc_addr = __ long_constant((jlong)$src$$constant);
 2820     }
 2821 
 2822     if (const_toc_addr == NULL) {
 2823       ciEnv::current()->record_out_of_memory_failure();
 2824       return;
 2825     }
 2826     __ relocate(r); // If set above.
 2827     // Get the constant's TOC offset.
 2828     toc_offset = __ offset_to_method_toc(const_toc_addr);
 2829 
 2830     __ ld($dst$$Register, toc_offset, $toc$$Register);
 2831   %}
 2832 
 2833   enc_class enc_load_long_constP_hi(iRegLdst dst, immP src, iRegLdst toc) %{
 2834 
 2835     C2_MacroAssembler _masm(&cbuf);
 2836     if (!ra_->C->output()->in_scratch_emit_size()) {
 2837       intptr_t val = $src$$constant;
 2838       relocInfo::relocType constant_reloc = $src->constant_reloc();  // src
 2839       address const_toc_addr;
 2840       RelocationHolder r; // Initializes type to none.
 2841       if (constant_reloc == relocInfo::oop_type) {
 2842         // Create an oop constant and a corresponding relocation.
 2843         AddressLiteral a = __ constant_oop_address((jobject)val);
 2844         const_toc_addr = __ address_constant((address)a.value(), RelocationHolder::none);
 2845         r = a.rspec();
 2846       } else if (constant_reloc == relocInfo::metadata_type) {
 2847         // Notify OOP recorder (don't need the relocation)
 2848         AddressLiteral a = __ constant_metadata_address((Metadata *)val);
 2849         const_toc_addr = __ address_constant((address)a.value(), RelocationHolder::none);

 2850       } else {  // non-oop pointers, e.g. card mark base, heap top
 2851         // Create a non-oop constant, no relocation needed.
 2852         const_toc_addr = __ long_constant((jlong)$src$$constant);
 2853       }
 2854 
 2855       if (const_toc_addr == NULL) {
 2856         ciEnv::current()->record_out_of_memory_failure();
 2857         return;
 2858       }
 2859       __ relocate(r); // If set above.
 2860       // Get the constant's TOC offset.
 2861       const int toc_offset = __ offset_to_method_toc(const_toc_addr);
 2862       // Store the toc offset of the constant.
 2863       ((loadConP_hiNode*)this)->_const_toc_offset = toc_offset;
 2864     }
 2865 
 2866     __ addis($dst$$Register, $toc$$Register, MacroAssembler::largeoffset_si16_si16_hi(_const_toc_offset));
 2867   %}
 2868 
 2869   // Postalloc expand emitter for loading a ptr constant from the method's TOC.
 2870   // Enc_class needed as consttanttablebase is not supported by postalloc
 2871   // expand.
 2872   enc_class postalloc_expand_load_ptr_constant(iRegPdst dst, immP src, iRegLdst toc) %{
 2873     const bool large_constant_pool = true; // TODO: PPC port C->cfg()->_consts_size > 4000;
 2874     if (large_constant_pool) {
 2875       // Create new nodes.
 2876       loadConP_hiNode *m1 = new loadConP_hiNode();
 2877       loadConP_loNode *m2 = new loadConP_loNode();
 2878 
 2879       // inputs for new nodes
< prev index next >