MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / luaC_changemode

Function luaC_changemode

third-party/lua-5.2.4/src/lgc.c:952–968  ·  view source on GitHub ↗

** change GC mode */

Source from the content-addressed store, hash-verified

950** change GC mode
951*/
952void luaC_changemode (lua_State *L, int mode) {
953 global_State *g = G(L);
954 if (mode == g->gckind) return; /* nothing to change */
955 if (mode == KGC_GEN) { /* change to generational mode */
956 /* make sure gray lists are consistent */
957 luaC_runtilstate(L, bitmask(GCSpropagate));
958 g->GCestimate = gettotalbytes(g);
959 g->gckind = KGC_GEN;
960 }
961 else { /* change to incremental mode */
962 /* sweep all objects to turn them back to white
963 (as white has not changed, nothing extra will be collected) */
964 g->gckind = KGC_NORMAL;
965 entersweep(L);
966 luaC_runtilstate(L, ~sweepphases);
967 }
968}
969
970
971/*

Callers 1

lua_gcFunction · 0.70

Calls 2

luaC_runtilstateFunction · 0.70
entersweepFunction · 0.70

Tested by

no test coverage detected