commit b373a40133800b53f23a7b2df721b7c6892d1797
parent 25951e0ea56874731d2bddf3982b1be64bfc79f0
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Fri, 7 May 2010 15:07:41 -0300
new macro 'isgenerational' + new macro 'isold' + better deffinition
for 'isdead', compatible with the code used by 'sweeplist'
Diffstat:
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/lgc.h b/lgc.h
@@ -1,5 +1,5 @@
/*
-** $Id: lgc.h,v 2.36 2010/05/05 18:53:41 roberto Exp roberto $
+** $Id: lgc.h,v 2.37 2010/05/06 18:17:22 roberto Exp roberto $
** Garbage Collector
** See Copyright Notice in lua.h
*/
@@ -39,6 +39,7 @@
#define issweepphase(g) \
(GCSsweepstring <= (g)->gcstate && (g)->gcstate <= GCSsweep)
+#define isgenerational(g) ((g)->gckind == KGC_GEN)
/*
** macro to tell when main invariant (white objects cannot point to black
@@ -48,7 +49,7 @@
** all objects are white again. During a generational collection, the
** invariant must be kept all times.
*/
-#define keepinvariant(g) (g->gckind == KGC_GEN || g->gcstate <= GCSatomic)
+#define keepinvariant(g) (isgenerational(g) || g->gcstate <= GCSatomic)
#define gcstopped(g) ((g)->GCdebt == MIN_LMEM)
@@ -87,8 +88,11 @@
#define isblack(x) testbit((x)->gch.marked, BLACKBIT)
#define isgray(x) (!isblack(x) && !iswhite(x))
+#define isold(x) testbit((x)->gch.marked, OLDBIT)
+
#define otherwhite(g) (g->currentwhite ^ WHITEBITS)
-#define isdead(g,v) ((v)->gch.marked & otherwhite(g) & WHITEBITS)
+#define isdeadm(ow,m) (!(((m) ^ WHITEBITS) & (ow)))
+#define isdead(g,v) isdeadm(otherwhite(g), (v)->gch.marked)
#define changewhite(x) ((x)->gch.marked ^= WHITEBITS)
#define gray2black(x) l_setbit((x)->gch.marked, BLACKBIT)