src/cpu/x86/vm/x86.ad
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File 8068945-8u-patched Sdiff src/cpu/x86/vm

src/cpu/x86/vm/x86.ad

Print this page
rev 7386 : 8068945: Use RBP register as proper frame pointer in JIT compiled code on x86
Summary: Introduce the PreserveFramePointer flag to control if RBP is used as the frame pointer or as a general purpose register.
Reviewed-by: kvn, roland, dlong, enevill, shade


 895 
 896 #ifndef PRODUCT
 897   void MachBreakpointNode::format(PhaseRegAlloc*, outputStream* st) const {
 898     st->print("# breakpoint");
 899   }
 900 #endif
 901 
 902   void MachBreakpointNode::emit(CodeBuffer &cbuf, PhaseRegAlloc* ra_) const {
 903     MacroAssembler _masm(&cbuf);
 904     __ int3();
 905   }
 906 
 907   uint MachBreakpointNode::size(PhaseRegAlloc* ra_) const {
 908     return MachNode::size(ra_);
 909   }
 910 
 911 %}
 912 
 913 encode %{
 914 
 915   enc_class preserve_SP %{
 916     debug_only(int off0 = cbuf.insts_size());
 917     MacroAssembler _masm(&cbuf);
 918     // RBP is preserved across all calls, even compiled calls.
 919     // Use it to preserve RSP in places where the callee might change the SP.
 920     __ movptr(rbp_mh_SP_save, rsp);
 921     debug_only(int off1 = cbuf.insts_size());
 922     assert(off1 - off0 == preserve_SP_size(), "correct size prediction");
 923   %}
 924 
 925   enc_class restore_SP %{
 926     MacroAssembler _masm(&cbuf);
 927     __ movptr(rsp, rbp_mh_SP_save);
 928   %}
 929 
 930   enc_class call_epilog %{
 931     if (VerifyStackAtCalls) {
 932       // Check that stack depth is unchanged: find majik cookie on stack
 933       int framesize = ra_->reg2offset_unchecked(OptoReg::add(ra_->_matcher._old_SP, -3*VMRegImpl::slots_per_word));
 934       MacroAssembler _masm(&cbuf);
 935       Label L;
 936       __ cmpptr(Address(rsp, framesize), (int32_t)0xbadb100d);
 937       __ jccb(Assembler::equal, L);
 938       // Die if stack mismatch
 939       __ int3();
 940       __ bind(L);
 941     }
 942   %}
 943 
 944 %}
 945 
 946 
 947 //----------OPERANDS-----------------------------------------------------------
 948 // Operand definitions must precede instruction definitions for correct parsing
 949 // in the ADLC because operands constitute user defined types which are used in




 895 
 896 #ifndef PRODUCT
 897   void MachBreakpointNode::format(PhaseRegAlloc*, outputStream* st) const {
 898     st->print("# breakpoint");
 899   }
 900 #endif
 901 
 902   void MachBreakpointNode::emit(CodeBuffer &cbuf, PhaseRegAlloc* ra_) const {
 903     MacroAssembler _masm(&cbuf);
 904     __ int3();
 905   }
 906 
 907   uint MachBreakpointNode::size(PhaseRegAlloc* ra_) const {
 908     return MachNode::size(ra_);
 909   }
 910 
 911 %}
 912 
 913 encode %{
 914 















 915   enc_class call_epilog %{
 916     if (VerifyStackAtCalls) {
 917       // Check that stack depth is unchanged: find majik cookie on stack
 918       int framesize = ra_->reg2offset_unchecked(OptoReg::add(ra_->_matcher._old_SP, -3*VMRegImpl::slots_per_word));
 919       MacroAssembler _masm(&cbuf);
 920       Label L;
 921       __ cmpptr(Address(rsp, framesize), (int32_t)0xbadb100d);
 922       __ jccb(Assembler::equal, L);
 923       // Die if stack mismatch
 924       __ int3();
 925       __ bind(L);
 926     }
 927   %}
 928 
 929 %}
 930 
 931 
 932 //----------OPERANDS-----------------------------------------------------------
 933 // Operand definitions must precede instruction definitions for correct parsing
 934 // in the ADLC because operands constitute user defined types which are used in


src/cpu/x86/vm/x86.ad
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File