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

Function singlestep

Source/Misc/lua/src/lua.c:6558–6609  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6556
6557
6558static l_mem singlestep (lua_State *L) {
6559global_State *g = G(L);
6560/*lua_checkmemory(L);*/
6561switch (g->gcstate) {
6562case GCSpause: {
6563markroot(L); /* start a new collection */
6564return 0;
6565}
6566case GCSpropagate: {
6567if (g->gray)
6568return propagatemark(g);
6569else { /* no more `gray' objects */
6570atomic(L); /* finish mark phase */
6571return 0;
6572}
6573}
6574case GCSsweepstring: {
6575lu_mem old = g->totalbytes;
6576sweepwholelist(L, &g->strt.hash[g->sweepstrgc++]);
6577if (g->sweepstrgc >= g->strt.size) /* nothing more to sweep? */
6578g->gcstate = GCSsweep; /* end sweep-string phase */
6579lua_assert(old >= g->totalbytes);
6580g->estimate -= old - g->totalbytes;
6581return GCSWEEPCOST;
6582}
6583case GCSsweep: {
6584lu_mem old = g->totalbytes;
6585g->sweepgc = sweeplist(L, g->sweepgc, GCSWEEPMAX);
6586if (*g->sweepgc == NULL) { /* nothing more to sweep? */
6587checkSizes(L);
6588g->gcstate = GCSfinalize; /* end sweep phase */
6589}
6590lua_assert(old >= g->totalbytes);
6591g->estimate -= old - g->totalbytes;
6592return GCSWEEPMAX*GCSWEEPCOST;
6593}
6594case GCSfinalize: {
6595if (g->tmudata) {
6596GCTM(L);
6597if (g->estimate > GCFINALIZECOST)
6598g->estimate -= GCFINALIZECOST;
6599return GCFINALIZECOST;
6600}
6601else {
6602g->gcstate = GCSpause; /* end collection */
6603g->gcdept = 0;
6604return 0;
6605}
6606}
6607default: lua_assert(0); return 0;
6608}
6609}
6610
6611
6612void luaC_step (lua_State *L) {

Callers 2

luaC_stepFunction · 0.85
luaC_fullgcFunction · 0.85

Calls 6

markrootFunction · 0.85
propagatemarkFunction · 0.85
atomicFunction · 0.85
sweeplistFunction · 0.85
checkSizesFunction · 0.85
GCTMFunction · 0.85

Tested by

no test coverage detected