aboutsummaryrefslogtreecommitdiff
path: root/ltests.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2012-07-04 12:52:38 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2012-07-04 12:52:38 -0300
commite4f609d0ee1cbbd357bec00c43effc659971bc7a (patch)
tree4be588031fdb7f63efafb86d42c37e53ab23fa26 /ltests.c
parent5ac56a94dd318aa3db031a31bdc03efb45386b9f (diff)
downloadlua-e4f609d0ee1cbbd357bec00c43effc659971bc7a.tar.gz
lua-e4f609d0ee1cbbd357bec00c43effc659971bc7a.tar.bz2
lua-e4f609d0ee1cbbd357bec00c43effc659971bc7a.zip
collector in generational mode must be in 'propagate' state when
not running a collection
Diffstat (limited to 'ltests.c')
-rw-r--r--ltests.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/ltests.c b/ltests.c
index 0a8b526a..610af463 100644
--- a/ltests.c
+++ b/ltests.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltests.c,v 2.130 2012/06/07 18:52:47 roberto Exp roberto $ 2** $Id: ltests.c,v 2.131 2012/07/02 15:38:36 roberto Exp roberto $
3** Internal Module for Debugging of the Lua Implementation 3** Internal Module for Debugging of the Lua Implementation
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -182,8 +182,8 @@ void *debug_realloc (void *ud, void *b, size_t oldsize, size_t size) {
182 182
183static int testobjref1 (global_State *g, GCObject *f, GCObject *t) { 183static int testobjref1 (global_State *g, GCObject *f, GCObject *t) {
184 if (isdead(g,t)) return 0; 184 if (isdead(g,t)) return 0;
185 if (isgenerational(g) || !issweepphase(g)) 185 if (!issweepphase(g))
186 return !isblack(f) || !iswhite(t); 186 return !(isblack(f) && iswhite(t));
187 else return 1; 187 else return 1;
188} 188}
189 189
@@ -329,7 +329,7 @@ static void checkobject (global_State *g, GCObject *o, int maybedead) {
329 if (isdead(g, o)) 329 if (isdead(g, o))
330 lua_assert(maybedead); 330 lua_assert(maybedead);
331 else { 331 else {
332 if (g->gcstate == GCSpause && !isgenerational(g)) 332 if (g->gcstate == GCSpause)
333 lua_assert(iswhite(o)); 333 lua_assert(iswhite(o));
334 switch (gch(o)->tt) { 334 switch (gch(o)->tt) {
335 case LUA_TUPVAL: { 335 case LUA_TUPVAL: {
@@ -432,6 +432,8 @@ int lua_checkmemory (lua_State *L) {
432 lua_assert(!iswhite(obj2gco(g->mainthread))); 432 lua_assert(!iswhite(obj2gco(g->mainthread)));
433 lua_assert(!iswhite(gcvalue(&g->l_registry))); 433 lua_assert(!iswhite(gcvalue(&g->l_registry)));
434 } 434 }
435 else /* generational mode keeps collector in 'propagate' state */
436 lua_assert(!isgenerational(g));
435 lua_assert(!isdead(g, gcvalue(&g->l_registry))); 437 lua_assert(!isdead(g, gcvalue(&g->l_registry)));
436 checkstack(g, g->mainthread); 438 checkstack(g, g->mainthread);
437 resetbit(g->mainthread->marked, TESTGRAYBIT); 439 resetbit(g->mainthread->marked, TESTGRAYBIT);
@@ -457,7 +459,7 @@ int lua_checkmemory (lua_State *L) {
457 /* check 'tobefnz' list */ 459 /* check 'tobefnz' list */
458 checkold(g, g->tobefnz); 460 checkold(g, g->tobefnz);
459 for (o = g->tobefnz; o != NULL; o = gch(o)->next) { 461 for (o = g->tobefnz; o != NULL; o = gch(o)->next) {
460 lua_assert(!iswhite(o)); 462 lua_assert(!iswhite(o) || g->gcstate == GCSpause);
461 lua_assert(!isdead(g, o) && testbit(o->gch.marked, SEPARATED)); 463 lua_assert(!isdead(g, o) && testbit(o->gch.marked, SEPARATED));
462 lua_assert(gch(o)->tt == LUA_TUSERDATA || 464 lua_assert(gch(o)->tt == LUA_TUSERDATA ||
463 gch(o)->tt == LUA_TTABLE); 465 gch(o)->tt == LUA_TTABLE);