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

Function incstep

third-party/lua-5.5.0/src/lgc.c:1710–1728  ·  view source on GitHub ↗

** Performs a basic incremental step. The step size is ** converted from bytes to "units of work"; then the function loops ** running single steps until adding that many units of work or ** finishing a cycle (pause state). Finally, it sets the debt that ** controls when next step will be performed. */

Source from the content-addressed store, hash-verified

1708** controls when next step will be performed.
1709*/
1710static void incstep (lua_State *L, global_State *g) {
1711 l_mem stepsize = applygcparam(g, STEPSIZE, 100);
1712 l_mem work2do = applygcparam(g, STEPMUL, stepsize / cast_int(sizeof(void*)));
1713 l_mem stres;
1714 int fast = (work2do == 0); /* special case: do a full collection */
1715 do { /* repeat until enough work */
1716 stres = singlestep(L, fast); /* perform one single step */
1717 if (stres == step2minor) /* returned to minor collections? */
1718 return; /* nothing else to be done here */
1719 else if (stres == step2pause || (stres == atomicstep && !fast))
1720 break; /* end of cycle or atomic */
1721 else
1722 work2do -= stres;
1723 } while (fast || work2do > 0);
1724 if (g->gcstate == GCSpause)
1725 setpause(g); /* pause until next cycle */
1726 else
1727 luaE_setdebt(g, stepsize);
1728}
1729
1730
1731#if !defined(luai_tracegc)

Callers 1

luaC_stepFunction · 0.70

Calls 3

singlestepFunction · 0.70
setpauseFunction · 0.70
luaE_setdebtFunction · 0.70

Tested by

no test coverage detected