From a33aa65fbc70a91fe21e9016c393bb5a764cd75a Mon Sep 17 00:00:00 2001 From: Serguei Spitsyn Date: Thu, 30 Oct 2025 14:24:00 +0000 Subject: [PATCH] 8369609: calls from Continuations to invalidate_jvmti_stack must be more accurate Reviewed-by: pchilanomate, dholmes --- .../share/runtime/continuationFreezeThaw.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/hotspot/share/runtime/continuationFreezeThaw.cpp b/src/hotspot/share/runtime/continuationFreezeThaw.cpp index 3e509e71551..78aa532b28b 100644 --- a/src/hotspot/share/runtime/continuationFreezeThaw.cpp +++ b/src/hotspot/share/runtime/continuationFreezeThaw.cpp @@ -1626,13 +1626,15 @@ static void invalidate_jvmti_stack(JavaThread* thread) { } static void jvmti_yield_cleanup(JavaThread* thread, ContinuationWrapper& cont) { - if (!cont.entry()->is_virtual_thread() && JvmtiExport::has_frame_pops(thread)) { - int num_frames = num_java_frames(cont); + if (!cont.entry()->is_virtual_thread()) { + if (JvmtiExport::has_frame_pops(thread)) { + int num_frames = num_java_frames(cont); - ContinuationWrapper::SafepointOp so(Thread::current(), cont); - JvmtiExport::continuation_yield_cleanup(JavaThread::current(), num_frames); + ContinuationWrapper::SafepointOp so(Thread::current(), cont); + JvmtiExport::continuation_yield_cleanup(thread, num_frames); + } + invalidate_jvmti_stack(thread); } - invalidate_jvmti_stack(thread); } static void jvmti_mount_end(JavaThread* current, ContinuationWrapper& cont, frame top) { @@ -2310,7 +2312,7 @@ NOINLINE intptr_t* Thaw::thaw_slow(stackChunkOop chunk, Continuation::t assert(_cont.chunk_invariant(), ""); - JVMTI_ONLY(invalidate_jvmti_stack(_thread)); + JVMTI_ONLY(if (!_cont.entry()->is_virtual_thread()) invalidate_jvmti_stack(_thread)); _thread->set_cont_fastpath(_fastpath);