#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"
Include dependency graph for lgc.c:
Go to the source code of this file.
Data Structures | |
struct | GCState |
Defines | |
#define | lgc_c |
#define | setbit(x, b) ((x) |= (1<<(b))) |
#define | resetbit(x, b) ((x) &= cast(lu_byte, ~(1<<(b)))) |
#define | testbit(x, b) ((x) & (1<<(b))) |
#define | unmark(x) resetbit((x)->gch.marked, 0) |
#define | ismarked(x) ((x)->gch.marked & ((1<<4)|1)) |
#define | stringmark(s) setbit((s)->tsv.marked, 0) |
#define | isfinalized(u) (!testbit((u)->uv.marked, 1)) |
#define | markfinalized(u) resetbit((u)->uv.marked, 1) |
#define | KEYWEAKBIT 1 |
#define | VALUEWEAKBIT 2 |
#define | KEYWEAK (1<<KEYWEAKBIT) |
#define | VALUEWEAK (1<<VALUEWEAKBIT) |
#define | markobject(st, o) |
#define | condmarkobject(st, o, c) |
#define | markvalue(st, t) |
Typedefs | |
typedef GCState | GCState |
Functions | |
static void | reallymarkobject (GCState *st, GCObject *o) |
static void | marktmu (GCState *st) |
size_t | luaC_separateudata (lua_State *L) |
static void | removekey (Node *n) |
static void | traversetable (GCState *st, Table *h) |
static void | traverseproto (GCState *st, Proto *f) |
static void | traverseclosure (GCState *st, Closure *cl) |
static void | checkstacksizes (lua_State *L, StkId max) |
static void | traversestack (GCState *st, lua_State *L1) |
static void | propagatemarks (GCState *st) |
static int | valismarked (const TObject *o) |
static void | cleartablekeys (GCObject *l) |
static void | cleartablevalues (GCObject *l) |
static void | freeobj (lua_State *L, GCObject *o) |
static int | sweeplist (lua_State *L, GCObject **p, int limit) |
static void | sweepstrings (lua_State *L, int all) |
static void | checkSizes (lua_State *L, size_t deadmem) |
static void | do1gcTM (lua_State *L, Udata *udata) |
void | luaC_callGCTM (lua_State *L) |
void | luaC_sweep (lua_State *L, int all) |
static void | markroot (GCState *st, lua_State *L) |
static size_t | mark (lua_State *L) |
void | luaC_collectgarbage (lua_State *L) |
void | luaC_link (lua_State *L, GCObject *o, lu_byte tt) |
|
Value: { checkconsistency(o); \ if (iscollectable(o) && !ismarked(gcvalue(o)) && (c)) \ reallymarkobject(st,gcvalue(o)); } Definition at line 66 of file lgc.c. Referenced by traversetable(). |
|
Definition at line 52 of file lgc.c. Referenced by luaC_separateudata(). |
|
Definition at line 47 of file lgc.c. Referenced by luaC_separateudata(), and reallymarkobject(). |
|
Definition at line 58 of file lgc.c. Referenced by cleartablekeys(), and traversetable(). |
|
Definition at line 56 of file lgc.c. Referenced by traversetable(). |
|
|
|
Definition at line 53 of file lgc.c. Referenced by luaC_callGCTM(), and luaC_separateudata(). |
|
Value: { checkconsistency(o); \ if (iscollectable(o) && !ismarked(gcvalue(o))) reallymarkobject(st,gcvalue(o)); } Definition at line 63 of file lgc.c. Referenced by markroot(), traverseclosure(), traversestack(), and traversetable(). |
|
Value: { if (!ismarked(valtogco(t))) \ reallymarkobject(st, valtogco(t)); } Definition at line 70 of file lgc.c. Referenced by markroot(), reallymarkobject(), traverseclosure(), traverseproto(), and traversetable(). |
|
|
|
Definition at line 42 of file lgc.c. Referenced by reallymarkobject(). |
|
Definition at line 49 of file lgc.c. Referenced by traverseproto(), and valismarked(). |
|
Definition at line 44 of file lgc.c. Referenced by valismarked(). |
|
Definition at line 46 of file lgc.c. Referenced by luaC_callGCTM(), marktmu(), and sweeplist(). |
|
Definition at line 59 of file lgc.c. Referenced by cleartablevalues(), and traversetable(). |
|
Definition at line 57 of file lgc.c. Referenced by traversetable(). |
|
|
|
Definition at line 436 of file lgc.c. References cast, G, LUA_MINBUFFER, luaS_resize(), luaZ_resizebuffer, luaZ_sizebuffer, and MINSTRTABSIZE. Referenced by luaC_collectgarbage(). |
|
Definition at line 251 of file lgc.c. References lua_State::base_ci, BASIC_STACK_SIZE, lua_State::ci, condhardstacktests, EXTRA_STACK, luaD_reallocCI(), luaD_reallocstack(), and lua_State::size_ci. Referenced by traversestack(). |
|
Definition at line 335 of file lgc.c. References Table::gclist, gcotoh, gkey, gnode, KEYWEAK, lua_assert, Table::marked, removekey(), sizenode, and valismarked(). Referenced by mark(). |
|
Definition at line 355 of file lgc.c. References Table::array, Table::gclist, gcotoh, gnode, gval, lua_assert, Table::marked, removekey(), setnilvalue, Table::sizearray, sizenode, valismarked(), and VALUEWEAK. Referenced by mark(). |
|
Definition at line 452 of file lgc.c. References fasttm, luaD_call(), setobj2s, setuvalue, TM_GC, lua_State::top, and Udata::uv. Referenced by luaC_callGCTM(). |
|
Definition at line 378 of file lgc.c. References G, GCObject::gch, gcotocl, gcotoh, gcotop, gcototh, gcotots, gcotou, gcotouv, lua_assert, LUA_TPROTO, LUA_TUPVAL, luaE_freethread(), luaF_freeclosure(), luaF_freeproto(), luaH_free(), luaM_free, luaM_freelem, sizestring, sizeudata, and GCheader::tt. Referenced by sweeplist(). |
|
Definition at line 465 of file lgc.c. References lua_State::allowhook, do1gcTM(), G, gcotou, markfinalized, setuvalue, lua_State::top, unmark, and Udata::uv. Referenced by callallgcTM(), and luaC_collectgarbage(). |
|
Definition at line 535 of file lgc.c. References checkSizes(), luaC_callGCTM(), luaC_sweep(), and mark(). |
|
Definition at line 543 of file lgc.c. References G, GCObject::gch, GCheader::marked, GCheader::next, and GCheader::tt. Referenced by luaE_newthread(), luaF_close(), luaF_newCclosure(), luaF_newLclosure(), luaF_newproto(), and luaH_new(). |
|
Definition at line 124 of file lgc.c. References fasttm, G, GCObject::gch, gcotou, isfinalized, ismarked, lua_assert, markfinalized, GCheader::next, sizeudata, TM_GC, and GCheader::tt. Referenced by lua_close(), and mark(). |
|
Definition at line 485 of file lgc.c. References G, sweeplist(), and sweepstrings(). Referenced by close_state(), and luaC_collectgarbage(). |
|
Definition at line 506 of file lgc.c. References cleartablekeys(), cleartablevalues(), G, GCState::g, luaC_separateudata(), markroot(), marktmu(), propagatemarks(), GCState::tmark, GCState::wk, GCState::wkv, and GCState::wv. Referenced by luaC_collectgarbage(). |
|
Definition at line 494 of file lgc.c. References defaultmeta, GCState::g, global_State::mainthread, markobject, markvalue, registry, and traversestack(). Referenced by mark(). |
|
Definition at line 112 of file lgc.c. References GCState::g, GCObject::gch, GCheader::next, reallymarkobject(), global_State::tmudata, and unmark. Referenced by mark(). |
|
Definition at line 286 of file lgc.c. References Closure::c, GCObject::gch, Proto::gclist, lua_State::gclist, CClosure::gclist, Table::gclist, gcotocl, gcotoh, gcotop, gcototh, lua_assert, LUA_TPROTO, GCState::tmark, traverseclosure(), traverseproto(), traversestack(), traversetable(), and GCheader::tt. Referenced by mark(). |
|
Definition at line 75 of file lgc.c. References GCObject::gch, gcotocl, gcotoh, gcotop, gcototh, gcotou, ismarked, lua_assert, LUA_TPROTO, GCheader::marked, markvalue, setbit, GCState::tmark, and GCheader::tt. Referenced by marktmu(). |
|
Definition at line 156 of file lgc.c. References gkey, gval, iscollectable, setnilvalue, and setttype. Referenced by cleartablekeys(), and cleartablevalues(). |
|
Definition at line 404 of file lgc.c. References freeobj(), GCObject::gch, GCheader::marked, GCheader::next, and unmark. Referenced by luaC_sweep(), and sweepstrings(). |
|
Definition at line 426 of file lgc.c. References G, and sweeplist(). Referenced by luaC_sweep(). |
|
Definition at line 227 of file lgc.c. References Closure::c, LClosure::g, hvalue, CClosure::isC, Closure::l, lua_assert, UpVal::marked, markobject, markvalue, Proto::nups, LClosure::nupvalues, LClosure::p, LClosure::upvals, CClosure::upvalue, and UpVal::value. Referenced by propagatemarks(). |
|
Definition at line 207 of file lgc.c. References Proto::k, Proto::locvars, lua_assert, luaG_checkcode(), markvalue, Proto::p, Proto::source, stringmark, tsvalue, ttisstring, Proto::upvalues, and LocVar::varname. Referenced by propagatemarks(). |
|
Definition at line 265 of file lgc.c. References lua_State::base_ci, checkstacksizes(), CI_C, CI_HASFRAME, CI_SAVEDPC, gt, lua_assert, markobject, setnilvalue, lua_State::stack, lua_State::stack_last, CallInfo::state, CallInfo::top, and lua_State::top. Referenced by markroot(), and propagatemarks(). |
|
Definition at line 165 of file lgc.c. References Table::array, cast, condmarkobject, global_State::dummynode, GCState::g, Table::gclist, gfasttm, gkey, gnode, gval, KEYWEAK, KEYWEAKBIT, Table::lsizenode, lua_assert, Table::marked, markobject, markvalue, Table::metatable, Table::node, Table::sizearray, sizenode, svalue, TM_MODE, ttisnil, ttisstring, valtogco, VALUEWEAK, VALUEWEAKBIT, GCState::wk, GCState::wkv, and GCState::wv. Referenced by propagatemarks(). |
|
Definition at line 323 of file lgc.c. References iscollectable, stringmark, testbit, tsvalue, and ttisstring. Referenced by cleartablekeys(), and cleartablevalues(). |