#include <string.h>#include "lua.h"#include "ldebug.h"#include "ldo.h"#include "lfunc.h"#include "lgc.h"#include "lmem.h"#include "lobject.h"#include "lstate.h"#include "lstring.h"#include "ltable.h"#include "ltm.h"Go to the source code of this file.
Defines | |
| #define | lgc_c |
| #define | LUA_CORE |
| #define | GCSTEPSIZE 1024u |
| #define | GCSWEEPMAX 40 |
| #define | GCSWEEPCOST 10 |
| #define | GCFINALIZECOST 100 |
| #define | maskmarks cast_byte(~(bitmask(BLACKBIT)|WHITEBITS)) |
| #define | makewhite(g, x) ((x)->gch.marked = cast_byte(((x)->gch.marked & maskmarks) | luaC_white(g))) |
| #define | white2gray(x) reset2bits((x)->gch.marked, WHITE0BIT, WHITE1BIT) |
| #define | black2gray(x) resetbit((x)->gch.marked, BLACKBIT) |
| #define | stringmark(s) reset2bits((s)->tsv.marked, WHITE0BIT, WHITE1BIT) |
| #define | isfinalized(u) testbit((u)->marked, FINALIZEDBIT) |
| #define | markfinalized(u) l_setbit((u)->marked, FINALIZEDBIT) |
| #define | KEYWEAK bitmask(KEYWEAKBIT) |
| #define | VALUEWEAK bitmask(VALUEWEAKBIT) |
| #define | markvalue(g, o) |
| #define | markobject(g, t) |
| #define | setthreshold(g) (g->GCthreshold = (g->estimate/100) * g->gcpause) |
| #define | sweepwholelist(L, p) sweeplist(L,p,MAX_LUMEM) |
Functions | |
| static void | removeentry (Node *n) |
| static void | reallymarkobject (global_State *g, GCObject *o) |
| static void | marktmu (global_State *g) |
| size_t | luaC_separateudata (lua_State *L, int all) |
| static int | traversetable (global_State *g, Table *h) |
| static void | traverseproto (global_State *g, Proto *f) |
| static void | traverseclosure (global_State *g, Closure *cl) |
| static void | checkstacksizes (lua_State *L, StkId max) |
| static void | traversestack (global_State *g, lua_State *l) |
| static l_mem | propagatemark (global_State *g) |
| static size_t | propagateall (global_State *g) |
| static int | iscleared (const TValue *o, int iskey) |
| static void | cleartable (GCObject *l) |
| static void | freeobj (lua_State *L, GCObject *o) |
| static GCObject ** | sweeplist (lua_State *L, GCObject **p, lu_mem count) |
| static void | checkSizes (lua_State *L) |
| static void | GCTM (lua_State *L) |
| void | luaC_callGCTM (lua_State *L) |
| void | luaC_freeall (lua_State *L) |
| static void | markmt (global_State *g) |
| static void | markroot (lua_State *L) |
| static void | remarkupvals (global_State *g) |
| static void | atomic (lua_State *L) |
| static l_mem | singlestep (lua_State *L) |
| void | luaC_step (lua_State *L) |
| void | luaC_fullgc (lua_State *L) |
| void | luaC_barrierf (lua_State *L, GCObject *o, GCObject *v) |
| void | luaC_barrierback (lua_State *L, Table *t) |
| void | luaC_link (lua_State *L, GCObject *o, lu_byte tt) |
| void | luaC_linkupval (lua_State *L, UpVal *uv) |
| #define GCFINALIZECOST 100 |
| #define GCSTEPSIZE 1024u |
| #define GCSWEEPCOST 10 |
| #define GCSWEEPMAX 40 |
| #define isfinalized | ( | u | ) | testbit((u)->marked, FINALIZEDBIT) |
| #define KEYWEAK bitmask(KEYWEAKBIT) |
| #define makewhite | ( | g, | |||
| x | ) | ((x)->gch.marked = cast_byte(((x)->gch.marked & maskmarks) | luaC_white(g))) |
Definition at line 34 of file lgc.cpp.
Referenced by GCTM(), luaC_barrierf(), luaC_linkupval(), marktmu(), and sweeplist().
| #define markfinalized | ( | u | ) | l_setbit((u)->marked, FINALIZEDBIT) |
Value:
Definition at line 55 of file lgc.cpp.
Referenced by atomic(), markmt(), markroot(), reallymarkobject(), traverseclosure(), traverseproto(), and traversetable().
| #define markvalue | ( | g, | |||
| o | ) |
Value:
{ checkconsistency(o); \
if (iscollectable(o) && iswhite(gcvalue(o))) reallymarkobject(g,gcvalue(o)); }
Definition at line 52 of file lgc.cpp.
Referenced by markroot(), reallymarkobject(), remarkupvals(), traverseclosure(), traverseproto(), traversestack(), and traversetable().
Definition at line 404 of file lgc.cpp.
Referenced by luaC_freeall(), singlestep(), and sweeplist().
| #define VALUEWEAK bitmask(VALUEWEAKBIT) |
| static void atomic | ( | lua_State * | L | ) | [static] |
Definition at line 525 of file lgc.cpp.
References cast_byte, cleartable(), global_State::currentwhite, global_State::estimate, G, GCSsweepstring, global_State::gcstate, global_State::gray, global_State::grayagain, iswhite, lua_assert, luaC_separateudata(), global_State::mainthread, markmt(), markobject, marktmu(), NULL, obj2gco, otherwhite, propagateall(), remarkupvals(), global_State::rootgc, global_State::sweepgc, global_State::sweepstrgc, global_State::totalbytes, and global_State::weak.
Referenced by singlestep().
| static void checkSizes | ( | lua_State * | L | ) | [static] |
Definition at line 431 of file lgc.cpp.
References global_State::buff, cast, G, LUA_MINBUFFER, luaS_resize(), luaZ_resizebuffer, luaZ_sizebuffer, MINSTRTABSIZE, stringtable::nuse, stringtable::size, and global_State::strt.
Referenced by singlestep().
Definition at line 241 of file lgc.cpp.
References lua_State::base_ci, BASIC_STACK_SIZE, cast_int, lua_State::ci, condhardstacktests, EXTRA_STACK, luaD_reallocCI(), luaD_reallocstack(), LUAI_MAXCALLS, lua_State::size_ci, lua_State::stack, and lua_State::stacksize.
Referenced by traversestack().
| static void cleartable | ( | GCObject * | l | ) | [static] |
Definition at line 351 of file lgc.cpp.
References Table::array, Table::gclist, gco2h, gnode, gval, iscleared(), key2tval, KEYWEAKBIT, lua_assert, removeentry(), setnilvalue, Table::sizearray, sizenode, testbit, ttisnil, and VALUEWEAKBIT.
Referenced by atomic().
Definition at line 378 of file lgc.cpp.
References G, GCObject::gch, gco2cl, gco2h, gco2p, gco2th, gco2ts, gco2u, gco2uv, lua_assert, LUA_TFUNCTION, LUA_TPROTO, LUA_TSTRING, LUA_TTABLE, LUA_TTHREAD, LUA_TUPVAL, LUA_TUSERDATA, luaE_freethread(), luaF_freeclosure(), luaF_freeproto(), luaF_freeupval(), luaH_free(), luaM_freemem, sizestring, and sizeudata.
Referenced by sweeplist().
| static void GCTM | ( | lua_State * | L | ) | [static] |
Definition at line 445 of file lgc.cpp.
References lua_State::allowhook, fasttm, G, GCObject::gch, global_State::GCthreshold, luaD_call(), global_State::mainthread, makewhite, Udata::metatable, NULL, rawgco2u, setobj2s, setuvalue, TM_GC, global_State::tmudata, lua_State::top, global_State::totalbytes, and Udata::uv.
Referenced by luaC_callGCTM(), and singlestep().
| static int iscleared | ( | const TValue * | o, | |
| int | iskey | |||
| ) | [static] |
Definition at line 337 of file lgc.cpp.
References gcvalue, iscollectable, isfinalized, iswhite, rawtsvalue, stringmark, ttisstring, ttisuserdata, and uvalue.
Referenced by cleartable().
| void luaC_callGCTM | ( | lua_State * | L | ) |
| void luaC_freeall | ( | lua_State * | L | ) |
Definition at line 686 of file lgc.cpp.
Referenced by luaE_newthread(), luaF_newCclosure(), luaF_newLclosure(), luaF_newproto(), luaF_newupval(), and luaH_new().
| size_t luaC_separateudata | ( | lua_State * | L, | |
| int | all | |||
| ) |
| static void markmt | ( | global_State * | g | ) | [static] |
Definition at line 493 of file lgc.cpp.
References markobject, global_State::mt, and NUM_TAGS.
Referenced by atomic(), and markroot().
| static void markroot | ( | lua_State * | L | ) | [static] |
Definition at line 501 of file lgc.cpp.
References G, GCSpropagate, global_State::gcstate, global_State::gray, global_State::grayagain, gt, global_State::mainthread, markmt(), markobject, markvalue, NULL, registry, and global_State::weak.
Referenced by luaC_fullgc(), and singlestep().
| static void marktmu | ( | global_State * | g | ) | [static] |
Definition at line 115 of file lgc.cpp.
References GCObject::gch, makewhite, reallymarkobject(), and global_State::tmudata.
Referenced by atomic().
| static size_t propagateall | ( | global_State * | g | ) | [static] |
Definition at line 323 of file lgc.cpp.
References global_State::gray, and propagatemark().
Referenced by atomic().
| static l_mem propagatemark | ( | global_State * | g | ) | [static] |
Definition at line 277 of file lgc.cpp.
References black2gray, Closure::c, GCObject::gch, Proto::gclist, lua_State::gclist, Table::gclist, gco2cl, gco2h, gco2p, gco2th, global_State::gray, gray2black, global_State::grayagain, int(), isgray, Closure::l, lua_assert, LUA_TFUNCTION, LUA_TPROTO, LUA_TTABLE, LUA_TTHREAD, lua_State::size_ci, Table::sizearray, sizeCclosure, Proto::sizecode, Proto::sizek, sizeLclosure, Proto::sizelineinfo, Proto::sizelocvars, sizenode, Proto::sizep, Proto::sizeupvalues, lua_State::stacksize, traverseclosure(), traverseproto(), traversestack(), and traversetable().
Referenced by propagateall(), and singlestep().
| static void reallymarkobject | ( | global_State * | g, | |
| GCObject * | o | |||
| ) | [static] |
Definition at line 69 of file lgc.cpp.
References GCObject::gch, gco2cl, gco2h, gco2p, gco2th, gco2u, gco2uv, global_State::gray, gray2black, isdead, iswhite, lua_assert, LUA_TFUNCTION, LUA_TPROTO, LUA_TSTRING, LUA_TTABLE, LUA_TTHREAD, LUA_TUPVAL, LUA_TUSERDATA, markobject, markvalue, UpVal::u, UpVal::v, UpVal::value, and white2gray.
Referenced by luaC_barrierf(), and marktmu().
| static void remarkupvals | ( | global_State * | g | ) | [static] |
| static void removeentry | ( | Node * | n | ) | [static] |
Definition at line 62 of file lgc.cpp.
References gkey, gval, iscollectable, lua_assert, LUA_TDEADKEY, setttype, and ttisnil.
Referenced by cleartable(), and traversetable().
Definition at line 556 of file lgc.cpp.
References atomic(), checkSizes(), global_State::estimate, G, global_State::gcdept, GCFINALIZECOST, GCSfinalize, GCSpause, GCSpropagate, GCSsweep, GCSsweepstring, global_State::gcstate, GCSWEEPCOST, GCSWEEPMAX, GCTM(), global_State::gray, stringtable::hash, lua_assert, markroot(), NULL, propagatemark(), stringtable::size, global_State::strt, global_State::sweepgc, sweeplist(), global_State::sweepstrgc, sweepwholelist, global_State::tmudata, and global_State::totalbytes.
Referenced by luaC_fullgc(), and luaC_step().
Definition at line 407 of file lgc.cpp.
References bitmask, FIXEDBIT, freeobj(), G, GCObject::gch, gco2th, isdead, lua_assert, LUA_TTHREAD, makewhite, NULL, otherwhite, global_State::rootgc, SFIXEDBIT, sweepwholelist, testbit, and WHITEBITS.
Referenced by singlestep().
| static void traverseclosure | ( | global_State * | g, | |
| Closure * | cl | |||
| ) | [static] |
Definition at line 224 of file lgc.cpp.
References Closure::c, Closure::l, lua_assert, markobject, markvalue, Proto::nups, LClosure::p, LClosure::upvals, and CClosure::upvalue.
Referenced by propagatemark().
| static void traverseproto | ( | global_State * | g, | |
| Proto * | f | |||
| ) | [static] |
Definition at line 203 of file lgc.cpp.
References Proto::k, Proto::locvars, markobject, markvalue, Proto::p, Proto::sizek, Proto::sizelocvars, Proto::sizep, Proto::sizeupvalues, Proto::source, stringmark, Proto::upvalues, and LocVar::varname.
Referenced by propagatemark().
| static void traversestack | ( | global_State * | g, | |
| lua_State * | l | |||
| ) | [static] |
Definition at line 256 of file lgc.cpp.
References lua_State::base_ci, checkstacksizes(), gt, lua_assert, markvalue, setnilvalue, lua_State::stack, lua_State::stack_last, CallInfo::top, and lua_State::top.
Referenced by propagatemark().
| static int traversetable | ( | global_State * | g, | |
| Table * | h | |||
| ) | [static] |
Definition at line 158 of file lgc.cpp.
References Table::array, cast_byte, Table::gclist, gfasttm, gkey, gnode, gval, KEYWEAK, KEYWEAKBIT, lua_assert, LUA_TDEADKEY, markobject, markvalue, Table::metatable, NULL, obj2gco, removeentry(), Table::sizearray, sizenode, svalue, TM_MODE, ttisnil, ttisstring, ttype, VALUEWEAK, VALUEWEAKBIT, and global_State::weak.
Referenced by propagatemark().
1.5.3