no more generational collection !!!

This commit is contained in:
Roberto Ierusalimschy 2013-08-05 13:58:28 -03:00
parent 4244da96bf
commit 677d90165f
10 changed files with 46 additions and 190 deletions

35
lapi.c
View File

@ -1,5 +1,5 @@
/*
** $Id: lapi.c,v 2.184 2013/06/20 15:12:43 roberto Exp roberto $
** $Id: lapi.c,v 2.185 2013/07/05 14:29:51 roberto Exp roberto $
** Lua API
** See Copyright Notice in lua.h
*/
@ -1068,19 +1068,13 @@ LUA_API int lua_gc (lua_State *L, int what, int data) {
break;
}
case LUA_GCSTEP: {
if (g->gckind == KGC_GEN) { /* generational mode? */
res = (g->GCestimate == 0); /* true if it will do major collection */
luaC_forcestep(L); /* do a single step */
}
else {
lu_mem debt = cast(lu_mem, data) * 1024 - GCSTEPSIZE;
if (g->gcrunning)
debt += g->GCdebt; /* include current debt */
luaE_setdebt(g, debt);
luaC_forcestep(L);
if (g->gcstate == GCSpause) /* end of cycle? */
res = 1; /* signal it */
}
lu_mem debt = cast(lu_mem, data) * 1024 - GCSTEPSIZE;
if (g->gcrunning)
debt += g->GCdebt; /* include current debt */
luaE_setdebt(g, debt);
luaC_forcestep(L);
if (g->gcstate == GCSpause) /* end of cycle? */
res = 1; /* signal it */
break;
}
case LUA_GCSETPAUSE: {
@ -1088,11 +1082,6 @@ LUA_API int lua_gc (lua_State *L, int what, int data) {
g->gcpause = data;
break;
}
case LUA_GCSETMAJORINC: {
res = g->gcmajorinc;
g->gcmajorinc = data;
break;
}
case LUA_GCSETSTEPMUL: {
res = g->gcstepmul;
g->gcstepmul = data;
@ -1102,14 +1091,6 @@ LUA_API int lua_gc (lua_State *L, int what, int data) {
res = g->gcrunning;
break;
}
case LUA_GCGEN: { /* change collector to generational mode */
luaC_changemode(L, KGC_GEN);
break;
}
case LUA_GCINC: { /* change collector to incremental mode */
luaC_changemode(L, KGC_NORMAL);
break;
}
default: res = -1; /* invalid option */
}
lua_unlock(L);

View File

@ -1,5 +1,5 @@
/*
** $Id: lbaselib.c,v 1.279 2013/07/05 14:39:15 roberto Exp roberto $
** $Id: lbaselib.c,v 1.280 2013/07/10 17:15:12 roberto Exp roberto $
** Basic library
** See Copyright Notice in lua.h
*/
@ -174,11 +174,9 @@ static int luaB_rawset (lua_State *L) {
static int luaB_collectgarbage (lua_State *L) {
static const char *const opts[] = {"stop", "restart", "collect",
"count", "step", "setpause", "setstepmul",
"setmajorinc", "isrunning", "generational", "incremental", NULL};
"count", "step", "setpause", "setstepmul", "isrunning", NULL};
static const int optsnum[] = {LUA_GCSTOP, LUA_GCRESTART, LUA_GCCOLLECT,
LUA_GCCOUNT, LUA_GCSTEP, LUA_GCSETPAUSE, LUA_GCSETSTEPMUL,
LUA_GCSETMAJORINC, LUA_GCISRUNNING, LUA_GCGEN, LUA_GCINC};
LUA_GCCOUNT, LUA_GCSTEP, LUA_GCSETPAUSE, LUA_GCSETSTEPMUL, LUA_GCISRUNNING};
int o = optsnum[luaL_checkoption(L, 1, "collect", opts)];
int ex = luaL_optint(L, 2, 0);
int res = lua_gc(L, o, ex);

View File

@ -1,5 +1,5 @@
/*
** $Id: lfunc.c,v 2.29 2012/05/08 13:53:33 roberto Exp roberto $
** $Id: lfunc.c,v 2.30 2012/10/03 12:36:46 roberto Exp roberto $
** Auxiliary functions to manipulate prototypes and closures
** See Copyright Notice in lua.h
*/
@ -52,7 +52,6 @@ UpVal *luaF_findupval (lua_State *L, StkId level) {
while (*pp != NULL && (p = gco2uv(*pp))->v >= level) {
GCObject *o = obj2gco(p);
lua_assert(p->v != &p->u.value);
lua_assert(!isold(o) || isold(obj2gco(L)));
if (p->v == level) { /* found a corresponding upvalue? */
if (isdead(g, o)) /* is it dead? */
changewhite(o); /* resurrect it */

115
lgc.c
View File

@ -1,5 +1,5 @@
/*
** $Id: lgc.c,v 2.140.1.2 2013/04/26 18:22:05 roberto Exp $
** $Id: lgc.c,v 2.141 2013/04/26 18:26:49 roberto Exp roberto $
** Garbage Collector
** See Copyright Notice in lua.h
*/
@ -52,10 +52,10 @@
/*
** 'makewhite' erases all color bits plus the old bit and then
** sets only the current white bit
** 'makewhite' erases all color bits then sets only the current white
** bit
*/
#define maskcolors (~(bit2mask(BLACKBIT, OLDBIT) | WHITEBITS))
#define maskcolors (~(bitmask(BLACKBIT) | WHITEBITS))
#define makewhite(g,x) \
(gch(x)->marked = cast_byte((gch(x)->marked & maskcolors) | luaC_white(g)))
@ -137,7 +137,7 @@ void luaC_barrier_ (lua_State *L, GCObject *o, GCObject *v) {
lua_assert(isblack(o) && iswhite(v) && !isdead(g, v) && !isdead(g, o));
lua_assert(g->gcstate != GCSpause);
lua_assert(gch(o)->tt != LUA_TTABLE);
if (keepinvariantout(g)) /* must keep invariant? */
if (keepinvariant(g)) /* must keep invariant? */
reallymarkobject(g, v); /* restore invariant */
else { /* sweep phase */
lua_assert(issweepphase(g));
@ -184,7 +184,7 @@ LUAI_FUNC void luaC_barrierproto_ (lua_State *L, Proto *p, Closure *c) {
/*
** check color (and invariants) for an upvalue that was closed,
** check color (and invariants) for an upvalue that is being closed,
** i.e., moved into the 'allgc' list
*/
void luaC_checkupvalcolor (global_State *g, UpVal *uv) {
@ -192,7 +192,6 @@ void luaC_checkupvalcolor (global_State *g, UpVal *uv) {
lua_assert(!isblack(o)); /* open upvalues are never black */
if (isgray(o)) {
if (keepinvariant(g)) {
resetoldbit(o); /* see MOVE OLD rule */
gray2black(o); /* it is being visited now */
markvalue(g, uv->v);
}
@ -331,8 +330,7 @@ static void remarkupvals (global_State *g) {
/*
** mark root set and reset all gray lists, to start a new
** incremental (or full) collection
** mark root set and reset all gray lists, to start a new collection
*/
static void restartcollection (global_State *g) {
g->gray = g->grayagain = NULL;
@ -708,29 +706,14 @@ static void sweepthread (lua_State *L, lua_State *L1) {
/*
** sweep at most 'count' elements from a list of GCObjects erasing dead
** objects, where a dead (not alive) object is one marked with the "old"
** (non current) white and not fixed.
** In non-generational mode, change all non-dead objects back to white,
** preparing for next collection cycle.
** In generational mode, keep black objects black, and also mark them as
** old; stop when hitting an old object, as all objects after that
** one will be old too.
** (non current) white and not fixed; change all non-dead objects back
** to white, preparing for next collection cycle.
** When object is a thread, sweep its list of open upvalues too.
*/
static GCObject **sweeplist (lua_State *L, GCObject **p, lu_mem count) {
global_State *g = G(L);
int ow = otherwhite(g);
int toclear, toset; /* bits to clear and to set in all live objects */
int tostop; /* stop sweep when this is true */
if (isgenerational(g)) { /* generational mode? */
toclear = ~0; /* clear nothing */
toset = bitmask(OLDBIT); /* set the old bit of all surviving objects */
tostop = bitmask(OLDBIT); /* do not sweep old generation */
}
else { /* normal mode */
toclear = maskcolors; /* clear all color bits + old bit */
toset = luaC_white(g); /* make object white */
tostop = 0; /* do not stop */
}
int white = luaC_white(g); /* current white */
while (*p != NULL && count-- > 0) {
GCObject *curr = *p;
int marked = gch(curr)->marked;
@ -739,12 +722,10 @@ static GCObject **sweeplist (lua_State *L, GCObject **p, lu_mem count) {
freeobj(L, curr); /* erase 'curr' */
}
else {
if (testbits(marked, tostop))
return NULL; /* stop sweeping this list */
if (gch(curr)->tt == LUA_TTHREAD)
sweepthread(L, gco2th(curr)); /* sweep thread's upvalues */
/* update marks */
gch(curr)->marked = cast_byte((marked & toclear) | toset);
gch(curr)->marked = cast_byte((marked & maskcolors) | white);
p = &gch(curr)->next; /* go to next element */
}
}
@ -793,8 +774,7 @@ static GCObject *udata2finalize (global_State *g) {
gch(o)->next = g->allgc; /* return it to 'allgc' list */
g->allgc = o;
resetbit(gch(o)->marked, SEPARATED); /* mark that it is not in 'tobefnz' */
lua_assert(!isold(o)); /* see MOVE OLD rule */
if (!keepinvariantout(g)) /* not keeping invariant? */
if (!keepinvariant(g)) /* not keeping invariant? */
makewhite(g, o); /* "sweep" object */
return o;
}
@ -889,10 +869,8 @@ void luaC_checkfinalizer (lua_State *L, GCObject *o, Table *mt) {
ho->next = g->finobj; /* link it in list 'finobj' */
g->finobj = o;
l_setbit(ho->marked, SEPARATED); /* mark it as such */
if (!keepinvariantout(g)) /* not keeping invariant? */
if (!keepinvariant(g)) /* not keeping invariant? */
makewhite(g, o); /* "sweep" object */
else
resetoldbit(o); /* see MOVE OLD rule */
}
}
@ -946,37 +924,13 @@ static int entersweep (lua_State *L) {
}
/*
** change GC mode
*/
void luaC_changemode (lua_State *L, int mode) {
global_State *g = G(L);
if (mode == g->gckind) return; /* nothing to change */
if (mode == KGC_GEN) { /* change to generational mode */
/* make sure gray lists are consistent */
luaC_runtilstate(L, bitmask(GCSpropagate));
g->GCestimate = gettotalbytes(g);
g->gckind = KGC_GEN;
}
else { /* change to incremental mode */
/* sweep all objects to turn them back to white
(as white has not changed, nothing extra will be collected) */
g->gckind = KGC_NORMAL;
entersweep(L);
luaC_runtilstate(L, ~sweepphases);
}
}
/*
** call all pending finalizers
*/
static void callallpendingfinalizers (lua_State *L, int propagateerrors) {
global_State *g = G(L);
while (g->tobefnz) {
resetoldbit(g->tobefnz);
while (g->tobefnz)
GCTM(L, propagateerrors);
}
}
@ -1014,7 +968,7 @@ static l_mem atomic (lua_State *L) {
work -= g->GCmemtrav; /* restart counting */
convergeephemerons(g);
/* at this point, all strongly accessible objects are marked. */
/* clear values from weak tables, before checking finalizers */
/* Clear values from weak tables, before checking finalizers */
clearvalues(g, g->weak, NULL);
clearvalues(g, g->allweak, NULL);
origweak = g->weak; origall = g->allweak;
@ -1043,7 +997,6 @@ static lu_mem singlestep (lua_State *L) {
case GCSpause: {
/* start to count memory traversed */
g->GCmemtrav = g->strt.size * sizeof(GCObject*);
lua_assert(!isgenerational(g));
restartcollection(g);
g->gcstate = GCSpropagate;
return g->GCmemtrav;
@ -1114,28 +1067,6 @@ void luaC_runtilstate (lua_State *L, int statesmask) {
}
static void generationalcollection (lua_State *L) {
global_State *g = G(L);
lua_assert(g->gcstate == GCSpropagate);
if (g->GCestimate == 0) { /* signal for another major collection? */
luaC_fullgc(L, 0); /* perform a full regular collection */
g->GCestimate = gettotalbytes(g); /* update control */
}
else {
lu_mem estimate = g->GCestimate;
luaC_runtilstate(L, bitmask(GCSpause)); /* run complete (minor) cycle */
g->gcstate = GCSpropagate; /* skip restart */
if (gettotalbytes(g) > (estimate / 100) * g->gcmajorinc)
g->GCestimate = 0; /* signal for a major collection */
else
g->GCestimate = estimate; /* keep estimate from last major coll. */
}
setpause(g, gettotalbytes(g));
lua_assert(g->gcstate == GCSpropagate);
}
static void incstep (lua_State *L) {
global_State *g = G(L);
l_mem debt = g->GCdebt;
@ -1163,8 +1094,7 @@ static void incstep (lua_State *L) {
void luaC_forcestep (lua_State *L) {
global_State *g = G(L);
int i;
if (isgenerational(g)) generationalcollection(L);
else incstep(L);
incstep(L);
/* run a few finalizers (or all of them at the end of a collect cycle) */
for (i = 0; g->tobefnz && (i < GCFINALIZENUM || g->gcstate == GCSpause); i++)
GCTM(L, 1); /* call one finalizer */
@ -1188,14 +1118,11 @@ void luaC_step (lua_State *L) {
*/
void luaC_fullgc (lua_State *L, int isemergency) {
global_State *g = G(L);
int origkind = g->gckind;
lua_assert(origkind != KGC_EMERGENCY);
lua_assert(g->gckind == KGC_NORMAL);
if (isemergency) /* do not run finalizers during emergency GC */
g->gckind = KGC_EMERGENCY;
else {
g->gckind = KGC_NORMAL;
else
callallpendingfinalizers(L, 1);
}
if (keepinvariant(g)) { /* may there be some black objects? */
/* must sweep all objects to turn them back to white
(as white has not changed, nothing will be collected) */
@ -1205,11 +1132,7 @@ void luaC_fullgc (lua_State *L, int isemergency) {
luaC_runtilstate(L, bitmask(GCSpause));
luaC_runtilstate(L, ~bitmask(GCSpause)); /* start new collection */
luaC_runtilstate(L, bitmask(GCSpause)); /* run entire collection */
if (origkind == KGC_GEN) { /* generational mode? */
/* generational mode must be kept in propagate phase */
luaC_runtilstate(L, bitmask(GCSpropagate));
}
g->gckind = origkind;
g->gckind = KGC_NORMAL;
setpause(g, gettotalbytes(g));
if (!isemergency) /* do not run finalizers during emergency GC */
callallpendingfinalizers(L, 1);

28
lgc.h
View File

@ -1,5 +1,5 @@
/*
** $Id: lgc.h,v 2.57 2012/07/04 15:52:38 roberto Exp roberto $
** $Id: lgc.h,v 2.58 2012/09/11 12:53:08 roberto Exp roberto $
** Garbage Collector
** See Copyright Notice in lua.h
*/
@ -47,27 +47,16 @@
#define issweepphase(g) \
(GCSsweepstring <= (g)->gcstate && (g)->gcstate <= GCSsweep)
#define isgenerational(g) ((g)->gckind == KGC_GEN)
/*
** macros to tell when main invariant (white objects cannot point to black
** ones) must be kept. During a non-generational collection, the sweep
** macro to tell when main invariant (white objects cannot point to black
** ones) must be kept. During a collection, the sweep
** phase may break the invariant, as objects turned white may point to
** still-black objects. The invariant is restored when sweep ends and
** all objects are white again. During a generational collection, the
** invariant must be kept all times.
** all objects are white again.
*/
#define keepinvariant(g) (isgenerational(g) || g->gcstate <= GCSatomic)
/*
** Outside the collector, the state in generational mode is kept in
** 'propagate', so 'keepinvariant' is always true.
*/
#define keepinvariantout(g) \
check_exp(g->gcstate == GCSpropagate || !isgenerational(g), \
g->gcstate <= GCSatomic)
#define keepinvariant(g) (g->gcstate <= GCSatomic)
/*
@ -90,7 +79,6 @@
#define FINALIZEDBIT 3 /* object has been separated for finalization */
#define SEPARATED 4 /* object is in 'finobj' list or in 'tobefnz' */
#define FIXEDBIT 5 /* object is fixed (should not be collected) */
#define OLDBIT 6 /* object is old (only in generational mode) */
/* bit 7 is currently used by tests (luaL_checkmemory) */
#define WHITEBITS bit2mask(WHITE0BIT, WHITE1BIT)
@ -101,11 +89,6 @@
#define isgray(x) /* neither white nor black */ \
(!testbits((x)->gch.marked, WHITEBITS | bitmask(BLACKBIT)))
#define isold(x) testbit((x)->gch.marked, OLDBIT)
/* MOVE OLD rule: whenever an object is moved to the beginning of
a GC list, its old bit must be cleared */
#define resetoldbit(o) resetbit((o)->gch.marked, OLDBIT)
#define otherwhite(g) (g->currentwhite ^ WHITEBITS)
#define isdeadm(ow,m) (!(((m) ^ WHITEBITS) & (ow)))
@ -152,6 +135,5 @@ LUAI_FUNC void luaC_barrierback_ (lua_State *L, GCObject *o);
LUAI_FUNC void luaC_barrierproto_ (lua_State *L, Proto *p, Closure *c);
LUAI_FUNC void luaC_checkfinalizer (lua_State *L, GCObject *o, Table *mt);
LUAI_FUNC void luaC_checkupvalcolor (global_State *g, UpVal *uv);
LUAI_FUNC void luaC_changemode (lua_State *L, int mode);
#endif

View File

@ -1,5 +1,5 @@
/*
** $Id: lstate.c,v 2.98 2012/05/30 12:33:44 roberto Exp roberto $
** $Id: lstate.c,v 2.99 2012/10/02 17:40:53 roberto Exp roberto $
** Global State
** See Copyright Notice in lua.h
*/
@ -30,10 +30,6 @@
#define LUAI_GCPAUSE 200 /* 200% */
#endif
#if !defined(LUAI_GCMAJOR)
#define LUAI_GCMAJOR 200 /* 200% */
#endif
#if !defined(LUAI_GCMUL)
#define LUAI_GCMUL 200 /* GC runs 'twice the speed' of memory allocation */
#endif
@ -298,7 +294,6 @@ LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) {
g->totalbytes = sizeof(LG);
g->GCdebt = 0;
g->gcpause = LUAI_GCPAUSE;
g->gcmajorinc = LUAI_GCMAJOR;
g->gcstepmul = LUAI_GCMUL;
for (i=0; i < LUA_NUMTAGS; i++) g->mt[i] = NULL;
if (luaD_rawrunprotected(L, f_luaopen, NULL) != LUA_OK) {

View File

@ -1,5 +1,5 @@
/*
** $Id: lstate.h,v 2.81 2012/06/08 15:14:04 roberto Exp roberto $
** $Id: lstate.h,v 2.82 2012/07/02 13:37:04 roberto Exp roberto $
** Global State
** See Copyright Notice in lua.h
*/
@ -53,7 +53,6 @@ struct lua_longjmp; /* defined in ldo.c */
/* kinds of Garbage Collection */
#define KGC_NORMAL 0
#define KGC_EMERGENCY 1 /* gc was forced by an allocation failure */
#define KGC_GEN 2 /* generational collection */
typedef struct stringtable {
@ -137,7 +136,6 @@ typedef struct global_State {
UpVal uvhead; /* head of double-linked list of all open upvalues */
Mbuffer buff; /* temporary buffer for string concatenation */
int gcpause; /* size of pause between successive GCs */
int gcmajorinc; /* pause between major collections (only in gen. mode) */
int gcstepmul; /* GC `granularity' */
lua_CFunction panic; /* to be called in unprotected errors */
struct lua_State *mainthread;

View File

@ -1,5 +1,5 @@
/*
** $Id: lstring.c,v 2.26 2013/01/08 13:50:10 roberto Exp roberto $
** $Id: lstring.c,v 2.27 2013/06/19 14:27:00 roberto Exp roberto $
** String table (keeps all strings handled by Lua)
** See Copyright Notice in lua.h
*/
@ -79,7 +79,6 @@ void luaS_resize (lua_State *L, int newsize) {
unsigned int h = lmod(gco2ts(p)->hash, newsize); /* new position */
gch(p)->next = tb->hash[h]; /* chain it */
tb->hash[h] = p;
resetoldbit(p); /* see MOVE OLD rule */
p = next;
}
}

View File

@ -1,5 +1,5 @@
/*
** $Id: ltests.c,v 2.138 2013/05/07 19:01:16 roberto Exp roberto $
** $Id: ltests.c,v 2.139 2013/06/20 21:59:13 roberto Exp roberto $
** Internal Module for Debugging of the Lua Implementation
** See Copyright Notice in lua.h
*/
@ -405,15 +405,8 @@ static void markgrays (global_State *g) {
}
static void checkold (global_State *g, GCObject *o) {
int isold = 0;
static void checkgray (global_State *g, GCObject *o) {
for (; o != NULL; o = gch(o)->next) {
if (isold(o)) { /* old generation? */
lua_assert(isgenerational(g));
if (!issweepphase(g))
isold = 1;
}
else lua_assert(!isold); /* non-old object cannot be after an old one */
if (isgray(o)) {
lua_assert(!keepinvariant(g) || testbit(o->gch.marked, TESTGRAYBIT));
resetbit(o->gch.marked, TESTGRAYBIT);
@ -432,14 +425,12 @@ int lua_checkmemory (lua_State *L) {
lua_assert(!iswhite(obj2gco(g->mainthread)));
lua_assert(!iswhite(gcvalue(&g->l_registry)));
}
else /* generational mode keeps collector in 'propagate' state */
lua_assert(!isgenerational(g));
lua_assert(!isdead(g, gcvalue(&g->l_registry)));
checkstack(g, g->mainthread);
resetbit(g->mainthread->marked, TESTGRAYBIT);
/* check 'allgc' list */
markgrays(g);
checkold(g, g->allgc);
checkgray(g, g->allgc);
lua_assert(g->sweepgc == NULL || issweepphase(g));
maybedead = 0;
for (o = g->allgc; o != NULL; o = gch(o)->next) {
@ -449,7 +440,7 @@ int lua_checkmemory (lua_State *L) {
lua_assert(!testbit(o->gch.marked, SEPARATED));
}
/* check 'finobj' list */
checkold(g, g->finobj);
checkgray(g, g->finobj);
for (o = g->finobj; o != NULL; o = gch(o)->next) {
lua_assert(testbit(o->gch.marked, SEPARATED));
lua_assert(gch(o)->tt == LUA_TUSERDATA ||
@ -457,7 +448,7 @@ int lua_checkmemory (lua_State *L) {
checkobject(g, o, 0);
}
/* check 'tobefnz' list */
checkold(g, g->tobefnz);
checkgray(g, g->tobefnz);
for (o = g->tobefnz; o != NULL; o = gch(o)->next) {
lua_assert(!iswhite(o) || g->gcstate == GCSpause);
lua_assert(!isdead(g, o) && testbit(o->gch.marked, SEPARATED));
@ -645,9 +636,6 @@ static int get_gccolor (lua_State *L) {
if (testbit(marked, FIXEDBIT)) {
lua_pushliteral(L, "/fixed"); n++;
}
if (testbit(marked, OLDBIT)) {
lua_pushliteral(L, "/old"); n++;
}
lua_concat(L, n);
}
return 1;
@ -664,13 +652,9 @@ static int gc_state (lua_State *L) {
}
else {
global_State *g = G(L);
if (g->gckind == KGC_GEN && option == GCSpause)
luaL_error(L, "cannot go to 'pause' state in generational mode");
lua_lock(L);
if (option < g->gcstate) { /* must cross 'pause'? */
luaC_runtilstate(L, bitmask(GCSpause)); /* run until pause */
if (g->gckind == KGC_GEN)
g->gcstate = GCSpropagate; /* skip pause in gen. mode */
}
luaC_runtilstate(L, bitmask(option));
lua_assert(G(L)->gcstate == option);

7
lua.h
View File

@ -1,5 +1,5 @@
/*
** $Id: lua.h,v 1.291 2013/06/07 19:01:50 roberto Exp roberto $
** $Id: lua.h,v 1.292 2013/07/05 14:29:51 roberto Exp roberto $
** Lua - A Scripting Language
** Lua.org, PUC-Rio, Brazil (http://www.lua.org)
** See Copyright Notice at the end of this file
@ -288,10 +288,7 @@ LUA_API int (lua_status) (lua_State *L);
#define LUA_GCSTEP 5
#define LUA_GCSETPAUSE 6
#define LUA_GCSETSTEPMUL 7
#define LUA_GCSETMAJORINC 8
#define LUA_GCISRUNNING 9
#define LUA_GCGEN 10
#define LUA_GCINC 11
#define LUA_GCISRUNNING 8
LUA_API int (lua_gc) (lua_State *L, int what, int data);