Handle calls with max. args in backends even after SPLIT.

This commit is contained in:
Mike Pall 2013-05-16 19:59:38 +02:00
parent 1c7650f782
commit 0f79d4741f
5 changed files with 9 additions and 9 deletions

View File

@ -948,7 +948,7 @@ static void asm_collectargs(ASMState *as, IRIns *ir,
const CCallInfo *ci, IRRef *args) const CCallInfo *ci, IRRef *args)
{ {
uint32_t n = CCI_NARGS(ci); uint32_t n = CCI_NARGS(ci);
lua_assert(n <= CCI_NARGS_MAX); lua_assert(n <= CCI_NARGS_MAX*2); /* Account for split args. */
if ((ci->flags & CCI_L)) { *args++ = ASMREF_L; n--; } if ((ci->flags & CCI_L)) { *args++ = ASMREF_L; n--; }
while (n-- > 1) { while (n-- > 1) {
ir = IR(ir->op1); ir = IR(ir->op1);

View File

@ -464,7 +464,7 @@ static void asm_call(ASMState *as, IRIns *ir)
static void asm_callx(ASMState *as, IRIns *ir) static void asm_callx(ASMState *as, IRIns *ir)
{ {
IRRef args[CCI_NARGS_MAX]; IRRef args[CCI_NARGS_MAX*2];
CCallInfo ci; CCallInfo ci;
IRRef func; IRRef func;
IRIns *irf; IRIns *irf;
@ -2295,7 +2295,7 @@ static void asm_ir(ASMState *as, IRIns *ir)
/* Ensure there are enough stack slots for call arguments. */ /* Ensure there are enough stack slots for call arguments. */
static Reg asm_setup_call_slots(ASMState *as, IRIns *ir, const CCallInfo *ci) static Reg asm_setup_call_slots(ASMState *as, IRIns *ir, const CCallInfo *ci)
{ {
IRRef args[CCI_NARGS_MAX]; IRRef args[CCI_NARGS_MAX*2];
uint32_t i, nargs = (int)CCI_NARGS(ci); uint32_t i, nargs = (int)CCI_NARGS(ci);
int nslots = 0, ngpr = REGARG_NUMGPR, nfpr = REGARG_NUMFPR, fprodd = 0; int nslots = 0, ngpr = REGARG_NUMGPR, nfpr = REGARG_NUMFPR, fprodd = 0;
asm_collectargs(as, ir, ci, args); asm_collectargs(as, ir, ci, args);

View File

@ -337,7 +337,7 @@ static void asm_call(ASMState *as, IRIns *ir)
static void asm_callx(ASMState *as, IRIns *ir) static void asm_callx(ASMState *as, IRIns *ir)
{ {
IRRef args[CCI_NARGS_MAX]; IRRef args[CCI_NARGS_MAX*2];
CCallInfo ci; CCallInfo ci;
IRRef func; IRRef func;
IRIns *irf; IRIns *irf;
@ -1894,7 +1894,7 @@ static void asm_ir(ASMState *as, IRIns *ir)
/* Ensure there are enough stack slots for call arguments. */ /* Ensure there are enough stack slots for call arguments. */
static Reg asm_setup_call_slots(ASMState *as, IRIns *ir, const CCallInfo *ci) static Reg asm_setup_call_slots(ASMState *as, IRIns *ir, const CCallInfo *ci)
{ {
IRRef args[CCI_NARGS_MAX]; IRRef args[CCI_NARGS_MAX*2];
uint32_t i, nargs = (int)CCI_NARGS(ci); uint32_t i, nargs = (int)CCI_NARGS(ci);
int nslots = 4, ngpr = REGARG_NUMGPR, nfpr = REGARG_NUMFPR; int nslots = 4, ngpr = REGARG_NUMGPR, nfpr = REGARG_NUMFPR;
asm_collectargs(as, ir, ci, args); asm_collectargs(as, ir, ci, args);

View File

@ -340,7 +340,7 @@ static void asm_call(ASMState *as, IRIns *ir)
static void asm_callx(ASMState *as, IRIns *ir) static void asm_callx(ASMState *as, IRIns *ir)
{ {
IRRef args[CCI_NARGS_MAX]; IRRef args[CCI_NARGS_MAX*2];
CCallInfo ci; CCallInfo ci;
IRRef func; IRRef func;
IRIns *irf; IRIns *irf;
@ -2092,7 +2092,7 @@ static void asm_ir(ASMState *as, IRIns *ir)
/* Ensure there are enough stack slots for call arguments. */ /* Ensure there are enough stack slots for call arguments. */
static Reg asm_setup_call_slots(ASMState *as, IRIns *ir, const CCallInfo *ci) static Reg asm_setup_call_slots(ASMState *as, IRIns *ir, const CCallInfo *ci)
{ {
IRRef args[CCI_NARGS_MAX]; IRRef args[CCI_NARGS_MAX*2];
uint32_t i, nargs = (int)CCI_NARGS(ci); uint32_t i, nargs = (int)CCI_NARGS(ci);
int nslots = 2, ngpr = REGARG_NUMGPR, nfpr = REGARG_NUMFPR; int nslots = 2, ngpr = REGARG_NUMGPR, nfpr = REGARG_NUMFPR;
asm_collectargs(as, ir, ci, args); asm_collectargs(as, ir, ci, args);

View File

@ -609,7 +609,7 @@ static void *asm_callx_func(ASMState *as, IRIns *irf, IRRef func)
static void asm_callx(ASMState *as, IRIns *ir) static void asm_callx(ASMState *as, IRIns *ir)
{ {
IRRef args[CCI_NARGS_MAX]; IRRef args[CCI_NARGS_MAX*2];
CCallInfo ci; CCallInfo ci;
IRRef func; IRRef func;
IRIns *irf; IRIns *irf;
@ -2742,7 +2742,7 @@ static void asm_ir(ASMState *as, IRIns *ir)
/* Ensure there are enough stack slots for call arguments. */ /* Ensure there are enough stack slots for call arguments. */
static Reg asm_setup_call_slots(ASMState *as, IRIns *ir, const CCallInfo *ci) static Reg asm_setup_call_slots(ASMState *as, IRIns *ir, const CCallInfo *ci)
{ {
IRRef args[CCI_NARGS_MAX]; IRRef args[CCI_NARGS_MAX*2];
int nslots; int nslots;
asm_collectargs(as, ir, ci, args); asm_collectargs(as, ir, ci, args);
nslots = asm_count_call_slots(as, ci, args); nslots = asm_count_call_slots(as, ci, args);