MCPcopy Create free account
hub / github.com/DFHack/dfhack / propagatemark

Function propagatemark

depends/lua/src/lgc.c:559–600  ·  view source on GitHub ↗

** traverse one gray object, turning it to black (except for threads, ** which are always gray). */

Source from the content-addressed store, hash-verified

557** which are always gray).
558*/
559static void propagatemark (global_State *g) {
560 lu_mem size;
561 GCObject *o = g->gray;
562 lua_assert(isgray(o));
563 gray2black(o);
564 switch (o->tt) {
565 case LUA_TTABLE: {
566 Table *h = gco2t(o);
567 g->gray = h->gclist; /* remove from 'gray' list */
568 size = traversetable(g, h);
569 break;
570 }
571 case LUA_TLCL: {
572 LClosure *cl = gco2lcl(o);
573 g->gray = cl->gclist; /* remove from 'gray' list */
574 size = traverseLclosure(g, cl);
575 break;
576 }
577 case LUA_TCCL: {
578 CClosure *cl = gco2ccl(o);
579 g->gray = cl->gclist; /* remove from 'gray' list */
580 size = traverseCclosure(g, cl);
581 break;
582 }
583 case LUA_TTHREAD: {
584 lua_State *th = gco2th(o);
585 g->gray = th->gclist; /* remove from 'gray' list */
586 linkgclist(th, g->grayagain); /* insert into 'grayagain' list */
587 black2gray(o);
588 size = traversethread(g, th);
589 break;
590 }
591 case LUA_TPROTO: {
592 Proto *p = gco2p(o);
593 g->gray = p->gclist; /* remove from 'gray' list */
594 size = traverseproto(g, p);
595 break;
596 }
597 default: lua_assert(0); return;
598 }
599 g->GCmemtrav += size;
600}
601
602
603static void propagateall (global_State *g) {

Callers 2

propagateallFunction · 0.85
singlestepFunction · 0.85

Calls 5

traversetableFunction · 0.85
traverseLclosureFunction · 0.85
traverseCclosureFunction · 0.85
traversethreadFunction · 0.85
traverseprotoFunction · 0.85

Tested by

no test coverage detected