MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / separatetobefnz

Function separatetobefnz

extlibs/lua/src/lgc.c:903–920  ·  view source on GitHub ↗

** Move all unreachable objects (or 'all' objects) that need ** finalization from list 'finobj' to list 'tobefnz' (to be finalized). ** (Note that objects after 'finobjold' cannot be white, so they ** don't need to be traversed. In incremental mode, 'finobjold' is NULL, ** so the whole list is traversed.) */

Source from the content-addressed store, hash-verified

901** so the whole list is traversed.)
902*/
903static void separatetobefnz (global_State *g, int all) {
904 GCObject *curr;
905 GCObject **p = &g->finobj;
906 GCObject **lastnext = findlast(&g->tobefnz);
907 while ((curr = *p) != g->finobjold) { /* traverse all finalizable objects */
908 lua_assert(tofinalize(curr));
909 if (!(iswhite(curr) || all)) /* not being collected? */
910 p = &curr->next; /* don't bother with it */
911 else {
912 if (curr == g->finobjsur) /* removing 'finobjsur'? */
913 g->finobjsur = curr->next; /* correct it */
914 *p = curr->next; /* remove 'curr' from 'finobj' list */
915 curr->next = *lastnext; /* link at the end of 'tobefnz' list */
916 *lastnext = curr;
917 lastnext = &curr->next;
918 }
919 }
920}
921
922
923/*

Callers 2

luaC_freeallobjectsFunction · 0.85
atomicFunction · 0.85

Calls 1

findlastFunction · 0.85

Tested by

no test coverage detected