** performs a full GC cycle; if "isemergency", does not call ** finalizers (which could change stack positions) */
| 1186 | ** finalizers (which could change stack positions) |
| 1187 | */ |
| 1188 | void luaC_fullgc (lua_State *L, int isemergency) { |
| 1189 | global_State *g = G(L); |
| 1190 | int origkind = g->gckind; |
| 1191 | lua_assert(origkind != KGC_EMERGENCY); |
| 1192 | if (isemergency) /* do not run finalizers during emergency GC */ |
| 1193 | g->gckind = KGC_EMERGENCY; |
| 1194 | else { |
| 1195 | g->gckind = KGC_NORMAL; |
| 1196 | callallpendingfinalizers(L, 1); |
| 1197 | } |
| 1198 | if (keepinvariant(g)) { /* may there be some black objects? */ |
| 1199 | /* must sweep all objects to turn them back to white |
| 1200 | (as white has not changed, nothing will be collected) */ |
| 1201 | entersweep(L); |
| 1202 | } |
| 1203 | /* finish any pending sweep phase to start a new cycle */ |
| 1204 | luaC_runtilstate(L, bitmask(GCSpause)); |
| 1205 | luaC_runtilstate(L, ~bitmask(GCSpause)); /* start new collection */ |
| 1206 | luaC_runtilstate(L, bitmask(GCSpause)); /* run entire collection */ |
| 1207 | if (origkind == KGC_GEN) { /* generational mode? */ |
| 1208 | /* generational mode must be kept in propagate phase */ |
| 1209 | luaC_runtilstate(L, bitmask(GCSpropagate)); |
| 1210 | } |
| 1211 | g->gckind = origkind; |
| 1212 | setpause(g, gettotalbytes(g)); |
| 1213 | if (!isemergency) /* do not run finalizers during emergency GC */ |
| 1214 | callallpendingfinalizers(L, 1); |
| 1215 | } |
| 1216 | |
| 1217 | /* }====================================================== */ |
| 1218 | /* END CSTYLED */ |
no test coverage detected