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

Function separatetobefnz

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

** move all unreachable objects (or 'all' objects) that need ** finalization from list 'finobj' to list 'tobefnz' (to be finalized) */

Source from the content-addressed store, hash-verified

842** finalization from list 'finobj' to list 'tobefnz' (to be finalized)
843*/
844static void separatetobefnz (lua_State *L, int all) {
845 global_State *g = G(L);
846 GCObject **p = &g->finobj;
847 GCObject *curr;
848 GCObject **lastnext = &g->tobefnz;
849 /* find last 'next' field in 'tobefnz' list (to add elements in its end) */
850 while (*lastnext != NULL)
851 lastnext = &gch(*lastnext)->next;
852 while ((curr = *p) != NULL) { /* traverse all finalizable objects */
853 lua_assert(!isfinalized(curr));
854 lua_assert(testbit(gch(curr)->marked, SEPARATED));
855 if (!(iswhite(curr) || all)) /* not being collected? */
856 p = &gch(curr)->next; /* don't bother with it */
857 else {
858 l_setbit(gch(curr)->marked, FINALIZEDBIT); /* won't be finalized again */
859 *p = gch(curr)->next; /* remove 'curr' from 'finobj' list */
860 gch(curr)->next = *lastnext; /* link at the end of 'tobefnz' list */
861 *lastnext = curr;
862 lastnext = &gch(curr)->next;
863 }
864 }
865}
866
867
868/*

Callers 2

luaC_freeallobjectsFunction · 0.85
atomicFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected