** 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
| 206 | ** whites from deads.) |
| 207 | */ |
| 208 | void luaC_barrier_ (lua_State *L, GCObject *o, GCObject *v) { |
| 209 | global_State *g = G(L); |
| 210 | lua_assert(isblack(o) && iswhite(v) && !isdead(g, v) && !isdead(g, o)); |
| 211 | if (keepinvariant(g)) { /* must keep invariant? */ |
| 212 | reallymarkobject(g, v); /* restore invariant */ |
| 213 | if (isold(o)) { |
| 214 | lua_assert(!isold(v)); /* white object could not be old */ |
| 215 | setage(v, G_OLD0); /* restore generational invariant */ |
| 216 | } |
| 217 | } |
| 218 | else { /* sweep phase */ |
| 219 | lua_assert(issweepphase(g)); |
| 220 | if (g->gckind == KGC_INC) /* incremental mode? */ |
| 221 | makewhite(g, o); /* mark 'o' as white to avoid other barriers */ |
| 222 | } |
| 223 | } |
| 224 | |
| 225 | |
| 226 | /* |
nothing calls this directly
no test coverage detected