mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-08 15:34:09 +00:00
Fix single-precision floating point parameters passed on stack.
The opposite way round to the registers for some reason.
This commit is contained in:
parent
86a24eac4a
commit
938f964b6a
@ -1000,7 +1000,7 @@ static int ccall_set_args(lua_State *L, CTState *cts, CType *ct,
|
|||||||
CTypeID did;
|
CTypeID did;
|
||||||
CType *d;
|
CType *d;
|
||||||
CTSize sz;
|
CTSize sz;
|
||||||
MSize n, isfp = 0, isva = 0;
|
MSize n, isfp = 0, isva = 0, onstack = 0;
|
||||||
void *dp, *rp = NULL;
|
void *dp, *rp = NULL;
|
||||||
|
|
||||||
if (fid) { /* Get argument type from field. */
|
if (fid) { /* Get argument type from field. */
|
||||||
@ -1040,6 +1040,7 @@ static int ccall_set_args(lua_State *L, CTState *cts, CType *ct,
|
|||||||
CCALL_HANDLE_REGARG /* Handle register arguments. */
|
CCALL_HANDLE_REGARG /* Handle register arguments. */
|
||||||
|
|
||||||
/* Otherwise pass argument on stack. */
|
/* Otherwise pass argument on stack. */
|
||||||
|
onstack = 1;
|
||||||
if (CCALL_ALIGN_STACKARG && !rp && (d->info & CTF_ALIGN) > CTALIGN_PTR) {
|
if (CCALL_ALIGN_STACKARG && !rp && (d->info & CTF_ALIGN) > CTALIGN_PTR) {
|
||||||
MSize align = (1u << ctype_align(d->info-CTALIGN_PTR)) -1;
|
MSize align = (1u << ctype_align(d->info-CTALIGN_PTR)) -1;
|
||||||
nsp = (nsp + align) & ~align; /* Align argument on stack. */
|
nsp = (nsp + align) & ~align; /* Align argument on stack. */
|
||||||
@ -1076,8 +1077,9 @@ static int ccall_set_args(lua_State *L, CTState *cts, CType *ct,
|
|||||||
#endif
|
#endif
|
||||||
#if LJ_TARGET_S390X
|
#if LJ_TARGET_S390X
|
||||||
/* Arguments need to be sign-/zero-extended to 64-bits. */
|
/* Arguments need to be sign-/zero-extended to 64-bits. */
|
||||||
if ((ctype_isinteger_or_bool(d->info) || ctype_isenum(d->info)) && d->size <= 4) {
|
if ((ctype_isinteger_or_bool(d->info) || ctype_isenum(d->info) ||
|
||||||
if (d->info & CTF_UNSIGNED)
|
(isfp && onstack)) && d->size <= 4) {
|
||||||
|
if (d->info & CTF_UNSIGNED || isfp)
|
||||||
*(uint64_t *)dp = (uint64_t)*(uint32_t *)dp;
|
*(uint64_t *)dp = (uint64_t)*(uint32_t *)dp;
|
||||||
else
|
else
|
||||||
*(int64_t *)dp = (int64_t)*(int32_t *)dp;
|
*(int64_t *)dp = (int64_t)*(int32_t *)dp;
|
||||||
|
Loading…
Reference in New Issue
Block a user