** 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.) */
| 1021 | ** so the whole list is traversed.) |
| 1022 | */ |
| 1023 | static 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 | /* |
no test coverage detected