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

Function singlestep

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

Source from the content-addressed store, hash-verified

1615
1616
1617static l_mem singlestep (lua_State *L, int fast) {
1618 global_State *g = G(L);
1619 l_mem stepresult;
1620 lua_assert(!g->gcstopem); /* collector is not reentrant */
1621 g->gcstopem = 1; /* no emergency collections while collecting */
1622 switch (g->gcstate) {
1623 case GCSpause: {
1624 restartcollection(g);
1625 g->gcstate = GCSpropagate;
1626 stepresult = 1;
1627 break;
1628 }
1629 case GCSpropagate: {
1630 if (fast || g->gray == NULL) {
1631 g->gcstate = GCSenteratomic; /* finish propagate phase */
1632 stepresult = 1;
1633 }
1634 else
1635 stepresult = propagatemark(g); /* traverse one gray object */
1636 break;
1637 }
1638 case GCSenteratomic: {
1639 atomic(L);
1640 if (checkmajorminor(L, g))
1641 stepresult = step2minor;
1642 else {
1643 entersweep(L);
1644 stepresult = atomicstep;
1645 }
1646 break;
1647 }
1648 case GCSswpallgc: { /* sweep "regular" objects */
1649 sweepstep(L, g, GCSswpfinobj, &g->finobj, fast);
1650 stepresult = GCSWEEPMAX;
1651 break;
1652 }
1653 case GCSswpfinobj: { /* sweep objects with finalizers */
1654 sweepstep(L, g, GCSswptobefnz, &g->tobefnz, fast);
1655 stepresult = GCSWEEPMAX;
1656 break;
1657 }
1658 case GCSswptobefnz: { /* sweep objects to be finalized */
1659 sweepstep(L, g, GCSswpend, NULL, fast);
1660 stepresult = GCSWEEPMAX;
1661 break;
1662 }
1663 case GCSswpend: { /* finish sweeps */
1664 checkSizes(L, g);
1665 g->gcstate = GCScallfin;
1666 stepresult = GCSWEEPMAX;
1667 break;
1668 }
1669 case GCScallfin: { /* call finalizers */
1670 if (g->tobefnz && !g->gcemergency && luaD_checkminstack(L)) {
1671 g->gcstopem = 0; /* ok collections during finalizers */
1672 GCTM(L); /* call one finalizer */
1673 stepresult = CWUFIN;
1674 }

Callers 2

luaC_runtilstateFunction · 0.70
incstepFunction · 0.70

Calls 9

checkmajorminorFunction · 0.85
luaD_checkminstackFunction · 0.85
restartcollectionFunction · 0.70
propagatemarkFunction · 0.70
atomicFunction · 0.70
entersweepFunction · 0.70
sweepstepFunction · 0.70
checkSizesFunction · 0.70
GCTMFunction · 0.70

Tested by

no test coverage detected