OSX/ARM64: fix variadic arguments handling in FFI

This patch fixes the issue introduced by commit
2e2fb8f6b5 ('OSX/iOS: Handle iOS simulator
and ARM64 Macs.'). Within the mentioned commit LJ_TARGET_IOS define is
set via Apple system header to enable several features (e.g. JIT and
external unwinder) on ARM64 Macs, but it's usage was not adjusted
source-wide. This is done for FFI machinery within this commit.

Since all LJ_TARGET_IOS usage is done with LJ_TARGET_ARM64 define being
set, we can simply replace all occurences with LJ_TARGET_OSX.

Reported-by: Nikita Pettik <korablev@tarantool.org>
Signed-off-by: Igor Munkin <imun@cpan.org>
This commit is contained in:
Igor Munkin 2021-04-30 22:15:43 +03:00
parent 75ee3a6159
commit b24e002d3e
No known key found for this signature in database
GPG Key ID: 106CCC88B29A21A1
2 changed files with 5 additions and 5 deletions

View File

@ -334,7 +334,7 @@
isfp = sz == 2*sizeof(float) ? 2 : 1;
#define CCALL_HANDLE_REGARG \
if (LJ_TARGET_IOS && isva) { \
if (LJ_TARGET_OSX && isva) { \
/* IOS: All variadic arguments are on the stack. */ \
} else if (isfp) { /* Try to pass argument in FPRs. */ \
int n2 = ctype_isvector(d->info) ? 1 : \
@ -345,10 +345,10 @@
goto done; \
} else { \
nfpr = CCALL_NARG_FPR; /* Prevent reordering. */ \
if (LJ_TARGET_IOS && d->size < 8) goto err_nyi; \
if (LJ_TARGET_OSX && d->size < 8) goto err_nyi; \
} \
} else { /* Try to pass argument in GPRs. */ \
if (!LJ_TARGET_IOS && (d->info & CTF_ALIGN) > CTALIGN_PTR) \
if (!LJ_TARGET_OSX && (d->info & CTF_ALIGN) > CTALIGN_PTR) \
ngpr = (ngpr + 1u) & ~1u; /* Align to regpair. */ \
if (ngpr + n <= maxgpr) { \
dp = &cc->gpr[ngpr]; \
@ -356,7 +356,7 @@
goto done; \
} else { \
ngpr = maxgpr; /* Prevent reordering. */ \
if (LJ_TARGET_IOS && d->size < 8) goto err_nyi; \
if (LJ_TARGET_OSX && d->size < 8) goto err_nyi; \
} \
}

View File

@ -414,7 +414,7 @@ void lj_ccallback_mcode_free(CTState *cts)
nfpr = CCALL_NARG_FPR; /* Prevent reordering. */ \
} \
} else { \
if (!LJ_TARGET_IOS && n > 1) \
if (!LJ_TARGET_OSX && n > 1) \
ngpr = (ngpr + 1u) & ~1u; /* Align to regpair. */ \
if (ngpr + n <= maxgpr) { \
sp = &cts->cb.gpr[ngpr]; \