diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/lj_dispatch.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/lj_dispatch.c b/src/lj_dispatch.c index 80a6ef2f..4eb6033b 100644 --- a/src/lj_dispatch.c +++ b/src/lj_dispatch.c | |||
@@ -388,9 +388,12 @@ void LJ_FASTCALL lj_dispatch_ins(lua_State *L, const BCIns *pc) | |||
388 | static int call_init(lua_State *L, GCfunc *fn) | 388 | static int call_init(lua_State *L, GCfunc *fn) |
389 | { | 389 | { |
390 | if (isluafunc(fn)) { | 390 | if (isluafunc(fn)) { |
391 | int numparams = funcproto(fn)->numparams; | 391 | GCproto *pt = funcproto(fn); |
392 | int numparams = pt->numparams; | ||
392 | int gotparams = (int)(L->top - L->base); | 393 | int gotparams = (int)(L->top - L->base); |
393 | lj_state_checkstack(L, (MSize)numparams); | 394 | int need = pt->framesize; |
395 | if ((pt->flags & PROTO_IS_VARARG)) need += 1+gotparams; | ||
396 | lj_state_checkstack(L, (MSize)need); | ||
394 | numparams -= gotparams; | 397 | numparams -= gotparams; |
395 | return numparams >= 0 ? numparams : 0; | 398 | return numparams >= 0 ? numparams : 0; |
396 | } else { | 399 | } else { |