MCPcopy Create free account
hub / github.com/Overload-Technologies/Overload / testobjref1

Function testobjref1

Dependencies/lua/src/ltests.c:297–311  ·  view source on GitHub ↗

** Check GC invariants. For incremental mode, a black object cannot ** point to a white one. For generational mode, really old objects ** cannot point to young objects. Both old1 and touched2 objects ** cannot point to new objects (but can point to survivals). ** (Threads and open upvalues, despite being marked "really old", ** continue to be visited in all collections, and therefore can point to

Source from the content-addressed store, hash-verified

295** new objects. They, and only they, are old but gray.)
296*/
297static int testobjref1 (global_State *g, GCObject *f, GCObject *t) {
298 if (isdead(g,t)) return 0;
299 if (issweepphase(g))
300 return 1; /* no invariants */
301 else if (g->gckind == KGC_INC)
302 return !(isblack(f) && iswhite(t)); /* basic incremental invariant */
303 else { /* generational mode */
304 if ((getage(f) == G_OLD && isblack(f)) && !isold(t))
305 return 0;
306 if (((getage(f) == G_OLD1 || getage(f) == G_TOUCHED2) && isblack(f)) &&
307 getage(t) == G_NEW)
308 return 0;
309 return 1;
310 }
311}
312
313
314static void printobj (global_State *g, GCObject *o) {

Callers 1

testobjrefFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected