From 8da245bfd2a767e1a738c2a85492d1f64d68f016 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 11 Dec 2009 19:31:14 -0200 Subject: better to keep GC state numbers sequential, to optimize switch in 'singlestep' --- lgc.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'lgc.c') diff --git a/lgc.c b/lgc.c index 2d042390..286b2213 100644 --- a/lgc.c +++ b/lgc.c @@ -1,5 +1,5 @@ /* -** $Id: lgc.c,v 2.63 2009/11/26 11:39:20 roberto Exp roberto $ +** $Id: lgc.c,v 2.64 2009/12/11 19:14:59 roberto Exp roberto $ ** Garbage Collector ** See Copyright Notice in lua.h */ @@ -786,12 +786,12 @@ void luaC_step (lua_State *L) { /* -** advances the garbage collector until it reaches a "valid" state -** (defined by the caller) +** advances the garbage collector until it reaches a state allowed +** by 'statemask' */ -void luaC_runtilstate (lua_State *L, int validstates) { +void luaC_runtilstate (lua_State *L, int statesmask) { global_State *g = G(L); - while (!(g->gcstate & validstates)) + while (!testbit(statesmask, g->gcstate)) singlestep(L); } @@ -811,13 +811,13 @@ void luaC_fullgc (lua_State *L, int isemergency) { g->gcstate = GCSsweepstring; } /* finish any pending sweep phase */ - luaC_runtilstate(L, ~(GCSsweepstring | GCSsweep)); + luaC_runtilstate(L, ~bit2mask(GCSsweepstring, GCSsweep)); markroot(L); /* start a new collection */ /* run collector up to finalizers */ - luaC_runtilstate(L, GCSfinalize); + luaC_runtilstate(L, bitmask(GCSfinalize)); g->gckind = KGC_NORMAL; if (!isemergency) /* do not run finalizers during emergency GC */ - luaC_runtilstate(L, ~GCSfinalize); + luaC_runtilstate(L, ~bitmask(GCSfinalize)); g->GCthreshold = (g->totalbytes/100) * g->gcpause; } -- cgit v1.2.3-55-g6feb