diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2022-11-24 10:20:15 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2022-11-24 10:20:15 -0300 |
commit | 152b51955aabb9dfb32302569fac810e999eda03 (patch) | |
tree | 68a5495c94326ac24023370779d231af468fbd9a /ldo.c | |
parent | ec61be9a7e828bfa366a35658b90f53b1ce39478 (diff) | |
download | lua-152b51955aabb9dfb32302569fac810e999eda03.tar.gz lua-152b51955aabb9dfb32302569fac810e999eda03.tar.bz2 lua-152b51955aabb9dfb32302569fac810e999eda03.zip |
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.)
Diffstat (limited to 'ldo.c')
-rw-r--r-- | ldo.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -416,7 +416,7 @@ static void rethook (lua_State *L, CallInfo *ci, int nres) { | |||
416 | StkId luaD_tryfuncTM (lua_State *L, StkId func) { | 416 | StkId luaD_tryfuncTM (lua_State *L, StkId func) { |
417 | const TValue *tm; | 417 | const TValue *tm; |
418 | StkId p; | 418 | StkId p; |
419 | checkstackGCp(L, 1, func); /* space for metamethod */ | 419 | checkstackp(L, 1, func); /* space for metamethod */ |
420 | tm = luaT_gettmbyobj(L, s2v(func), TM_CALL); /* (after previous GC) */ | 420 | tm = luaT_gettmbyobj(L, s2v(func), TM_CALL); /* (after previous GC) */ |
421 | if (l_unlikely(ttisnil(tm))) | 421 | if (l_unlikely(ttisnil(tm))) |
422 | luaG_callerror(L, s2v(func)); /* nothing to call */ | 422 | luaG_callerror(L, s2v(func)); /* nothing to call */ |
@@ -521,7 +521,7 @@ l_sinline int precallC (lua_State *L, StkId func, int nresults, | |||
521 | lua_CFunction f) { | 521 | lua_CFunction f) { |
522 | int n; /* number of returns */ | 522 | int n; /* number of returns */ |
523 | CallInfo *ci; | 523 | CallInfo *ci; |
524 | checkstackGCp(L, LUA_MINSTACK, func); /* ensure minimum stack size */ | 524 | checkstackp(L, LUA_MINSTACK, func); /* ensure minimum stack size */ |
525 | L->ci = ci = prepCallInfo(L, func, nresults, CIST_C, | 525 | L->ci = ci = prepCallInfo(L, func, nresults, CIST_C, |
526 | L->top.p + LUA_MINSTACK); | 526 | L->top.p + LUA_MINSTACK); |
527 | lua_assert(ci->top.p <= L->stack_last.p); | 527 | lua_assert(ci->top.p <= L->stack_last.p); |
@@ -557,7 +557,7 @@ int luaD_pretailcall (lua_State *L, CallInfo *ci, StkId func, | |||
557 | int fsize = p->maxstacksize; /* frame size */ | 557 | int fsize = p->maxstacksize; /* frame size */ |
558 | int nfixparams = p->numparams; | 558 | int nfixparams = p->numparams; |
559 | int i; | 559 | int i; |
560 | checkstackGCp(L, fsize - delta, func); | 560 | checkstackp(L, fsize - delta, func); |
561 | ci->func.p -= delta; /* restore 'func' (if vararg) */ | 561 | ci->func.p -= delta; /* restore 'func' (if vararg) */ |
562 | for (i = 0; i < narg1; i++) /* move down function and arguments */ | 562 | for (i = 0; i < narg1; i++) /* move down function and arguments */ |
563 | setobjs2s(L, ci->func.p + i, func + i); | 563 | setobjs2s(L, ci->func.p + i, func + i); |
@@ -604,7 +604,7 @@ CallInfo *luaD_precall (lua_State *L, StkId func, int nresults) { | |||
604 | int narg = cast_int(L->top.p - func) - 1; /* number of real arguments */ | 604 | int narg = cast_int(L->top.p - func) - 1; /* number of real arguments */ |
605 | int nfixparams = p->numparams; | 605 | int nfixparams = p->numparams; |
606 | int fsize = p->maxstacksize; /* frame size */ | 606 | int fsize = p->maxstacksize; /* frame size */ |
607 | checkstackGCp(L, fsize, func); | 607 | checkstackp(L, fsize, func); |
608 | L->ci = ci = prepCallInfo(L, func, nresults, 0, func + 1 + fsize); | 608 | L->ci = ci = prepCallInfo(L, func, nresults, 0, func + 1 + fsize); |
609 | ci->u.l.savedpc = p->code; /* starting point */ | 609 | ci->u.l.savedpc = p->code; /* starting point */ |
610 | for (; narg < nfixparams; narg++) | 610 | for (; narg < nfixparams; narg++) |