MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / luaD_shrinkstack

Function luaD_shrinkstack

extlibs/lua/src/ldo.c:246–259  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

244
245
246void luaD_shrinkstack (lua_State *L) {
247 int inuse = stackinuse(L);
248 int goodsize = inuse + (inuse / 8) + 2*EXTRA_STACK;
249 if (goodsize > LUAI_MAXSTACK)
250 goodsize = LUAI_MAXSTACK; /* respect stack limit */
251 /* if thread is currently not handling a stack overflow and its
252 good size is smaller than current size, shrink its stack */
253 if (inuse <= (LUAI_MAXSTACK - EXTRA_STACK) &&
254 goodsize < L->stacksize)
255 luaD_reallocstack(L, goodsize, 0); /* ok if that fails */
256 else /* don't change stack */
257 condmovestack(L,{},{}); /* (change only for debugging) */
258 luaE_shrinkCI(L); /* shrink CI list */
259}
260
261
262void luaD_inctop (lua_State *L) {

Callers 3

recoverFunction · 0.85
luaD_pcallFunction · 0.85
traversethreadFunction · 0.85

Calls 3

stackinuseFunction · 0.85
luaD_reallocstackFunction · 0.85
luaE_shrinkCIFunction · 0.85

Tested by

no test coverage detected