MCPcopy Create free account
hub / github.com/F-Stack/f-stack / traverseweakvalue

Function traverseweakvalue

freebsd/contrib/openzfs/module/lua/lgc.c:354–374  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

352*/
353
354static void traverseweakvalue (global_State *g, Table *h) {
355 Node *n, *limit = gnodelast(h);
356 /* if there is array part, assume it may have white values (do not
357 traverse it just to check) */
358 int hasclears = (h->sizearray > 0);
359 for (n = gnode(h, 0); n < limit; n++) {
360 checkdeadkey(n);
361 if (ttisnil(gval(n))) /* entry is empty? */
362 removeentry(n); /* remove it */
363 else {
364 lua_assert(!ttisnil(gkey(n)));
365 markvalue(g, gkey(n)); /* mark key */
366 if (!hasclears && iscleared(g, gval(n))) /* is there a white value? */
367 hasclears = 1; /* table will have to be cleared */
368 }
369 }
370 if (hasclears)
371 linktable(h, &g->weak); /* has to be cleared later */
372 else /* no white values */
373 linktable(h, &g->grayagain); /* no need to clean */
374}
375
376
377static int traverseephemeron (global_State *g, Table *h) {

Callers 1

traversetableFunction · 0.85

Calls 2

removeentryFunction · 0.70
isclearedFunction · 0.70

Tested by

no test coverage detected