Defines | Functions

lua/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.

Defines

#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 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
#define WHITE1BIT   1
#define BLACKBIT   2
#define FINALIZEDBIT   3
#define SEPARATED   4
#define FIXEDBIT   5
#define OLDBIT   6
#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)

Define Documentation

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

Definition at line 62 of file lgc.h.

Referenced by lua_newstate().

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

Definition at line 61 of file lgc.h.

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

#define BLACKBIT   2

Definition at line 71 of file lgc.h.

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

Definition at line 96 of file lgc.h.

Referenced by luaF_findupval(), and luaS_newlstr().

#define FINALIZEDBIT   3

Definition at line 72 of file lgc.h.

Referenced by separatetobefnz().

#define FIXEDBIT   5

Definition at line 74 of file lgc.h.

Referenced by lua_newstate().

#define GCSatomic   1

Definition at line 32 of file lgc.h.

Referenced by traversestack().

#define GCSpause   5

Definition at line 36 of file lgc.h.

Referenced by generationalcollection(), lua_gc(), luaC_barrier_(), luaC_fullgc(), singlestep(), and step().

#define GCSpropagate   0

Definition at line 31 of file lgc.h.

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

#define GCSsweep   4

Definition at line 35 of file lgc.h.

Referenced by singlestep().

#define GCSsweepstring   2

Definition at line 33 of file lgc.h.

Referenced by luaS_resize(), and singlestep().

#define GCSsweepudata   3

Definition at line 34 of file lgc.h.

Referenced by singlestep().

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

Definition at line 97 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)
#define isdeadm (   ow,
  m 
)    (!(((m) ^ WHITEBITS) & (ow)))

Definition at line 93 of file lgc.h.

Referenced by sweeplist().

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

Definition at line 42 of file lgc.h.

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

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

Definition at line 83 of file lgc.h.

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

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

Definition at line 86 of file lgc.h.

Referenced by udata2finalize().

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

Definition at line 39 of file lgc.h.

Referenced by luaC_barrier_(), and luaC_checkupvalcolor().

#define iswhite (   x  )     testbits((x)->gch.marked, WHITEBITS)
#define keepinvariant (   g  )     (isgenerational(g) || g->gcstate <= GCSatomic)

Definition at line 52 of file lgc.h.

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

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

Definition at line 63 of file lgc.h.

Referenced by luaC_checkfinalizer(), and separatetobefnz().

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

Definition at line 109 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)))  \
    luaC_barrierback_(L,p); }

Definition at line 112 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 122 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 104 of file lgc.h.

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

Definition at line 119 of file lgc.h.

Referenced by lua_setmetatable().

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

Definition at line 101 of file lgc.h.

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

#define OLDBIT   6

Definition at line 75 of file lgc.h.

Referenced by sweeplist().

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

Definition at line 92 of file lgc.h.

Referenced by atomic(), and sweeplist().

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

Definition at line 64 of file lgc.h.

Referenced by udata2finalize().

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

Definition at line 58 of file lgc.h.

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

Definition at line 73 of file lgc.h.

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

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

Definition at line 59 of file lgc.h.

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

Definition at line 65 of file lgc.h.

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

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

Definition at line 60 of file lgc.h.

Referenced by sweeplist().

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

Definition at line 99 of file lgc.h.

Referenced by removeentry(), and traverseephemeron().

#define WHITE0BIT   0

Definition at line 69 of file lgc.h.

Referenced by lua_newstate().

#define WHITE1BIT   1

Definition at line 70 of file lgc.h.

#define WHITEBITS   bit2mask(WHITE0BIT, WHITE1BIT)

Definition at line 78 of file lgc.h.


Function Documentation

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

Definition at line 140 of file lgc.c.

References G, gch, GCSpause, global_State::gcstate, isblack, isdead, isgenerational, issweepphase, iswhite, keepinvariant, lua_assert, LUA_TTABLE, makewhite, and reallymarkobject().

Here is the call graph for this function:

LUAI_FUNC void luaC_barrierback_ ( lua_State L,
GCObject o 
)

Definition at line 160 of file lgc.c.

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 
)

Definition at line 862 of file lgc.c.

References bitmask, G, global_State::gckind, GCSpropagate, global_State::gcstate, gettotalbytes, KGC_GEN, global_State::lastmajormem, luaC_runtilstate(), sweepphases, and global_State::sweepstrgc.

Referenced by lua_gc().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 829 of file lgc.c.

References global_State::allgc, global_State::finobj, G, gch, gfasttm, isfinalized, l_setbit, resetoldbit, SEPARATED, testbit, and TM_GC.

Referenced by lua_setmetatable().

Here is the caller graph for this function:

LUAI_FUNC void luaC_checkupvalcolor ( global_State g,
UpVal uv 
)

Definition at line 195 of file lgc.c.

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

Referenced by luaF_close().

Here is the caller graph for this function:

LUAI_FUNC void luaC_forcestep ( lua_State L  ) 

Definition at line 1051 of file lgc.c.

References G, GCFINALIZENUM, GCTM(), generationalcollection(), isgenerational, step(), and global_State::tobefnz.

Referenced by lua_gc(), and luaC_step().

Here is the call graph for this function:

Here is the caller graph for this function:

LUAI_FUNC void luaC_freeallobjects ( lua_State L  ) 

Definition at line 894 of file lgc.c.

References global_State::allgc, callallpendingfinalizers(), global_State::currentwhite, global_State::finobj, G, global_State::gckind, stringtable::hash, lua_assert, stringtable::nuse, separatetobefnz(), stringtable::size, global_State::strt, and sweepwholelist.

Referenced by close_state().

Here is the call graph for this function:

Here is the caller graph for this function:

LUAI_FUNC void luaC_fullgc ( lua_State L,
int  isemergency 
)

Definition at line 1073 of file lgc.c.

References bitmask, callallpendingfinalizers(), G, global_State::gckind, GCSpause, GCSpropagate, global_State::gcstate, keepinvariant, KGC_EMERGENCY, KGC_GEN, lua_assert, luaC_runtilstate(), luaE_setdebt(), stddebt, and global_State::sweepstrgc.

Referenced by generationalcollection(), lua_gc(), and luaM_realloc_().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 217 of file lgc.c.

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

Referenced by lua_newthread(), luaF_findupval(), luaF_newCclosure(), luaF_newLclosure(), luaF_newproto(), luaF_newupval(), luaH_new(), luaS_newudata(), and newlstr().

Here is the caller graph for this function:

LUAI_FUNC void luaC_runtilstate ( lua_State L,
int  statesmask 
)

Definition at line 1012 of file lgc.c.

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

LUAI_FUNC void luaC_step ( lua_State L  ) 

Definition at line 1064 of file lgc.c.

References G, and luaC_forcestep().

Referenced by luaV_execute().

Here is the call graph for this function:

Here is the caller graph for this function:

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Fri May 25 2012 01:07:05 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs