#include "lprefix.h"
#include <stdio.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.
#define GCFINALIZECOST 50 |
Definition at line 46 of file lgc.cpp.
Referenced by singlestep().
#define GCFINMAX 10 |
Definition at line 40 of file lgc.cpp.
Referenced by singlestep().
#define GCSWEEPMAX 100 |
Definition at line 35 of file lgc.cpp.
Referenced by sweepstep().
#define gcvalueN | ( | o | ) | (iscollectable(o) ? gcvalue(o) : NULL) |
Definition at line 91 of file lgc.cpp.
Referenced by clearbyvalues(), and traverseweakvalue().
Definition at line 122 of file lgc.cpp.
Referenced by clearbykeys(), clearbyvalues(), traversestrongtable(), and traverseweakvalue().
#define linkgclist | ( | o, | |
p | |||
) | linkgclist_(obj2gco(o), &(o)->gclist, &(p)) |
Definition at line 146 of file lgc.cpp.
Referenced by sweep2old(), traverseephemeron(), traversetable(), traversethread(), and traverseweakvalue().
#define linkobjgclist | ( | o, | |
p | |||
) | linkgclist_(obj2gco(o), getgclist(o), &(p)) |
Definition at line 159 of file lgc.cpp.
Referenced by genlink(), luaC_barrierback_(), and reallymarkobject().
#define makewhite | ( | g, | |
x | |||
) | (x->marked = cast_byte((x->marked & ~maskcolors) | luaC_white(g))) |
Definition at line 71 of file lgc.cpp.
Referenced by luaC_barrier_(), luaC_checkfinalizer(), and udata2finalize().
#define markkey | ( | g, | |
n | |||
) | { if keyiswhite(n) reallymarkobject(g,gckey(n)); } |
Definition at line 97 of file lgc.cpp.
Referenced by traversestrongtable(), and traverseweakvalue().
Definition at line 99 of file lgc.cpp.
Referenced by atomic(), iscleared(), markbeingfnz(), restartcollection(), and traversethread().
Definition at line 105 of file lgc.cpp.
Referenced by markmt(), reallymarkobject(), traverseLclosure(), traverseproto(), traversetable(), and traverseudata().
#define markvalue | ( | g, | |
o | |||
) |
Definition at line 94 of file lgc.cpp.
Referenced by atomic(), reallymarkobject(), remarkupvals(), restartcollection(), traverseCclosure(), traverseproto(), traversestrongtable(), traversethread(), and traverseudata().
#define maskgcbits (maskcolors | AGEBITS) |
Definition at line 67 of file lgc.cpp.
Referenced by sweepgen(), sweeplist(), and whitelist().
#define PAUSEADJ 100 |
Definition at line 60 of file lgc.cpp.
Referenced by setpause().
Definition at line 79 of file lgc.cpp.
Referenced by reallymarkobject().
#define set2gray | ( | x | ) | resetbits(x->marked, maskcolors) |
Definition at line 75 of file lgc.cpp.
Referenced by linkgclist_(), luaC_barrierback_(), luaC_fix(), reallymarkobject(), and sweep2old().
#define valiswhite | ( | x | ) | (iscollectable(x) && iswhite(gcvalue(x))) |
Definition at line 83 of file lgc.cpp.
Referenced by traverseephemeron().
Definition at line 1516 of file lgc.cpp.
References global_State::allweak, cast_byte, clearbykeys(), clearbyvalues(), convergeephemerons(), global_State::currentwhite, global_State::ephemeron, G, GCSatomic, 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 entergen(), singlestep(), stepgenfull(), and youngcollection().
|
static |
Definition at line 1265 of file lgc.cpp.
References global_State::allgc, cleargraylists(), finishgencycle(), global_State::finobj, global_State::finobjold1, global_State::finobjrold, global_State::finobjsur, global_State::firstold1, global_State::GCestimate, global_State::gckind, GCSswpallgc, global_State::gcstate, gettotalbytes, KGC_GEN, global_State::lastatomic, global_State::old1, global_State::reallyold, global_State::survival, sweep2old(), and global_State::tobefnz.
Referenced by entergen(), and stepgenfull().
|
static |
Definition at line 942 of file lgc.cpp.
References g, G, GCTM(), and global_State::tobefnz.
Referenced by finishgencycle(), and luaC_freeallobjects().
Definition at line 989 of file lgc.cpp.
Referenced by correctpointers().
|
static |
Definition at line 863 of file lgc.cpp.
References global_State::GCdebt, global_State::gcemergency, global_State::GCestimate, luaS_resize(), stringtable::nuse, stringtable::size, and global_State::strt.
Referenced by finishgencycle(), and singlestep().
|
static |
|
static |
Definition at line 736 of file lgc.cpp.
References Table::array, clearkey(), f, gco2t, gcvalueN, gnode, gnodelast, gval, h, i, iscleared(), isempty, luaH_realasize(), n, and setempty.
Referenced by atomic().
|
static |
Definition at line 388 of file lgc.cpp.
References global_State::allweak, global_State::ephemeron, global_State::gray, global_State::grayagain, and global_State::weak.
Referenced by atomic2gen(), and restartcollection().
|
static |
Definition at line 171 of file lgc.cpp.
References gval, isempty, keyiscollectable, lua_assert, and setdeadkey.
Referenced by clearbykeys(), clearbyvalues(), traverseephemeron(), traversestrongtable(), and traverseweakvalue().
|
static |
Definition at line 683 of file lgc.cpp.
References global_State::ephemeron, Table::gclist, gco2t, h, next, nw2black, propagateall(), traverseephemeron(), and w.
Referenced by atomic().
Definition at line 1145 of file lgc.cpp.
References changeage, curr, G_OLD, G_TOUCHED1, G_TOUCHED2, getage, getgclist(), isgray, isold, iswhite, lua_assert, LUA_VTHREAD, next, nw2black, and p.
Referenced by correctgraylists().
|
static |
Definition at line 1178 of file lgc.cpp.
References global_State::allweak, correctgraylist(), global_State::ephemeron, global_State::grayagain, and global_State::weak.
Referenced by finishgencycle().
|
static |
Definition at line 999 of file lgc.cpp.
References checkpointer(), global_State::firstold1, global_State::old1, global_State::reallyold, and global_State::survival.
Referenced by luaC_checkfinalizer().
Definition at line 1490 of file lgc.cpp.
References freeobj(), and next.
Referenced by luaC_freeallobjects().
|
static |
Definition at line 893 of file lgc.cpp.
References luaD_callnoyield(), lua_State::top, and UNUSED.
Referenced by GCTM().
|
static |
Definition at line 1293 of file lgc.cpp.
References atomic(), atomic2gen(), bitmask, GCSpause, GCSpropagate, and luaC_runtilstate().
Referenced by fullgen(), and luaC_changemode().
|
static |
Definition at line 1308 of file lgc.cpp.
References global_State::allgc, global_State::finobj, global_State::finobjold1, global_State::finobjrold, global_State::finobjsur, global_State::gckind, GCSpause, global_State::gcstate, KGC_INC, global_State::lastatomic, global_State::old1, global_State::reallyold, global_State::survival, global_State::tobefnz, and whitelist().
Referenced by fullgen(), luaC_changemode(), and stepgenfull().
|
static |
Definition at line 1478 of file lgc.cpp.
References global_State::allgc, G, GCSswpallgc, global_State::gcstate, lua_assert, global_State::sweepgc, and sweeptolive().
Referenced by fullinc(), singlestep(), and stepgenfull().
|
static |
Definition at line 1210 of file lgc.cpp.
References callallpendingfinalizers(), checkSizes(), correctgraylists(), global_State::gcemergency, GCSpropagate, and global_State::gcstate.
Referenced by atomic2gen(), and youngcollection().
Definition at line 764 of file lgc.cpp.
References freeupval(), gco2ccl, gco2lcl, gco2p, gco2t, gco2th, gco2ts, gco2u, gco2upv, Udata::len, TString::lnglen, lua_assert, LUA_VCCL, LUA_VLCL, LUA_VLNGSTR, LUA_VPROTO, LUA_VSHRSTR, LUA_VTABLE, LUA_VTHREAD, LUA_VUPVAL, LUA_VUSERDATA, luaE_freethread(), luaF_freeproto(), luaH_free(), luaM_freemem, luaS_remove(), Udata::nuvalue, TString::shrlen, sizeCclosure, sizeLclosure, sizelstring, sizeudata, and TString::u.
Referenced by deletelist(), sweep2old(), sweepgen(), and sweeplist().
|
static |
Definition at line 1338 of file lgc.cpp.
References entergen(), and enterinc().
Referenced by genstep(), and luaC_fullgc().
|
static |
Definition at line 1685 of file lgc.cpp.
References bitmask, entersweep(), global_State::GCestimate, GCScallfin, GCSpause, gettotalbytes, keepinvariant, lua_assert, luaC_runtilstate(), and setpause().
Referenced by luaC_fullgc().
|
static |
Definition at line 899 of file lgc.cpp.
References lua_State::allowhook, CallInfo::callstatus, lua_State::ci, CIST_FIN, dothecall(), g, G, global_State::gcemergency, global_State::gcrunning, lua_assert, LUA_OK, luaD_pcall(), luaE_warnerror(), luaT_gettmbyobj(), notm, savestack, setgcovalue, setobj2s, TM_GC, lua_State::top, udata2finalize(), and unlikely.
Referenced by callallpendingfinalizers(), and runafewfinalizers().
|
static |
Definition at line 424 of file lgc.cpp.
References changeage, G_OLD, G_TOUCHED1, G_TOUCHED2, getage, global_State::grayagain, isblack, linkobjgclist, and lua_assert.
Referenced by traverseephemeron(), traversestrongtable(), and traverseudata().
|
static |
Definition at line 1414 of file lgc.cpp.
References fullgen(), global_State::GCdebt, global_State::GCestimate, global_State::genmajormul, getgcparam, gettotalbytes, isdecGCmodegen, global_State::lastatomic, lua_assert, setminordebt(), setpause(), stepgenfull(), and youngcollection().
Referenced by luaC_step().
Definition at line 125 of file lgc.cpp.
References Udata::gclist, gco2ccl, gco2lcl, gco2p, gco2t, gco2th, gco2u, lua_assert, LUA_VCCL, LUA_VLCL, LUA_VPROTO, LUA_VTABLE, LUA_VTHREAD, LUA_VUSERDATA, and Udata::nuvalue.
Referenced by correctgraylist(), and propagatemark().
|
static |
Definition at line 1645 of file lgc.cpp.
References cast, global_State::GCdebt, GCSpause, global_State::gcstate, global_State::gcstepmul, global_State::gcstepsize, getgcparam, log2maxs, luaE_setdebt(), MAX_LMEM, setpause(), singlestep(), and WORK2MEM.
Referenced by luaC_step().
|
static |
Definition at line 185 of file lgc.cpp.
References iswhite, LUA_TSTRING, markobject, and novariant.
Referenced by clearbykeys(), clearbyvalues(), traverseephemeron(), and traverseweakvalue().
Definition at line 148 of file lgc.cpp.
References isgray, lua_assert, and set2gray.
Definition at line 208 of file lgc.cpp.
References g, G, G_OLD0, global_State::gckind, isblack, isdead, isold, issweepphase, iswhite, keepinvariant, KGC_INC, lua_assert, makewhite, reallymarkobject(), and setage.
Definition at line 230 of file lgc.cpp.
References g, G, G_TOUCHED1, G_TOUCHED2, global_State::gckind, getage, global_State::grayagain, isblack, isdead, isold, KGC_GEN, linkobjgclist, lua_assert, set2gray, and setage.
void luaC_changemode | ( | lua_State * | L, |
int | newmode | ||
) |
Definition at line 1323 of file lgc.cpp.
References entergen(), enterinc(), G, global_State::gckind, KGC_GEN, and global_State::lastatomic.
Referenced by lua_gc(), and luaC_freeallobjects().
Definition at line 1011 of file lgc.cpp.
References global_State::allgc, correctpointers(), FINALIZEDBIT, global_State::finobj, g, G, gfasttm, issweepphase, l_setbit, makewhite, p, setpause(), global_State::sweepgc, sweeptolive(), TM_GC, and tofinalize.
Referenced by lua_setmetatable().
Definition at line 243 of file lgc.cpp.
References global_State::allgc, global_State::fixedgc, g, G, G_OLD, lua_assert, set2gray, and setage.
Referenced by luaS_init(), luaT_init(), and luaX_init().
void luaC_freeallobjects | ( | lua_State * | L | ) |
Definition at line 1503 of file lgc.cpp.
References global_State::allgc, callallpendingfinalizers(), deletelist(), global_State::finobj, global_State::fixedgc, G, KGC_INC, lua_assert, luaC_changemode(), global_State::mainthread, stringtable::nuse, obj2gco, separatetobefnz(), and global_State::strt.
Referenced by close_state().
void luaC_fullgc | ( | lua_State * | L, |
int | isemergency | ||
) |
Definition at line 1703 of file lgc.cpp.
References fullgen(), fullinc(), G, global_State::gcemergency, global_State::gckind, KGC_INC, and lua_assert.
Referenced by growstrtab(), lua_gc(), and tryagain().
Definition at line 258 of file lgc.cpp.
References global_State::allgc, cast, g, G, luaC_white, luaM_newobject, and novariant.
Referenced by createstrobj(), luaF_initupvals(), luaF_newCclosure(), luaF_newLclosure(), luaF_newproto(), luaH_new(), luaS_newudata(), and newupval().
void luaC_runtilstate | ( | lua_State * | L, |
int | statesmask | ||
) |
Definition at line 1631 of file lgc.cpp.
References G, global_State::gcstate, singlestep(), and testbit.
Referenced by entergen(), fullinc(), and stepgenfull().
void luaC_step | ( | lua_State * | L | ) |
Definition at line 1666 of file lgc.cpp.
References G, global_State::gcemergency, global_State::gcrunning, genstep(), incstep(), isdecGCmodegen, and lua_assert.
Referenced by lua_gc().
|
static |
Definition at line 339 of file lgc.cpp.
References markobject, and global_State::tobefnz.
Referenced by atomic(), and restartcollection().
|
static |
Definition at line 329 of file lgc.cpp.
References i, LUA_NUMTAGS, markobjectN, and global_State::mt.
Referenced by atomic(), and restartcollection().
|
static |
Definition at line 1194 of file lgc.cpp.
References changeage, G_OLD, G_OLD1, getage, isblack, iswhite, lua_assert, p, and reallymarkobject().
Referenced by youngcollection().
|
static |
Definition at line 668 of file lgc.cpp.
References global_State::gray, and propagatemark().
Referenced by atomic(), and convergeephemerons().
|
static |
Definition at line 652 of file lgc.cpp.
References gco2ccl, gco2lcl, gco2p, gco2t, gco2th, gco2u, getgclist(), global_State::gray, lua_assert, LUA_VCCL, LUA_VLCL, LUA_VPROTO, LUA_VTABLE, LUA_VTHREAD, LUA_VUSERDATA, nw2black, traverseCclosure(), traverseLclosure(), traverseproto(), traversetable(), traversethread(), and traverseudata().
Referenced by propagateall(), and singlestep().
|
static |
Definition at line 291 of file lgc.cpp.
References gco2u, gco2upv, global_State::gray, linkobjgclist, lua_assert, LUA_VCCL, LUA_VLCL, LUA_VLNGSTR, LUA_VPROTO, LUA_VSHRSTR, LUA_VTABLE, LUA_VTHREAD, LUA_VUPVAL, LUA_VUSERDATA, markobjectN, markvalue, Udata::metatable, Udata::nuvalue, set2black, set2gray, upisopen, and UpVal::v.
Referenced by luaC_barrier_(), markold(), and traverseephemeron().
|
static |
Definition at line 361 of file lgc.cpp.
References getage, isgray, isold, iswhite, lua_assert, markvalue, UpVal::open, lua_State::openupval, p, global_State::twups, lua_State::twups, UpVal::u, upisopen, and UpVal::v.
Referenced by atomic().
|
static |
Definition at line 397 of file lgc.cpp.
References cleargraylists(), global_State::l_registry, global_State::mainthread, markbeingfnz(), markmt(), markobject, and markvalue.
Referenced by singlestep().
|
static |
Definition at line 930 of file lgc.cpp.
References g, G, GCTM(), i, and global_State::tobefnz.
Referenced by singlestep().
|
static |
Definition at line 966 of file lgc.cpp.
References curr, findlast(), global_State::finobj, global_State::finobjold1, global_State::finobjsur, iswhite, lua_assert, p, global_State::tobefnz, and tofinalize.
Referenced by atomic(), and luaC_freeallobjects().
|
static |
Definition at line 1348 of file lgc.cpp.
References cast, global_State::genminormul, gettotalbytes, and luaE_setdebt().
Referenced by genstep(), and stepgenfull().
|
static |
Definition at line 1457 of file lgc.cpp.
References global_State::GCestimate, global_State::gcpause, getgcparam, gettotalbytes, lua_assert, luaE_setdebt(), MAX_LMEM, and PAUSEADJ.
Referenced by fullinc(), genstep(), incstep(), luaC_checkfinalizer(), and stepgenfull().
Definition at line 1576 of file lgc.cpp.
References atomic(), checkSizes(), entersweep(), global_State::finobj, G, global_State::gcemergency, global_State::GCestimate, GCFINALIZECOST, GCFINMAX, GCScallfin, GCSenteratomic, GCSpause, GCSpropagate, GCSswpallgc, GCSswpend, GCSswpfinobj, GCSswptobefnz, global_State::gcstate, gettotalbytes, global_State::gray, lua_assert, n, propagatemark(), restartcollection(), runafewfinalizers(), sweepstep(), and global_State::tobefnz.
Referenced by incstep(), and luaC_runtilstate().
|
static |
Definition at line 1374 of file lgc.cpp.
References atomic(), atomic2gen(), bitmask, enterinc(), entersweep(), global_State::GCestimate, global_State::gckind, GCSpause, GCSpropagate, gettotalbytes, KGC_GEN, global_State::lastatomic, luaC_runtilstate(), setminordebt(), and setpause().
Referenced by genstep().
Definition at line 1052 of file lgc.cpp.
References curr, freeobj(), G, G_OLD, gco2th, gco2upv, global_State::grayagain, isdead, iswhite, linkgclist, lua_assert, LUA_VTHREAD, LUA_VUPVAL, nw2black, set2gray, setage, and upisopen.
Referenced by atomic2gen().
|
static |
Definition at line 1088 of file lgc.cpp.
References cast_byte, curr, freeobj(), G_NEW, G_OLD, G_OLD1, G_SURVIVAL, G_TOUCHED1, G_TOUCHED2, getage, isdead, isold, iswhite, lua_assert, luaC_white, maskgcbits, p, and setage.
Referenced by youngcollection().
Definition at line 816 of file lgc.cpp.
References cast_byte, curr, freeobj(), g, G, i, isdeadm, luaC_white, maskgcbits, otherwhite, and p.
Referenced by sweepstep(), and sweeptolive().
|
static |
Definition at line 1559 of file lgc.cpp.
References global_State::GCdebt, global_State::GCestimate, global_State::gcstate, GCSWEEPMAX, global_State::sweepgc, and sweeplist().
Referenced by singlestep().
Definition at line 843 of file lgc.cpp.
References p, and sweeplist().
Referenced by entersweep(), and luaC_checkfinalizer().
|
static |
Definition at line 587 of file lgc.cpp.
References i, markvalue, and CClosure::upvalue.
Referenced by propagatemark().
|
static |
Definition at line 474 of file lgc.cpp.
References global_State::allweak, Table::array, clearkey(), global_State::ephemeron, gckeyN, GCSpropagate, global_State::gcstate, gcvalue, genlink(), gnode, global_State::grayagain, gval, i, iscleared(), isempty, linkgclist, luaH_realasize(), n, obj2gco, reallymarkobject(), sizenode, and valiswhite.
Referenced by convergeephemerons(), and traversetable().
|
static |
Definition at line 598 of file lgc.cpp.
References i, markobjectN, LClosure::p, and LClosure::upvals.
Referenced by propagatemark().
|
static |
Definition at line 572 of file lgc.cpp.
References i, Proto::k, Proto::locvars, markobjectN, markvalue, Upvaldesc::name, Proto::p, Proto::sizek, Proto::sizelocvars, Proto::sizep, Proto::sizeupvalues, Proto::source, Proto::upvalues, and LocVar::varname.
Referenced by propagatemark().
|
static |
Definition at line 517 of file lgc.cpp.
References Table::array, clearkey(), genlink(), gnode, gnodelast, gval, i, isempty, keyisnil, lua_assert, luaH_realasize(), markkey, markvalue, n, and obj2gco.
Referenced by traversetable().
|
static |
Definition at line 536 of file lgc.cpp.
References Table::alimit, allocsizenode, global_State::allweak, cast_void, gfasttm, linkgclist, markobjectN, Table::metatable, svalue, TM_MODE, traverseephemeron(), traversestrongtable(), traverseweakvalue(), and ttisstring.
Referenced by propagatemark().
|
static |
Definition at line 621 of file lgc.cpp.
References EXTRA_STACK, global_State::gcemergency, GCSatomic, GCSpropagate, global_State::gcstate, global_State::grayagain, isintwups, isold, linkgclist, lua_assert, luaD_shrinkstack(), markobject, markvalue, UpVal::open, lua_State::openupval, s2v, setnilvalue, lua_State::stack, lua_State::stack_last, stacksize, lua_State::top, global_State::twups, lua_State::twups, and UpVal::u.
Referenced by propagatemark().
|
static |
Definition at line 557 of file lgc.cpp.
References genlink(), i, markobjectN, markvalue, Udata::metatable, Udata::nuvalue, obj2gco, UValue::uv, and Udata::uv.
Referenced by propagatemark().
|
static |
Definition at line 440 of file lgc.cpp.
References Table::alimit, clearkey(), GCSatomic, global_State::gcstate, gcvalueN, gnode, gnodelast, global_State::grayagain, gval, iscleared(), isempty, keyisnil, linkgclist, lua_assert, markkey, n, and global_State::weak.
Referenced by traversetable().
|
static |
Definition at line 878 of file lgc.cpp.
References global_State::allgc, FINALIZEDBIT, global_State::firstold1, G_OLD1, getage, issweepphase, lua_assert, makewhite, resetbit, global_State::tobefnz, and tofinalize.
Referenced by GCTM().
|
static |
Definition at line 1129 of file lgc.cpp.
References cast_byte, luaC_white, and maskgcbits.
Referenced by enterinc().
|
static |
Definition at line 1224 of file lgc.cpp.
References global_State::allgc, atomic(), dummy, finishgencycle(), global_State::finobj, global_State::finobjold1, global_State::finobjrold, global_State::finobjsur, global_State::firstold1, GCSpropagate, GCSswpallgc, global_State::gcstate, lua_assert, markold(), global_State::old1, global_State::reallyold, global_State::survival, sweepgen(), and global_State::tobefnz.
Referenced by genstep().