** Barrier that moves collector forward, that is, marks the white object ** 'v' being pointed by the black object 'o'. In the generational ** mode, 'v' must also become old, if 'o' is old; however, it cannot ** be changed directly to OLD, because it may still point to non-old ** objects. So, it is marked as OLD0. In the next cycle it will become ** OLD1, and in the next it will finally become OLD
| 244 | ** white from dead.) |
| 245 | */ |
| 246 | void luaC_barrier_ (lua_State *L, GCObject *o, GCObject *v) { |
| 247 | global_State *g = G(L); |
| 248 | lua_assert(isblack(o) && iswhite(v) && !isdead(g, v) && !isdead(g, o)); |
| 249 | if (keepinvariant(g)) { /* must keep invariant? */ |
| 250 | reallymarkobject(g, v); /* restore invariant */ |
| 251 | if (isold(o)) { |
| 252 | lua_assert(!isold(v)); /* white object could not be old */ |
| 253 | setage(v, G_OLD0); /* restore generational invariant */ |
| 254 | } |
| 255 | } |
| 256 | else { /* sweep phase */ |
| 257 | lua_assert(issweepphase(g)); |
| 258 | if (g->gckind != KGC_GENMINOR) /* incremental mode? */ |
| 259 | makewhite(g, o); /* mark 'o' as white to avoid other barriers */ |
| 260 | } |
| 261 | } |
| 262 | |
| 263 | |
| 264 | /* |
nothing calls this directly
no test coverage detected