mirror of https://github.com/rusefi/lua.git
Reduce calls to 'luaC_step' when GC is stopped
This commit is contained in:
parent
82fae58e25
commit
fa2f294dd1
9
lgc.c
9
lgc.c
|
@ -1681,12 +1681,15 @@ static void incstep (lua_State *L, global_State *g) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** performs a basic GC step if collector is running
|
** Performs a basic GC step if collector is running. (If collector is
|
||||||
|
** not running, set a reasonable debt to avoid it being called at
|
||||||
|
** every single check.)
|
||||||
*/
|
*/
|
||||||
void luaC_step (lua_State *L) {
|
void luaC_step (lua_State *L) {
|
||||||
global_State *g = G(L);
|
global_State *g = G(L);
|
||||||
lua_assert(!g->gcemergency);
|
if (!gcrunning(g)) /* not running? */
|
||||||
if (gcrunning(g)) { /* running? */
|
luaE_setdebt(g, -2000);
|
||||||
|
else {
|
||||||
if(isdecGCmodegen(g))
|
if(isdecGCmodegen(g))
|
||||||
genstep(L, g);
|
genstep(L, g);
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue