diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-04-02 12:19:19 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-04-02 12:19:19 -0300 |
| commit | 11126422d9006e835a00cb1cbe2290a6820a401d (patch) | |
| tree | 3a14b05a52f30efa9077bf8dd2a9b5d477cb250e | |
| parent | e54668b6961a610a1b83a78a11581e2e6cfc0c7e (diff) | |
| download | lua-11126422d9006e835a00cb1cbe2290a6820a401d.tar.gz lua-11126422d9006e835a00cb1cbe2290a6820a401d.tar.bz2 lua-11126422d9006e835a00cb1cbe2290a6820a401d.zip | |
option to return GC to normal (incremental, non generational) mode
| -rw-r--r-- | lapi.c | 6 | ||||
| -rw-r--r-- | lbaselib.c | 7 | ||||
| -rw-r--r-- | lua.h | 3 |
3 files changed, 11 insertions, 5 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lapi.c,v 2.117 2010/03/26 20:58:11 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 2.118 2010/03/29 17:43:14 roberto Exp roberto $ |
| 3 | ** Lua API | 3 | ** Lua API |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -952,6 +952,10 @@ LUA_API int lua_gc (lua_State *L, int what, int data) { | |||
| 952 | g->gckind = KGC_GEN; | 952 | g->gckind = KGC_GEN; |
| 953 | break; | 953 | break; |
| 954 | } | 954 | } |
| 955 | case LUA_GCINC: { /* change collector to incremental mode */ | ||
| 956 | g->gckind = KGC_NORMAL; | ||
| 957 | break; | ||
| 958 | } | ||
| 955 | default: res = -1; /* invalid option */ | 959 | default: res = -1; /* invalid option */ |
| 956 | } | 960 | } |
| 957 | lua_unlock(L); | 961 | lua_unlock(L); |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lbaselib.c,v 1.239 2010/03/22 18:28:03 roberto Exp roberto $ | 2 | ** $Id: lbaselib.c,v 1.240 2010/03/26 20:58:11 roberto Exp roberto $ |
| 3 | ** Basic library | 3 | ** Basic library |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -148,10 +148,11 @@ static int luaB_gcinfo (lua_State *L) { | |||
| 148 | 148 | ||
| 149 | static int luaB_collectgarbage (lua_State *L) { | 149 | static int luaB_collectgarbage (lua_State *L) { |
| 150 | static const char *const opts[] = {"stop", "restart", "collect", | 150 | static const char *const opts[] = {"stop", "restart", "collect", |
| 151 | "count", "step", "setpause", "setstepmul", "isrunning", "gen", NULL}; | 151 | "count", "step", "setpause", "setstepmul", "isrunning", |
| 152 | "gen", "inc", NULL}; | ||
| 152 | static const int optsnum[] = {LUA_GCSTOP, LUA_GCRESTART, LUA_GCCOLLECT, | 153 | static const int optsnum[] = {LUA_GCSTOP, LUA_GCRESTART, LUA_GCCOLLECT, |
| 153 | LUA_GCCOUNT, LUA_GCSTEP, LUA_GCSETPAUSE, LUA_GCSETSTEPMUL, | 154 | LUA_GCCOUNT, LUA_GCSTEP, LUA_GCSETPAUSE, LUA_GCSETSTEPMUL, |
| 154 | LUA_GCISRUNNING, LUA_GCGEN}; | 155 | LUA_GCISRUNNING, LUA_GCGEN, LUA_GCINC}; |
| 155 | int o = optsnum[luaL_checkoption(L, 1, "collect", opts)]; | 156 | int o = optsnum[luaL_checkoption(L, 1, "collect", opts)]; |
| 156 | int ex = luaL_optint(L, 2, 0); | 157 | int ex = luaL_optint(L, 2, 0); |
| 157 | int res = lua_gc(L, o, ex); | 158 | int res = lua_gc(L, o, ex); |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lua.h,v 1.264 2010/03/22 18:28:03 roberto Exp roberto $ | 2 | ** $Id: lua.h,v 1.265 2010/03/26 20:58:11 roberto Exp roberto $ |
| 3 | ** Lua - A Scripting Language | 3 | ** Lua - A Scripting Language |
| 4 | ** Lua.org, PUC-Rio, Brazil (http://www.lua.org) | 4 | ** Lua.org, PUC-Rio, Brazil (http://www.lua.org) |
| 5 | ** See Copyright Notice at the end of this file | 5 | ** See Copyright Notice at the end of this file |
| @@ -267,6 +267,7 @@ LUA_API int (lua_status) (lua_State *L); | |||
| 267 | #define LUA_GCSETSTEPMUL 7 | 267 | #define LUA_GCSETSTEPMUL 7 |
| 268 | #define LUA_GCISRUNNING 8 | 268 | #define LUA_GCISRUNNING 8 |
| 269 | #define LUA_GCGEN 9 | 269 | #define LUA_GCGEN 9 |
| 270 | #define LUA_GCINC 10 | ||
| 270 | 271 | ||
| 271 | LUA_API int (lua_gc) (lua_State *L, int what, int data); | 272 | LUA_API int (lua_gc) (lua_State *L, int what, int data); |
| 272 | 273 | ||
