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

Function incstep

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

Source from the content-addressed store, hash-verified

1137
1138
1139static void incstep (lua_State *L) {
1140 global_State *g = G(L);
1141 l_mem debt = g->GCdebt;
1142 int stepmul = g->gcstepmul;
1143 if (stepmul < 40) stepmul = 40; /* avoid ridiculous low values (and 0) */
1144 /* convert debt from Kb to 'work units' (avoid zero debt and overflows) */
1145 debt = (debt / STEPMULADJ) + 1;
1146 debt = (debt < MAX_LMEM / stepmul) ? debt * stepmul : MAX_LMEM;
1147 do { /* always perform at least one single step */
1148 lu_mem work = singlestep(L); /* do some work */
1149 debt -= work;
1150 } while (debt > -GCSTEPSIZE && g->gcstate != GCSpause);
1151 if (g->gcstate == GCSpause)
1152 setpause(g, g->GCestimate); /* pause until next cycle */
1153 else {
1154 debt = (debt / stepmul) * STEPMULADJ; /* convert 'work units' to Kb */
1155 luaE_setdebt(g, debt);
1156 }
1157}
1158
1159
1160/*

Callers 1

luaC_forcestepFunction · 0.70

Calls 3

singlestepFunction · 0.70
setpauseFunction · 0.70
luaE_setdebtFunction · 0.70

Tested by

no test coverage detected