diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-05-07 15:08:05 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-05-07 15:08:05 -0300 |
| commit | b373a40133800b53f23a7b2df721b7c6892d1797 (patch) | |
| tree | 5c926ee08213d92e9995d630a061c7c928f2c107 | |
| parent | 25951e0ea56874731d2bddf3982b1be64bfc79f0 (diff) | |
| download | lua-b373a40133800b53f23a7b2df721b7c6892d1797.tar.gz lua-b373a40133800b53f23a7b2df721b7c6892d1797.tar.bz2 lua-b373a40133800b53f23a7b2df721b7c6892d1797.zip | |
new macro 'isgenerational' + new macro 'isold' + better deffinition
for 'isdead', compatible with the code used by 'sweeplist'
| -rw-r--r-- | lgc.h | 10 |
1 files changed, 7 insertions, 3 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lgc.h,v 2.36 2010/05/05 18:53:41 roberto Exp roberto $ | 2 | ** $Id: lgc.h,v 2.37 2010/05/06 18:17:22 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 | */ |
| @@ -39,6 +39,7 @@ | |||
| 39 | #define issweepphase(g) \ | 39 | #define issweepphase(g) \ |
| 40 | (GCSsweepstring <= (g)->gcstate && (g)->gcstate <= GCSsweep) | 40 | (GCSsweepstring <= (g)->gcstate && (g)->gcstate <= GCSsweep) |
| 41 | 41 | ||
| 42 | #define isgenerational(g) ((g)->gckind == KGC_GEN) | ||
| 42 | 43 | ||
| 43 | /* | 44 | /* |
| 44 | ** macro to tell when main invariant (white objects cannot point to black | 45 | ** macro to tell when main invariant (white objects cannot point to black |
| @@ -48,7 +49,7 @@ | |||
| 48 | ** all objects are white again. During a generational collection, the | 49 | ** all objects are white again. During a generational collection, the |
| 49 | ** invariant must be kept all times. | 50 | ** invariant must be kept all times. |
| 50 | */ | 51 | */ |
| 51 | #define keepinvariant(g) (g->gckind == KGC_GEN || g->gcstate <= GCSatomic) | 52 | #define keepinvariant(g) (isgenerational(g) || g->gcstate <= GCSatomic) |
| 52 | 53 | ||
| 53 | 54 | ||
| 54 | #define gcstopped(g) ((g)->GCdebt == MIN_LMEM) | 55 | #define gcstopped(g) ((g)->GCdebt == MIN_LMEM) |
| @@ -87,8 +88,11 @@ | |||
| 87 | #define isblack(x) testbit((x)->gch.marked, BLACKBIT) | 88 | #define isblack(x) testbit((x)->gch.marked, BLACKBIT) |
| 88 | #define isgray(x) (!isblack(x) && !iswhite(x)) | 89 | #define isgray(x) (!isblack(x) && !iswhite(x)) |
| 89 | 90 | ||
| 91 | #define isold(x) testbit((x)->gch.marked, OLDBIT) | ||
| 92 | |||
| 90 | #define otherwhite(g) (g->currentwhite ^ WHITEBITS) | 93 | #define otherwhite(g) (g->currentwhite ^ WHITEBITS) |
| 91 | #define isdead(g,v) ((v)->gch.marked & otherwhite(g) & WHITEBITS) | 94 | #define isdeadm(ow,m) (!(((m) ^ WHITEBITS) & (ow))) |
| 95 | #define isdead(g,v) isdeadm(otherwhite(g), (v)->gch.marked) | ||
| 92 | 96 | ||
| 93 | #define changewhite(x) ((x)->gch.marked ^= WHITEBITS) | 97 | #define changewhite(x) ((x)->gch.marked ^= WHITEBITS) |
| 94 | #define gray2black(x) l_setbit((x)->gch.marked, BLACKBIT) | 98 | #define gray2black(x) l_setbit((x)->gch.marked, BLACKBIT) |
