29 #if !defined(GCSTEPSIZE)
31 #define GCSTEPSIZE (cast_int(100 * sizeof(TString)))
38 #define GCSpropagate 0
40 #define GCSsweepstring 2
41 #define GCSsweepudata 3
46 #define issweepphase(g) \
47 (GCSsweepstring <= (g)->gcstate && (g)->gcstate <= GCSsweep)
49 #define isgenerational(g) ((g)->gckind == KGC_GEN)
60 #define keepinvariant(g) (isgenerational(g) || g->gcstate <= GCSatomic)
67 #define keepinvariantout(g) \
68 check_exp(g->gcstate == GCSpropagate || !isgenerational(g), \
69 g->gcstate <= GCSatomic)
75 #define resetbits(x,m) ((x) &= cast(lu_byte, ~(m)))
76 #define setbits(x,m) ((x) |= (m))
77 #define testbits(x,m) ((x) & (m))
78 #define bitmask(b) (1<<(b))
79 #define bit2mask(b1,b2) (bitmask(b1) | bitmask(b2))
80 #define l_setbit(x,b) setbits(x, bitmask(b))
81 #define resetbit(x,b) resetbits(x, bitmask(b))
82 #define testbit(x,b) testbits(x, bitmask(b))
89 #define FINALIZEDBIT 3
95 #define WHITEBITS bit2mask(WHITE0BIT, WHITE1BIT)
98 #define iswhite(x) testbits((x)->gch.marked, WHITEBITS)
99 #define isblack(x) testbit((x)->gch.marked, BLACKBIT)
101 (!testbits((x)->gch.marked, WHITEBITS | bitmask(BLACKBIT)))
103 #define isold(x) testbit((x)->gch.marked, OLDBIT)
107 #define resetoldbit(o) resetbit((o)->gch.marked, OLDBIT)
109 #define otherwhite(g) (g->currentwhite ^ WHITEBITS)
110 #define isdeadm(ow,m) (!(((m) ^ WHITEBITS) & (ow)))
111 #define isdead(g,v) isdeadm(otherwhite(g), (v)->gch.marked)
113 #define changewhite(x) ((x)->gch.marked ^= WHITEBITS)
114 #define gray2black(x) l_setbit((x)->gch.marked, BLACKBIT)
116 #define valiswhite(x) (iscollectable(x) && iswhite(gcvalue(x)))
118 #define luaC_white(g) cast(lu_byte, (g)->currentwhite & WHITEBITS)
121 #define luaC_condGC(L,c) \
122 {if (G(L)->GCdebt > 0) {c;}; condchangemem(L);}
123 #define luaC_checkGC(L) luaC_condGC(L, luaC_step(L);)
126 #define luaC_barrier(L,p,v) { if (valiswhite(v) && isblack(obj2gco(p))) \
127 luaC_barrier_(L,obj2gco(p),gcvalue(v)); }
129 #define luaC_barrierback(L,p,v) { if (valiswhite(v) && isblack(obj2gco(p))) \
130 luaC_barrierback_(L,p); }
132 #define luaC_objbarrier(L,p,o) \
133 { if (iswhite(obj2gco(o)) && isblack(obj2gco(p))) \
134 luaC_barrier_(L,obj2gco(p),obj2gco(o)); }
136 #define luaC_objbarrierback(L,p,o) \
137 { if (iswhite(obj2gco(o)) && isblack(obj2gco(p))) luaC_barrierback_(L,p); }
139 #define luaC_barrierproto(L,p,c) \
140 { if (isblack(obj2gco(p))) luaC_barrierproto_(L,p,c); }
LUAI_FUNC void luaC_runtilstate(lua_State *L, int statesmask)
LUAI_FUNC void luaC_step(lua_State *L)
LUAI_FUNC void luaC_checkfinalizer(lua_State *L, GCObject *o, Table *mt)
LUAI_FUNC GCObject * luaC_newobj(lua_State *L, int tt, size_t sz, GCObject **list, int offset)
LUAI_FUNC void luaC_checkupvalcolor(global_State *g, UpVal *uv)
LUAI_FUNC void luaC_freeallobjects(lua_State *L)
LUAI_FUNC void luaC_fullgc(lua_State *L, int isemergency)
LUAI_FUNC void luaC_barrierproto_(lua_State *L, Proto *p, Closure *c)
LUAI_FUNC void luaC_barrierback_(lua_State *L, GCObject *o)
LUAI_FUNC void luaC_forcestep(lua_State *L)
LUAI_FUNC void luaC_changemode(lua_State *L, int mode)
LUAI_FUNC void luaC_barrier_(lua_State *L, GCObject *o, GCObject *v)