commit 5ac56a94dd318aa3db031a31bdc03efb45386b9f
parent 4fc15bbfb731d1258c2771d45078bbbb51bff700
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Mon, 2 Jul 2012 12:38:11 -0300
collector in generational mode should never be in 'pause' state
Diffstat:
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/ltests.c b/ltests.c
@@ -1,5 +1,5 @@
/*
-** $Id: ltests.c,v 2.129 2012/05/31 20:25:42 roberto Exp $
+** $Id: ltests.c,v 2.130 2012/06/07 18:52:47 roberto Exp roberto $
** Internal Module for Debugging of the Lua Implementation
** See Copyright Notice in lua.h
*/
@@ -663,7 +663,15 @@ static int gc_state (lua_State *L) {
return 1;
}
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);
lua_unlock(L);