From f7dcabbe3613dc2465d3685f057b1893d228977b Mon Sep 17 00:00:00 2001 From: "Brian W. Hart" Date: Wed, 31 Aug 2016 11:04:24 -0500 Subject: [PATCH] luajit-2.1: fix fp parameter passing for ppc64 The POWER 64-bit LE ABI calls for floating point function arguments beyond the 8th to be passed via floating point registers and also to reserve a slot in the parameter save area on the stack. The PPC CCALL_HANDLE_REGARG correctly includes the values in FPRs, but neglects to reserve corresponding slots when spilling into the save area. --- src/lj_ccall.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/lj_ccall.c b/src/lj_ccall.c index 7ff93826..8d358728 100644 --- a/src/lj_ccall.c +++ b/src/lj_ccall.c @@ -390,8 +390,13 @@ if (nfpr + 1 <= CCALL_NARG_FPR) { \ dp = &cc->fpr[nfpr]; \ nfpr += 1; \ - ngpr += 1; /* align GPRs */ \ d = ctype_get(cts, CTID_DOUBLE); /* FPRs always hold doubles. */ \ + if (ngpr + 1 <= maxgpr) \ + ngpr += 1; /* align GPRs */ \ + else if (nsp + 1 <= CCALL_MAXSTACK) \ + nsp += 1; /* align save area slots */ \ + else \ + goto err_nyi; /* Too many args */ \ goto done; \ } \ } else { /* Try to pass argument in GPRs. */ \