lua

A copy of the Lua development repository
Log | Files | Refs | README

commit 31829ad1770223833bcbdab634e25cdfd911633d
parent c2361e0b6108a2e7e53dcfcdc3a569fcc4a1e31d
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date:   Fri, 11 May 2012 16:22:09 -0300

test for whether collector is running moved from function to
macro 'luaC_condGC'.

Diffstat:
Mlapi.c | 6+++---
Mlgc.c | 14+++-----------
Mlgc.h | 4++--
3 files changed, 8 insertions(+), 16 deletions(-)

diff --git a/lapi.c b/lapi.c @@ -1,5 +1,5 @@ /* -** $Id: lapi.c,v 2.158 2011/11/29 15:55:08 roberto Exp roberto $ +** $Id: lapi.c,v 2.159 2011/11/30 12:32:05 roberto Exp roberto $ ** Lua API ** See Copyright Notice in lua.h */ @@ -1046,11 +1046,11 @@ LUA_API int lua_gc (lua_State *L, int what, int data) { case LUA_GCSTEP: { if (g->gckind == KGC_GEN) { /* generational mode? */ res = (g->lastmajormem == 0); /* 1 if will do major collection */ - luaC_forcestep(L); /* do a single step */ + luaC_step(L); /* do a single step */ } else { while (data-- >= 0) { - luaC_forcestep(L); + luaC_step(L); if (g->gcstate == GCSpause) { /* end of cycle? */ res = 1; /* signal it */ break; diff --git a/lgc.c b/lgc.c @@ -1,5 +1,5 @@ /* -** $Id: lgc.c,v 2.119 2012/01/25 21:05:40 roberto Exp roberto $ +** $Id: lgc.c,v 2.120 2012/05/08 13:53:33 roberto Exp roberto $ ** Garbage Collector ** See Copyright Notice in lua.h */ @@ -1069,9 +1069,9 @@ static void step (lua_State *L) { /* -** performs a basic GC step even if the collector is stopped +** performs a basic GC step */ -void luaC_forcestep (lua_State *L) { +void luaC_step (lua_State *L) { global_State *g = G(L); int i; if (isgenerational(g)) generationalcollection(L); @@ -1082,14 +1082,6 @@ void luaC_forcestep (lua_State *L) { /* -** performs a basic GC step only if collector is running -*/ -void luaC_step (lua_State *L) { - if (G(L)->gcrunning) luaC_forcestep(L); -} - - -/* ** performs a full GC cycle; if "isemergency", does not call ** finalizers (which could change stack positions) */ diff --git a/lgc.h b/lgc.h @@ -1,5 +1,5 @@ /* -** $Id: lgc.h,v 2.52 2011/10/03 17:54:25 roberto Exp roberto $ +** $Id: lgc.h,v 2.53 2012/01/23 20:29:12 roberto Exp roberto $ ** Garbage Collector ** See Copyright Notice in lua.h */ @@ -104,7 +104,7 @@ #define luaC_condGC(L,c) \ - {if (G(L)->GCdebt > 0) {c;}; condchangemem(L);} + {if (G(L)->GCdebt > 0 && G(L)->gcrunning) {c;}; condchangemem(L);} #define luaC_checkGC(L) luaC_condGC(L, luaC_step(L);)