diff -r d9a157f6fd71 src/hotspot/cpu/x86/frame_x86.cpp --- a/src/hotspot/cpu/x86/frame_x86.cpp Tue Jun 11 07:31:47 2019 -0400 +++ b/src/hotspot/cpu/x86/frame_x86.cpp Wed Jun 12 11:36:30 2019 +0100 @@ -277,17 +277,27 @@ // Either the return address is the original one or we are going to // patch in the same address that's already there. assert(_pc == *pc_addr || pc == *pc_addr, "must be"); + DEBUG_ONLY(address old_pc = _pc;) *pc_addr = pc; _cb = CodeCache::find_blob(pc); + _pc = pc; // must be set before call to get_deopt_original_pc address original_pc = CompiledMethod::get_deopt_original_pc(this); if (original_pc != NULL) { - assert(original_pc == _pc, "expected original PC to be stored before patching"); + assert(original_pc == old_pc, "expected original PC to be stored before patching"); _deopt_state = is_deoptimized; - // leave _pc as is + _pc = original_pc; } else { _deopt_state = not_deoptimized; - _pc = pc; } + assert (!is_compiled_frame() || !_cb->as_compiled_method()->is_deopt_entry(_pc), "must be"); + +#ifdef ASSERT + { + frame f = frame(this->sp(), this->unextended_sp(), this->fp(), pc); + assert(f.is_deoptimized_frame() == this->is_deoptimized_frame() + && f.pc() == this->pc() && f.raw_pc() == this->raw_pc(), "must be"); + } +#endif }