lua5.4
lgc.h
浏览该文件的文档.
1 /*
2 ** $Id: lgc.h $
3 ** Garbage Collector
4 ** See Copyright Notice in lua.h
5 */
6 
7 #ifndef lgc_h
8 #define lgc_h
9 
10 
11 #include "lobject.h"
12 #include "lstate.h"
13 
14 /*
15 ** Collectable objects may have one of three colors: white, which means
16 ** the object is not marked; gray, which means the object is marked, but
17 ** its references may be not marked; and black, which means that the
18 ** object and all its references are marked. The main invariant of the
19 ** garbage collector, while marking objects, is that a black object can
20 ** never point to a white one. Moreover, any gray object must be in a
21 ** "gray list" (gray, grayagain, weak, allweak, ephemeron) so that it
22 ** can be visited again before finishing the collection cycle. (Open
23 ** upvalues are an exception to this rule.) These lists have no meaning
24 ** when the invariant is not being enforced (e.g., sweep phase).
25 */
26 
27 
28 /*
29 ** Possible states of the Garbage Collector
30 */
31 #define GCSpropagate 0
32 #define GCSenteratomic 1
33 #define GCSatomic 2
34 #define GCSswpallgc 3
35 #define GCSswpfinobj 4
36 #define GCSswptobefnz 5
37 #define GCSswpend 6
38 #define GCScallfin 7
39 #define GCSpause 8
40 
41 
42 #define issweepphase(g) \
43  (GCSswpallgc <= (g)->gcstate && (g)->gcstate <= GCSswpend)
44 
45 
46 /*
47 ** macro to tell when main invariant (white objects cannot point to black
48 ** ones) must be kept. During a collection, the sweep
49 ** phase may break the invariant, as objects turned white may point to
50 ** still-black objects. The invariant is restored when sweep ends and
51 ** all objects are white again.
52 */
53 
54 #define keepinvariant(g) ((g)->gcstate <= GCSatomic)
55 
56 
57 /*
58 ** some useful bit tricks
59 */
60 #define resetbits(x,m) ((x) &= cast_byte(~(m)))
61 #define setbits(x,m) ((x) |= (m))
62 #define testbits(x,m) ((x) & (m))
63 #define bitmask(b) (1<<(b))
64 #define bit2mask(b1,b2) (bitmask(b1) | bitmask(b2))
65 #define l_setbit(x,b) setbits(x, bitmask(b))
66 #define resetbit(x,b) resetbits(x, bitmask(b))
67 #define testbit(x,b) testbits(x, bitmask(b))
68 
69 
70 /*
71 ** Layout for bit use in 'marked' field. First three bits are
72 ** used for object "age" in generational mode. Last bit is used
73 ** by tests.
74 */
75 #define WHITE0BIT 3 /* object is white (type 0) */
76 #define WHITE1BIT 4 /* object is white (type 1) */
77 #define BLACKBIT 5 /* object is black */
78 #define FINALIZEDBIT 6 /* object has been marked for finalization */
79 
80 #define TESTBIT 7
81 
82 
83 
84 #define WHITEBITS bit2mask(WHITE0BIT, WHITE1BIT)
85 
86 
87 #define iswhite(x) testbits((x)->marked, WHITEBITS)
88 #define isblack(x) testbit((x)->marked, BLACKBIT)
89 #define isgray(x) /* neither white nor black */ \
90  (!testbits((x)->marked, WHITEBITS | bitmask(BLACKBIT)))
91 
92 #define tofinalize(x) testbit((x)->marked, FINALIZEDBIT)
93 
94 #define otherwhite(g) ((g)->currentwhite ^ WHITEBITS)
95 #define isdeadm(ow,m) ((m) & (ow))
96 #define isdead(g,v) isdeadm(otherwhite(g), (v)->marked)
97 
98 #define changewhite(x) ((x)->marked ^= WHITEBITS)
99 #define nw2black(x) \
100  check_exp(!iswhite(x), l_setbit((x)->marked, BLACKBIT))
101 
102 #define luaC_white(g) cast_byte((g)->currentwhite & WHITEBITS)
103 
104 
105 /* object age in generational mode */
106 #define G_NEW 0 /* created in current cycle */
107 #define G_SURVIVAL 1 /* created in previous cycle */
108 #define G_OLD0 2 /* marked old by frw. barrier in this cycle */
109 #define G_OLD1 3 /* first full cycle as old */
110 #define G_OLD 4 /* really old object (not to be visited) */
111 #define G_TOUCHED1 5 /* old object touched this cycle */
112 #define G_TOUCHED2 6 /* old object touched in previous cycle */
113 
114 #define AGEBITS 7 /* all age bits (111) */
115 
116 #define getage(o) ((o)->marked & AGEBITS)
117 #define setage(o,a) ((o)->marked = cast_byte(((o)->marked & (~AGEBITS)) | a))
118 #define isold(o) (getage(o) > G_SURVIVAL)
119 
120 #define changeage(o,f,t) \
121  check_exp(getage(o) == (f), (o)->marked ^= ((f)^(t)))
122 
123 
124 /* Default Values for GC parameters */
125 #define LUAI_GENMAJORMUL 100
126 #define LUAI_GENMINORMUL 20
127 
128 /* wait memory to double before starting new cycle */
129 #define LUAI_GCPAUSE 200
130 
131 /*
132 ** some gc parameters are stored divided by 4 to allow a maximum value
133 ** up to 1023 in a 'lu_byte'.
134 */
135 #define getgcparam(p) ((p) * 4)
136 #define setgcparam(p,v) ((p) = (v) / 4)
137 
138 #define LUAI_GCMUL 100
139 
140 /* how much to allocate before next GC step (log2) */
141 #define LUAI_GCSTEPSIZE 13 /* 8 KB */
142 
143 
144 /*
145 ** Check whether the declared GC mode is generational. While in
146 ** generational mode, the collector can go temporarily to incremental
147 ** mode to improve performance. This is signaled by 'g->lastatomic != 0'.
148 */
149 #define isdecGCmodegen(g) (g->gckind == KGC_GEN || g->lastatomic != 0)
150 
151 /*
152 ** Does one step of collection when debt becomes positive. 'pre'/'pos'
153 ** allows some adjustments to be done only when needed. macro
154 ** 'condchangemem' is used only for heavy tests (forcing a full
155 ** GC cycle on every opportunity)
156 */
157 #define luaC_condGC(L,pre,pos) \
158  { if (G(L)->GCdebt > 0) { pre; luaC_step(L); pos;}; \
159  condchangemem(L,pre,pos); }
160 
161 /* more often than not, 'pre'/'pos' are empty */
162 #define luaC_checkGC(L) luaC_condGC(L,(void)0,(void)0)
163 
164 
165 #define luaC_barrier(L,p,v) ( \
166  (iscollectable(v) && isblack(p) && iswhite(gcvalue(v))) ? \
167  luaC_barrier_(L,obj2gco(p),gcvalue(v)) : cast_void(0))
168 
169 #define luaC_barrierback(L,p,v) ( \
170  (iscollectable(v) && isblack(p) && iswhite(gcvalue(v))) ? \
171  luaC_barrierback_(L,p) : cast_void(0))
172 
173 #define luaC_objbarrier(L,p,o) ( \
174  (isblack(p) && iswhite(o)) ? \
175  luaC_barrier_(L,obj2gco(p),obj2gco(o)) : cast_void(0))
176 
177 LUAI_FUNC void luaC_fix (lua_State *L, GCObject *o);
179 LUAI_FUNC void luaC_step (lua_State *L);
180 LUAI_FUNC void luaC_runtilstate (lua_State *L, int statesmask);
181 LUAI_FUNC void luaC_fullgc (lua_State *L, int isemergency);
182 LUAI_FUNC GCObject *luaC_newobj (lua_State *L, int tt, size_t sz);
186 LUAI_FUNC void luaC_changemode (lua_State *L, int newmode);
187 
188 
189 #endif
LUA_VTHREAD
#define LUA_VTHREAD
Definition: lobject.h:240
GCScallfin
#define GCScallfin
Definition: lgc.h:38
luaE_warnerror
void luaE_warnerror(lua_State *L, const char *where)
Definition: lstate.c:419
EXTRA_STACK
#define EXTRA_STACK
Definition: lstate.h:137
s2v
#define s2v(o)
Definition: lobject.h:150
luaC_newobj
GCObject * luaC_newobj(lua_State *L, int tt, size_t sz)
Definition: lgc.c:258
iswhite
#define iswhite(x)
Definition: lgc.h:87
global_State::lastatomic
lu_mem lastatomic
Definition: lstate.h:225
GCFINALIZECOST
#define GCFINALIZECOST
Definition: lgc.c:46
remarkupvals
static int remarkupvals(global_State *g)
Definition: lgc.c:361
maskgcbits
#define maskgcbits
Definition: lgc.c:67
tofinalize
#define tofinalize(x)
Definition: lgc.h:92
Proto::upvalues
Upvaldesc * upvalues
Definition: lobject.h:547
luaC_barrierback_
void luaC_barrierback_(lua_State *L, GCObject *o)
Definition: lgc.c:230
deletelist
static void deletelist(lua_State *L, GCObject *p, GCObject *limit)
Definition: lgc.c:1490
reallymarkobject
static void reallymarkobject(global_State *g, GCObject *o)
Definition: lgc.c:291
G_SURVIVAL
#define G_SURVIVAL
Definition: lgc.h:107
TString::u
union TString::@1 u
lua_assert
#define lua_assert(c)
Definition: lauxlib.h:169
entergen
static lu_mem entergen(lua_State *L, global_State *g)
Definition: lgc.c:1293
LUAI_FUNC
#define LUAI_FUNC
Definition: luaconf.h:307
restartcollection
static void restartcollection(global_State *g)
Definition: lgc.c:397
cleargraylists
static void cleargraylists(global_State *g)
Definition: lgc.c:388
cast_byte
#define cast_byte(i)
Definition: llimits.h:130
luaH_free
void luaH_free(lua_State *L, Table *t)
Definition: ltable.c:608
cast
#define cast(t, exp)
Definition: llimits.h:123
isdecGCmodegen
#define isdecGCmodegen(g)
Definition: lgc.h:149
stepgenfull
static void stepgenfull(lua_State *L, global_State *g)
Definition: lgc.c:1374
UpVal::u
union UpVal::@3 u
LUA_NUMTAGS
#define LUA_NUMTAGS
Definition: lua.h:415
lstate.h
novariant
#define novariant(t)
Definition: lobject.h:78
traverseLclosure
static int traverseLclosure(global_State *g, LClosure *cl)
Definition: lgc.c:598
traverseudata
static int traverseudata(global_State *g, Udata *u)
Definition: lgc.c:557
bitmask
#define bitmask(b)
Definition: lgc.h:63
LUA_OK
#define LUA_OK
Definition: lua.h:49
linkobjgclist
#define linkobjgclist(o, p)
Definition: lgc.c:159
enterinc
static void enterinc(global_State *g)
Definition: lgc.c:1308
fullinc
static void fullinc(lua_State *L, global_State *g)
Definition: lgc.c:1685
markmt
static void markmt(global_State *g)
Definition: lgc.c:329
luaF_freeproto
void luaF_freeproto(lua_State *L, Proto *f)
Definition: lfunc.c:273
luaC_checkfinalizer
void luaC_checkfinalizer(lua_State *L, GCObject *o, Table *mt)
Definition: lgc.c:1011
WORK2MEM
#define WORK2MEM
Definition: lgc.c:53
GCSswpallgc
#define GCSswpallgc
Definition: lgc.h:34
global_State::l_registry
TValue l_registry
Definition: lstate.h:227
gco2ts
#define gco2ts(o)
Definition: lstate.h:330
global_State::old1
GCObject * old1
Definition: lstate.h:252
LUA_TSTRING
#define LUA_TSTRING
Definition: lua.h:69
GCTM
static void GCTM(lua_State *L)
Definition: lgc.c:899
LocVar::varname
TString * varname
Definition: lobject.h:506
unlikely
#define unlikely(x)
Definition: llimits.h:162
traverseephemeron
static int traverseephemeron(global_State *g, Table *h, int inv)
Definition: lgc.c:474
checkpointer
static void checkpointer(GCObject **p, GCObject *o)
Definition: lgc.c:989
ltable.h
iscleared
static int iscleared(global_State *g, const GCObject *o)
Definition: lgc.c:185
global_State::GCestimate
lu_mem GCestimate
Definition: lstate.h:224
setdeadkey
#define setdeadkey(node)
Definition: lobject.h:753
global_State::strt
stringtable strt
Definition: lstate.h:226
luaF_unlinkupval
void luaF_unlinkupval(UpVal *uv)
Definition: lfunc.c:215
traversetable
static lu_mem traversetable(global_State *g, Table *h)
Definition: lgc.c:536
markobject
#define markobject(g, t)
Definition: lgc.c:99
global_State::currentwhite
lu_byte currentwhite
Definition: lstate.h:230
isempty
#define isempty(v)
Definition: lobject.h:195
sweeptolive
static GCObject ** sweeptolive(lua_State *L, GCObject **p)
Definition: lgc.c:843
notm
#define notm(tm)
Definition: ltm.h:61
global_State::firstold1
GCObject * firstold1
Definition: lstate.h:254
Proto::p
struct Proto ** p
Definition: lobject.h:546
obj2gco
#define obj2gco(v)
Definition: lstate.h:347
gcvalue
#define gcvalue(o)
Definition: lobject.h:283
gnode
#define gnode(t, i)
Definition: ltable.h:13
lu_mem
unsigned long lu_mem
Definition: llimits.h:30
global_State::genmajormul
lu_byte genmajormul
Definition: lstate.h:234
sweepgen
static GCObject ** sweepgen(lua_State *L, global_State *g, GCObject **p, GCObject *limit, GCObject **pfirstold1)
Definition: lgc.c:1088
singlestep
static lu_mem singlestep(lua_State *L)
Definition: lgc.c:1576
G_TOUCHED1
#define G_TOUCHED1
Definition: lgc.h:111
luaC_step
void luaC_step(lua_State *L)
Definition: lgc.c:1666
Udata::uv
UValue uv[1]
Definition: lobject.h:445
Udata::nuvalue
unsigned short nuvalue
Definition: lobject.h:441
luaC_fix
void luaC_fix(lua_State *L, GCObject *o)
Definition: lgc.c:243
gco2u
#define gco2u(o)
Definition: lstate.h:332
keyiscollectable
#define keyiscollectable(n)
Definition: lobject.h:741
setminordebt
static void setminordebt(global_State *g)
Definition: lgc.c:1348
isold
#define isold(o)
Definition: lgc.h:118
traversestrongtable
static void traversestrongtable(global_State *g, Table *h)
Definition: lgc.c:517
Upvaldesc::name
TString * name
Definition: lobject.h:494
ltm.h
setgcovalue
#define setgcovalue(L, obj, x)
Definition: lobject.h:287
changeage
#define changeage(o, f, t)
Definition: lgc.h:120
luaC_runtilstate
void luaC_runtilstate(lua_State *L, int statesmask)
Definition: lgc.c:1631
global_State::grayagain
GCObject * grayagain
Definition: lstate.h:244
l_setbit
#define l_setbit(x, b)
Definition: lgc.h:65
luaS_remove
void luaS_remove(lua_State *L, TString *ts)
Definition: lstring.c:164
global_State::gcemergency
lu_byte gcemergency
Definition: lstate.h:236
clearbykeys
static void clearbykeys(global_State *g, GCObject *l)
Definition: lgc.c:717
StackValue
Definition: lobject.h:141
markobjectN
#define markobjectN(g, t)
Definition: lgc.c:105
global_State::gcstate
lu_byte gcstate
Definition: lstate.h:231
luaD_callnoyield
void luaD_callnoyield(lua_State *L, StkId func, int nResults)
Definition: ldo.c:565
GCSpropagate
#define GCSpropagate
Definition: lgc.h:31
Proto::sizep
int sizep
Definition: lobject.h:539
G_OLD0
#define G_OLD0
Definition: lgc.h:108
UValue::uv
TValue uv
Definition: lobject.h:430
global_State::sweepgc
GCObject ** sweepgc
Definition: lstate.h:241
Proto::source
TString * source
Definition: lobject.h:551
genstep
static void genstep(lua_State *L, global_State *g)
Definition: lgc.c:1414
luaC_changemode
LUAI_FUNC void luaC_changemode(lua_State *L, int newmode)
Definition: lgc.c:1323
traverseweakvalue
static void traverseweakvalue(global_State *g, Table *h)
Definition: lgc.c:440
isdeadm
#define isdeadm(ow, m)
Definition: lgc.h:95
freeobj
static void freeobj(lua_State *L, GCObject *o)
Definition: lgc.c:764
UNUSED
#define UNUSED(x)
Definition: llimits.h:118
gnodelast
#define gnodelast(h)
Definition: lgc.c:122
LUA_VTABLE
#define LUA_VTABLE
Definition: lobject.h:655
PAUSEADJ
#define PAUSEADJ
Definition: lgc.c:60
linkgclist
#define linkgclist(o, p)
Definition: lgc.c:146
global_State::allgc
GCObject * allgc
Definition: lstate.h:240
luaD_shrinkstack
void luaD_shrinkstack(lua_State *L)
Definition: ldo.c:262
log2maxs
#define log2maxs(t)
Definition: llimits.h:60
nw2black
#define nw2black(x)
Definition: lgc.h:99
setnilvalue
#define setnilvalue(obj)
Definition: lobject.h:178
GCSpause
#define GCSpause
Definition: lgc.h:39
lua.h
luaC_white
#define luaC_white(g)
Definition: lgc.h:102
UpVal
Definition: lobject.h:606
traversethread
static int traversethread(global_State *g, lua_State *th)
Definition: lgc.c:621
sweeplist
static GCObject ** sweeplist(lua_State *L, GCObject **p, int countin, int *countout)
Definition: lgc.c:816
gval
#define gval(n)
Definition: ltable.h:14
dummy
int dummy
Definition: lstrlib.c:1347
Udata::len
size_t len
Definition: lobject.h:442
youngcollection
static void youngcollection(lua_State *L, global_State *g)
Definition: lgc.c:1224
luaE_setdebt
void luaE_setdebt(global_State *g, l_mem debt)
Definition: lstate.c:89
FINALIZEDBIT
#define FINALIZEDBIT
Definition: lgc.h:78
luaC_runtilstate
LUAI_FUNC void luaC_runtilstate(lua_State *L, int statesmask)
Definition: lgc.c:1631
GCSWEEPMAX
#define GCSWEEPMAX
Definition: lgc.c:35
l_mem
long l_mem
Definition: llimits.h:31
upisopen
#define upisopen(up)
Definition: lfunc.h:32
Udata::gclist
GCObject * gclist
Definition: lobject.h:444
luaC_barrier_
LUAI_FUNC void luaC_barrier_(lua_State *L, GCObject *o, GCObject *v)
Definition: lgc.c:208
lua_State::stack_last
StkId stack_last
Definition: lstate.h:281
global_State::gcrunning
lu_byte gcrunning
Definition: lstate.h:235
CClosure
Definition: lobject.h:624
getage
#define getage(o)
Definition: lgc.h:116
cast_void
#define cast_void(i)
Definition: llimits.h:125
sizeLclosure
#define sizeLclosure(n)
Definition: lfunc.h:17
TM_GC
@ TM_GC
Definition: ltm.h:21
G
#define G(L)
Definition: lstate.h:298
correctgraylists
static void correctgraylists(global_State *g)
Definition: lgc.c:1178
sizelstring
#define sizelstring(l)
Definition: lstring.h:26
LUA_VLNGSTR
#define LUA_VLNGSTR
Definition: lobject.h:339
clearkey
static void clearkey(Node *n)
Definition: lgc.c:171
LUA_VSHRSTR
#define LUA_VSHRSTR
Definition: lobject.h:338
TString
Definition: lobject.h:364
clearbyvalues
static void clearbyvalues(global_State *g, GCObject *l, GCObject *f)
Definition: lgc.c:736
lprefix.h
gco2t
#define gco2t(o)
Definition: lstate.h:337
luaC_freeallobjects
LUAI_FUNC void luaC_freeallobjects(lua_State *L)
Definition: lgc.c:1503
luaC_newobj
LUAI_FUNC GCObject * luaC_newobj(lua_State *L, int tt, size_t sz)
Definition: lgc.c:258
ldebug.h
global_State::finobj
GCObject * finobj
Definition: lstate.h:242
Proto::sizek
int sizek
Definition: lobject.h:536
lu_byte
unsigned char lu_byte
Definition: llimits.h:36
linkgclist_
static void linkgclist_(GCObject *o, GCObject **pnext, GCObject **list)
Definition: lgc.c:148
set2black
#define set2black(x)
Definition: lgc.c:79
TString::lnglen
size_t lnglen
Definition: lobject.h:370
GCSatomic
#define GCSatomic
Definition: lgc.h:33
G_TOUCHED2
#define G_TOUCHED2
Definition: lgc.h:112
G_OLD
#define G_OLD
Definition: lgc.h:110
CClosure::upvalue
TValue upvalue[1]
Definition: lobject.h:627
Table
Definition: lobject.h:714
Udata
Definition: lobject.h:439
isgray
#define isgray(x)
Definition: lgc.h:89
lua_State::openupval
UpVal * openupval
Definition: lstate.h:283
luaC_fix
LUAI_FUNC void luaC_fix(lua_State *L, GCObject *o)
Definition: lgc.c:243
gfasttm
#define gfasttm(g, et, e)
Definition: ltm.h:64
global_State::GCdebt
l_mem GCdebt
Definition: lstate.h:223
gco2lcl
#define gco2lcl(o)
Definition: lstate.h:333
luaC_barrier_
void luaC_barrier_(lua_State *L, GCObject *o, GCObject *v)
Definition: lgc.c:208
luaH_realasize
LUAI_FUNC unsigned int luaH_realasize(const Table *t)
Definition: ltable.c:222
lobject.h
findlast
static GCObject ** findlast(GCObject **p)
Definition: lgc.c:952
Table::metatable
struct Table * metatable
Definition: lobject.h:722
global_State::genminormul
lu_byte genminormul
Definition: lstate.h:233
global_State
Definition: lstate.h:219
udata2finalize
static GCObject * udata2finalize(global_State *g)
Definition: lgc.c:878
lua_State
Definition: lstate.h:273
global_State::finobjold1
GCObject * finobjold1
Definition: lstate.h:256
Table::gclist
GCObject * gclist
Definition: lobject.h:723
global_State::gckind
lu_byte gckind
Definition: lstate.h:232
allocsizenode
#define allocsizenode(t)
Definition: ltable.h:31
GCFINMAX
#define GCFINMAX
Definition: lgc.c:40
LClosure::p
struct Proto * p
Definition: lobject.h:633
getgclist
static GCObject ** getgclist(GCObject *o)
Definition: lgc.c:125
lua_State::twups
struct lua_State * twups
Definition: lstate.h:285
luaM_newobject
#define luaM_newobject(L, tag, s)
Definition: lmem.h:64
TValue
Definition: lobject.h:65
gco2upv
#define gco2upv(o)
Definition: lstate.h:340
checkSizes
static void checkSizes(lua_State *L, global_State *g)
Definition: lgc.c:863
gettotalbytes
#define gettotalbytes(g)
Definition: lstate.h:351
UpVal::v
TValue * v
Definition: lobject.h:609
Table::array
TValue * array
Definition: lobject.h:719
keepinvariant
#define keepinvariant(g)
Definition: lgc.h:54
Proto::k
TValue * k
Definition: lobject.h:544
keyisnil
#define keyisnil(node)
Definition: lobject.h:733
sizenode
#define sizenode(t)
Definition: lobject.h:768
setempty
#define setempty(v)
Definition: lobject.h:203
Table::alimit
unsigned int alimit
Definition: lobject.h:718
dothecall
static void dothecall(lua_State *L, void *ud)
Definition: lgc.c:893
LUA_VPROTO
#define LUA_VPROTO
Definition: lobject.h:487
LClosure
Definition: lobject.h:631
gco2p
#define gco2p(o)
Definition: lstate.h:338
global_State::reallyold
GCObject * reallyold
Definition: lstate.h:253
markold
static void markold(global_State *g, GCObject *from, GCObject *to)
Definition: lgc.c:1194
testbit
#define testbit(x, b)
Definition: lgc.h:67
setpause
static void setpause(global_State *g)
Definition: lgc.c:1457
MAX_LMEM
#define MAX_LMEM
Definition: llimits.h:50
GCSswpfinobj
#define GCSswpfinobj
Definition: lgc.h:35
markkey
#define markkey(g, n)
Definition: lgc.c:97
Proto::sizeupvalues
int sizeupvalues
Definition: lobject.h:535
propagateall
static lu_mem propagateall(global_State *g)
Definition: lgc.c:668
luaC_freeallobjects
void luaC_freeallobjects(lua_State *L)
Definition: lgc.c:1503
global_State::twups
struct lua_State * twups
Definition: lstate.h:258
finishgencycle
static void finishgencycle(lua_State *L, global_State *g)
Definition: lgc.c:1210
global_State::mt
struct Table * mt[LUA_NUMTAGS]
Definition: lstate.h:263
setage
#define setage(o, a)
Definition: lgc.h:117
G_OLD1
#define G_OLD1
Definition: lgc.h:109
otherwhite
#define otherwhite(g)
Definition: lgc.h:94
lua_State::ci
CallInfo * ci
Definition: lstate.h:280
lua_State::stack
StkId stack
Definition: lstate.h:282
isblack
#define isblack(x)
Definition: lgc.h:88
correctgraylist
static GCObject ** correctgraylist(GCObject **p)
Definition: lgc.c:1145
resetbit
#define resetbit(x, b)
Definition: lgc.h:66
sizeudata
#define sizeudata(nuv, nb)
Definition: lobject.h:476
correctpointers
static void correctpointers(global_State *g, GCObject *o)
Definition: lgc.c:999
gco2th
#define gco2th(o)
Definition: lstate.h:339
isdead
#define isdead(g, v)
Definition: lgc.h:96
global_State::gcstepmul
lu_byte gcstepmul
Definition: lstate.h:238
Proto
Definition: lobject.h:530
set2gray
#define set2gray(x)
Definition: lgc.c:75
GCSenteratomic
#define GCSenteratomic
Definition: lgc.h:32
global_State::finobjrold
GCObject * finobjrold
Definition: lstate.h:257
sweepstep
static int sweepstep(lua_State *L, global_State *g, int nextstate, GCObject **nextlist)
Definition: lgc.c:1559
global_State::gcpause
lu_byte gcpause
Definition: lstate.h:237
luaD_pcall
int luaD_pcall(lua_State *L, Pfunc func, void *u, ptrdiff_t old_top, ptrdiff_t ef)
Definition: ldo.c:777
atomic
static lu_mem atomic(lua_State *L)
Definition: lgc.c:1516
luaM_freemem
#define luaM_freemem(L, b, s)
Definition: lmem.h:55
markvalue
#define markvalue(g, o)
Definition: lgc.c:94
atomic2gen
static void atomic2gen(lua_State *L, global_State *g)
Definition: lgc.c:1265
fullgen
static lu_mem fullgen(lua_State *L, global_State *g)
Definition: lgc.c:1338
callallpendingfinalizers
static void callallpendingfinalizers(lua_State *L)
Definition: lgc.c:942
luaT_gettmbyobj
const TValue * luaT_gettmbyobj(lua_State *L, const TValue *o, TMS event)
Definition: ltm.c:71
runafewfinalizers
static int runafewfinalizers(lua_State *L, int n)
Definition: lgc.c:930
gcvalueN
#define gcvalueN(o)
Definition: lgc.c:91
setobj2s
#define setobj2s(L, o1, o2)
Definition: lobject.h:129
UpVal::open
struct UpVal::@3::@4 open
convergeephemerons
static void convergeephemerons(global_State *g)
Definition: lgc.c:683
lstring.h
stringtable::nuse
int nuse
Definition: lstate.h:152
gco2ccl
#define gco2ccl(o)
Definition: lstate.h:334
global_State::gcstepsize
lu_byte gcstepsize
Definition: lstate.h:239
luaC_checkfinalizer
LUAI_FUNC void luaC_checkfinalizer(lua_State *L, GCObject *o, Table *mt)
Definition: lgc.c:1011
G_NEW
#define G_NEW
Definition: lgc.h:106
CIST_FIN
#define CIST_FIN
Definition: lstate.h:199
luaS_clearcache
void luaS_clearcache(global_State *g)
Definition: lstring.c:110
GCSswptobefnz
#define GCSswptobefnz
Definition: lgc.h:36
stringtable::size
int size
Definition: lstate.h:153
traverseCclosure
static int traverseCclosure(global_State *g, CClosure *cl)
Definition: lgc.c:587
luaM_free
#define luaM_free(L, b)
Definition: lmem.h:56
global_State::mainthread
struct lua_State * mainthread
Definition: lstate.h:260
markbeingfnz
static lu_mem markbeingfnz(global_State *g)
Definition: lgc.c:339
Node
Definition: lobject.h:676
issweepphase
#define issweepphase(g)
Definition: lgc.h:42
lmem.h
TString::shrlen
lu_byte shrlen
Definition: lobject.h:367
lua_State::top
StkId top
Definition: lstate.h:278
Udata::metatable
struct Table * metatable
Definition: lobject.h:443
global_State::fixedgc
GCObject * fixedgc
Definition: lstate.h:249
LUA_VLCL
#define LUA_VLCL
Definition: lobject.h:568
global_State::tobefnz
GCObject * tobefnz
Definition: lstate.h:248
separatetobefnz
static void separatetobefnz(global_State *g, int all)
Definition: lgc.c:966
lgc.h
GCObject
Definition: lobject.h:270
traverseproto
static int traverseproto(global_State *g, Proto *f)
Definition: lgc.c:572
GCSswpend
#define GCSswpend
Definition: lgc.h:37
luaC_fullgc
void luaC_fullgc(lua_State *L, int isemergency)
Definition: lgc.c:1703
LUA_VUPVAL
#define LUA_VUPVAL
Definition: lobject.h:564
KGC_INC
#define KGC_INC
Definition: lstate.h:146
KGC_GEN
#define KGC_GEN
Definition: lstate.h:147
isintwups
#define isintwups(L)
Definition: lfunc.h:22
global_State::allweak
GCObject * allweak
Definition: lstate.h:247
stacksize
#define stacksize(th)
Definition: lstate.h:142
lua_State::allowhook
lu_byte allowhook
Definition: lstate.h:276
next
#define next(ls)
Definition: llex.c:32
Proto::locvars
LocVar * locvars
Definition: lobject.h:550
sizeCclosure
#define sizeCclosure(n)
Definition: lfunc.h:14
CallInfo::callstatus
unsigned short callstatus
Definition: lstate.h:185
global_State::finobjsur
GCObject * finobjsur
Definition: lstate.h:255
getgcparam
#define getgcparam(p)
Definition: lgc.h:135
whitelist
static void whitelist(global_State *g, GCObject *p)
Definition: lgc.c:1129
LUA_VCCL
#define LUA_VCCL
Definition: lobject.h:570
svalue
#define svalue(o)
Definition: lobject.h:385
LUA_VUSERDATA
#define LUA_VUSERDATA
Definition: lobject.h:409
luaC_changemode
void luaC_changemode(lua_State *L, int newmode)
Definition: lgc.c:1323
valiswhite
#define valiswhite(x)
Definition: lgc.c:83
Proto::sizelocvars
int sizelocvars
Definition: lobject.h:540
luaE_freethread
void luaE_freethread(lua_State *L, lua_State *L1)
Definition: lstate.c:314
luaS_resize
void luaS_resize(lua_State *L, int nsize)
Definition: lstring.c:85
luaC_barrierback_
LUAI_FUNC void luaC_barrierback_(lua_State *L, GCObject *o)
Definition: lgc.c:230
freeupval
static void freeupval(lua_State *L, UpVal *uv)
Definition: lgc.c:757
propagatemark
static lu_mem propagatemark(global_State *g)
Definition: lgc.c:652
luaC_step
LUAI_FUNC void luaC_step(lua_State *L)
Definition: lgc.c:1666
global_State::gray
GCObject * gray
Definition: lstate.h:243
global_State::ephemeron
GCObject * ephemeron
Definition: lstate.h:246
gckeyN
#define gckeyN(n)
Definition: lobject.h:744
LClosure::upvals
UpVal * upvals[1]
Definition: lobject.h:634
sweep2old
static void sweep2old(lua_State *L, GCObject **p)
Definition: lgc.c:1052
TM_MODE
@ TM_MODE
Definition: ltm.h:22
global_State::weak
GCObject * weak
Definition: lstate.h:245
lfunc.h
global_State::survival
GCObject * survival
Definition: lstate.h:251
ldo.h
savestack
#define savestack(L, p)
Definition: ldo.h:35
genlink
static void genlink(global_State *g, GCObject *o)
Definition: lgc.c:424
entersweep
static void entersweep(lua_State *L)
Definition: lgc.c:1478
incstep
static void incstep(lua_State *L, global_State *g)
Definition: lgc.c:1645
makewhite
#define makewhite(g, x)
Definition: lgc.c:71
luaC_fullgc
LUAI_FUNC void luaC_fullgc(lua_State *L, int isemergency)
Definition: lgc.c:1703
ttisstring
#define ttisstring(o)
Definition: lobject.h:341