Print this page


Split Close
Expand all
Collapse all
          --- old/src/cpu/sparc/vm/frame_sparc.cpp
          +++ new/src/cpu/sparc/vm/frame_sparc.cpp
↓ open down ↓ 328 lines elided ↑ open up ↑
 329  329    }
 330  330    _deopt_state = unknown;
 331  331  #ifdef ASSERT
 332  332    if ( _cb != NULL && _cb->is_nmethod()) {
 333  333      // Without a valid unextended_sp() we can't convert the pc to "original"
 334  334      assert(!((nmethod*)_cb)->is_deopt_pc(_pc), "invariant broken");
 335  335    }
 336  336  #endif // ASSERT
 337  337  }
 338  338  
 339      -frame::frame(intptr_t* sp, intptr_t* younger_sp, bool younger_frame_adjusted_stack) {
 340      -  _sp = sp;
 341      -  _younger_sp = younger_sp;
      339 +frame::frame(intptr_t* sp, intptr_t* younger_sp, bool younger_frame_is_interpreted) :
      340 +  _sp(sp),
      341 +  _younger_sp(younger_sp),
      342 +  _deopt_state(unknown),
      343 +  _sp_adjustment_by_callee(0) {
 342  344    if (younger_sp == NULL) {
 343  345      // make a deficient frame which doesn't know where its PC is
 344  346      _pc = NULL;
 345  347      _cb = NULL;
 346  348    } else {
 347  349      _pc = (address)younger_sp[I7->sp_offset_in_saved_window()] + pc_return_offset;
 348  350      assert( (intptr_t*)younger_sp[FP->sp_offset_in_saved_window()] == (intptr_t*)((intptr_t)sp - STACK_BIAS), "younger_sp must be valid");
 349  351      // Any frame we ever build should always "safe" therefore we should not have to call
 350  352      // find_blob_unsafe
 351  353      // In case of native stubs, the pc retrieved here might be
 352  354      // wrong.  (the _last_native_pc will have the right value)
 353  355      // So do not put add any asserts on the _pc here.
 354  356    }
 355      -  if (younger_frame_adjusted_stack) {
 356      -    // 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()] +
 358      -                                             STACK_BIAS) - sp;
 359      -  } else {
 360      -    _sp_adjustment_by_callee = 0;
      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 +    }
 361  372    }
 362  373  
 363      -  _deopt_state = unknown;
      374 +  if (younger_frame_is_interpreted) {
      375 +    // compute adjustment to this frame's SP made by its interpreted callee
      376 +    _sp_adjustment_by_callee = (intptr_t*) ((intptr_t) younger_sp[I5_savedSP->sp_offset_in_saved_window()] + STACK_BIAS) - sp;
      377 +  }
 364  378  
 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()
      379 +  // It is important that the frame is fully constructed when we do
      380 +  // this lookup as get_deopt_original_pc() needs a correct value for
      381 +  // unextended_sp() which uses _sp_adjustment_by_callee.
 367  382    if (_pc != NULL) {
 368      -    _cb = CodeCache::find_blob(_pc);
 369  383      address original_pc = nmethod::get_deopt_original_pc(this);
 370  384      if (original_pc != NULL) {
 371  385        _pc = original_pc;
 372  386        _deopt_state = is_deoptimized;
 373  387      } else {
 374  388        _deopt_state = not_deoptimized;
 375  389      }
 376  390    }
 377  391  }
 378  392  
↓ open down ↓ 76 lines elided ↑ open up ↑
 455  469  frame frame::sender(RegisterMap* map) const {
 456  470    assert(map != NULL, "map must be set");
 457  471  
 458  472    assert(CodeCache::find_blob_unsafe(_pc) == _cb, "inconsistent");
 459  473  
 460  474    // Default is not to follow arguments; update it accordingly below
 461  475    map->set_include_argument_oops(false);
 462  476  
 463  477    if (is_entry_frame()) return sender_for_entry_frame(map);
 464  478  
 465      -  intptr_t* younger_sp     = sp();
 466      -  intptr_t* sp             = sender_sp();
 467      -  bool      adjusted_stack = false;
      479 +  intptr_t* younger_sp = sp();
      480 +  intptr_t* sp         = sender_sp();
 468  481  
 469  482    // Note:  The version of this operation on any platform with callee-save
 470  483    //        registers must update the register map (if not null).
 471  484    //        In order to do this correctly, the various subtypes of
 472  485    //        of frame (interpreted, compiled, glue, native),
 473  486    //        must be distinguished.  There is no need on SPARC for
 474  487    //        such distinctions, because all callee-save registers are
 475  488    //        preserved for all frames via SPARC-specific mechanisms.
 476  489    //
 477  490    //        *** HOWEVER, *** if and when we make any floating-point
 478  491    //        registers callee-saved, then we will have to copy over
 479  492    //        the RegisterMap update logic from the Intel code.
 480  493  
 481  494    // The constructor of the sender must know whether this frame is interpreted so it can set the
 482  495    // sender's _sp_adjustment_by_callee field.  An osr adapter frame was originally
 483  496    // interpreted but its pc is in the code cache (for c1 -> osr_frame_return_id stub), so it must be
 484  497    // explicitly recognized.
 485  498  
 486      -  adjusted_stack = is_interpreted_frame();
 487      -  if (adjusted_stack) {
      499 +  bool frame_is_interpreted = is_interpreted_frame();
      500 +  if (frame_is_interpreted) {
 488  501      map->make_integer_regs_unsaved();
 489  502      map->shift_window(sp, younger_sp);
 490  503    } else if (_cb != NULL) {
 491  504      // Update the locations of implicitly saved registers to be their
 492  505      // addresses in the register save area.
 493  506      // For %o registers, the addresses of %i registers in the next younger
 494  507      // frame are used.
 495  508      map->shift_window(sp, younger_sp);
 496  509      if (map->update_map()) {
 497  510        // Tell GC to use argument oopmaps for some runtime stubs that need it.
 498  511        // For C1, the runtime stub might not have oop maps, so set this flag
 499  512        // outside of update_register_map.
 500  513        map->set_include_argument_oops(_cb->caller_must_gc_arguments(map->thread()));
 501  514        if (_cb->oop_maps() != NULL) {
 502  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  523  void frame::patch_pc(Thread* thread, address pc) {
 511  524    if(thread == Thread::current()) {
 512  525     StubRoutines::Sparc::flush_callers_register_windows_func()();
 513  526    }
 514  527    if (TracePcPatching) {
 515  528      // QQQ this assert is invalid (or too strong anyway) sice _pc could
 516  529      // be original pc and frame could have the deopt pc.
↓ open down ↓ 262 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX