MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / luaF_closeupval

Function luaF_closeupval

3rd/lua-5.4.3/src/lfunc.c:194–208  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

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

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