new function 'luaC_changemode'

This commit is contained in:
Roberto Ierusalimschy
2010-05-05 15:53:41 -03:00
parent 237f755dca
commit d77898597e
2 changed files with 6 additions and 10 deletions

13
lapi.c
View File

@@ -1,5 +1,5 @@
/*
** $Id: lapi.c,v 2.124 2010/04/20 20:14:50 roberto Exp roberto $
** $Id: lapi.c,v 2.125 2010/04/29 17:31:31 roberto Exp roberto $
** Lua API
** See Copyright Notice in lua.h
*/
@@ -69,7 +69,7 @@ static TValue *index2addr (lua_State *L, int idx) {
/*
** to be caled by 'lua_checkstack' in protected mode, to grow stack
** to be called by 'lua_checkstack' in protected mode, to grow stack
** capturing memory errors
*/
static void growstack (lua_State *L, void *ud) {
@@ -966,14 +966,9 @@ LUA_API int lua_gc (lua_State *L, int what, int data) {
res = !gcstopped(g);
break;
}
case LUA_GCGEN: { /* change collector to generational mode */
luaC_runtilstate(L, bitmask(GCSpropagate));
g->lastmajormem = g->totalbytes;
g->gckind = KGC_GEN;
break;
}
case LUA_GCGEN: /* change collector to generational mode */
case LUA_GCINC: { /* change collector to incremental mode */
g->gckind = KGC_NORMAL;
luaC_changemode(L, what);
break;
}
default: res = -1; /* invalid option */

3
lgc.h
View File

@@ -1,5 +1,5 @@
/*
** $Id: lgc.h,v 2.34 2010/05/03 11:24:30 roberto Exp roberto $
** $Id: lgc.h,v 2.35 2010/05/03 17:33:39 roberto Exp roberto $
** Garbage Collector
** See Copyright Notice in lua.h
*/
@@ -134,5 +134,6 @@ LUAI_FUNC void luaC_barrierf (lua_State *L, GCObject *o, GCObject *v);
LUAI_FUNC void luaC_barrierback (lua_State *L, Table *t);
LUAI_FUNC void luaC_checkfinalizer (lua_State *L, Udata *u);
LUAI_FUNC void luaC_checkupvalcolor (global_State *g, UpVal *uv);
LUAI_FUNC void luaC_changemode (lua_State *L, int mode);
#endif