Fix ffi calls returning structs.

This commit is contained in:
Michael Munday 2017-01-11 12:13:12 -05:00
parent f660d36138
commit 5c697cc772

View File

@ -559,9 +559,8 @@
/* -- POSIX/s390x calling conventions --------------------------------------- */ /* -- POSIX/s390x calling conventions --------------------------------------- */
#define CCALL_HANDLE_STRUCTRET \ #define CCALL_HANDLE_STRUCTRET \
/* Return structs of size 1, 2, 4 or 8 in a GPR. */ \ cc->retref = 1; /* Return all structs by reference. */ \
cc->retref = !(sz == 1 || sz == 2 || sz == 4 || sz == 8); \ cc->gpr[ngpr++] = (GPRArg)dp;
if (cc->retref) cc->gpr[ngpr++] = (GPRArg)dp;
#define CCALL_HANDLE_COMPLEXRET \ #define CCALL_HANDLE_COMPLEXRET \
cc->retref = 1; /* Return all complex values by reference. */ \ cc->retref = 1; /* Return all complex values by reference. */ \
@ -579,6 +578,7 @@
#define CCALL_HANDLE_COMPLEXARG \ #define CCALL_HANDLE_COMPLEXARG \
/* Pass complex numbers by reference. */ \ /* Pass complex numbers by reference. */ \
/* TODO: not sure why this is different to structs. */ \
rp = cdataptr(lj_cdata_new(cts, did, sz)); \ rp = cdataptr(lj_cdata_new(cts, did, sz)); \
sz = CTSIZE_PTR; \ sz = CTSIZE_PTR; \