Skip to content

Commit

Permalink
Recognize JNI local refs in JNINativeMethodFrames
Browse files Browse the repository at this point in the history
First 8 JNI local refs are directly stored inside the
J9SFJNINativeMethodFrame before allocating J9JNIReferenceFrame to
store additional references. StackWalker should check if the object
pushes from method frame is JNI local when walking O-Slots.

Signed-off-by: Jack Lu <Jack.S.Lu@ibm.com>
  • Loading branch information
fengxue-IS committed Oct 30, 2023
1 parent 4ba8f3d commit cec8a15
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion runtime/vm/swalk.c
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,7 @@ static void
walkMethodFrame(J9StackWalkState * walkState)
{
J9SFMethodFrame * methodFrame = (J9SFMethodFrame *) ((U_8*) walkState->walkSP + (UDATA) walkState->literals);
BOOLEAN isJNINative = (J9SF_FRAME_TYPE_JNI_NATIVE_METHOD == (UDATA)walkState->pc);

walkState->bp = (UDATA *) &(methodFrame->savedA0);
walkState->frameFlags = methodFrame->specialFrameFlags;
Expand Down Expand Up @@ -734,7 +735,7 @@ walkMethodFrame(J9StackWalkState * walkState)
#endif

if ((walkState->flags & J9_STACKWALK_ITERATE_O_SLOTS) && walkState->literals) {
if (walkState->frameFlags & J9_SSF_JNI_REFS_REDIRECTED) {
if ((walkState->frameFlags & J9_SSF_JNI_REFS_REDIRECTED) || isJNINative) {
walkPushedJNIRefs(walkState);
} else {
walkObjectPushes(walkState);
Expand Down

0 comments on commit cec8a15

Please sign in to comment.