diff options
Diffstat (limited to 'lgc.h')
-rw-r--r-- | lgc.h | 19 |
1 files changed, 14 insertions, 5 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lgc.h,v 2.56 2012/05/23 15:43:14 roberto Exp roberto $ | 2 | ** $Id: lgc.h,v 2.57 2012/07/04 15:52:38 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 | */ |
@@ -50,15 +50,24 @@ | |||
50 | #define isgenerational(g) ((g)->gckind == KGC_GEN) | 50 | #define isgenerational(g) ((g)->gckind == KGC_GEN) |
51 | 51 | ||
52 | /* | 52 | /* |
53 | ** macro to tell when main invariant (white objects cannot point to black | 53 | ** macros to tell when main invariant (white objects cannot point to black |
54 | ** ones) must be kept. During a non-generational collection, the sweep | 54 | ** ones) must be kept. During a non-generational collection, the sweep |
55 | ** phase may break the invariant, as objects turned white may point to | 55 | ** phase may break the invariant, as objects turned white may point to |
56 | ** still-black objects. The invariant is restored when sweep ends and | 56 | ** still-black objects. The invariant is restored when sweep ends and |
57 | ** all objects are white again. During a generational collection, the | 57 | ** all objects are white again. During a generational collection, the |
58 | ** invariant must be kept all times. (The state in generational mode | 58 | ** invariant must be kept all times. |
59 | ** is kept in 'propagate', so 'keepinvariant' is always true.) | ||
60 | */ | 59 | */ |
61 | #define keepinvariant(g) (g->gcstate <= GCSatomic) | 60 | |
61 | #define keepinvariant(g) (isgenerational(g) || g->gcstate <= GCSatomic) | ||
62 | |||
63 | |||
64 | /* | ||
65 | ** Outside the collector, the state in generational mode is kept in | ||
66 | ** 'propagate', so 'keepinvariant' is always true. | ||
67 | */ | ||
68 | #define keepinvariantout(g) \ | ||
69 | check_exp(g->gcstate == GCSpropagate || !isgenerational(g), \ | ||
70 | g->gcstate <= GCSatomic) | ||
62 | 71 | ||
63 | 72 | ||
64 | /* | 73 | /* |