MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / traversestack

Function traversestack

third-party/lua-5.2.4/src/lgc.c:495–514  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

493
494
495static lu_mem traversestack (global_State *g, lua_State *th) {
496 int n = 0;
497 StkId o = th->stack;
498 if (o == NULL)
499 return 1; /* stack not completely built yet */
500 for (; o < th->top; o++) /* mark live elements in the stack */
501 markvalue(g, o);
502 if (g->gcstate == GCSatomic) { /* final traversal? */
503 StkId lim = th->stack + th->stacksize; /* real end of stack */
504 for (; o < lim; o++) /* clear not-marked stack slice */
505 setnilvalue(o);
506 }
507 else { /* count call infos to compute size */
508 CallInfo *ci;
509 for (ci = &th->base_ci; ci != th->ci; ci = ci->next)
510 n++;
511 }
512 return sizeof(lua_State) + sizeof(TValue) * th->stacksize +
513 sizeof(CallInfo) * n;
514}
515
516
517/*

Callers 1

propagatemarkFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected