#include "lprefix.h"
#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.
Definition at line 71 of file lgc.cpp.
Referenced by luaC_barrierback_(), propagatemark(), and traversetable().
#define checkconsistency | ( | obj | ) | lua_longassert(!iscollectable(obj) || righttt(obj)) |
#define checkdeadkey | ( | n | ) | lua_assert(!ttisdeadkey(gkey(n)) || ttisnil(gval(n))) |
Definition at line 76 of file lgc.cpp.
Referenced by traverseephemeron(), traversestrongtable(), and traverseweakvalue().
#define GCFINALIZECOST GCSWEEPCOST |
Definition at line 45 of file lgc.cpp.
Referenced by singlestep().
#define GCSinsideatomic (GCSpause + 1) |
Definition at line 33 of file lgc.cpp.
Referenced by atomic(), traverseLclosure(), and traversethread().
#define GCSWEEPCOST ((sizeof(TString) + 4) / 4) |
Definition at line 39 of file lgc.cpp.
Referenced by sweepstep().
#define GCSWEEPMAX (cast_int((GCSTEPSIZE / GCSWEEPCOST) / 4)) |
Definition at line 42 of file lgc.cpp.
Referenced by sweepstep().
Definition at line 107 of file lgc.cpp.
Referenced by clearkeys(), clearvalues(), traverseephemeron(), traversestrongtable(), and traverseweakvalue().
Definition at line 113 of file lgc.cpp.
Referenced by luaC_barrierback_(), propagatemark(), reallymarkobject(), traverseephemeron(), traversetable(), and traverseweakvalue().
#define makewhite | ( | g, | |
x | |||
) | (x->marked = cast_byte((x->marked & maskcolors) | luaC_white(g))) |
Definition at line 67 of file lgc.cpp.
Referenced by luaC_barrier_(), luaC_checkfinalizer(), singlestep(), and udata2finalize().
Definition at line 86 of file lgc.cpp.
Referenced by atomic(), iscleared(), luaC_upvalbarrier_(), markbeingfnz(), and restartcollection().
Definition at line 92 of file lgc.cpp.
Referenced by markmt(), reallymarkobject(), traverseLclosure(), traverseproto(), and traversetable().
#define markvalue | ( | g, | |
o | |||
) |
Definition at line 83 of file lgc.cpp.
Referenced by atomic(), remarkupvals(), restartcollection(), traverseCclosure(), traverseLclosure(), traverseproto(), traversestrongtable(), traversethread(), and traverseweakvalue().
Definition at line 66 of file lgc.cpp.
Referenced by sweeplist().
#define PAUSEADJ 100 |
Definition at line 59 of file lgc.cpp.
Referenced by setpause().
#define STEPMULADJ 200 |
Definition at line 52 of file lgc.cpp.
Referenced by getdebt(), and luaC_step().
Definition at line 724 of file lgc.cpp.
Referenced by luaC_freeallobjects().
#define valiswhite | ( | x | ) | (iscollectable(x) && iswhite(gcvalue(x))) |
Definition at line 74 of file lgc.cpp.
Referenced by reallymarkobject(), removeentry(), and traverseephemeron().
Definition at line 70 of file lgc.cpp.
Referenced by luaC_fix(), and reallymarkobject().
Definition at line 982 of file lgc.cpp.
References global_State::allweak, cast_byte, clearkeys(), clearvalues(), convergeephemerons(), global_State::currentwhite, global_State::ephemeron, g, G, global_State::gcfinnum, global_State::GCmemtrav, GCSinsideatomic, global_State::gcstate, global_State::gray, global_State::grayagain, iswhite, global_State::l_registry, lua_assert, luaS_clearcache(), global_State::mainthread, markbeingfnz(), markmt(), markobject, markvalue, otherwhite, propagateall(), remarkupvals(), separatetobefnz(), and global_State::weak.
Referenced by singlestep().
|
static |
Definition at line 859 of file lgc.cpp.
References g, G, GCTM(), and global_State::tobefnz.
Referenced by luaC_freeallobjects().
|
static |
Definition at line 778 of file lgc.cpp.
References global_State::GCdebt, global_State::GCestimate, global_State::gckind, KGC_EMERGENCY, luaS_resize(), stringtable::nuse, stringtable::size, and global_State::strt.
Referenced by singlestep().
|
static |
Definition at line 639 of file lgc.cpp.
References f, gco2t, gkey, gnode, gnodelast, gval, h, iscleared(), n, removeentry(), setnilvalue, and ttisnil.
Referenced by atomic().
|
static |
Definition at line 658 of file lgc.cpp.
References Table::array, f, gco2t, gnode, gnodelast, gval, h, i, iscleared(), n, removeentry(), setnilvalue, Table::sizearray, and ttisnil.
Referenced by atomic().
|
static |
Definition at line 608 of file lgc.cpp.
References global_State::ephemeron, gco2t, next, propagateall(), traverseephemeron(), and w.
Referenced by atomic().
|
static |
Definition at line 801 of file lgc.cpp.
References luaD_callnoyield(), lua_State::top, and UNUSED.
Referenced by GCTM().
|
static |
Definition at line 959 of file lgc.cpp.
References global_State::allgc, g, G, GCSswpallgc, global_State::gcstate, lua_assert, global_State::sweepgc, and sweeplist().
Referenced by luaC_fullgc(), and singlestep().
Definition at line 686 of file lgc.cpp.
References i, luaC_upvdeccount(), luaM_freemem, sizeLclosure, and LClosure::upvals.
Referenced by freeobj().
Definition at line 697 of file lgc.cpp.
References freeLclosure(), gco2ccl, gco2lcl, gco2p, gco2t, gco2th, gco2ts, gco2u, lua_assert, LUA_TCCL, LUA_TLCL, LUA_TLNGSTR, LUA_TPROTO, LUA_TSHRSTR, LUA_TTABLE, LUA_TTHREAD, LUA_TUSERDATA, luaE_freethread(), luaF_freeproto(), luaH_free(), luaM_freemem, luaS_remove(), sizeCclosure, sizelstring, and sizeudata.
Referenced by sweeplist().
|
static |
Definition at line 807 of file lgc.cpp.
References lua_State::allowhook, CallInfo::callstatus, lua_State::ci, CIST_FIN, dothecall(), g, G, global_State::gcrunning, LUA_ERRGCMM, LUA_ERRRUN, LUA_OK, luaD_pcall(), luaD_throw(), luaO_pushfstring(), luaT_gettmbyobj(), wfl::msg(), savestack, setgcovalue, setobj2s, svalue, TM_GC, lua_State::top, ttisfunction, ttisstring, and udata2finalize().
Referenced by callallpendingfinalizers(), and runafewfinalizers().
|
static |
Definition at line 1115 of file lgc.cpp.
References global_State::GCdebt, global_State::gcstepmul, MAX_LMEM, and STEPMULADJ.
Referenced by luaC_step().
|
static |
Definition at line 139 of file lgc.cpp.
References gcvalue, iscollectable, iswhite, markobject, tsvalue, and ttisstring.
Referenced by clearkeys(), clearvalues(), traverseephemeron(), and traverseweakvalue().
Definition at line 155 of file lgc.cpp.
References g, G, isblack, isdead, issweepphase, iswhite, keepinvariant, lua_assert, makewhite, and reallymarkobject().
Definition at line 171 of file lgc.cpp.
References black2gray, g, G, global_State::grayagain, isblack, isdead, linkgclist, and lua_assert.
Definition at line 902 of file lgc.cpp.
References global_State::allgc, FINALIZEDBIT, global_State::finobj, g, G, gfasttm, issweepphase, l_setbit, makewhite, p, global_State::sweepgc, sweeptolive(), TM_GC, and tofinalize.
Referenced by lua_setmetatable().
Definition at line 194 of file lgc.cpp.
References global_State::allgc, global_State::fixedgc, g, G, lua_assert, and white2gray.
Referenced by luaS_init(), luaT_init(), and luaX_init().
void luaC_freeallobjects | ( | lua_State * | L | ) |
Definition at line 967 of file lgc.cpp.
References global_State::allgc, callallpendingfinalizers(), global_State::currentwhite, global_State::finobj, global_State::fixedgc, g, G, global_State::gckind, KGC_NORMAL, lua_assert, stringtable::nuse, separatetobefnz(), global_State::strt, sweepwholelist, global_State::tobefnz, and WHITEBITS.
Referenced by close_state().
void luaC_fullgc | ( | lua_State * | L, |
int | isemergency | ||
) |
Definition at line 1159 of file lgc.cpp.
References bitmask, entersweep(), g, G, global_State::GCestimate, global_State::gckind, GCScallfin, GCSpause, gettotalbytes, keepinvariant, KGC_EMERGENCY, KGC_NORMAL, lua_assert, luaC_runtilstate(), and setpause().
Referenced by lua_gc(), and luaM_realloc_().
Definition at line 208 of file lgc.cpp.
References global_State::allgc, cast, g, G, luaC_white, luaM_newobject, and novariant.
Referenced by createstrobj(), luaF_newCclosure(), luaF_newLclosure(), luaF_newproto(), luaH_new(), and luaS_newudata().
void luaC_runtilstate | ( | lua_State * | L, |
int | statesmask | ||
) |
Definition at line 1104 of file lgc.cpp.
References g, G, global_State::gcstate, singlestep(), and testbit.
Referenced by luaC_fullgc().
void luaC_step | ( | lua_State * | L | ) |
Definition at line 1129 of file lgc.cpp.
References g, G, global_State::gcrunning, GCSpause, global_State::gcstate, global_State::gcstepmul, GCSTEPSIZE, getdebt(), luaE_setdebt(), runafewfinalizers(), setpause(), singlestep(), and STEPMULADJ.
Referenced by lua_gc().
Definition at line 185 of file lgc.cpp.
References g, G, gcvalue, keepinvariant, lua_assert, markobject, upisopen, and UpVal::v.
Definition at line 678 of file lgc.cpp.
References lua_assert, luaM_free, UpVal::refcount, and upisopen.
Referenced by freeLclosure(), and lua_upvaluejoin().
|
static |
Definition at line 299 of file lgc.cpp.
References markobject, and global_State::tobefnz.
Referenced by atomic(), and restartcollection().
|
static |
Definition at line 289 of file lgc.cpp.
References i, LUA_NUMTAGS, markobjectN, and global_State::mt.
Referenced by atomic(), and restartcollection().
|
static |
Definition at line 603 of file lgc.cpp.
References global_State::gray, and propagatemark().
Referenced by atomic(), convergeephemerons(), and singlestep().
|
static |
Definition at line 559 of file lgc.cpp.
References black2gray, lua_State::gclist, Proto::gclist, Table::gclist, global_State::GCmemtrav, gco2ccl, gco2lcl, gco2p, gco2t, gco2th, global_State::gray, gray2black, global_State::grayagain, h, isgray, linkgclist, lua_assert, LUA_TCCL, LUA_TLCL, LUA_TPROTO, LUA_TTABLE, LUA_TTHREAD, p, utf8::size(), traverseCclosure(), traverseLclosure(), traverseproto(), traversetable(), and traversethread().
Referenced by propagateall(), and singlestep().
|
static |
Definition at line 235 of file lgc.cpp.
References global_State::GCmemtrav, gco2ccl, gco2lcl, gco2p, gco2t, gco2th, gco2ts, gco2u, gcvalue, getuservalue, global_State::gray, gray2black, linkgclist, lua_assert, LUA_TCCL, LUA_TLCL, LUA_TLNGSTR, LUA_TPROTO, LUA_TSHRSTR, LUA_TTABLE, LUA_TTHREAD, LUA_TUSERDATA, global_State::mainthread, markobjectN, sizelstring, sizeudata, uvalue, valiswhite, and white2gray.
Referenced by luaC_barrier_(), and traverseephemeron().
|
static |
Definition at line 312 of file lgc.cpp.
References isblack, isgray, lua_assert, markvalue, UpVal::open, lua_State::openupval, p, global_State::twups, lua_State::twups, UpVal::u, and UpVal::v.
Referenced by atomic().
|
static |
Definition at line 125 of file lgc.cpp.
References gkey, gval, lua_assert, setdeadvalue, ttisnil, valiswhite, and wgkey.
Referenced by clearkeys(), clearvalues(), traverseephemeron(), traversestrongtable(), and traverseweakvalue().
|
static |
Definition at line 337 of file lgc.cpp.
References global_State::allweak, global_State::ephemeron, global_State::gray, global_State::grayagain, global_State::l_registry, global_State::mainthread, markbeingfnz(), markmt(), markobject, markvalue, and global_State::weak.
Referenced by singlestep().
|
static |
Definition at line 844 of file lgc.cpp.
References g, G, global_State::gcfinnum, GCTM(), i, lua_assert, and global_State::tobefnz.
Referenced by luaC_step(), and singlestep().
|
static |
Definition at line 880 of file lgc.cpp.
References curr, findlast(), global_State::finobj, iswhite, lua_assert, p, global_State::tobefnz, and tofinalize.
Referenced by atomic(), and luaC_freeallobjects().
|
static |
Definition at line 940 of file lgc.cpp.
References global_State::GCestimate, global_State::gcpause, gettotalbytes, lua_assert, luaE_setdebt(), MAX_LMEM, and PAUSEADJ.
Referenced by luaC_fullgc(), and luaC_step().
Definition at line 1045 of file lgc.cpp.
References atomic(), checkSizes(), entersweep(), global_State::finobj, g, G, global_State::GCestimate, GCFINALIZECOST, global_State::gckind, global_State::GCmemtrav, GCSatomic, GCScallfin, GCSpause, GCSpropagate, GCSswpallgc, GCSswpend, GCSswpfinobj, GCSswptobefnz, global_State::gcstate, gettotalbytes, global_State::gray, KGC_EMERGENCY, lua_assert, global_State::mainthread, makewhite, n, propagateall(), propagatemark(), restartcollection(), runafewfinalizers(), stringtable::size, global_State::strt, sweepstep(), and global_State::tobefnz.
Referenced by luaC_runtilstate(), and luaC_step().
Definition at line 735 of file lgc.cpp.
References cast_byte, curr, freeobj(), g, G, isdeadm, luaC_white, maskcolors, otherwhite, and p.
Referenced by entersweep(), sweepstep(), and sweeptolive().
|
static |
Definition at line 1029 of file lgc.cpp.
References global_State::GCdebt, global_State::GCestimate, global_State::gcstate, GCSWEEPCOST, GCSWEEPMAX, global_State::sweepgc, and sweeplist().
Referenced by singlestep().
Definition at line 758 of file lgc.cpp.
References p, and sweeplist().
Referenced by luaC_checkfinalizer().
|
static |
Definition at line 501 of file lgc.cpp.
References i, markvalue, sizeCclosure, and CClosure::upvalue.
Referenced by propagatemark().
|
static |
Definition at line 394 of file lgc.cpp.
References global_State::allweak, Table::array, checkdeadkey, global_State::ephemeron, GCSpropagate, global_State::gcstate, gcvalue, gkey, gnode, gnodelast, global_State::grayagain, gval, i, iscleared(), linkgclist, n, reallymarkobject(), removeentry(), Table::sizearray, ttisnil, and valiswhite.
Referenced by convergeephemerons(), and traversetable().
|
static |
Definition at line 514 of file lgc.cpp.
References GCSinsideatomic, global_State::gcstate, i, markobjectN, markvalue, UpVal::open, LClosure::p, sizeLclosure, UpVal::u, upisopen, LClosure::upvals, and UpVal::v.
Referenced by propagatemark().
|
static |
Definition at line 479 of file lgc.cpp.
References Proto::cache, i, iswhite, Proto::k, Proto::locvars, markobjectN, markvalue, Upvaldesc::name, Proto::p, Proto::sizecode, Proto::sizek, Proto::sizelineinfo, Proto::sizelocvars, Proto::sizep, Proto::sizeupvalues, Proto::source, Proto::upvalues, and LocVar::varname.
Referenced by propagatemark().
|
static |
Definition at line 433 of file lgc.cpp.
References Table::array, checkdeadkey, gkey, gnode, gnodelast, gval, i, lua_assert, markvalue, n, removeentry(), Table::sizearray, and ttisnil.
Referenced by traversetable().
|
static |
Definition at line 451 of file lgc.cpp.
References allocsizenode, global_State::allweak, black2gray, cast, gfasttm, linkgclist, markobjectN, Table::metatable, Table::sizearray, svalue, TM_MODE, traverseephemeron(), traversestrongtable(), traverseweakvalue(), and ttisstring.
Referenced by propagatemark().
|
static |
Definition at line 530 of file lgc.cpp.
References global_State::gckind, GCSinsideatomic, global_State::gcstate, isintwups, KGC_EMERGENCY, lua_assert, luaD_shrinkstack(), markvalue, lua_State::nci, lua_State::openupval, setnilvalue, lua_State::stack, lua_State::stacksize, lua_State::top, global_State::twups, and lua_State::twups.
Referenced by propagatemark().
|
static |
Definition at line 361 of file lgc.cpp.
References checkdeadkey, GCSpropagate, global_State::gcstate, gkey, gnode, gnodelast, global_State::grayagain, gval, iscleared(), linkgclist, lua_assert, markvalue, n, removeentry(), Table::sizearray, ttisnil, and global_State::weak.
Referenced by traversetable().
|
static |
Definition at line 788 of file lgc.cpp.
References global_State::allgc, FINALIZEDBIT, issweepphase, lua_assert, makewhite, resetbit, global_State::tobefnz, and tofinalize.
Referenced by GCTM().