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

Function luaC_barrier_

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

** 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

Source from the content-addressed store, hash-verified

206** whites from deads.)
207*/
208void 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/*

Callers

nothing calls this directly

Calls 1

reallymarkobjectFunction · 0.85

Tested by

no test coverage detected