MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / luaC_barrier_

Function luaC_barrier_

third-party/lua-5.5.0/src/lgc.c:246–261  ·  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

244** white from dead.)
245*/
246void 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/*

Callers

nothing calls this directly

Calls 1

reallymarkobjectFunction · 0.70

Tested by

no test coverage detected