From ee6c39175bc47608282c52c575ce908399349e7c Mon Sep 17 00:00:00 2001 From: Richard Reingruber Date: Wed, 5 Oct 2022 14:10:02 +0000 Subject: [PATCH] 8289925: Shared code shouldn't reference the platform specific method frame::interpreter_frame_last_sp() Reviewed-by: eosterlund, dlong --- src/hotspot/cpu/ppc/frame_ppc.hpp | 2 -- src/hotspot/cpu/ppc/frame_ppc.inline.hpp | 5 ----- src/hotspot/cpu/s390/frame_s390.hpp | 2 -- src/hotspot/cpu/s390/frame_s390.inline.hpp | 5 ----- src/hotspot/cpu/zero/frame_zero.hpp | 2 -- src/hotspot/cpu/zero/frame_zero.inline.hpp | 5 ----- src/hotspot/share/runtime/continuation.cpp | 14 +++++++++----- 7 files changed, 9 insertions(+), 26 deletions(-) diff --git a/src/hotspot/cpu/ppc/frame_ppc.hpp b/src/hotspot/cpu/ppc/frame_ppc.hpp index 3b280b0f1e2..ba4438d1b21 100644 --- a/src/hotspot/cpu/ppc/frame_ppc.hpp +++ b/src/hotspot/cpu/ppc/frame_ppc.hpp @@ -395,8 +395,6 @@ inline void interpreter_frame_set_top_frame_sp(intptr_t* top_frame_sp); inline void interpreter_frame_set_sender_sp(intptr_t* sender_sp); - inline intptr_t* interpreter_frame_last_sp() const; - template static void update_map_with_saved_link(RegisterMapT* map, intptr_t** link_addr); diff --git a/src/hotspot/cpu/ppc/frame_ppc.inline.hpp b/src/hotspot/cpu/ppc/frame_ppc.inline.hpp index a1c8f5792c9..37beacd9a62 100644 --- a/src/hotspot/cpu/ppc/frame_ppc.inline.hpp +++ b/src/hotspot/cpu/ppc/frame_ppc.inline.hpp @@ -257,11 +257,6 @@ inline void frame::interpreted_frame_oop_map(InterpreterOopMap* mask) const { Unimplemented(); } -inline intptr_t* frame::interpreter_frame_last_sp() const { - Unimplemented(); - return NULL; -} - inline int frame::sender_sp_ret_address_offset() { Unimplemented(); return 0; diff --git a/src/hotspot/cpu/s390/frame_s390.hpp b/src/hotspot/cpu/s390/frame_s390.hpp index 64210147f0f..fffed836a7f 100644 --- a/src/hotspot/cpu/s390/frame_s390.hpp +++ b/src/hotspot/cpu/s390/frame_s390.hpp @@ -480,8 +480,6 @@ address* sender_pc_addr(void) const; public: - inline intptr_t* interpreter_frame_last_sp() const; - template static void update_map_with_saved_link(RegisterMapT* map, intptr_t** link_addr); diff --git a/src/hotspot/cpu/s390/frame_s390.inline.hpp b/src/hotspot/cpu/s390/frame_s390.inline.hpp index 2ebbd679437..126baaf8978 100644 --- a/src/hotspot/cpu/s390/frame_s390.inline.hpp +++ b/src/hotspot/cpu/s390/frame_s390.inline.hpp @@ -326,11 +326,6 @@ inline void frame::interpreted_frame_oop_map(InterpreterOopMap* mask) const { Unimplemented(); } -inline intptr_t* frame::interpreter_frame_last_sp() const { - Unimplemented(); - return NULL; -} - inline int frame::sender_sp_ret_address_offset() { Unimplemented(); return 0; diff --git a/src/hotspot/cpu/zero/frame_zero.hpp b/src/hotspot/cpu/zero/frame_zero.hpp index bc8e45543a1..e5cce2dc4c8 100644 --- a/src/hotspot/cpu/zero/frame_zero.hpp +++ b/src/hotspot/cpu/zero/frame_zero.hpp @@ -81,8 +81,6 @@ inline address* sender_pc_addr() const; - inline intptr_t* interpreter_frame_last_sp() const; - template static void update_map_with_saved_link(RegisterMapT* map, intptr_t** link_addr); diff --git a/src/hotspot/cpu/zero/frame_zero.inline.hpp b/src/hotspot/cpu/zero/frame_zero.inline.hpp index bec224337e8..966360d3064 100644 --- a/src/hotspot/cpu/zero/frame_zero.inline.hpp +++ b/src/hotspot/cpu/zero/frame_zero.inline.hpp @@ -190,11 +190,6 @@ inline void frame::interpreted_frame_oop_map(InterpreterOopMap* mask) const { Unimplemented(); } -inline intptr_t* frame::interpreter_frame_last_sp() const { - Unimplemented(); - return NULL; -} - inline int frame::sender_sp_ret_address_offset() { Unimplemented(); return 0; diff --git a/src/hotspot/share/runtime/continuation.cpp b/src/hotspot/share/runtime/continuation.cpp index eebb77d03bf..3903521cc44 100644 --- a/src/hotspot/share/runtime/continuation.cpp +++ b/src/hotspot/share/runtime/continuation.cpp @@ -135,12 +135,17 @@ bool Continuation::is_continuation_entry_frame(const frame& f, const RegisterMap return m != nullptr && m->intrinsic_id() == vmIntrinsics::_Continuation_enter; } +// The parameter `sp` should be the actual sp and not the unextended sp because at +// least on PPC64 unextended_sp < sp is possible as interpreted frames are trimmed +// to the actual size of the expression stack before calls. The problem there is +// that even unextended_sp < entry_sp < sp is possible for an interpreted frame. static inline bool is_sp_in_continuation(const ContinuationEntry* entry, intptr_t* const sp) { + // entry_sp() returns the unextended_sp which is always greater or equal to the actual sp return entry->entry_sp() > sp; } bool Continuation::is_frame_in_continuation(const ContinuationEntry* entry, const frame& f) { - return is_sp_in_continuation(entry, f.unextended_sp()); + return is_sp_in_continuation(entry, f.sp()); } ContinuationEntry* Continuation::get_continuation_entry_for_sp(JavaThread* thread, intptr_t* const sp) { @@ -160,7 +165,7 @@ ContinuationEntry* Continuation::get_continuation_entry_for_entry_frame(JavaThre } bool Continuation::is_frame_in_continuation(JavaThread* thread, const frame& f) { - return f.is_heap_frame() || (get_continuation_entry_for_sp(thread, f.unextended_sp()) != nullptr); + return f.is_heap_frame() || (get_continuation_entry_for_sp(thread, f.sp()) != nullptr); } static frame continuation_top_frame(const ContinuationWrapper& cont, RegisterMap* map) { @@ -296,9 +301,8 @@ bool Continuation::unpin(JavaThread* current) { frame Continuation::continuation_bottom_sender(JavaThread* thread, const frame& callee, intptr_t* sender_sp) { assert (thread != nullptr, ""); - ContinuationEntry* ce = get_continuation_entry_for_sp(thread, - callee.is_interpreted_frame() ? callee.interpreter_frame_last_sp() : callee.unextended_sp()); - assert(ce != nullptr, "callee.unextended_sp(): " INTPTR_FORMAT, p2i(callee.unextended_sp())); + ContinuationEntry* ce = get_continuation_entry_for_sp(thread, callee.sp()); + assert(ce != nullptr, "callee.sp(): " INTPTR_FORMAT, p2i(callee.sp())); log_develop_debug(continuations)("continuation_bottom_sender: [" JLONG_FORMAT "] [%d] callee: " INTPTR_FORMAT " sender_sp: " INTPTR_FORMAT,