The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Macros | Functions
lgc.h File Reference
#include "lobject.h"
#include "lstate.h"
Include dependency graph for lgc.h:
This graph shows which files directly or indirectly include this file:

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

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

Definition at line 79 of file lgc.h.

Referenced by lua_newstate().

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

Definition at line 78 of file lgc.h.

Referenced by generationalcollection(), luaC_changemode(), luaC_fullgc(), luaS_resize(), and sweeplist().

#define BLACKBIT   2 /* object is black */

Definition at line 88 of file lgc.h.

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

Definition at line 113 of file lgc.h.

Referenced by internshrstr(), and luaF_findupval().

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

Definition at line 89 of file lgc.h.

Referenced by separatetobefnz().

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

Definition at line 91 of file lgc.h.

Referenced by lua_newstate().

#define GCSatomic   1

Definition at line 39 of file lgc.h.

Referenced by singlestep(), and traversestack().

#define GCSpause   5
#define GCSpropagate   0

Definition at line 38 of file lgc.h.

Referenced by generationalcollection(), luaC_changemode(), luaC_fullgc(), and singlestep().

#define GCSsweep   4

Definition at line 42 of file lgc.h.

Referenced by singlestep().

#define GCSsweepstring   2

Definition at line 40 of file lgc.h.

Referenced by entersweep(), luaS_resize(), and singlestep().

#define GCSsweepudata   3

Definition at line 41 of file lgc.h.

Referenced by singlestep().

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

Definition at line 31 of file lgc.h.

Referenced by incstep(), lua_gc(), and luaC_step().

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

Definition at line 114 of file lgc.h.

Referenced by luaC_checkupvalcolor(), propagatemark(), and reallymarkobject().

#define isblack (   x)    testbit((x)->gch.marked, BLACKBIT)
#define isdead (   g,
  v 
)    isdeadm(otherwhite(g), (v)->gch.marked)

Definition at line 111 of file lgc.h.

Referenced by internshrstr(), luaC_barrier_(), luaC_barrierback_(), luaF_close(), and luaF_findupval().

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

Definition at line 110 of file lgc.h.

Referenced by sweeplist().

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

Definition at line 49 of file lgc.h.

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

#define isgray (   x)
Value:
/* neither white nor black */ \
(!testbits((x)->gch.marked, WHITEBITS | bitmask(BLACKBIT)))
#define WHITEBITS
Definition: lgc.h:95
#define gch(o)
Definition: lstate.h:196
GLint GLint GLint GLint GLint x
Definition: glew.h:1220
#define bitmask(b)
Definition: lgc.h:78
#define BLACKBIT
Definition: lgc.h:88
#define testbits(x, m)
Definition: lgc.h:77

Definition at line 100 of file lgc.h.

Referenced by luaC_checkupvalcolor(), propagatemark(), and remarkupvals().

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

Definition at line 103 of file lgc.h.

Referenced by luaF_findupval(), and udata2finalize().

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

Definition at line 46 of file lgc.h.

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

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

Definition at line 98 of file lgc.h.

Referenced by atomic(), iscleared(), luaC_barrier_(), separatetobefnz(), and traverseproto().

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

Definition at line 60 of file lgc.h.

Referenced by luaC_checkupvalcolor(), and luaC_fullgc().

#define keepinvariantout (   g)
Value:
g->gcstate <= GCSatomic)
#define check_exp(c, e)
Definition: llimits.h:66
GLboolean GLboolean g
Definition: glew.h:7319
#define GCSatomic
Definition: lgc.h:39
#define isgenerational(g)
Definition: lgc.h:49
#define GCSpropagate
Definition: lgc.h:38

Definition at line 67 of file lgc.h.

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

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

Definition at line 80 of file lgc.h.

Referenced by luaC_checkfinalizer(), and separatetobefnz().

#define luaC_barrier (   L,
  p,
  v 
)
Value:
{ if (valiswhite(v) && isblack(obj2gco(p))) \
#define gcvalue(o)
Definition: lobject.h:153
#define valiswhite(x)
Definition: lgc.h:116
#define obj2gco(v)
Definition: lstate.h:214
const GLdouble * v
Definition: glew.h:1359
GLfloat GLfloat p
Definition: glew.h:12766
#define isblack(x)
Definition: lgc.h:99
LUAI_FUNC void luaC_barrier_(lua_State *L, GCObject *o, GCObject *v)
Definition: lgc.cpp:134

Definition at line 126 of file lgc.h.

Referenced by addk(), lua_load(), lua_setupvalue(), luaV_execute(), and moveto().

#define luaC_barrierback (   L,
  p,
  v 
)
Value:
{ if (valiswhite(v) && isblack(obj2gco(p))) \
#define valiswhite(x)
Definition: lgc.h:116
#define obj2gco(v)
Definition: lstate.h:214
const GLdouble * v
Definition: glew.h:1359
GLfloat GLfloat p
Definition: glew.h:12766
LUAI_FUNC void luaC_barrierback_(lua_State *L, GCObject *o)
Definition: lgc.cpp:154
#define isblack(x)
Definition: lgc.h:99

Definition at line 129 of file lgc.h.

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

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

Definition at line 139 of file lgc.h.

Referenced by pushclosure().

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

Definition at line 121 of file lgc.h.

#define luaC_objbarrier (   L,
  p,
 
)
Value:
{ if (iswhite(obj2gco(o)) && isblack(obj2gco(p))) \
#define obj2gco(v)
Definition: lstate.h:214
#define iswhite(x)
Definition: lgc.h:98
GLfloat GLfloat p
Definition: glew.h:12766
#define isblack(x)
Definition: lgc.h:99
LUAI_FUNC void luaC_barrier_(lua_State *L, GCObject *o, GCObject *v)
Definition: lgc.cpp:134

Definition at line 132 of file lgc.h.

Referenced by addprototype(), f_parser(), lua_setmetatable(), lua_setuservalue(), lua_upvaluejoin(), luaC_barrierproto_(), newupvalue(), and registerlocalvar().

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

Definition at line 136 of file lgc.h.

Referenced by lua_setmetatable().

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

Definition at line 118 of file lgc.h.

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

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

Definition at line 92 of file lgc.h.

Referenced by sweeplist().

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

Definition at line 109 of file lgc.h.

Referenced by atomic(), and sweeplist().

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

Definition at line 81 of file lgc.h.

Referenced by udata2finalize().

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

Definition at line 75 of file lgc.h.

#define resetoldbit (   o)    resetbit((o)->gch.marked, OLDBIT)
#define SEPARATED   4 /* object is in 'finobj' list or in 'tobefnz' */

Definition at line 90 of file lgc.h.

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

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

Definition at line 76 of file lgc.h.

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

Definition at line 82 of file lgc.h.

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

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

Definition at line 77 of file lgc.h.

Referenced by sweeplist().

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

Definition at line 116 of file lgc.h.

Referenced by removeentry(), and traverseephemeron().

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

Definition at line 86 of file lgc.h.

Referenced by lua_newstate().

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

Definition at line 87 of file lgc.h.

#define WHITEBITS   bit2mask(WHITE0BIT, WHITE1BIT)

Definition at line 95 of file lgc.h.

Referenced by luaC_freeallobjects().

Function Documentation

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

Definition at line 154 of file lgc.cpp.

References black2gray, G, gch, gco2t, global_State::grayagain, isblack, isdead, lua_assert, and LUA_TTABLE.

LUAI_FUNC void luaC_barrierproto_ ( lua_State L,
Proto p,
Closure c 
)
LUAI_FUNC void luaC_changemode ( lua_State L,
int  mode 
)
LUAI_FUNC void luaC_checkfinalizer ( lua_State L,
GCObject o,
Table mt 
)
LUAI_FUNC void luaC_checkupvalcolor ( global_State g,
UpVal uv 
)

Definition at line 189 of file lgc.cpp.

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

Referenced by luaF_close().

LUAI_FUNC void luaC_forcestep ( lua_State L)
LUAI_FUNC void luaC_freeallobjects ( lua_State L)
LUAI_FUNC void luaC_fullgc ( lua_State L,
int  isemergency 
)
LUAI_FUNC GCObject* luaC_newobj ( lua_State L,
int  tt,
size_t  sz,
GCObject **  list,
int  offset 
)
LUAI_FUNC void luaC_runtilstate ( lua_State L,
int  statesmask 
)

Definition at line 1109 of file lgc.cpp.

References G, global_State::gcstate, singlestep(), and testbit.

Referenced by generationalcollection(), luaC_changemode(), luaC_fullgc(), and luaS_resize().

LUAI_FUNC void luaC_step ( lua_State L)

Definition at line 1176 of file lgc.cpp.

References G, global_State::gcrunning, GCSTEPSIZE, luaC_forcestep(), and luaE_setdebt().