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

Function luaF_closeupval

lib/lua/src/lfunc.c:193–207  ·  view source on GitHub ↗

** Close all upvalues up to the given stack level. */

Source from the content-addressed store, hash-verified

191** Close all upvalues up to the given stack level.
192*/
193void luaF_closeupval (lua_State *L, StkId level) {
194 UpVal *uv;
195 StkId upl; /* stack index pointed by 'uv' */
196 while ((uv = L->openupval) != NULL && (upl = uplevel(uv)) >= level) {
197 TValue *slot = &uv->u.value; /* new position for value */
198 lua_assert(uplevel(uv) < L->top.p);
199 luaF_unlinkupval(uv); /* remove upvalue from 'openupval' list */
200 setobj(L, slot, uv->v.p); /* move value to upvalue slot */
201 uv->v.p = slot; /* now current value lives here */
202 if (!iswhite(uv)) { /* neither white nor dead? */
203 nw2black(uv); /* closed upvalues cannot be gray */
204 luaC_barrier(L, uv, slot);
205 }
206 }
207}
208
209
210/*

Callers 3

luaV_executeFunction · 0.85
luaE_freethreadFunction · 0.85
luaF_closeFunction · 0.85

Calls 1

luaF_unlinkupvalFunction · 0.85

Tested by

no test coverage detected