aboutsummaryrefslogtreecommitdiff
path: root/lgc.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2022-12-09 16:35:19 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2022-12-09 16:35:19 -0300
commitfa2f294dd1269115bf9cf534dd38553e2f606801 (patch)
treedec31b0dfbf6c316c5eee6fc8c0b7f3028598aa9 /lgc.c
parent82fae58e25b7e2be6390238ce60d5678b24dce44 (diff)
downloadlua-fa2f294dd1269115bf9cf534dd38553e2f606801.tar.gz
lua-fa2f294dd1269115bf9cf534dd38553e2f606801.tar.bz2
lua-fa2f294dd1269115bf9cf534dd38553e2f606801.zip
Reduce calls to 'luaC_step' when GC is stopped
Diffstat (limited to 'lgc.c')
-rw-r--r--lgc.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/lgc.c b/lgc.c
index 2e749902..a3094ff5 100644
--- a/lgc.c
+++ b/lgc.c
@@ -1681,12 +1681,15 @@ static void incstep (lua_State *L, global_State *g) {
1681} 1681}
1682 1682
1683/* 1683/*
1684** performs a basic GC step if collector is running 1684** Performs a basic GC step if collector is running. (If collector is
1685** not running, set a reasonable debt to avoid it being called at
1686** every single check.)
1685*/ 1687*/
1686void luaC_step (lua_State *L) { 1688void luaC_step (lua_State *L) {
1687 global_State *g = G(L); 1689 global_State *g = G(L);
1688 lua_assert(!g->gcemergency); 1690 if (!gcrunning(g)) /* not running? */
1689 if (gcrunning(g)) { /* running? */ 1691 luaE_setdebt(g, -2000);
1692 else {
1690 if(isdecGCmodegen(g)) 1693 if(isdecGCmodegen(g))
1691 genstep(L, g); 1694 genstep(L, g);
1692 else 1695 else