** Does a young collection. First, mark 'OLD1' objects. (Only survival ** and "recent old" lists can contain 'OLD1' objects. New lists cannot ** contain 'OLD1' objects, at most 'OLD0' objects that were already ** visited when marked old.) Then does the atomic step. Then, ** sweep all lists and advance pointers. Finally, finish the collection. */
| 1138 | ** sweep all lists and advance pointers. Finally, finish the collection. |
| 1139 | */ |
| 1140 | static void youngcollection (lua_State *L, global_State *g) { |
| 1141 | GCObject **psurvival; /* to point to first non-dead survival object */ |
| 1142 | lua_assert(g->gcstate == GCSpropagate); |
| 1143 | markold(g, g->survival, g->reallyold); |
| 1144 | markold(g, g->finobj, g->finobjrold); |
| 1145 | atomic(L); |
| 1146 | |
| 1147 | /* sweep nursery and get a pointer to its last live element */ |
| 1148 | psurvival = sweepgen(L, g, &g->allgc, g->survival); |
| 1149 | /* sweep 'survival' and 'old' */ |
| 1150 | sweepgen(L, g, psurvival, g->reallyold); |
| 1151 | g->reallyold = g->old; |
| 1152 | g->old = *psurvival; /* 'survival' survivals are old now */ |
| 1153 | g->survival = g->allgc; /* all news are survivals */ |
| 1154 | |
| 1155 | /* repeat for 'finobj' lists */ |
| 1156 | psurvival = sweepgen(L, g, &g->finobj, g->finobjsur); |
| 1157 | /* sweep 'survival' and 'old' */ |
| 1158 | sweepgen(L, g, psurvival, g->finobjrold); |
| 1159 | g->finobjrold = g->finobjold; |
| 1160 | g->finobjold = *psurvival; /* 'survival' survivals are old now */ |
| 1161 | g->finobjsur = g->finobj; /* all news are survivals */ |
| 1162 | |
| 1163 | sweepgen(L, g, &g->tobefnz, NULL); |
| 1164 | |
| 1165 | finishgencycle(L, g); |
| 1166 | } |
| 1167 | |
| 1168 | |
| 1169 | static void atomic2gen (lua_State *L, global_State *g) { |
no test coverage detected