|
@@ -1,5 +1,5 @@
|
|
|
/*
|
|
|
-** $Id: ldo.c,v 2.135 2014/11/11 17:13:39 roberto Exp roberto $
|
|
|
+** $Id: ldo.c,v 2.136 2015/03/06 19:49:50 roberto Exp roberto $
|
|
|
** Stack and Call structure of Lua
|
|
|
** See Copyright Notice in lua.h
|
|
|
*/
|
|
@@ -323,6 +323,7 @@ int luaD_precall (lua_State *L, StkId func, int nresults) {
|
|
|
case LUA_TCCL: { /* C closure */
|
|
|
f = clCvalue(func)->f;
|
|
|
Cfunc:
|
|
|
+ luaC_checkGC(L); /* stack grow uses memory */
|
|
|
luaD_checkstack(L, LUA_MINSTACK); /* ensure minimum stack size */
|
|
|
ci = next_ci(L); /* now 'enter' new function */
|
|
|
ci->nresults = nresults;
|
|
@@ -330,7 +331,6 @@ int luaD_precall (lua_State *L, StkId func, int nresults) {
|
|
|
ci->top = L->top + LUA_MINSTACK;
|
|
|
lua_assert(ci->top <= L->stack_last);
|
|
|
ci->callstatus = 0;
|
|
|
- luaC_checkGC(L); /* stack grow uses memory */
|
|
|
if (L->hookmask & LUA_MASKCALL)
|
|
|
luaD_hook(L, LUA_HOOKCALL, -1);
|
|
|
lua_unlock(L);
|
|
@@ -344,6 +344,7 @@ int luaD_precall (lua_State *L, StkId func, int nresults) {
|
|
|
StkId base;
|
|
|
Proto *p = clLvalue(func)->p;
|
|
|
n = cast_int(L->top - func) - 1; /* number of real arguments */
|
|
|
+ luaC_checkGC(L); /* stack grow uses memory */
|
|
|
luaD_checkstack(L, p->maxstacksize);
|
|
|
for (; n < p->numparams; n++)
|
|
|
setnilvalue(L->top++); /* complete missing arguments */
|
|
@@ -364,7 +365,6 @@ int luaD_precall (lua_State *L, StkId func, int nresults) {
|
|
|
ci->u.l.savedpc = p->code; /* starting point */
|
|
|
ci->callstatus = CIST_LUA;
|
|
|
L->top = ci->top;
|
|
|
- luaC_checkGC(L); /* stack grow uses memory */
|
|
|
if (L->hookmask & LUA_MASKCALL)
|
|
|
callhook(L, ci);
|
|
|
return 0;
|
|
@@ -393,7 +393,7 @@ int luaD_poscall (lua_State *L, StkId firstResult) {
|
|
|
}
|
|
|
res = ci->func; /* res == final position of 1st result */
|
|
|
wanted = ci->nresults;
|
|
|
- L->ci = ci = ci->previous; /* back to caller */
|
|
|
+ L->ci = ci->previous; /* back to caller */
|
|
|
/* move results to correct place */
|
|
|
for (i = wanted; i != 0 && firstResult < L->top; i--)
|
|
|
setobjs2s(L, res++, firstResult++);
|