MCPcopy Create free account
hub / github.com/F-Stack/f-stack / incstep

Function incstep

freebsd/contrib/openzfs/module/lua/lgc.c:1138–1156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

luaC_forcestepFunction · 0.85

Calls 3

setpauseFunction · 0.85
luaE_setdebtFunction · 0.85
singlestepFunction · 0.70

Tested by

no test coverage detected