aboutsummaryrefslogtreecommitdiff
path: root/lgc.c
diff options
context:
space:
mode:
Diffstat (limited to 'lgc.c')
-rw-r--r--lgc.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/lgc.c b/lgc.c
index 2d042390..286b2213 100644
--- a/lgc.c
+++ b/lgc.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lgc.c,v 2.63 2009/11/26 11:39:20 roberto Exp roberto $ 2** $Id: lgc.c,v 2.64 2009/12/11 19:14:59 roberto Exp roberto $
3** Garbage Collector 3** Garbage Collector
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -786,12 +786,12 @@ void luaC_step (lua_State *L) {
786 786
787 787
788/* 788/*
789** advances the garbage collector until it reaches a "valid" state 789** advances the garbage collector until it reaches a state allowed
790** (defined by the caller) 790** by 'statemask'
791*/ 791*/
792void luaC_runtilstate (lua_State *L, int validstates) { 792void luaC_runtilstate (lua_State *L, int statesmask) {
793 global_State *g = G(L); 793 global_State *g = G(L);
794 while (!(g->gcstate & validstates)) 794 while (!testbit(statesmask, g->gcstate))
795 singlestep(L); 795 singlestep(L);
796} 796}
797 797
@@ -811,13 +811,13 @@ void luaC_fullgc (lua_State *L, int isemergency) {
811 g->gcstate = GCSsweepstring; 811 g->gcstate = GCSsweepstring;
812 } 812 }
813 /* finish any pending sweep phase */ 813 /* finish any pending sweep phase */
814 luaC_runtilstate(L, ~(GCSsweepstring | GCSsweep)); 814 luaC_runtilstate(L, ~bit2mask(GCSsweepstring, GCSsweep));
815 markroot(L); /* start a new collection */ 815 markroot(L); /* start a new collection */
816 /* run collector up to finalizers */ 816 /* run collector up to finalizers */
817 luaC_runtilstate(L, GCSfinalize); 817 luaC_runtilstate(L, bitmask(GCSfinalize));
818 g->gckind = KGC_NORMAL; 818 g->gckind = KGC_NORMAL;
819 if (!isemergency) /* do not run finalizers during emergency GC */ 819 if (!isemergency) /* do not run finalizers during emergency GC */
820 luaC_runtilstate(L, ~GCSfinalize); 820 luaC_runtilstate(L, ~bitmask(GCSfinalize));
821 g->GCthreshold = (g->totalbytes/100) * g->gcpause; 821 g->GCthreshold = (g->totalbytes/100) * g->gcpause;
822} 822}
823 823