hotspot/src/cpu/sparc/vm/frame_sparc.cpp
changeset 5687 b862d1f189bd
parent 5419 f2e8cc8c12ea
child 5702 201c5cde25bb
equal deleted inserted replaced
5686:5435e77aa3df 5687:b862d1f189bd
   334     assert(!((nmethod*)_cb)->is_deopt_pc(_pc), "invariant broken");
   334     assert(!((nmethod*)_cb)->is_deopt_pc(_pc), "invariant broken");
   335   }
   335   }
   336 #endif // ASSERT
   336 #endif // ASSERT
   337 }
   337 }
   338 
   338 
   339 frame::frame(intptr_t* sp, intptr_t* younger_sp, bool younger_frame_adjusted_stack) {
   339 frame::frame(intptr_t* sp, intptr_t* younger_sp, bool younger_frame_is_interpreted) :
   340   _sp = sp;
   340   _sp(sp),
   341   _younger_sp = younger_sp;
   341   _younger_sp(younger_sp),
       
   342   _deopt_state(unknown),
       
   343   _sp_adjustment_by_callee(0) {
   342   if (younger_sp == NULL) {
   344   if (younger_sp == NULL) {
   343     // make a deficient frame which doesn't know where its PC is
   345     // make a deficient frame which doesn't know where its PC is
   344     _pc = NULL;
   346     _pc = NULL;
   345     _cb = NULL;
   347     _cb = NULL;
   346   } else {
   348   } else {
   350     // find_blob_unsafe
   352     // find_blob_unsafe
   351     // In case of native stubs, the pc retrieved here might be
   353     // In case of native stubs, the pc retrieved here might be
   352     // wrong.  (the _last_native_pc will have the right value)
   354     // wrong.  (the _last_native_pc will have the right value)
   353     // So do not put add any asserts on the _pc here.
   355     // So do not put add any asserts on the _pc here.
   354   }
   356   }
   355   if (younger_frame_adjusted_stack) {
   357 
       
   358   if (_pc != NULL)
       
   359     _cb = CodeCache::find_blob(_pc);
       
   360 
       
   361   // Check for MethodHandle call sites.
       
   362   if (_cb != NULL) {
       
   363     nmethod* nm = _cb->as_nmethod_or_null();
       
   364     if (nm != NULL) {
       
   365       if (nm->is_deopt_mh_entry(_pc) || nm->is_method_handle_return(_pc)) {
       
   366         _sp_adjustment_by_callee = (intptr_t*) ((intptr_t) sp[L7_mh_SP_save->sp_offset_in_saved_window()] + STACK_BIAS) - sp;
       
   367         // The SP is already adjusted by this MH call site, don't
       
   368         // overwrite this value with the wrong interpreter value.
       
   369         younger_frame_is_interpreted = false;
       
   370       }
       
   371     }
       
   372   }
       
   373 
       
   374   if (younger_frame_is_interpreted) {
   356     // compute adjustment to this frame's SP made by its interpreted callee
   375     // compute adjustment to this frame's SP made by its interpreted callee
   357     _sp_adjustment_by_callee = (intptr_t*)((intptr_t)younger_sp[I5_savedSP->sp_offset_in_saved_window()] +
   376     _sp_adjustment_by_callee = (intptr_t*) ((intptr_t) younger_sp[I5_savedSP->sp_offset_in_saved_window()] + STACK_BIAS) - sp;
   358                                              STACK_BIAS) - sp;
   377   }
   359   } else {
   378 
   360     _sp_adjustment_by_callee = 0;
   379   // It is important that the frame is fully constructed when we do
   361   }
   380   // this lookup as get_deopt_original_pc() needs a correct value for
   362 
   381   // unextended_sp() which uses _sp_adjustment_by_callee.
   363   _deopt_state = unknown;
       
   364 
       
   365   // It is important that frame be fully construct when we do this lookup
       
   366   // as get_original_pc() needs correct value for unextended_sp()
       
   367   if (_pc != NULL) {
   382   if (_pc != NULL) {
   368     _cb = CodeCache::find_blob(_pc);
       
   369     address original_pc = nmethod::get_deopt_original_pc(this);
   383     address original_pc = nmethod::get_deopt_original_pc(this);
   370     if (original_pc != NULL) {
   384     if (original_pc != NULL) {
   371       _pc = original_pc;
   385       _pc = original_pc;
   372       _deopt_state = is_deoptimized;
   386       _deopt_state = is_deoptimized;
   373     } else {
   387     } else {
   460   // Default is not to follow arguments; update it accordingly below
   474   // Default is not to follow arguments; update it accordingly below
   461   map->set_include_argument_oops(false);
   475   map->set_include_argument_oops(false);
   462 
   476 
   463   if (is_entry_frame()) return sender_for_entry_frame(map);
   477   if (is_entry_frame()) return sender_for_entry_frame(map);
   464 
   478 
   465   intptr_t* younger_sp     = sp();
   479   intptr_t* younger_sp = sp();
   466   intptr_t* sp             = sender_sp();
   480   intptr_t* sp         = sender_sp();
   467   bool      adjusted_stack = false;
       
   468 
   481 
   469   // Note:  The version of this operation on any platform with callee-save
   482   // Note:  The version of this operation on any platform with callee-save
   470   //        registers must update the register map (if not null).
   483   //        registers must update the register map (if not null).
   471   //        In order to do this correctly, the various subtypes of
   484   //        In order to do this correctly, the various subtypes of
   472   //        of frame (interpreted, compiled, glue, native),
   485   //        of frame (interpreted, compiled, glue, native),
   481   // The constructor of the sender must know whether this frame is interpreted so it can set the
   494   // The constructor of the sender must know whether this frame is interpreted so it can set the
   482   // sender's _sp_adjustment_by_callee field.  An osr adapter frame was originally
   495   // sender's _sp_adjustment_by_callee field.  An osr adapter frame was originally
   483   // interpreted but its pc is in the code cache (for c1 -> osr_frame_return_id stub), so it must be
   496   // interpreted but its pc is in the code cache (for c1 -> osr_frame_return_id stub), so it must be
   484   // explicitly recognized.
   497   // explicitly recognized.
   485 
   498 
   486   adjusted_stack = is_interpreted_frame();
   499   bool frame_is_interpreted = is_interpreted_frame();
   487   if (adjusted_stack) {
   500   if (frame_is_interpreted) {
   488     map->make_integer_regs_unsaved();
   501     map->make_integer_regs_unsaved();
   489     map->shift_window(sp, younger_sp);
   502     map->shift_window(sp, younger_sp);
   490   } else if (_cb != NULL) {
   503   } else if (_cb != NULL) {
   491     // Update the locations of implicitly saved registers to be their
   504     // Update the locations of implicitly saved registers to be their
   492     // addresses in the register save area.
   505     // addresses in the register save area.
   501       if (_cb->oop_maps() != NULL) {
   514       if (_cb->oop_maps() != NULL) {
   502         OopMapSet::update_register_map(this, map);
   515         OopMapSet::update_register_map(this, map);
   503       }
   516       }
   504     }
   517     }
   505   }
   518   }
   506   return frame(sp, younger_sp, adjusted_stack);
   519   return frame(sp, younger_sp, frame_is_interpreted);
   507 }
   520 }
   508 
   521 
   509 
   522 
   510 void frame::patch_pc(Thread* thread, address pc) {
   523 void frame::patch_pc(Thread* thread, address pc) {
   511   if(thread == Thread::current()) {
   524   if(thread == Thread::current()) {