agent/src/share/classes/sun/jvm/hotspot/runtime/x86/X86Frame.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File 8068945-8u-patched Sdiff agent/src/share/classes/sun/jvm/hotspot/runtime/x86

agent/src/share/classes/sun/jvm/hotspot/runtime/x86/X86Frame.java

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


 300     if (Assert.ASSERTS_ENABLED) {
 301       Assert.that(!entryFrameIsFirst(), "next Java fp must be non zero");
 302       Assert.that(jcw.getLastJavaSP().greaterThan(getSP()), "must be above this frame on stack");
 303     }
 304     X86Frame fr;
 305     if (jcw.getLastJavaPC() != null) {
 306       fr = new X86Frame(jcw.getLastJavaSP(), jcw.getLastJavaFP(), jcw.getLastJavaPC());
 307     } else {
 308       fr = new X86Frame(jcw.getLastJavaSP(), jcw.getLastJavaFP());
 309     }
 310     map.clear();
 311     if (Assert.ASSERTS_ENABLED) {
 312       Assert.that(map.getIncludeArgumentOops(), "should be set by clear");
 313     }
 314     return fr;
 315   }
 316 
 317   //------------------------------------------------------------------------------
 318   // frame::adjust_unextended_sp
 319   private void adjustUnextendedSP() {
 320     // If we are returning to a compiled MethodHandle call site, the
 321     // saved_fp will in fact be a saved value of the unextended SP.  The
 322     // simplest way to tell whether we are returning to such a call site
 323     // is as follows:
 324 
 325     CodeBlob cb = cb();
 326     NMethod senderNm = (cb == null) ? null : cb.asNMethodOrNull();
 327     if (senderNm != null) {
 328       // If the sender PC is a deoptimization point, get the original
 329       // PC.  For MethodHandle call site the unextended_sp is stored in
 330       // saved_fp.
 331       if (senderNm.isDeoptMhEntry(getPC())) {
 332         // DEBUG_ONLY(verifyDeoptMhOriginalPc(senderNm, getFP()));
 333         raw_unextendedSP = getFP();
 334       }
 335       else if (senderNm.isDeoptEntry(getPC())) {
 336         // DEBUG_ONLY(verifyDeoptOriginalPc(senderNm, raw_unextendedSp));
 337       }
 338       else if (senderNm.isMethodHandleReturn(getPC())) {
 339         raw_unextendedSP = getFP();
 340       }
 341     }
 342   }
 343 
 344   private Frame senderForInterpreterFrame(X86RegisterMap map) {
 345     if (DEBUG) {
 346       System.out.println("senderForInterpreterFrame");
 347     }
 348     Address unextendedSP = addressOfStackSlot(INTERPRETER_FRAME_SENDER_SP_OFFSET).getAddressAt(0);
 349     Address sp = addressOfStackSlot(SENDER_SP_OFFSET);
 350     // We do not need to update the callee-save register mapping because above
 351     // us is either another interpreter frame or a converter-frame, but never
 352     // directly a compiled frame.
 353     // 11/24/04 SFG. With the removal of adapter frames this is no longer true.
 354     // However c2 no longer uses callee save register for java calls so there
 355     // are no callee register to find.
 356 
 357     if (map.getUpdateMap())
 358       updateMapWithSavedLink(map, addressOfStackSlot(LINK_OFFSET));
 359 




 300     if (Assert.ASSERTS_ENABLED) {
 301       Assert.that(!entryFrameIsFirst(), "next Java fp must be non zero");
 302       Assert.that(jcw.getLastJavaSP().greaterThan(getSP()), "must be above this frame on stack");
 303     }
 304     X86Frame fr;
 305     if (jcw.getLastJavaPC() != null) {
 306       fr = new X86Frame(jcw.getLastJavaSP(), jcw.getLastJavaFP(), jcw.getLastJavaPC());
 307     } else {
 308       fr = new X86Frame(jcw.getLastJavaSP(), jcw.getLastJavaFP());
 309     }
 310     map.clear();
 311     if (Assert.ASSERTS_ENABLED) {
 312       Assert.that(map.getIncludeArgumentOops(), "should be set by clear");
 313     }
 314     return fr;
 315   }
 316 
 317   //------------------------------------------------------------------------------
 318   // frame::adjust_unextended_sp
 319   private void adjustUnextendedSP() {
 320     // On x86, sites calling method handle intrinsics and lambda forms are treated
 321     // as any other call site. Therefore, no special action is needed when we are
 322     // returning to any of these call sites.

 323 
 324     CodeBlob cb = cb();
 325     NMethod senderNm = (cb == null) ? null : cb.asNMethodOrNull();
 326     if (senderNm != null) {
 327       // If the sender PC is a deoptimization point, get the original PC.
 328       if (senderNm.isDeoptEntry(getPC()) ||
 329           senderNm.isDeoptMhEntry(getPC())) {
 330         // DEBUG_ONLY(verifyDeoptriginalPc(senderNm, raw_unextendedSp));








 331       }
 332     }
 333   }
 334 
 335   private Frame senderForInterpreterFrame(X86RegisterMap map) {
 336     if (DEBUG) {
 337       System.out.println("senderForInterpreterFrame");
 338     }
 339     Address unextendedSP = addressOfStackSlot(INTERPRETER_FRAME_SENDER_SP_OFFSET).getAddressAt(0);
 340     Address sp = addressOfStackSlot(SENDER_SP_OFFSET);
 341     // We do not need to update the callee-save register mapping because above
 342     // us is either another interpreter frame or a converter-frame, but never
 343     // directly a compiled frame.
 344     // 11/24/04 SFG. With the removal of adapter frames this is no longer true.
 345     // However c2 no longer uses callee save register for java calls so there
 346     // are no callee register to find.
 347 
 348     if (map.getUpdateMap())
 349       updateMapWithSavedLink(map, addressOfStackSlot(LINK_OFFSET));
 350 


agent/src/share/classes/sun/jvm/hotspot/runtime/x86/X86Frame.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File