From 558caee5ec48a30d0dadf3eddf8307fbadb2a725 Mon Sep 17 00:00:00 2001 From: Patricio Chilano Mateo Date: Wed, 8 Jan 2025 15:56:13 -0400 Subject: [PATCH] v1 --- src/hotspot/cpu/aarch64/frame_aarch64.cpp | 4 ++++ src/hotspot/cpu/ppc/frame_ppc.cpp | 4 ++++ src/hotspot/cpu/riscv/frame_riscv.cpp | 4 ++++ src/hotspot/cpu/x86/frame_x86.cpp | 4 ++++ 4 files changed, 16 insertions(+) diff --git a/src/hotspot/cpu/aarch64/frame_aarch64.cpp b/src/hotspot/cpu/aarch64/frame_aarch64.cpp index 361b913fd2ea2..f3da9939db389 100644 --- a/src/hotspot/cpu/aarch64/frame_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/frame_aarch64.cpp @@ -163,6 +163,10 @@ bool frame::safe_for_sender(JavaThread *thread) { } if (Continuation::is_return_barrier_entry(sender_pc)) { + // Check that the frame belongs to a Continuation. + if (!Continuation::is_frame_in_continuation(thread, *this)) { + return false; + } // If our sender_pc is the return barrier, then our "real" sender is the continuation entry frame s = Continuation::continuation_bottom_sender(thread, *this, sender_sp); sender_sp = s.sp(); diff --git a/src/hotspot/cpu/ppc/frame_ppc.cpp b/src/hotspot/cpu/ppc/frame_ppc.cpp index f698b14d312b8..ac9c411f884f2 100644 --- a/src/hotspot/cpu/ppc/frame_ppc.cpp +++ b/src/hotspot/cpu/ppc/frame_ppc.cpp @@ -122,6 +122,10 @@ bool frame::safe_for_sender(JavaThread *thread) { address sender_pc = (address) sender_abi->lr; if (Continuation::is_return_barrier_entry(sender_pc)) { + // Check that the frame belongs to a Continuation. + if (!Continuation::is_frame_in_continuation(thread, *this)) { + return false; + } // If our sender_pc is the return barrier, then our "real" sender is the continuation entry frame s = Continuation::continuation_bottom_sender(thread, *this, sender_sp); sender_sp = s.sp(); diff --git a/src/hotspot/cpu/riscv/frame_riscv.cpp b/src/hotspot/cpu/riscv/frame_riscv.cpp index ecc450bd6b254..ffd5603d15527 100644 --- a/src/hotspot/cpu/riscv/frame_riscv.cpp +++ b/src/hotspot/cpu/riscv/frame_riscv.cpp @@ -158,6 +158,10 @@ bool frame::safe_for_sender(JavaThread *thread) { } if (Continuation::is_return_barrier_entry(sender_pc)) { + // Check that the frame belongs to a Continuation. + if (!Continuation::is_frame_in_continuation(thread, *this)) { + return false; + } // If our sender_pc is the return barrier, then our "real" sender is the continuation entry frame s = Continuation::continuation_bottom_sender(thread, *this, sender_sp); sender_sp = s.sp(); diff --git a/src/hotspot/cpu/x86/frame_x86.cpp b/src/hotspot/cpu/x86/frame_x86.cpp index 4e28dc125341a..a8755cb575a0b 100644 --- a/src/hotspot/cpu/x86/frame_x86.cpp +++ b/src/hotspot/cpu/x86/frame_x86.cpp @@ -154,6 +154,10 @@ bool frame::safe_for_sender(JavaThread *thread) { } if (Continuation::is_return_barrier_entry(sender_pc)) { + // Check that the frame belongs to a Continuation. + if (!Continuation::is_frame_in_continuation(thread, *this)) { + return false; + } // If our sender_pc is the return barrier, then our "real" sender is the continuation entry frame s = Continuation::continuation_bottom_sender(thread, *this, sender_sp); sender_sp = s.sp();