/* performs a full GC cycle; if "isemergency", does not call finalizers (which could change stack positions)  */
void luaC_fullgc(lua_State *L, int isemergency)
/* performs a full GC cycle; if "isemergency", does not call finalizers (which could change stack positions)  */
void luaC_fullgc(lua_State *L, int isemergency)
{
    g->gckind = KGC_NORMAL;
    callallpendingfinalizers(L, 1);
  }
  if (keepinvariant(g)) {
    entersweep(L);
  }
  luaC_runtilstate(L, bitmask(GCSpause));
  luaC_runtilstate(L, ~bitmask(GCSpause));
  luaC_runtilstate(L, bitmask(GCSpause));
  if (origkind == KGC_GEN) {
    luaC_runtilstate(L, bitmask(GCSpropagate));
  }
  g->gckind = origkind;
  setpause(g, gettotalbytes(g));
  if (!isemergency)
    callallpendingfinalizers(L, 1);
}