MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / propagatemark

Function propagatemark

Source/Misc/lua/src/lua.c:6279–6322  ·  view source on GitHub ↗

** traverse one gray object, turning it to black. ** Returns `quantity' traversed. */

Source from the content-addressed store, hash-verified

6277** Returns `quantity' traversed.
6278*/
6279static l_mem propagatemark (global_State *g) {
6280GCObject *o = g->gray;
6281lua_assert(isgray(o));
6282gray2black(o);
6283switch (o->gch.tt) {
6284case LUA_TTABLE: {
6285Table *h = gco2h(o);
6286g->gray = h->gclist;
6287if (traversetable(g, h)) /* table is weak? */
6288black2gray(o); /* keep it gray */
6289return sizeof(Table) + sizeof(TValue) * h->sizearray +
6290sizeof(Node) * sizenode(h);
6291}
6292case LUA_TFUNCTION: {
6293Closure *cl = gco2cl(o);
6294g->gray = cl->c.gclist;
6295traverseclosure(g, cl);
6296return (cl->c.isC) ? sizeCclosure(cl->c.nupvalues) :
6297sizeLclosure(cl->l.nupvalues);
6298}
6299case LUA_TTHREAD: {
6300lua_State *th = gco2th(o);
6301g->gray = th->gclist;
6302th->gclist = g->grayagain;
6303g->grayagain = o;
6304black2gray(o);
6305traversestack(g, th);
6306return sizeof(lua_State) + sizeof(TValue) * th->stacksize +
6307sizeof(CallInfo) * th->size_ci;
6308}
6309case LUA_TPROTO: {
6310Proto *p = gco2p(o);
6311g->gray = p->gclist;
6312traverseproto(g, p);
6313return sizeof(Proto) + sizeof(Instruction) * p->sizecode +
6314sizeof(Proto *) * p->sizep +
6315sizeof(TValue) * p->sizek +
6316sizeof(int) * p->sizelineinfo +
6317sizeof(LocVar) * p->sizelocvars +
6318sizeof(TString *) * p->sizeupvalues;
6319}
6320default: lua_assert(0); return 0;
6321}
6322}
6323
6324
6325static size_t propagateall (global_State *g) {

Callers 2

propagateallFunction · 0.85
singlestepFunction · 0.85

Calls 4

traversetableFunction · 0.85
traverseclosureFunction · 0.85
traversestackFunction · 0.85
traverseprotoFunction · 0.85

Tested by

no test coverage detected