/* Close all upvalues up to the given stack level.  */
void luaF_closeupval(lua_State *L, StkId level)
/* Close all upvalues up to the given stack level.  */
void luaF_closeupval(lua_State *L, StkId level)
{
    TValue *slot = &uv->u.value;
    lua_assert(uplevel(uv) < L->top);
    luaF_unlinkupval(uv);
    setobj(L, slot, uv->v);
    uv->v = slot;
    if (!iswhite(uv)) {
      nw2black(uv);
      luaC_barrier(L, uv, slot);
    }
  }
}