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

Function stackinuse

third-party/lua-5.4.6/src/ldo.c:283–295  ·  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

281** maximum top of all call frames in the stack and the current top.
282*/
283static int stackinuse (lua_State *L) {
284 CallInfo *ci;
285 int res;
286 StkId lim = L->top.p;
287 for (ci = L->ci; ci != NULL; ci = ci->previous) {
288 if (lim < ci->top.p) lim = ci->top.p;
289 }
290 lua_assert(lim <= L->stack_last.p + EXTRA_STACK);
291 res = cast_int(lim - L->stack.p) + 1; /* part of stack in use */
292 if (res < LUA_MINSTACK)
293 res = LUA_MINSTACK; /* ensure a minimum size */
294 return res;
295}
296
297
298/*

Callers 1

luaD_shrinkstackFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected