Github User Fetcher 1.0.0
C Application with Server and GUI
Loading...
Searching...
No Matches
lgc.h File Reference
#include "lobject.h"
#include "lstate.h"

Go to the source code of this file.

Macros

#define GCSTEPSIZE   (cast_int(100 * sizeof(TString)))
 
#define GCSpropagate   0
 
#define GCSatomic   1
 
#define GCSsweepstring   2
 
#define GCSsweepudata   3
 
#define GCSsweep   4
 
#define GCSpause   5
 
#define issweepphase(g)    (GCSsweepstring <= (g)->gcstate && (g)->gcstate <= GCSsweep)
 
#define isgenerational(g)   ((g)->gckind == KGC_GEN)
 
#define keepinvariant(g)   (isgenerational(g) || g->gcstate <= GCSatomic)
 
#define keepinvariantout(g)
 
#define resetbits(x, m)   ((x) &= cast(lu_byte, ~(m)))
 
#define setbits(x, m)   ((x) |= (m))
 
#define testbits(x, m)   ((x) & (m))
 
#define bitmask(b)   (1<<(b))
 
#define bit2mask(b1, b2)   (bitmask(b1) | bitmask(b2))
 
#define l_setbit(x, b)   setbits(x, bitmask(b))
 
#define resetbit(x, b)   resetbits(x, bitmask(b))
 
#define testbit(x, b)   testbits(x, bitmask(b))
 
#define WHITE0BIT   0 /* object is white (type 0) */
 
#define WHITE1BIT   1 /* object is white (type 1) */
 
#define BLACKBIT   2 /* object is black */
 
#define FINALIZEDBIT   3 /* object has been separated for finalization */
 
#define SEPARATED   4 /* object is in 'finobj' list or in 'tobefnz' */
 
#define FIXEDBIT   5 /* object is fixed (should not be collected) */
 
#define OLDBIT   6 /* object is old (only in generational mode) */
 
#define WHITEBITS   bit2mask(WHITE0BIT, WHITE1BIT)
 
#define iswhite(x)   testbits((x)->gch.marked, WHITEBITS)
 
#define isblack(x)   testbit((x)->gch.marked, BLACKBIT)
 
#define isgray(x)
 
#define isold(x)   testbit((x)->gch.marked, OLDBIT)
 
#define resetoldbit(o)   resetbit((o)->gch.marked, OLDBIT)
 
#define otherwhite(g)   (g->currentwhite ^ WHITEBITS)
 
#define isdeadm(ow, m)   (!(((m) ^ WHITEBITS) & (ow)))
 
#define isdead(g, v)   isdeadm(otherwhite(g), (v)->gch.marked)
 
#define changewhite(x)   ((x)->gch.marked ^= WHITEBITS)
 
#define gray2black(x)   l_setbit((x)->gch.marked, BLACKBIT)
 
#define valiswhite(x)   (iscollectable(x) && iswhite(gcvalue(x)))
 
#define luaC_white(g)   cast(lu_byte, (g)->currentwhite & WHITEBITS)
 
#define luaC_condGC(L, c)    {if (G(L)->GCdebt > 0) {c;}; condchangemem(L);}
 
#define luaC_checkGC(L)   luaC_condGC(L, luaC_step(L);)
 
#define luaC_barrier(L, p, v)
 
#define luaC_barrierback(L, p, v)
 
#define luaC_objbarrier(L, p, o)
 
#define luaC_objbarrierback(L, p, o)    { if (iswhite(obj2gco(o)) && isblack(obj2gco(p))) luaC_barrierback_(L,p); }
 
#define luaC_barrierproto(L, p, c)    { if (isblack(obj2gco(p))) luaC_barrierproto_(L,p,c); }
 

Functions

LUAI_FUNC void luaC_freeallobjects (lua_State *L)
 
LUAI_FUNC void luaC_step (lua_State *L)
 
LUAI_FUNC void luaC_forcestep (lua_State *L)
 
LUAI_FUNC void luaC_runtilstate (lua_State *L, int statesmask)
 
LUAI_FUNC void luaC_fullgc (lua_State *L, int isemergency)
 
LUAI_FUNC GCObjectluaC_newobj (lua_State *L, int tt, size_t sz, GCObject **list, int offset)
 
LUAI_FUNC void luaC_barrier_ (lua_State *L, GCObject *o, GCObject *v)
 
LUAI_FUNC void luaC_barrierback_ (lua_State *L, GCObject *o)
 
LUAI_FUNC void luaC_barrierproto_ (lua_State *L, Proto *p, Closure *c)
 
LUAI_FUNC void luaC_checkfinalizer (lua_State *L, GCObject *o, Table *mt)
 
LUAI_FUNC void luaC_checkupvalcolor (global_State *g, UpVal *uv)
 
LUAI_FUNC void luaC_changemode (lua_State *L, int mode)
 

Macro Definition Documentation

◆ bit2mask

#define bit2mask ( b1,
b2 )   (bitmask(b1) | bitmask(b2))

Definition at line 80 of file lua-5.2.4/src/lgc.h.

◆ bitmask

#define bitmask ( b)    (1<<(b))

Definition at line 79 of file lua-5.2.4/src/lgc.h.

◆ BLACKBIT

#define BLACKBIT   2 /* object is black */

Definition at line 89 of file lua-5.2.4/src/lgc.h.

◆ changewhite

#define changewhite ( x)    ((x)->gch.marked ^= WHITEBITS)

Definition at line 114 of file lua-5.2.4/src/lgc.h.

◆ FINALIZEDBIT

#define FINALIZEDBIT   3 /* object has been separated for finalization */

Definition at line 90 of file lua-5.2.4/src/lgc.h.

◆ FIXEDBIT

#define FIXEDBIT   5 /* object is fixed (should not be collected) */

Definition at line 92 of file lua-5.2.4/src/lgc.h.

◆ GCSatomic

#define GCSatomic   1

◆ GCSpause

#define GCSpause   5

Definition at line 44 of file lua-5.2.4/src/lgc.h.

◆ GCSpropagate

#define GCSpropagate   0

Definition at line 39 of file lua-5.2.4/src/lgc.h.

◆ GCSsweep

#define GCSsweep   4

Definition at line 43 of file lua-5.2.4/src/lgc.h.

◆ GCSsweepstring

#define GCSsweepstring   2

Definition at line 41 of file lua-5.2.4/src/lgc.h.

◆ GCSsweepudata

#define GCSsweepudata   3

Definition at line 42 of file lua-5.2.4/src/lgc.h.

Referenced by singlestep().

◆ GCSTEPSIZE

#define GCSTEPSIZE   (cast_int(100 * sizeof(TString)))

Definition at line 32 of file lua-5.2.4/src/lgc.h.

◆ gray2black

#define gray2black ( x)    l_setbit((x)->gch.marked, BLACKBIT)

Definition at line 115 of file lua-5.2.4/src/lgc.h.

◆ isblack

#define isblack ( x)    testbit((x)->gch.marked, BLACKBIT)

Definition at line 100 of file lua-5.2.4/src/lgc.h.

◆ isdead

#define isdead ( g,
v )   isdeadm(otherwhite(g), (v)->gch.marked)

Definition at line 112 of file lua-5.2.4/src/lgc.h.

◆ isdeadm

#define isdeadm ( ow,
m )   (!(((m) ^ WHITEBITS) & (ow)))

Definition at line 111 of file lua-5.2.4/src/lgc.h.

Referenced by sweeplist(), sweeplist(), and sweeplist().

◆ isgenerational

#define isgenerational ( g)    ((g)->gckind == KGC_GEN)

Definition at line 50 of file lua-5.2.4/src/lgc.h.

Referenced by luaC_forcestep(), singlestep(), and sweeplist().

◆ isgray

#define isgray ( x)
Value:
/* neither white nor black */ \
(!testbits((x)->gch.marked, WHITEBITS | bitmask(BLACKBIT)))
#define WHITEBITS
#define testbits(x, m)
#define BLACKBIT
#define bitmask(b)
#define gch(o)

Definition at line 101 of file lua-5.2.4/src/lgc.h.

101#define isgray(x) /* neither white nor black */ \
102 (!testbits((x)->gch.marked, WHITEBITS | bitmask(BLACKBIT)))

◆ isold

#define isold ( x)    testbit((x)->gch.marked, OLDBIT)

◆ issweepphase

#define issweepphase ( g)     (GCSsweepstring <= (g)->gcstate && (g)->gcstate <= GCSsweep)

Definition at line 47 of file lua-5.2.4/src/lgc.h.

47#define issweepphase(g) \
48 (GCSsweepstring <= (g)->gcstate && (g)->gcstate <= GCSsweep)

Referenced by luaC_barrier_(), luaC_checkfinalizer(), luaC_checkupvalcolor(), udata2finalize(), and udata2finalize().

◆ iswhite

#define iswhite ( x)    testbits((x)->gch.marked, WHITEBITS)

Definition at line 99 of file lua-5.2.4/src/lgc.h.

◆ keepinvariant

#define keepinvariant ( g)    (isgenerational(g) || g->gcstate <= GCSatomic)

◆ keepinvariantout

#define keepinvariantout ( g)
Value:
check_exp(g->gcstate == GCSpropagate || !isgenerational(g), \
g->gcstate <= GCSatomic)
#define check_exp(c, e)
#define GCSpropagate
#define isgenerational(g)
#define GCSatomic

Definition at line 68 of file lua-5.2.4/src/lgc.h.

68#define keepinvariantout(g) \
69 check_exp(g->gcstate == GCSpropagate || !isgenerational(g), \
70 g->gcstate <= GCSatomic)

Referenced by luaC_barrier_(), luaC_checkfinalizer(), and udata2finalize().

◆ l_setbit

#define l_setbit ( x,
b )   setbits(x, bitmask(b))

Definition at line 81 of file lua-5.2.4/src/lgc.h.

◆ luaC_barrier

#define luaC_barrier ( L,
p,
v )
Value:
{ if (valiswhite(v) && isblack(obj2gco(p))) \
luaC_barrier_(L,obj2gco(p),gcvalue(v)); }
#define gcvalue(o)
#define obj2gco(v)
#define valiswhite(x)
#define isblack(x)

Definition at line 127 of file lua-5.2.4/src/lgc.h.

127#define luaC_barrier(L,p,v) { if (valiswhite(v) && isblack(obj2gco(p))) \
128 luaC_barrier_(L,obj2gco(p),gcvalue(v)); }

◆ luaC_barrierback

#define luaC_barrierback ( L,
p,
v )
Value:
{ if (valiswhite(v) && isblack(obj2gco(p))) \
luaC_barrierback_(L,p); }

Definition at line 130 of file lua-5.2.4/src/lgc.h.

130#define luaC_barrierback(L,p,v) { if (valiswhite(v) && isblack(obj2gco(p))) \
131 luaC_barrierback_(L,p); }

Referenced by aux_rawset(), lua_rawset(), lua_rawseti(), lua_rawseti(), lua_rawsetp(), lua_setiuservalue(), luaH_newkey(), luaH_newkey(), luaV_execute(), luaV_execute(), luaV_finishset(), luaV_finishset(), and luaV_settable().

◆ luaC_barrierproto

#define luaC_barrierproto ( L,
p,
c )    { if (isblack(obj2gco(p))) luaC_barrierproto_(L,p,c); }

Definition at line 140 of file lua-5.2.4/src/lgc.h.

140#define luaC_barrierproto(L,p,c) \
141 { if (isblack(obj2gco(p))) luaC_barrierproto_(L,p,c); }

Referenced by pushclosure().

◆ luaC_checkGC

#define luaC_checkGC ( L)    luaC_condGC(L, luaC_step(L);)

Definition at line 124 of file lua-5.2.4/src/lgc.h.

◆ luaC_condGC

#define luaC_condGC ( L,
c )    {if (G(L)->GCdebt > 0) {c;}; condchangemem(L);}

Definition at line 122 of file lua-5.2.4/src/lgc.h.

122#define luaC_condGC(L,c) \
123 {if (G(L)->GCdebt > 0) {c;}; condchangemem(L);}

◆ luaC_objbarrier

#define luaC_objbarrier ( L,
p,
o )
Value:
{ if (iswhite(obj2gco(o)) && isblack(obj2gco(p))) \
luaC_barrier_(L,obj2gco(p),obj2gco(o)); }
#define iswhite(x)

Definition at line 133 of file lua-5.2.4/src/lgc.h.

133#define luaC_objbarrier(L,p,o) \
134 { if (iswhite(obj2gco(o)) && isblack(obj2gco(p))) \
135 luaC_barrier_(L,obj2gco(p),obj2gco(o)); }

◆ luaC_objbarrierback

#define luaC_objbarrierback ( L,
p,
o )    { if (iswhite(obj2gco(o)) && isblack(obj2gco(p))) luaC_barrierback_(L,p); }

Definition at line 137 of file lua-5.2.4/src/lgc.h.

137#define luaC_objbarrierback(L,p,o) \
138 { if (iswhite(obj2gco(o)) && isblack(obj2gco(p))) luaC_barrierback_(L,p); }

Referenced by lua_setmetatable().

◆ luaC_white

#define luaC_white ( g)    cast(lu_byte, (g)->currentwhite & WHITEBITS)

Definition at line 119 of file lua-5.2.4/src/lgc.h.

◆ OLDBIT

#define OLDBIT   6 /* object is old (only in generational mode) */

Definition at line 93 of file lua-5.2.4/src/lgc.h.

Referenced by sweeplist().

◆ otherwhite

#define otherwhite ( g)    (g->currentwhite ^ WHITEBITS)

Definition at line 110 of file lua-5.2.4/src/lgc.h.

◆ resetbit

#define resetbit ( x,
b )   resetbits(x, bitmask(b))

Definition at line 82 of file lua-5.2.4/src/lgc.h.

◆ resetbits

#define resetbits ( x,
m )   ((x) &= cast(lu_byte, ~(m)))

Definition at line 76 of file lua-5.2.4/src/lgc.h.

◆ resetoldbit

#define resetoldbit ( o)    resetbit((o)->gch.marked, OLDBIT)

◆ SEPARATED

#define SEPARATED   4 /* object is in 'finobj' list or in 'tobefnz' */

Definition at line 91 of file lua-5.2.4/src/lgc.h.

Referenced by luaC_checkfinalizer(), separatetobefnz(), and udata2finalize().

◆ setbits

#define setbits ( x,
m )   ((x) |= (m))

Definition at line 77 of file lua-5.2.4/src/lgc.h.

◆ testbit

#define testbit ( x,
b )   testbits(x, bitmask(b))

Definition at line 83 of file lua-5.2.4/src/lgc.h.

◆ testbits

#define testbits ( x,
m )   ((x) & (m))

Definition at line 78 of file lua-5.2.4/src/lgc.h.

◆ valiswhite

#define valiswhite ( x)    (iscollectable(x) && iswhite(gcvalue(x)))

Definition at line 117 of file lua-5.2.4/src/lgc.h.

◆ WHITE0BIT

#define WHITE0BIT   0 /* object is white (type 0) */

Definition at line 87 of file lua-5.2.4/src/lgc.h.

◆ WHITE1BIT

#define WHITE1BIT   1 /* object is white (type 1) */

Definition at line 88 of file lua-5.2.4/src/lgc.h.

◆ WHITEBITS

#define WHITEBITS   bit2mask(WHITE0BIT, WHITE1BIT)

Definition at line 96 of file lua-5.2.4/src/lgc.h.

Function Documentation

◆ luaC_barrier_()

LUAI_FUNC void luaC_barrier_ ( lua_State * L,
GCObject * o,
GCObject * v )

Definition at line 135 of file lua-5.2.4/src/lgc.c.

135 {
136 global_State *g = G(L);
137 lua_assert(isblack(o) && iswhite(v) && !isdead(g, v) && !isdead(g, o));
139 lua_assert(gch(o)->tt != LUA_TTABLE);
140 if (keepinvariantout(g)) /* must keep invariant? */
141 reallymarkobject(g, v); /* restore invariant */
142 else { /* sweep phase */
144 makewhite(g, o); /* mark main obj. as white to avoid other barriers */
145 }
146}
#define iswhite(x)
#define GCSpause
#define isblack(x)
#define isdead(g, v)
#define lua_assert(c)
#define G(L)
#define LUA_TTABLE
static void reallymarkobject(global_State *g, GCObject *o)
#define makewhite(g, x)
#define issweepphase(g)
#define keepinvariantout(g)

◆ luaC_barrierback_()

LUAI_FUNC void luaC_barrierback_ ( lua_State * L,
GCObject * o )

Definition at line 155 of file lua-5.2.4/src/lgc.c.

155 {
156 global_State *g = G(L);
157 lua_assert(isblack(o) && !isdead(g, o) && gch(o)->tt == LUA_TTABLE);
158 black2gray(o); /* make object gray (again) */
159 gco2t(o)->gclist = g->grayagain;
160 g->grayagain = o;
161}
#define black2gray(x)
#define gco2t(o)

◆ luaC_barrierproto_()

LUAI_FUNC void luaC_barrierproto_ ( lua_State * L,
Proto * p,
Closure * c )

Definition at line 172 of file lua-5.2.4/src/lgc.c.

172 {
173 global_State *g = G(L);
175 if (p->cache == NULL) { /* first time? */
176 luaC_objbarrier(L, p, c);
177 }
178 else { /* use a backward barrier */
179 black2gray(obj2gco(p)); /* make prototype gray (again) */
180 p->gclist = g->grayagain;
181 g->grayagain = obj2gco(p);
182 }
183}
#define NULL
Definition gmacros.h:924
#define luaC_objbarrier(L, p, o)
union Closure * cache
GCObject * gclist

References black2gray, Proto::cache, G, Proto::gclist, global_State::grayagain, isblack, lua_assert, luaC_objbarrier, NULL, and obj2gco.

◆ luaC_changemode()

LUAI_FUNC void luaC_changemode ( lua_State * L,
int mode )

Definition at line 952 of file lua-5.2.4/src/lgc.c.

952 {
953 global_State *g = G(L);
954 if (mode == g->gckind) return; /* nothing to change */
955 if (mode == KGC_GEN) { /* change to generational mode */
956 /* make sure gray lists are consistent */
959 g->gckind = KGC_GEN;
960 }
961 else { /* change to incremental mode */
962 /* sweep all objects to turn them back to white
963 (as white has not changed, nothing extra will be collected) */
964 g->gckind = KGC_NORMAL;
965 entersweep(L);
967 }
968}
#define GCSpropagate
#define bitmask(b)
static int entersweep(lua_State *L)
#define sweepphases
void luaC_runtilstate(lua_State *L, int statesmask)
#define gettotalbytes(g)
#define KGC_GEN
#define KGC_NORMAL

◆ luaC_checkfinalizer()

LUAI_FUNC void luaC_checkfinalizer ( lua_State * L,
GCObject * o,
Table * mt )

Definition at line 873 of file lua-5.2.4/src/lgc.c.

873 {
874 global_State *g = G(L);
875 if (testbit(gch(o)->marked, SEPARATED) || /* obj. is already separated... */
876 isfinalized(o) || /* ... or is finalized... */
877 gfasttm(g, mt, TM_GC) == NULL) /* or has no finalizer? */
878 return; /* nothing to be done */
879 else { /* move 'o' to 'finobj' list */
880 GCObject **p;
881 GCheader *ho = gch(o);
882 if (g->sweepgc == &ho->next) { /* avoid removing current sweep object */
884 g->sweepgc = sweeptolive(L, g->sweepgc, NULL);
885 }
886 /* search for pointer pointing to 'o' */
887 for (p = &g->allgc; *p != o; p = &gch(*p)->next) { /* empty */ }
888 *p = ho->next; /* remove 'o' from root list */
889 ho->next = g->finobj; /* link it in list 'finobj' */
890 g->finobj = o;
891 l_setbit(ho->marked, SEPARATED); /* mark it as such */
892 if (!keepinvariantout(g)) /* not keeping invariant? */
893 makewhite(g, o); /* "sweep" object */
894 else
895 resetoldbit(o); /* see MOVE OLD rule */
896 }
897}
#define testbit(x, b)
#define l_setbit(x, b)
@ TM_GC
#define gfasttm(g, et, e)
#define isfinalized(x)
static GCObject ** sweeptolive(lua_State *L, GCObject **p, int *n)
#define resetoldbit(o)
#define SEPARATED

◆ luaC_checkupvalcolor()

LUAI_FUNC void luaC_checkupvalcolor ( global_State * g,
UpVal * uv )

Definition at line 190 of file lua-5.2.4/src/lgc.c.

190 {
191 GCObject *o = obj2gco(uv);
192 lua_assert(!isblack(o)); /* open upvalues are never black */
193 if (isgray(o)) {
194 if (keepinvariant(g)) {
195 resetoldbit(o); /* see MOVE OLD rule */
196 gray2black(o); /* it is being visited now */
197 markvalue(g, uv->v);
198 }
199 else {
201 makewhite(g, o);
202 }
203 }
204}
#define isgray(x)
#define gray2black(x)
#define markvalue(g, o)
#define keepinvariant(g)

References gray2black, isblack, isgray, issweepphase, keepinvariant, lua_assert, makewhite, markvalue, obj2gco, resetoldbit, and UpVal::v.

Referenced by luaF_close().

◆ luaC_forcestep()

LUAI_FUNC void luaC_forcestep ( lua_State * L)

Definition at line 1163 of file lua-5.2.4/src/lgc.c.

1163 {
1164 global_State *g = G(L);
1165 int i;
1167 else incstep(L);
1168 /* run a few finalizers (or all of them at the end of a collect cycle) */
1169 for (i = 0; g->tobefnz && (i < GCFINALIZENUM || g->gcstate == GCSpause); i++)
1170 GCTM(L, 1); /* call one finalizer */
1171}
#define GCFINALIZENUM
static void incstep(lua_State *L)
static void generationalcollection(lua_State *L)
static void GCTM(lua_State *L, int propagateerrors)

References G, GCFINALIZENUM, GCSpause, global_State::gcstate, GCTM(), generationalcollection(), incstep(), isgenerational, and global_State::tobefnz.

Referenced by lua_gc(), and luaC_step().

◆ luaC_freeallobjects()

LUAI_FUNC void luaC_freeallobjects ( lua_State * L)

Definition at line 983 of file lua-5.2.4/src/lgc.c.

983 {
984 global_State *g = G(L);
985 int i;
986 separatetobefnz(L, 1); /* separate all objects with finalizers */
987 lua_assert(g->finobj == NULL);
989 g->currentwhite = WHITEBITS; /* this "white" makes all objects look dead */
990 g->gckind = KGC_NORMAL;
991 sweepwholelist(L, &g->finobj); /* finalizers can create objs. in 'finobj' */
992 sweepwholelist(L, &g->allgc);
993 for (i = 0; i < g->strt.size; i++) /* free all string lists */
994 sweepwholelist(L, &g->strt.hash[i]);
995 lua_assert(g->strt.nuse == 0);
996}
#define WHITEBITS
#define sweepwholelist(L, p)
static void callallpendingfinalizers(lua_State *L, int propagateerrors)
static void separatetobefnz(lua_State *L, int all)

◆ luaC_fullgc()

LUAI_FUNC void luaC_fullgc ( lua_State * L,
int isemergency )

Definition at line 1189 of file lua-5.2.4/src/lgc.c.

1189 {
1190 global_State *g = G(L);
1191 int origkind = g->gckind;
1192 lua_assert(origkind != KGC_EMERGENCY);
1193 if (isemergency) /* do not run finalizers during emergency GC */
1194 g->gckind = KGC_EMERGENCY;
1195 else {
1196 g->gckind = KGC_NORMAL;
1198 }
1199 if (keepinvariant(g)) { /* may there be some black objects? */
1200 /* must sweep all objects to turn them back to white
1201 (as white has not changed, nothing will be collected) */
1202 entersweep(L);
1203 }
1204 /* finish any pending sweep phase to start a new cycle */
1206 luaC_runtilstate(L, ~bitmask(GCSpause)); /* start new collection */
1207 luaC_runtilstate(L, bitmask(GCSpause)); /* run entire collection */
1208 if (origkind == KGC_GEN) { /* generational mode? */
1209 /* generational mode must be kept in propagate phase */
1211 }
1212 g->gckind = origkind;
1213 setpause(g, gettotalbytes(g));
1214 if (!isemergency) /* do not run finalizers during emergency GC */
1216}
static void setpause(global_State *g, l_mem estimate)
#define KGC_EMERGENCY

◆ luaC_newobj()

LUAI_FUNC GCObject * luaC_newobj ( lua_State * L,
int tt,
size_t sz,
GCObject ** list,
int offset )

Definition at line 212 of file lua-5.2.4/src/lgc.c.

213 {
214 global_State *g = G(L);
215 char *raw = cast(char *, luaM_newobject(L, novariant(tt), sz));
216 GCObject *o = obj2gco(raw + offset);
217 if (list == NULL)
218 list = &g->allgc; /* standard list for collectable objects */
219 gch(o)->marked = luaC_white(g);
220 gch(o)->tt = tt;
221 gch(o)->next = *list;
222 *list = o;
223 return o;
224}
#define luaC_white(g)
#define cast(t, exp)
#define luaM_newobject(L, tag, s)
#define novariant(x)

References global_State::allgc, cast, G, gch, luaC_white, luaM_newobject, novariant, NULL, and obj2gco.

Referenced by createstrobj(), createstrobj(), createstrobj(), lua_newthread(), luaF_findupval(), luaF_initupvals(), luaF_newCclosure(), luaF_newCclosure(), luaF_newLclosure(), luaF_newLclosure(), luaF_newproto(), luaF_newupval(), luaH_new(), luaS_newudata(), luaS_newudata(), luaS_newudata(), and newupval().

◆ luaC_runtilstate()

LUAI_FUNC void luaC_runtilstate ( lua_State * L,
int statesmask )

Definition at line 1110 of file lua-5.2.4/src/lgc.c.

1110 {
1111 global_State *g = G(L);
1112 while (!testbit(statesmask, g->gcstate))
1113 singlestep(L);
1114}
static lu_mem singlestep(lua_State *L)

◆ luaC_step()

LUAI_FUNC void luaC_step ( lua_State * L)

Definition at line 610 of file lua-5.1.5/src/lgc.c.

610 {
611 global_State *g = G(L);
612 l_mem lim = (GCSTEPSIZE/100) * g->gcstepmul;
613 if (lim == 0)
614 lim = (MAX_LUMEM-1)/2; /* no limit */
615 g->gcdept += g->totalbytes - g->GCthreshold;
616 do {
617 lim -= singlestep(L);
618 if (g->gcstate == GCSpause)
619 break;
620 } while (lim > 0);
621 if (g->gcstate != GCSpause) {
622 if (g->gcdept < GCSTEPSIZE)
623 g->GCthreshold = g->totalbytes + GCSTEPSIZE; /* - lim/g->gcstepmul;*/
624 else {
625 g->gcdept -= GCSTEPSIZE;
626 g->GCthreshold = g->totalbytes;
627 }
628 }
629 else {
630 setthreshold(g);
631 }
632}
static l_mem singlestep(lua_State *L)
#define setthreshold(g)
#define GCSTEPSIZE
#define MAX_LUMEM
LUAI_MEM l_mem