better name for GC pause

This commit is contained in:
Roberto Ierusalimschy 2005-03-22 13:04:29 -03:00
parent ad24cff0f1
commit 390256edf7
6 changed files with 16 additions and 16 deletions

8
lapi.c
View File

@ -1,5 +1,5 @@
/* /*
** $Id: lapi.c,v 2.34 2005/03/18 20:11:28 roberto Exp roberto $ ** $Id: lapi.c,v 2.35 2005/03/21 18:12:21 roberto Exp roberto $
** Lua API ** Lua API
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@ -913,9 +913,9 @@ LUA_API int lua_gc (lua_State *L, int what, int data) {
res = 1; /* signal it */ res = 1; /* signal it */
break; break;
} }
case LUA_GCSETPACE: { case LUA_GCSETPAUSE: {
res = g->gcpace; res = g->gcpause;
g->gcpace = data; g->gcpause = data;
break; break;
} }
case LUA_GCSETSTEPMUL: { case LUA_GCSETSTEPMUL: {

View File

@ -1,5 +1,5 @@
/* /*
** $Id: lbaselib.c,v 1.170 2005/03/11 15:51:08 roberto Exp roberto $ ** $Id: lbaselib.c,v 1.171 2005/03/16 16:58:41 roberto Exp roberto $
** Basic library ** Basic library
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@ -187,9 +187,9 @@ static int luaB_gcinfo (lua_State *L) {
static int luaB_collectgarbage (lua_State *L) { static int luaB_collectgarbage (lua_State *L) {
static const char *const opts[] = {"stop", "restart", "collect", static const char *const opts[] = {"stop", "restart", "collect",
"count", "step", "setpace", "setstepmul", NULL}; "count", "step", "setpause", "setstepmul", NULL};
static const int optsnum[] = {LUA_GCSTOP, LUA_GCRESTART, LUA_GCCOLLECT, static const int optsnum[] = {LUA_GCSTOP, LUA_GCRESTART, LUA_GCCOLLECT,
LUA_GCCOUNT, LUA_GCSTEP, LUA_GCSETPACE, LUA_GCSETSTEPMUL}; LUA_GCCOUNT, LUA_GCSTEP, LUA_GCSETPAUSE, LUA_GCSETSTEPMUL};
int o = luaL_findstring(luaL_optstring(L, 1, "collect"), opts); int o = luaL_findstring(luaL_optstring(L, 1, "collect"), opts);
int ex = luaL_optinteger(L, 2, 0); int ex = luaL_optinteger(L, 2, 0);
luaL_argcheck(L, o >= 0, 1, "invalid option"); luaL_argcheck(L, o >= 0, 1, "invalid option");

4
lgc.c
View File

@ -1,5 +1,5 @@
/* /*
** $Id: lgc.c,v 2.29 2005/03/09 16:28:07 roberto Exp roberto $ ** $Id: lgc.c,v 2.30 2005/03/16 17:00:21 roberto Exp roberto $
** Garbage Collector ** Garbage Collector
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@ -57,7 +57,7 @@
reallymarkobject(g, obj2gco(t)); } reallymarkobject(g, obj2gco(t)); }
#define setthreshold(g) (g->GCthreshold = (g->estimate/100) * g->gcpace) #define setthreshold(g) (g->GCthreshold = (g->estimate/100) * g->gcpause)
static void removeentry (Node *n) { static void removeentry (Node *n) {

View File

@ -1,5 +1,5 @@
/* /*
** $Id: lstate.c,v 2.26 2005/03/18 18:02:04 roberto Exp roberto $ ** $Id: lstate.c,v 2.27 2005/03/18 18:55:45 roberto Exp roberto $
** Global State ** Global State
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@ -170,8 +170,8 @@ LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) {
g->weak = NULL; g->weak = NULL;
g->tmudata = NULL; g->tmudata = NULL;
g->totalbytes = sizeof(LG); g->totalbytes = sizeof(LG);
g->gcpace = 200; /* 200% (wait memory to double before next collection) */ g->gcpause = LUAI_GCPAUSE;
g->gcstepmul = 200; /* GC runs `twice the speed' of memory allocation */ g->gcstepmul = LUAI_GCMUL;
g->gcdept = 0; g->gcdept = 0;
if (luaD_rawrunprotected(L, f_luaopen, NULL) != 0) { if (luaD_rawrunprotected(L, f_luaopen, NULL) != 0) {
/* memory allocation error: free partial state */ /* memory allocation error: free partial state */

View File

@ -1,5 +1,5 @@
/* /*
** $Id: lstate.h,v 2.16 2005/02/23 17:30:22 roberto Exp roberto $ ** $Id: lstate.h,v 2.17 2005/03/18 18:55:09 roberto Exp roberto $
** Global State ** Global State
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@ -83,7 +83,7 @@ typedef struct global_State {
lu_mem totalbytes; /* number of bytes currently allocated */ lu_mem totalbytes; /* number of bytes currently allocated */
lu_mem estimate; /* an estimate of number of bytes actually in use */ lu_mem estimate; /* an estimate of number of bytes actually in use */
lu_mem gcdept; /* how much GC is `behind schedule' */ lu_mem gcdept; /* how much GC is `behind schedule' */
int gcpace; /* size of pause between successive GCs */ int gcpause; /* size of pause between successive GCs */
int gcstepmul; /* GC `granularity' */ int gcstepmul; /* GC `granularity' */
lua_CFunction panic; /* to be called in unprotected errors */ lua_CFunction panic; /* to be called in unprotected errors */
TValue _registry; TValue _registry;

4
lua.h
View File

@ -1,5 +1,5 @@
/* /*
** $Id: lua.h,v 1.201 2005/01/17 23:50:55 roberto Exp roberto $ ** $Id: lua.h,v 1.202 2005/02/18 12:40:02 roberto Exp roberto $
** Lua - An Extensible Extension Language ** Lua - An Extensible Extension Language
** Tecgraf: Computer Graphics Technology Group, PUC-Rio, Brazil ** Tecgraf: Computer Graphics Technology Group, PUC-Rio, Brazil
** http://www.lua.org mailto:info@lua.org ** http://www.lua.org mailto:info@lua.org
@ -227,7 +227,7 @@ LUA_API int (lua_status) (lua_State *L);
#define LUA_GCCOLLECT 2 #define LUA_GCCOLLECT 2
#define LUA_GCCOUNT 3 #define LUA_GCCOUNT 3
#define LUA_GCSTEP 4 #define LUA_GCSTEP 4
#define LUA_GCSETPACE 5 #define LUA_GCSETPAUSE 5
#define LUA_GCSETSTEPMUL 6 #define LUA_GCSETSTEPMUL 6
LUA_API int (lua_gc) (lua_State *L, int what, int data); LUA_API int (lua_gc) (lua_State *L, int what, int data);