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

Function traversethread

depends/lua/src/lgc.c:530–552  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

528
529
530static lu_mem traversethread (global_State *g, lua_State *th) {
531 StkId o = th->stack;
532 if (o == NULL)
533 return 1; /* stack not completely built yet */
534 lua_assert(g->gcstate == GCSinsideatomic ||
535 th->openupval == NULL || isintwups(th));
536 for (; o < th->top; o++) /* mark live elements in the stack */
537 markvalue(g, o);
538 if (g->gcstate == GCSinsideatomic) { /* final traversal? */
539 StkId lim = th->stack + th->stacksize; /* real end of stack */
540 for (; o < lim; o++) /* clear not-marked stack slice */
541 setnilvalue(o);
542 /* 'remarkupvals' may have removed thread from 'twups' list */
543 if (!isintwups(th) && th->openupval != NULL) {
544 th->twups = g->twups; /* link it back to the list */
545 g->twups = th;
546 }
547 }
548 else if (g->gckind != KGC_EMERGENCY)
549 luaD_shrinkstack(th); /* do not change stack in emergency cycle */
550 return (sizeof(lua_State) + sizeof(TValue) * th->stacksize +
551 sizeof(CallInfo) * th->nci);
552}
553
554
555/*

Callers 1

propagatemarkFunction · 0.85

Calls 1

luaD_shrinkstackFunction · 0.85

Tested by

no test coverage detected