MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / stackinuse

Function stackinuse

lib/lua/src/ldo.c:276–288  ·  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

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

Callers 1

luaD_shrinkstackFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected