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

Function stackinuse

third-party/lua-5.5.0/src/ldo.c:387–399  ·  view source on GitHub ↗

** Compute how much of the stack is being used, by computing the ** maximum top of all call frames in the stack and the current top. */

Source from the content-addressed store, hash-verified

385** maximum top of all call frames in the stack and the current top.
386*/
387static int stackinuse (lua_State *L) {
388 CallInfo *ci;
389 int res;
390 StkId lim = L->top.p;
391 for (ci = L->ci; ci != NULL; ci = ci->previous) {
392 if (lim < ci->top.p) lim = ci->top.p;
393 }
394 lua_assert(lim <= L->stack_last.p + EXTRA_STACK);
395 res = cast_int(lim - L->stack.p) + 1; /* part of stack in use */
396 if (res < LUA_MINSTACK)
397 res = LUA_MINSTACK; /* ensure a minimum size */
398 return res;
399}
400
401
402/*

Callers 1

luaD_shrinkstackFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected