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

Function separatetobefnz

third-party/lua-5.5.0/src/lgc.c:1023–1040  ·  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 'finobjold1' cannot be white, so they ** don't need to be traversed. In incremental mode, 'finobjold1' is NULL, ** so the whole list is traversed.) */

Source from the content-addressed store, hash-verified

1021** so the whole list is traversed.)
1022*/
1023static void separatetobefnz (global_State *g, int all) {
1024 GCObject *curr;
1025 GCObject **p = &g->finobj;
1026 GCObject **lastnext = findlast(&g->tobefnz);
1027 while ((curr = *p) != g->finobjold1) { /* traverse all finalizable objects */
1028 lua_assert(tofinalize(curr));
1029 if (!(iswhite(curr) || all)) /* not being collected? */
1030 p = &curr->next; /* don't bother with it */
1031 else {
1032 if (curr == g->finobjsur) /* removing 'finobjsur'? */
1033 g->finobjsur = curr->next; /* correct it */
1034 *p = curr->next; /* remove 'curr' from 'finobj' list */
1035 curr->next = *lastnext; /* link at the end of 'tobefnz' list */
1036 *lastnext = curr;
1037 lastnext = &curr->next;
1038 }
1039 }
1040}
1041
1042
1043/*

Callers 2

luaC_freeallobjectsFunction · 0.70
atomicFunction · 0.70

Calls 1

findlastFunction · 0.70

Tested by

no test coverage detected