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

Function luaD_shrinkstack

third-party/lua-5.3.5/src/ldo.c:221–237  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

219
220
221void luaD_shrinkstack (lua_State *L) {
222 int inuse = stackinuse(L);
223 int goodsize = inuse + (inuse / 8) + 2*EXTRA_STACK;
224 if (goodsize > LUAI_MAXSTACK)
225 goodsize = LUAI_MAXSTACK; /* respect stack limit */
226 if (L->stacksize > LUAI_MAXSTACK) /* had been handling stack overflow? */
227 luaE_freeCI(L); /* free all CIs (list grew because of an error) */
228 else
229 luaE_shrinkCI(L); /* shrink list */
230 /* if thread is currently not handling a stack overflow and its
231 good size is smaller than current size, shrink its stack */
232 if (inuse <= (LUAI_MAXSTACK - EXTRA_STACK) &&
233 goodsize < L->stacksize)
234 luaD_reallocstack(L, goodsize);
235 else /* don't change stack */
236 condmovestack(L,{},{}); /* (change only for debugging) */
237}
238
239
240void luaD_inctop (lua_State *L) {

Callers 3

recoverFunction · 0.70
luaD_pcallFunction · 0.70
traversethreadFunction · 0.70

Calls 4

stackinuseFunction · 0.70
luaE_freeCIFunction · 0.70
luaE_shrinkCIFunction · 0.70
luaD_reallocstackFunction · 0.70

Tested by

no test coverage detected