Skip to content

Commit

Permalink
Try to do potentially costly operations in is_first_C_frame() as late…
Browse files Browse the repository at this point in the history
… as possible
  • Loading branch information
schmelter-sap committed Nov 22, 2023
1 parent 2c31ca5 commit 125c2ec
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/hotspot/share/runtime/os.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1307,9 +1307,8 @@ bool os::is_first_C_frame(frame* fr) {
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;

uintptr_t old_fp = (uintptr_t)fr->link_or_null();
if (old_fp == 0 || old_fp == (uintptr_t)-1 || old_fp == ufp ||
is_pointer_bad(fr->link_or_null())) return true;
uintptr_t old_fp = (uintptr_t)fr->link();
if (old_fp == 0 || old_fp == (uintptr_t)-1 || 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 @@ -1318,6 +1317,8 @@ 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((intptr_t*) old_fp)) return true;

return false;
}

Expand Down

0 comments on commit 125c2ec

Please sign in to comment.