** Does a young collection. First, mark 'OLD1' objects. Then does the ** atomic step. Then, sweep all lists and advance pointers. Finally, ** finish the collection. */
| 1249 | ** finish the collection. |
| 1250 | */ |
| 1251 | static void youngcollection (lua_State *L, global_State *g) { |
| 1252 | GCObject **psurvival; /* to point to first non-dead survival object */ |
| 1253 | GCObject *dummy; /* dummy out parameter to 'sweepgen' */ |
| 1254 | lua_assert(g->gcstate == GCSpropagate); |
| 1255 | if (g->firstold1) { /* are there regular OLD1 objects? */ |
| 1256 | markold(g, g->firstold1, g->reallyold); /* mark them */ |
| 1257 | g->firstold1 = NULL; /* no more OLD1 objects (for now) */ |
| 1258 | } |
| 1259 | markold(g, g->finobj, g->finobjrold); |
| 1260 | markold(g, g->tobefnz, NULL); |
| 1261 | atomic(L); |
| 1262 | |
| 1263 | /* sweep nursery and get a pointer to its last live element */ |
| 1264 | g->gcstate = GCSswpallgc; |
| 1265 | psurvival = sweepgen(L, g, &g->allgc, g->survival, &g->firstold1); |
| 1266 | /* sweep 'survival' */ |
| 1267 | sweepgen(L, g, psurvival, g->old1, &g->firstold1); |
| 1268 | g->reallyold = g->old1; |
| 1269 | g->old1 = *psurvival; /* 'survival' survivals are old now */ |
| 1270 | g->survival = g->allgc; /* all news are survivals */ |
| 1271 | |
| 1272 | /* repeat for 'finobj' lists */ |
| 1273 | dummy = NULL; /* no 'firstold1' optimization for 'finobj' lists */ |
| 1274 | psurvival = sweepgen(L, g, &g->finobj, g->finobjsur, &dummy); |
| 1275 | /* sweep 'survival' */ |
| 1276 | sweepgen(L, g, psurvival, g->finobjold1, &dummy); |
| 1277 | g->finobjrold = g->finobjold1; |
| 1278 | g->finobjold1 = *psurvival; /* 'survival' survivals are old now */ |
| 1279 | g->finobjsur = g->finobj; /* all news are survivals */ |
| 1280 | |
| 1281 | sweepgen(L, g, &g->tobefnz, NULL, &dummy); |
| 1282 | finishgencycle(L, g); |
| 1283 | } |
| 1284 | |
| 1285 | |
| 1286 | /* |
no test coverage detected