MCPcopy Create free account
hub / github.com/F-Stack/f-stack / luaC_fullgc

Function luaC_fullgc

freebsd/contrib/openzfs/module/lua/lgc.c:1188–1215  ·  view source on GitHub ↗

** performs a full GC cycle; if "isemergency", does not call ** finalizers (which could change stack positions) */

Source from the content-addressed store, hash-verified

1186** finalizers (which could change stack positions)
1187*/
1188void 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 */

Callers 3

luaM_realloc_Function · 0.70
lua_gcFunction · 0.70
generationalcollectionFunction · 0.70

Calls 5

callallpendingfinalizersFunction · 0.85
entersweepFunction · 0.85
luaC_runtilstateFunction · 0.85
setpauseFunction · 0.85
bitmaskClass · 0.50

Tested by

no test coverage detected