src/cpu/sparc/vm/frame_sparc.cpp

changeset 1919
61b2245abf36
parent 1861
2338d41fbd81
child 1934
e9ff18c4ace7
     1.1 --- a/src/cpu/sparc/vm/frame_sparc.cpp	Thu May 20 06:34:23 2010 -0700
     1.2 +++ b/src/cpu/sparc/vm/frame_sparc.cpp	Fri May 21 02:59:24 2010 -0700
     1.3 @@ -336,9 +336,11 @@
     1.4  #endif // ASSERT
     1.5  }
     1.6  
     1.7 -frame::frame(intptr_t* sp, intptr_t* younger_sp, bool younger_frame_adjusted_stack) {
     1.8 -  _sp = sp;
     1.9 -  _younger_sp = younger_sp;
    1.10 +frame::frame(intptr_t* sp, intptr_t* younger_sp, bool younger_frame_is_interpreted) :
    1.11 +  _sp(sp),
    1.12 +  _younger_sp(younger_sp),
    1.13 +  _deopt_state(unknown),
    1.14 +  _sp_adjustment_by_callee(0) {
    1.15    if (younger_sp == NULL) {
    1.16      // make a deficient frame which doesn't know where its PC is
    1.17      _pc = NULL;
    1.18 @@ -352,20 +354,32 @@
    1.19      // wrong.  (the _last_native_pc will have the right value)
    1.20      // So do not put add any asserts on the _pc here.
    1.21    }
    1.22 -  if (younger_frame_adjusted_stack) {
    1.23 -    // compute adjustment to this frame's SP made by its interpreted callee
    1.24 -    _sp_adjustment_by_callee = (intptr_t*)((intptr_t)younger_sp[I5_savedSP->sp_offset_in_saved_window()] +
    1.25 -                                             STACK_BIAS) - sp;
    1.26 -  } else {
    1.27 -    _sp_adjustment_by_callee = 0;
    1.28 +
    1.29 +  if (_pc != NULL)
    1.30 +    _cb = CodeCache::find_blob(_pc);
    1.31 +
    1.32 +  // Check for MethodHandle call sites.
    1.33 +  if (_cb != NULL) {
    1.34 +    nmethod* nm = _cb->as_nmethod_or_null();
    1.35 +    if (nm != NULL) {
    1.36 +      if (nm->is_deopt_mh_entry(_pc) || nm->is_method_handle_return(_pc)) {
    1.37 +        _sp_adjustment_by_callee = (intptr_t*) ((intptr_t) sp[L7_mh_SP_save->sp_offset_in_saved_window()] + STACK_BIAS) - sp;
    1.38 +        // The SP is already adjusted by this MH call site, don't
    1.39 +        // overwrite this value with the wrong interpreter value.
    1.40 +        younger_frame_is_interpreted = false;
    1.41 +      }
    1.42 +    }
    1.43    }
    1.44  
    1.45 -  _deopt_state = unknown;
    1.46 +  if (younger_frame_is_interpreted) {
    1.47 +    // compute adjustment to this frame's SP made by its interpreted callee
    1.48 +    _sp_adjustment_by_callee = (intptr_t*) ((intptr_t) younger_sp[I5_savedSP->sp_offset_in_saved_window()] + STACK_BIAS) - sp;
    1.49 +  }
    1.50  
    1.51 -  // It is important that frame be fully construct when we do this lookup
    1.52 -  // as get_original_pc() needs correct value for unextended_sp()
    1.53 +  // It is important that the frame is fully constructed when we do
    1.54 +  // this lookup as get_deopt_original_pc() needs a correct value for
    1.55 +  // unextended_sp() which uses _sp_adjustment_by_callee.
    1.56    if (_pc != NULL) {
    1.57 -    _cb = CodeCache::find_blob(_pc);
    1.58      address original_pc = nmethod::get_deopt_original_pc(this);
    1.59      if (original_pc != NULL) {
    1.60        _pc = original_pc;
    1.61 @@ -462,9 +476,8 @@
    1.62  
    1.63    if (is_entry_frame()) return sender_for_entry_frame(map);
    1.64  
    1.65 -  intptr_t* younger_sp     = sp();
    1.66 -  intptr_t* sp             = sender_sp();
    1.67 -  bool      adjusted_stack = false;
    1.68 +  intptr_t* younger_sp = sp();
    1.69 +  intptr_t* sp         = sender_sp();
    1.70  
    1.71    // Note:  The version of this operation on any platform with callee-save
    1.72    //        registers must update the register map (if not null).
    1.73 @@ -483,8 +496,8 @@
    1.74    // interpreted but its pc is in the code cache (for c1 -> osr_frame_return_id stub), so it must be
    1.75    // explicitly recognized.
    1.76  
    1.77 -  adjusted_stack = is_interpreted_frame();
    1.78 -  if (adjusted_stack) {
    1.79 +  bool frame_is_interpreted = is_interpreted_frame();
    1.80 +  if (frame_is_interpreted) {
    1.81      map->make_integer_regs_unsaved();
    1.82      map->shift_window(sp, younger_sp);
    1.83    } else if (_cb != NULL) {
    1.84 @@ -503,7 +516,7 @@
    1.85        }
    1.86      }
    1.87    }
    1.88 -  return frame(sp, younger_sp, adjusted_stack);
    1.89 +  return frame(sp, younger_sp, frame_is_interpreted);
    1.90  }
    1.91  
    1.92  

mercurial