** Mark an object. Userdata, strings, and closed upvalues are visited ** and turned black here. Other objects are marked gray and added ** to appropriate list to be visited (and turned black) later. (Open ** upvalues are already linked in 'headuv' list. They are kept gray ** to avoid barriers, as their values will be revisited by the thread.) */
| 266 | ** to avoid barriers, as their values will be revisited by the thread.) |
| 267 | */ |
| 268 | static void reallymarkobject (global_State *g, GCObject *o) { |
| 269 | white2gray(o); |
| 270 | switch (o->tt) { |
| 271 | case LUA_VSHRSTR: |
| 272 | case LUA_VLNGSTR: { |
| 273 | gray2black(o); |
| 274 | break; |
| 275 | } |
| 276 | case LUA_VUPVAL: { |
| 277 | UpVal *uv = gco2upv(o); |
| 278 | if (!upisopen(uv)) /* open upvalues are kept gray */ |
| 279 | gray2black(o); |
| 280 | markvalue(g, uv->v); /* mark its content */ |
| 281 | break; |
| 282 | } |
| 283 | case LUA_VUSERDATA: { |
| 284 | Udata *u = gco2u(o); |
| 285 | if (u->nuvalue == 0) { /* no user values? */ |
| 286 | markobjectN(g, u->metatable); /* mark its metatable */ |
| 287 | gray2black(o); /* nothing else to mark */ |
| 288 | break; |
| 289 | } |
| 290 | /* else... */ |
| 291 | } /* FALLTHROUGH */ |
| 292 | case LUA_VLCL: case LUA_VCCL: case LUA_VTABLE: |
| 293 | case LUA_VTHREAD: case LUA_VPROTO: { |
| 294 | linkobjgclist(o, g->gray); |
| 295 | break; |
| 296 | } |
| 297 | default: lua_assert(0); break; |
| 298 | } |
| 299 | } |
| 300 | |
| 301 | |
| 302 | /* |
no outgoing calls
no test coverage detected