diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-03-22 15:28:03 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-03-22 15:28:03 -0300 |
commit | 74123e96869bdb55d3967036e2bc0c6f9e0550d6 (patch) | |
tree | 06b60d23fb253c8ff1c640f34e15424455737395 /lapi.c | |
parent | 9c196bebad4f84ffb43f0ef1e19792cc4b795704 (diff) | |
download | lua-74123e96869bdb55d3967036e2bc0c6f9e0550d6.tar.gz lua-74123e96869bdb55d3967036e2bc0c6f9e0550d6.tar.bz2 lua-74123e96869bdb55d3967036e2bc0c6f9e0550d6.zip |
draft version of a generational mode for garbage collection. (Not well
tested; no major collections; ...)
Diffstat (limited to 'lapi.c')
-rw-r--r-- | lapi.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lapi.c,v 2.113 2010/02/09 11:55:37 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 2.114 2010/03/08 16:55:52 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 | */ |
@@ -928,6 +928,7 @@ LUA_API int lua_gc (lua_State *L, int what, int data) { | |||
928 | break; | 928 | break; |
929 | } | 929 | } |
930 | case LUA_GCRESTART: { | 930 | case LUA_GCRESTART: { |
931 | g->gckind = KGC_NORMAL; | ||
931 | g->GCthreshold = g->totalbytes; | 932 | g->GCthreshold = g->totalbytes; |
932 | break; | 933 | break; |
933 | } | 934 | } |
@@ -973,6 +974,11 @@ LUA_API int lua_gc (lua_State *L, int what, int data) { | |||
973 | res = (g->GCthreshold != MAX_LUMEM); | 974 | res = (g->GCthreshold != MAX_LUMEM); |
974 | break; | 975 | break; |
975 | } | 976 | } |
977 | case LUA_GCGEN: { /* change collector to generational mode */ | ||
978 | luaC_runtilstate(L, bitmask(GCSpropagate)); | ||
979 | g->gckind = KGC_GEN; | ||
980 | break; | ||
981 | } | ||
976 | default: res = -1; /* invalid option */ | 982 | default: res = -1; /* invalid option */ |
977 | } | 983 | } |
978 | lua_unlock(L); | 984 | lua_unlock(L); |