Skip to content

Commit

Permalink
Remove link_or_null since it was only used in one place.
Browse files Browse the repository at this point in the history
  • Loading branch information
schmelter-sap committed Dec 28, 2023
1 parent 74e3790 commit 64b1a7a
Show file tree
Hide file tree
Showing 9 changed files with 3 additions and 41 deletions.
5 changes: 0 additions & 5 deletions src/hotspot/cpu/aarch64/frame_aarch64.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,6 @@ inline bool frame::is_older(intptr_t* id) const { assert(this->id() != nullptr

inline intptr_t* frame::link() const { return (intptr_t*) *(intptr_t **)addr_at(link_offset); }

inline intptr_t* frame::link_or_null() const {
intptr_t** ptr = (intptr_t **)addr_at(link_offset);
return os::is_readable_pointer(ptr) ? *ptr : nullptr;
}

inline intptr_t* frame::unextended_sp() const { assert_absolute(); return _unextended_sp; }
inline void frame::set_unextended_sp(intptr_t* value) { _unextended_sp = value; }
inline int frame::offset_unextended_sp() const { assert_offset(); return _offset_unextended_sp; }
Expand Down
5 changes: 0 additions & 5 deletions src/hotspot/cpu/arm/frame_arm.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,6 @@ inline bool frame::is_older(intptr_t* id) const { assert(this->id() != nullptr

inline intptr_t* frame::link() const { return (intptr_t*) *(intptr_t **)addr_at(link_offset); }

inline intptr_t* frame::link_or_null() const {
intptr_t** ptr = (intptr_t **)addr_at(link_offset);
return os::is_readable_pointer(ptr) ? *ptr : nullptr;
}

inline intptr_t* frame::unextended_sp() const { return _unextended_sp; }

// Return address:
Expand Down
4 changes: 0 additions & 4 deletions src/hotspot/cpu/ppc/frame_ppc.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,6 @@ inline intptr_t* frame::link() const {
return (intptr_t*)callers_abi()->callers_sp;
}

inline intptr_t* frame::link_or_null() const {
return link();
}

inline intptr_t* frame::real_fp() const {
return fp();
}
Expand Down
5 changes: 0 additions & 5 deletions src/hotspot/cpu/riscv/frame_riscv.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,6 @@ inline bool frame::is_older(intptr_t* id) const { assert(this->id() != nullptr

inline intptr_t* frame::link() const { return (intptr_t*) *(intptr_t **)addr_at(link_offset); }

inline intptr_t* frame::link_or_null() const {
intptr_t** ptr = (intptr_t **)addr_at(link_offset);
return os::is_readable_pointer(ptr) ? *ptr : nullptr;
}

inline intptr_t* frame::unextended_sp() const { assert_absolute(); return _unextended_sp; }
inline void frame::set_unextended_sp(intptr_t* value) { _unextended_sp = value; }
inline int frame::offset_unextended_sp() const { assert_offset(); return _offset_unextended_sp; }
Expand Down
4 changes: 0 additions & 4 deletions src/hotspot/cpu/s390/frame_s390.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,6 @@ inline intptr_t* frame::link() const {
return (intptr_t*) callers_abi()->callers_sp;
}

inline intptr_t* frame::link_or_null() const {
return link();
}

inline intptr_t* frame::interpreter_frame_locals() const {
return (intptr_t*) (ijava_state()->locals);
}
Expand Down
5 changes: 0 additions & 5 deletions src/hotspot/cpu/x86/frame_x86.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,6 @@ inline bool frame::is_older(intptr_t* id) const { assert(this->id() != nullptr

inline intptr_t* frame::link() const { return *(intptr_t **)addr_at(link_offset); }

inline intptr_t* frame::link_or_null() const {
intptr_t** ptr = (intptr_t **)addr_at(link_offset);
return os::is_readable_pointer(ptr) ? *ptr : nullptr;
}

inline intptr_t* frame::unextended_sp() const { assert_absolute(); return _unextended_sp; }
inline void frame::set_unextended_sp(intptr_t* value) { _unextended_sp = value; }
inline int frame::offset_unextended_sp() const { assert_offset(); return _offset_unextended_sp; }
Expand Down
5 changes: 0 additions & 5 deletions src/hotspot/cpu/zero/frame_zero.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,6 @@ inline intptr_t* frame::link() const {
return nullptr;
}

inline intptr_t* frame::link_or_null() const {
ShouldNotCallThis();
return nullptr;
}

inline interpreterState frame::get_interpreterState() const {
return zero_interpreterframe()->interpreter_state();
}
Expand Down
3 changes: 0 additions & 3 deletions src/hotspot/share/runtime/frame.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,6 @@ class frame {
// might crash if the frame has no parent
intptr_t* link() const;

// Link (i.e., the pointer to the previous frame) or null if the link cannot be accessed
intptr_t* link_or_null() const;

// Return address
address sender_pc() const;

Expand Down
8 changes: 3 additions & 5 deletions src/hotspot/share/runtime/os.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1302,13 +1302,10 @@ bool os::is_first_C_frame(frame* fr) {
if (is_pointer_bad(fr->sp())) return true;

uintptr_t ufp = (uintptr_t)fr->fp();
if (is_pointer_bad(fr->fp())) return true;

uintptr_t old_sp = (uintptr_t)fr->sender_sp();
if ((uintptr_t)fr->sender_sp() == (uintptr_t)-1 || is_pointer_bad(fr->sender_sp())) return true;
if (is_pointer_bad((intptr_t*)ufp)) return true;

uintptr_t old_fp = (uintptr_t)fr->link();
if (old_fp == 0 || old_fp == (uintptr_t)-1 || old_fp == ufp) return true;
if (old_fp == 0 || old_fp == ufp) return true;

// stack grows downwards; if old_fp is below current fp or if the stack
// frame is too large, either the stack is corrupted or fp is not saved
Expand All @@ -1317,6 +1314,7 @@ bool os::is_first_C_frame(frame* fr) {
if (old_fp < ufp) return true;
if (old_fp - ufp > 64 * K) return true;

if (is_pointer_bad(fr->sender_sp())) return true;
if (is_pointer_bad((intptr_t*) old_fp)) return true;

return false;
Expand Down

0 comments on commit 64b1a7a

Please sign in to comment.