diff a/src/hotspot/share/runtime/deoptimization.cpp b/src/hotspot/share/runtime/deoptimization.cpp --- a/src/hotspot/share/runtime/deoptimization.cpp +++ b/src/hotspot/share/runtime/deoptimization.cpp @@ -662,13 +662,21 @@ Events::log_deopt_message(thread, "DEOPT UNPACKING pc=" INTPTR_FORMAT " sp=" INTPTR_FORMAT " mode %d", p2i(stub_frame.pc()), p2i(stub_frame.sp()), exec_mode); UnrollBlock* info = array->unroll_block(); + // We set the last_Java frame. But the stack isn't really parsable here. So we + // clear it to make sure JFR understands not to try and walk stacks from events + // in here. + intptr_t* sp = thread->frame_anchor()->last_Java_sp(); + thread->frame_anchor()->set_last_Java_sp(NULL); + // Unpack the interpreter frames and any adapter frame (c2 only) we might create. array->unpack_to_stack(stub_frame, exec_mode, info->caller_actual_parameters()); + thread->frame_anchor()->set_last_Java_sp(sp); + BasicType bt = info->return_type(); // If we have an exception pending, claim that the return type is an oop // so the deopt_blob does not overwrite the exception_oop. @@ -800,11 +808,10 @@ is_top_frame = false; } } #endif /* !PRODUCT */ - return bt; JRT_END class DeoptimizeMarkedClosure : public HandshakeClosure { public: