MCPcopy Create free account
hub / github.com/ArduPilot/ardupilot / luaD_shrinkstack

Function luaD_shrinkstack

libraries/AP_Scripting/lua/src/ldo.c:230–246  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 3

recoverFunction · 0.85
luaD_pcallFunction · 0.85
traversethreadFunction · 0.85

Calls 4

stackinuseFunction · 0.85
luaE_freeCIFunction · 0.85
luaE_shrinkCIFunction · 0.85
luaD_reallocstackFunction · 0.85

Tested by

no test coverage detected