diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2020-07-07 17:38:29 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2020-07-07 17:38:29 -0300 |
commit | dbbe0f7971dfe89368224010352d2c08d13ef44f (patch) | |
tree | 4aedc09477bda5f47ac6d5370e00c078810c468d /ldo.c | |
parent | 0ca522c254911aed6657134959d4f7017dd853e3 (diff) | |
download | lua-github-temporary.tar.gz |
Fixed bug in 'checkstackp'temporary
The macro 'checkstackp' can run a GC step and destroy a preallocated
CallInfo. It has been renamed to 'checkstackGCp' to hint of this
collateral effect.
Diffstat (limited to 'ldo.c')
-rw-r--r-- | ldo.c | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -466,13 +466,13 @@ void luaD_call (lua_State *L, StkId func, int nresults) { f = fvalue(s2v(func)); Cfunc: { int n; /* number of returns */ - CallInfo *ci = next_ci(L); - checkstackp(L, LUA_MINSTACK, func); /* ensure minimum stack size */ + CallInfo *ci; + checkstackGCp(L, LUA_MINSTACK, func); /* ensure minimum stack size */ + L->ci = ci = next_ci(L); ci->nresults = nresults; ci->callstatus = CIST_C; ci->top = L->top + LUA_MINSTACK; ci->func = func; - L->ci = ci; lua_assert(ci->top <= L->stack_last); if (L->hookmask & LUA_MASKCALL) { int narg = cast_int(L->top - func) - 1; @@ -486,12 +486,13 @@ void luaD_call (lua_State *L, StkId func, int nresults) { break; } case LUA_VLCL: { /* Lua function */ - CallInfo *ci = next_ci(L); + CallInfo *ci; Proto *p = clLvalue(s2v(func))->p; int narg = cast_int(L->top - func) - 1; /* number of real arguments */ int nfixparams = p->numparams; int fsize = p->maxstacksize; /* frame size */ - checkstackp(L, fsize, func); + checkstackGCp(L, fsize, func); + L->ci = ci = next_ci(L); ci->nresults = nresults; ci->u.l.savedpc = p->code; /* starting point */ ci->callstatus = 0; @@ -505,7 +506,7 @@ void luaD_call (lua_State *L, StkId func, int nresults) { break; } default: { /* not a function */ - checkstackp(L, 1, func); /* space for metamethod */ + checkstackGCp(L, 1, func); /* space for metamethod */ luaD_tryfuncTM(L, func); /* try to get '__call' metamethod */ goto retry; /* try again with metamethod */ } |