summaryrefslogtreecommitdiff
path: root/lgc.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2013-08-05 13:58:28 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2013-08-05 13:58:28 -0300
commit677d90165ffef728231340c6328e9661824dbc34 (patch)
tree3338e6f1b0c2f82db84def5751ea418a58fbc31a /lgc.h
parent4244da96bfcf205624487b99b69e9d8dd1857293 (diff)
downloadlua-677d90165ffef728231340c6328e9661824dbc34.tar.gz
lua-677d90165ffef728231340c6328e9661824dbc34.tar.bz2
lua-677d90165ffef728231340c6328e9661824dbc34.zip
no more generational collection !!!
Diffstat (limited to 'lgc.h')
-rw-r--r--lgc.h28
1 files changed, 5 insertions, 23 deletions
diff --git a/lgc.h b/lgc.h
index 08899d9b..bda11607 100644
--- a/lgc.h
+++ b/lgc.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lgc.h,v 2.57 2012/07/04 15:52:38 roberto Exp roberto $ 2** $Id: lgc.h,v 2.58 2012/09/11 12:53:08 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*/
@@ -47,27 +47,16 @@
47#define issweepphase(g) \ 47#define issweepphase(g) \
48 (GCSsweepstring <= (g)->gcstate && (g)->gcstate <= GCSsweep) 48 (GCSsweepstring <= (g)->gcstate && (g)->gcstate <= GCSsweep)
49 49
50#define isgenerational(g) ((g)->gckind == KGC_GEN)
51 50
52/* 51/*
53** macros to tell when main invariant (white objects cannot point to black 52** macro to tell when main invariant (white objects cannot point to black
54** ones) must be kept. During a non-generational collection, the sweep 53** ones) must be kept. During a collection, the sweep
55** phase may break the invariant, as objects turned white may point to 54** phase may break the invariant, as objects turned white may point to
56** still-black objects. The invariant is restored when sweep ends and 55** still-black objects. The invariant is restored when sweep ends and
57** all objects are white again. During a generational collection, the 56** all objects are white again.
58** invariant must be kept all times.
59*/ 57*/
60 58
61#define keepinvariant(g) (isgenerational(g) || g->gcstate <= GCSatomic) 59#define keepinvariant(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)
71 60
72 61
73/* 62/*
@@ -90,7 +79,6 @@
90#define FINALIZEDBIT 3 /* object has been separated for finalization */ 79#define FINALIZEDBIT 3 /* object has been separated for finalization */
91#define SEPARATED 4 /* object is in 'finobj' list or in 'tobefnz' */ 80#define SEPARATED 4 /* object is in 'finobj' list or in 'tobefnz' */
92#define FIXEDBIT 5 /* object is fixed (should not be collected) */ 81#define FIXEDBIT 5 /* object is fixed (should not be collected) */
93#define OLDBIT 6 /* object is old (only in generational mode) */
94/* bit 7 is currently used by tests (luaL_checkmemory) */ 82/* bit 7 is currently used by tests (luaL_checkmemory) */
95 83
96#define WHITEBITS bit2mask(WHITE0BIT, WHITE1BIT) 84#define WHITEBITS bit2mask(WHITE0BIT, WHITE1BIT)
@@ -101,11 +89,6 @@
101#define isgray(x) /* neither white nor black */ \ 89#define isgray(x) /* neither white nor black */ \
102 (!testbits((x)->gch.marked, WHITEBITS | bitmask(BLACKBIT))) 90 (!testbits((x)->gch.marked, WHITEBITS | bitmask(BLACKBIT)))
103 91
104#define isold(x) testbit((x)->gch.marked, OLDBIT)
105
106/* MOVE OLD rule: whenever an object is moved to the beginning of
107 a GC list, its old bit must be cleared */
108#define resetoldbit(o) resetbit((o)->gch.marked, OLDBIT)
109 92
110#define otherwhite(g) (g->currentwhite ^ WHITEBITS) 93#define otherwhite(g) (g->currentwhite ^ WHITEBITS)
111#define isdeadm(ow,m) (!(((m) ^ WHITEBITS) & (ow))) 94#define isdeadm(ow,m) (!(((m) ^ WHITEBITS) & (ow)))
@@ -152,6 +135,5 @@ LUAI_FUNC void luaC_barrierback_ (lua_State *L, GCObject *o);
152LUAI_FUNC void luaC_barrierproto_ (lua_State *L, Proto *p, Closure *c); 135LUAI_FUNC void luaC_barrierproto_ (lua_State *L, Proto *p, Closure *c);
153LUAI_FUNC void luaC_checkfinalizer (lua_State *L, GCObject *o, Table *mt); 136LUAI_FUNC void luaC_checkfinalizer (lua_State *L, GCObject *o, Table *mt);
154LUAI_FUNC void luaC_checkupvalcolor (global_State *g, UpVal *uv); 137LUAI_FUNC void luaC_checkupvalcolor (global_State *g, UpVal *uv);
155LUAI_FUNC void luaC_changemode (lua_State *L, int mode);
156 138
157#endif 139#endif