Print this page


Split Close
Expand all
Collapse all
          --- old/src/cpu/x86/vm/frame_x86.cpp
          +++ new/src/cpu/x86/vm/frame_x86.cpp
↓ open down ↓ 322 lines elided ↑ open up ↑
 323  323    return fr;
 324  324  }
 325  325  
 326  326  frame frame::sender_for_interpreter_frame(RegisterMap* map) const {
 327  327    // sp is the raw sp from the sender after adapter or interpreter extension
 328  328    intptr_t* sp = (intptr_t*) addr_at(sender_sp_offset);
 329  329  
 330  330    // This is the sp before any possible extension (adapter/locals).
 331  331    intptr_t* unextended_sp = interpreter_frame_sender_sp();
 332  332  
      333 +  address sender_pc = this->sender_pc();
      334 +  CodeBlob* sender_cb = CodeCache::find_blob_unsafe(sender_pc);
      335 +  assert(sender_cb, "sanity");
      336 +  nmethod* sender_nm = sender_cb->as_nmethod_or_null();
      337 +  if (sender_nm != NULL && sender_nm->is_method_handle_return(sender_pc)) {
      338 +    unextended_sp = (intptr_t*) at(link_offset);
      339 +  }
      340 +
 333  341    // The interpreter and compiler(s) always save EBP/RBP in a known
 334  342    // location on entry. We must record where that location is
 335  343    // so this if EBP/RBP was live on callout from c2 we can find
 336  344    // the saved copy no matter what it called.
 337  345  
 338  346    // Since the interpreter always saves EBP/RBP if we record where it is then
 339  347    // we don't have to always save EBP/RBP on entry and exit to c2 compiled
 340  348    // code, on entry will be enough.
 341  349  #ifdef COMPILER2
 342  350    if (map->update_map()) {
↓ open down ↓ 2 lines elided ↑ open up ↑
 345  353      // this is weird "H" ought to be at a higher address however the
 346  354      // oopMaps seems to have the "H" regs at the same address and the
 347  355      // vanilla register.
 348  356      // XXXX make this go away
 349  357      if (true) {
 350  358        map->set_location(rbp->as_VMReg()->next(), (address)addr_at(link_offset));
 351  359      }
 352  360  #endif // AMD64
 353  361    }
 354  362  #endif /* COMPILER2 */
 355      -  return frame(sp, unextended_sp, link(), sender_pc());
      363 +  return frame(sp, unextended_sp, link(), sender_pc);
 356  364  }
 357  365  
 358  366  
 359  367  //------------------------------sender_for_compiled_frame-----------------------
 360  368  frame frame::sender_for_compiled_frame(RegisterMap* map) const {
 361  369    assert(map != NULL, "map must be set");
 362  370    const bool c1_compiled = _cb->is_compiled_by_c1();
 363  371  
 364  372    // frame owned by optimizing compiler
 365  373    intptr_t* sender_sp = NULL;
↓ open down ↓ 2 lines elided ↑ open up ↑
 368  376    sender_sp = unextended_sp() + _cb->frame_size();
 369  377  
 370  378    // On Intel the return_address is always the word on the stack
 371  379    address sender_pc = (address) *(sender_sp-1);
 372  380  
 373  381    // This is the saved value of ebp which may or may not really be an fp.
 374  382    // it is only an fp if the sender is an interpreter frame (or c1?)
 375  383  
 376  384    intptr_t *saved_fp = (intptr_t*)*(sender_sp - frame::sender_sp_offset);
 377  385  
      386 +  intptr_t* unextended_sp = sender_sp;
      387 +  // If we are returning to a compiled method handle call site,
      388 +  // the saved_fp will in fact be a saved value of the unextended SP.
      389 +  // The simplest way to tell whether we are returning to such a call
      390 +  // site is as follows:
      391 +  CodeBlob* sender_cb = CodeCache::find_blob_unsafe(sender_pc);
      392 +  assert(sender_cb, "sanity");
      393 +  nmethod* sender_nm = sender_cb->as_nmethod_or_null();
      394 +  if (sender_nm != NULL && sender_nm->is_method_handle_return(sender_pc)) {
      395 +    unextended_sp = saved_fp;
      396 +  }
      397 +
 378  398    if (map->update_map()) {
 379  399      // Tell GC to use argument oopmaps for some runtime stubs that need it.
 380  400      // For C1, the runtime stub might not have oop maps, so set this flag
 381  401      // outside of update_register_map.
 382  402      map->set_include_argument_oops(_cb->caller_must_gc_arguments(map->thread()));
 383  403      if (_cb->oop_maps() != NULL) {
 384  404        OopMapSet::update_register_map(this, map);
 385  405      }
 386  406      // Since the prolog does the save and restore of epb there is no oopmap
 387  407      // for it so we must fill in its location as if there was an oopmap entry
↓ open down ↓ 4 lines elided ↑ open up ↑
 392  412      // oopMaps seems to have the "H" regs at the same address and the
 393  413      // vanilla register.
 394  414      // XXXX make this go away
 395  415      if (true) {
 396  416        map->set_location(rbp->as_VMReg()->next(), (address) (sender_sp - frame::sender_sp_offset));
 397  417      }
 398  418  #endif // AMD64
 399  419    }
 400  420  
 401  421    assert(sender_sp != sp(), "must have changed");
 402      -  return frame(sender_sp, saved_fp, sender_pc);
      422 +  return frame(sender_sp, unextended_sp, saved_fp, sender_pc);
 403  423  }
 404  424  
 405  425  frame frame::sender(RegisterMap* map) const {
 406  426    // Default is we done have to follow them. The sender_for_xxx will
 407  427    // update it accordingly
 408  428    map->set_include_argument_oops(false);
 409  429  
 410  430    if (is_entry_frame())       return sender_for_entry_frame(map);
 411  431    if (is_interpreted_frame()) return sender_for_interpreter_frame(map);
 412  432    assert(_cb == CodeCache::find_blob(pc()),"Must be the same");
↓ open down ↓ 167 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX