From 152b51955aabb9dfb32302569fac810e999eda03 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Thu, 24 Nov 2022 10:20:15 -0300 Subject: Removed GC checks from function calls Function calls do not create new objects. (It may use memory with stack reallocation, but now that is irrelevant to the GC.) --- ldo.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'ldo.c') diff --git a/ldo.c b/ldo.c index c30cde76..54518aff 100644 --- a/ldo.c +++ b/ldo.c @@ -416,7 +416,7 @@ static void rethook (lua_State *L, CallInfo *ci, int nres) { StkId luaD_tryfuncTM (lua_State *L, StkId func) { const TValue *tm; StkId p; - checkstackGCp(L, 1, func); /* space for metamethod */ + checkstackp(L, 1, func); /* space for metamethod */ tm = luaT_gettmbyobj(L, s2v(func), TM_CALL); /* (after previous GC) */ if (l_unlikely(ttisnil(tm))) luaG_callerror(L, s2v(func)); /* nothing to call */ @@ -521,7 +521,7 @@ l_sinline int precallC (lua_State *L, StkId func, int nresults, lua_CFunction f) { int n; /* number of returns */ CallInfo *ci; - checkstackGCp(L, LUA_MINSTACK, func); /* ensure minimum stack size */ + checkstackp(L, LUA_MINSTACK, func); /* ensure minimum stack size */ L->ci = ci = prepCallInfo(L, func, nresults, CIST_C, L->top.p + LUA_MINSTACK); lua_assert(ci->top.p <= L->stack_last.p); @@ -557,7 +557,7 @@ int luaD_pretailcall (lua_State *L, CallInfo *ci, StkId func, int fsize = p->maxstacksize; /* frame size */ int nfixparams = p->numparams; int i; - checkstackGCp(L, fsize - delta, func); + checkstackp(L, fsize - delta, func); ci->func.p -= delta; /* restore 'func' (if vararg) */ for (i = 0; i < narg1; i++) /* move down function and arguments */ setobjs2s(L, ci->func.p + i, func + i); @@ -604,7 +604,7 @@ CallInfo *luaD_precall (lua_State *L, StkId func, int nresults) { int narg = cast_int(L->top.p - func) - 1; /* number of real arguments */ int nfixparams = p->numparams; int fsize = p->maxstacksize; /* frame size */ - checkstackGCp(L, fsize, func); + checkstackp(L, fsize, func); L->ci = ci = prepCallInfo(L, func, nresults, 0, func + 1 + fsize); ci->u.l.savedpc = p->code; /* starting point */ for (; narg < nfixparams; narg++) -- cgit v1.2.3-55-g6feb