lgc.h File Reference

#include "lobject.h"

Go to the source code of this file.

Defines

#define GCSpause   0
#define GCSpropagate   1
#define GCSsweepstring   2
#define GCSsweep   3
#define GCSfinalize   4
#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 set2bits(x, b1, b2)   setbits(x, (bit2mask(b1, b2)))
#define reset2bits(x, b1, b2)   resetbits(x, (bit2mask(b1, b2)))
#define test2bits(x, b1, b2)   testbits(x, (bit2mask(b1, b2)))
#define WHITE0BIT   0
#define WHITE1BIT   1
#define BLACKBIT   2
#define FINALIZEDBIT   3
#define KEYWEAKBIT   3
#define VALUEWEAKBIT   4
#define FIXEDBIT   5
#define SFIXEDBIT   6
#define WHITEBITS   bit2mask(WHITE0BIT, WHITE1BIT)
#define iswhite(x)   test2bits((x)->gch.marked, WHITE0BIT, WHITE1BIT)
#define isblack(x)   testbit((x)->gch.marked, BLACKBIT)
#define isgray(x)   (!isblack(x) && !iswhite(x))
#define otherwhite(g)   (g->currentwhite ^ WHITEBITS)
#define isdead(g, v)   ((v)->gch.marked & otherwhite(g) & WHITEBITS)
#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_checkGC(L)
#define luaC_barrier(L, p, v)
#define luaC_barriert(L, t, v)
#define luaC_objbarrier(L, p, o)
#define luaC_objbarriert(L, t, o)   { if (iswhite(obj2gco(o)) && isblack(obj2gco(t))) luaC_barrierback(L,t); }

Functions

LUAI_FUNC size_t luaC_separateudata (lua_State *L, int all)
LUAI_FUNC void luaC_callGCTM (lua_State *L)
LUAI_FUNC void luaC_freeall (lua_State *L)
LUAI_FUNC void luaC_step (lua_State *L)
LUAI_FUNC void luaC_fullgc (lua_State *L)
LUAI_FUNC void luaC_link (lua_State *L, GCObject *o, lu_byte tt)
LUAI_FUNC void luaC_linkupval (lua_State *L, UpVal *uv)
LUAI_FUNC void luaC_barrierf (lua_State *L, GCObject *o, GCObject *v)
LUAI_FUNC void luaC_barrierback (lua_State *L, Table *t)


Define Documentation

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

Definition at line 31 of file lgc.h.

Referenced by lua_newstate().

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

Definition at line 30 of file lgc.h.

Referenced by luaC_freeall(), and sweeplist().

#define BLACKBIT   2

Definition at line 56 of file lgc.h.

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

Definition at line 72 of file lgc.h.

Referenced by luaF_findupval(), and luaS_newlstr().

#define FINALIZEDBIT   3

Definition at line 57 of file lgc.h.

#define FIXEDBIT   5

Definition at line 60 of file lgc.h.

Referenced by lua_newstate(), and sweeplist().

#define GCSfinalize   4

Definition at line 21 of file lgc.h.

Referenced by luaC_barrierback(), luaC_barrierf(), luaC_fullgc(), luaC_linkupval(), and singlestep().

#define GCSpause   0

Definition at line 17 of file lgc.h.

Referenced by lua_gc(), lua_newstate(), luaC_barrierback(), luaC_barrierf(), luaC_fullgc(), luaC_linkupval(), luaC_step(), and singlestep().

#define GCSpropagate   1

Definition at line 18 of file lgc.h.

Referenced by luaC_barrierf(), luaC_fullgc(), luaC_linkupval(), markroot(), and singlestep().

#define GCSsweep   3

Definition at line 20 of file lgc.h.

Referenced by luaC_fullgc(), and singlestep().

#define GCSsweepstring   2

Definition at line 19 of file lgc.h.

Referenced by atomic(), luaC_fullgc(), luaS_resize(), and singlestep().

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

Definition at line 73 of file lgc.h.

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

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

Definition at line 66 of file lgc.h.

Referenced by luaC_barrierback(), luaC_barrierf(), and luaF_close().

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

Definition at line 70 of file lgc.h.

Referenced by luaC_barrierback(), luaC_barrierf(), luaF_close(), luaF_findupval(), luaS_newlstr(), reallymarkobject(), and sweeplist().

#define isgray ( x   )     (!isblack(x) && !iswhite(x))

Definition at line 67 of file lgc.h.

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

#define iswhite ( x   )     test2bits((x)->gch.marked, WHITE0BIT, WHITE1BIT)

Definition at line 65 of file lgc.h.

Referenced by adjust_varargs(), atomic(), iscleared(), lua_pushcclosure(), luaC_barrierf(), luaC_separateudata(), luaE_newthread(), and reallymarkobject().

#define KEYWEAKBIT   3

Definition at line 58 of file lgc.h.

Referenced by cleartable(), and traversetable().

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

Definition at line 32 of file lgc.h.

#define luaC_barrier ( L,
p,
v   ) 

Value:

Definition at line 86 of file lgc.h.

Referenced by addk(), lua_replace(), lua_setupvalue(), and luaC_linkupval().

#define luaC_barriert ( L,
t,
v   ) 

Value:

Definition at line 89 of file lgc.h.

Referenced by lua_rawset(), lua_rawseti(), luaV_settable(), and newkey().

#define luaC_checkGC (  ) 

Value:

{ \
  condhardstacktests(luaD_reallocstack(L, L->stacksize - EXTRA_STACK - 1)); \
  if (G(L)->totalbytes >= G(L)->GCthreshold) \
        luaC_step(L); }

Definition at line 80 of file lgc.h.

Referenced by adjust_varargs(), f_parser(), lua_concat(), lua_createtable(), lua_newthread(), lua_newuserdata(), lua_pushcclosure(), lua_pushfstring(), lua_pushlstring(), lua_pushvfstring(), lua_tolstring(), and luaD_call().

#define luaC_objbarrier ( L,
p,
 ) 

Value:

Definition at line 92 of file lgc.h.

Referenced by indexupvalue(), lua_setfenv(), lua_setmetatable(), pushclosure(), and registerlocalvar().

#define luaC_objbarriert ( L,
t,
 )     { if (iswhite(obj2gco(o)) && isblack(obj2gco(t))) luaC_barrierback(L,t); }

Definition at line 96 of file lgc.h.

Referenced by lua_setmetatable().

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

Definition at line 77 of file lgc.h.

Referenced by lua_newstate(), luaC_link(), luaF_findupval(), luaS_newudata(), and newlstr().

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

Definition at line 69 of file lgc.h.

Referenced by atomic(), and sweeplist().

#define reset2bits ( x,
b1,
b2   )     resetbits(x, (bit2mask(b1, b2)))

Definition at line 36 of file lgc.h.

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

Definition at line 33 of file lgc.h.

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

Definition at line 27 of file lgc.h.

#define set2bits ( x,
b1,
b2   )     setbits(x, (bit2mask(b1, b2)))

Definition at line 35 of file lgc.h.

Referenced by lua_newstate().

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

Definition at line 28 of file lgc.h.

#define SFIXEDBIT   6

Definition at line 61 of file lgc.h.

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

#define test2bits ( x,
b1,
b2   )     testbits(x, (bit2mask(b1, b2)))

Definition at line 37 of file lgc.h.

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

Definition at line 34 of file lgc.h.

Referenced by cleartable(), and sweeplist().

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

Definition at line 29 of file lgc.h.

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

Definition at line 75 of file lgc.h.

#define VALUEWEAKBIT   4

Definition at line 59 of file lgc.h.

Referenced by cleartable(), and traversetable().

#define WHITE0BIT   0

Definition at line 54 of file lgc.h.

Referenced by lua_newstate().

#define WHITE1BIT   1

Definition at line 55 of file lgc.h.

#define WHITEBITS   bit2mask(WHITE0BIT, WHITE1BIT)

Definition at line 62 of file lgc.h.

Referenced by luaC_freeall(), and sweeplist().


Function Documentation

LUAI_FUNC void luaC_barrierback ( lua_State L,
Table t 
)

Definition at line 675 of file lgc.cpp.

References black2gray, G, Table::gclist, GCSfinalize, GCSpause, global_State::gcstate, global_State::grayagain, isblack, isdead, lua_assert, and obj2gco.

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

Definition at line 662 of file lgc.cpp.

References G, GCObject::gch, GCSfinalize, GCSpause, GCSpropagate, global_State::gcstate, isblack, isdead, iswhite, lua_assert, LUA_TTABLE, makewhite, reallymarkobject(), and ttype.

LUAI_FUNC void luaC_callGCTM ( lua_State L  ) 

Definition at line 477 of file lgc.cpp.

References G, and GCTM().

LUAI_FUNC void luaC_freeall ( lua_State L  ) 

Definition at line 483 of file lgc.cpp.

References bitmask, global_State::currentwhite, G, stringtable::hash, global_State::rootgc, SFIXEDBIT, stringtable::size, global_State::strt, sweepwholelist, and WHITEBITS.

LUAI_FUNC void luaC_fullgc ( lua_State L  ) 

Definition at line 636 of file lgc.cpp.

References G, GCSfinalize, GCSpause, GCSpropagate, GCSsweep, GCSsweepstring, global_State::gcstate, global_State::gray, global_State::grayagain, lua_assert, markroot(), NULL, global_State::rootgc, setthreshold, singlestep(), global_State::sweepgc, global_State::sweepstrgc, and global_State::weak.

LUAI_FUNC void luaC_link ( lua_State L,
GCObject o,
lu_byte  tt 
)

Definition at line 686 of file lgc.cpp.

References G, GCObject::gch, luaC_white, and global_State::rootgc.

LUAI_FUNC void luaC_linkupval ( lua_State L,
UpVal uv 
)

Definition at line 695 of file lgc.cpp.

References G, GCObject::gch, GCSfinalize, GCSpause, GCSpropagate, global_State::gcstate, gray2black, isgray, lua_assert, luaC_barrier, makewhite, obj2gco, global_State::rootgc, and UpVal::v.

LUAI_FUNC size_t luaC_separateudata ( lua_State L,
int  all 
)

Definition at line 128 of file lgc.cpp.

References fasttm, G, GCObject::gch, gco2u, isfinalized, iswhite, global_State::mainthread, markfinalized, NULL, sizeudata, TM_GC, and global_State::tmudata.

LUAI_FUNC void luaC_step ( lua_State L  ) 

Definition at line 610 of file lgc.cpp.

References global_State::estimate, G, global_State::gcdept, GCSpause, global_State::gcstate, global_State::gcstepmul, GCSTEPSIZE, global_State::GCthreshold, lua_assert, MAX_LUMEM, setthreshold, singlestep(), and global_State::totalbytes.


Generated on Mon Feb 16 15:14:58 2009 for Scorched3D by  doxygen 1.5.3