@@ -5297,7 +5297,9 @@ class INTERPRETER_CLASS
5297
5297
for (U_8 i = 0 ; i < ffiArgCount; i++) {
5298
5298
U_8 argType = LayoutFFITypeHelpers::getJ9NativeTypeCodeFromFFIType (cif->arg_types [i]);
5299
5299
5300
- if (J9NtcPointer == argType) {
5300
+ if ((0 == ffiArgs[i]) && (J9NtcPointer != argType)) {
5301
+ values[i] = &(ffiArgs[i]);
5302
+ } else if (J9NtcPointer == argType) {
5301
5303
/* ffi_call expects the address of the pointer is the address of the stackslot. */
5302
5304
pointerValues[i] = (U_64)ffiArgs[i];
5303
5305
#if JAVA_SPEC_VERSION >= 22
@@ -5348,15 +5350,13 @@ class INTERPRETER_CLASS
5348
5350
} else {
5349
5351
values[i] = &(ffiArgs[i]);
5350
5352
#if !defined(J9VM_ENV_LITTLE_ENDIAN)
5351
- if (0 != ffiArgs[i]) {
5352
- /* Note: A float number is converted to int by Float.floatToIntBits() in InternalDowncallHandler. */
5353
- if ((J9NtcInt == argType) || (J9NtcFloat == argType)) {
5354
- values[i] = (void *)((U_64)values[i] + extraBytesOfInt);
5355
- } else if ((J9NtcShort == argType) || (J9NtcChar == argType)) {
5356
- values[i] = (void *)((U_64)values[i] + extraBytesOfShortAndChar);
5357
- } else if ((J9NtcBoolean == argType) || (J9NtcByte == argType)) {
5358
- values[i] = (void *)((U_64)values[i] + extraBytesOfBoolAndByte);
5359
- }
5353
+ /* Note: A float number is converted to int by Float.floatToIntBits() in InternalDowncallHandler. */
5354
+ if ((J9NtcInt == argType) || (J9NtcFloat == argType)) {
5355
+ values[i] = (void *)((U_64)values[i] + extraBytesOfInt);
5356
+ } else if ((J9NtcShort == argType) || (J9NtcChar == argType)) {
5357
+ values[i] = (void *)((U_64)values[i] + extraBytesOfShortAndChar);
5358
+ } else if ((J9NtcBoolean == argType) || (J9NtcByte == argType)) {
5359
+ values[i] = (void *)((U_64)values[i] + extraBytesOfBoolAndByte);
5360
5360
}
5361
5361
#endif /* J9VM_ENV_LITTLE_ENDIAN */
5362
5362
}
0 commit comments