diff options
author | Mike Pall <mike> | 2010-12-08 19:11:58 +0100 |
---|---|---|
committer | Mike Pall <mike> | 2010-12-08 19:11:58 +0100 |
commit | d0b283e596b3ea7da7438b1a17f4ecfb98e7c97a (patch) | |
tree | 301d5477afe0cb498c1381e039264948d57e1346 /src | |
parent | 6a04591b7b319095dcd4800d31d5d1bcb922c76b (diff) | |
download | luajit-d0b283e596b3ea7da7438b1a17f4ecfb98e7c97a.tar.gz luajit-d0b283e596b3ea7da7438b1a17f4ecfb98e7c97a.tar.bz2 luajit-d0b283e596b3ea7da7438b1a17f4ecfb98e7c97a.zip |
Avoid stack resizes while recording calls to vararg functions.
FUNCV might have been recorded twice (with ill effects).
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 { |