Skip to content

Commit

Permalink
Increment counter correctly in FFI Upcall on Z
Browse files Browse the repository at this point in the history
When getArgPointer is invoked while an upcall is performed
the gprIndex must be incremented if hidden parameters have
to be accounted for. This commit implements the suggested
change.

Fixes: eclipse-openj9#16214

Signed-off-by: Dhruv Chopra <Dhruv.C.Chopra@ibm.com>
  • Loading branch information
dchopra001 committed Nov 15, 2022
1 parent e0259a6 commit de300b8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions runtime/vm/xz64/UpcallThunkGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,10 @@ getArgPointer(J9UpcallNativeSignature *nativeSig, void *argListPtr, I_32 argIdx)
// where the struct must be stored when we return to native caller. So we must skip over that
// "hiddenParameter" when trying to identify arguments in getArgPointer.
calleeFrameIndex++;
// When the return type is a struct, the buffer where the struct must be populated is initially
// provided in GPR2 by the caller. So we must increment the GPR index as well in order to correctly
// find the position of the current argument pointer.
gprIndex++;
}

I_32 structOffset = 0;
Expand Down

0 comments on commit de300b8

Please sign in to comment.