no more 'TESTGRAYBIT' (to free this bit for real uses)
diff --git a/lgc.h b/lgc.h
index fc62cfd..d7adf44 100644
--- a/lgc.h
+++ b/lgc.h
@@ -1,5 +1,5 @@
/*
-** $Id: lgc.h,v 2.102 2018/02/19 13:55:34 roberto Exp roberto $
+** $Id: lgc.h,v 2.102 2018/02/19 20:06:56 roberto Exp roberto $
** Garbage Collector
** See Copyright Notice in lua.h
*/
@@ -69,13 +69,14 @@
/*
** Layout for bit use in 'marked' field. First three bits are
-** used for object "age" in generational mode.
+** used for object "age" in generational mode. Last bit is free
+** to be used by respective objects.
*/
#define WHITE0BIT 3 /* object is white (type 0) */
#define WHITE1BIT 4 /* object is white (type 1) */
#define BLACKBIT 5 /* object is black */
#define FINALIZEDBIT 6 /* object has been marked for finalization */
-#define TESTGRAYBIT 7 /* used by tests (luaL_checkmemory) */
+
#define WHITEBITS bit2mask(WHITE0BIT, WHITE1BIT)
diff --git a/ltests.c b/ltests.c
index bc8b6b4..452785c 100644
--- a/ltests.c
+++ b/ltests.c
@@ -1,5 +1,5 @@
/*
-** $Id: ltests.c,v 2.242 2018/02/23 13:13:31 roberto Exp roberto $
+** $Id: ltests.c,v 2.243 2018/03/09 19:24:45 roberto Exp roberto $
** Internal Module for Debugging of the Lua Implementation
** See Copyright Notice in lua.h
*/
@@ -428,8 +428,6 @@
((void)g); /* better to keep it available if we need to print an object */
while (o) {
lua_assert(isgray(o) || getage(o) == G_TOUCHED2);
- lua_assert(!testbit(o->marked, TESTGRAYBIT));
- l_setbit(o->marked, TESTGRAYBIT);
switch (o->tt) {
case LUA_TTABLE: o = gco2t(o)->gclist; break;
case LUA_TLCL: o = gco2lcl(o)->gclist; break;
@@ -443,10 +441,9 @@
/*
-** mark all objects in gray lists with the TESTGRAYBIT, so that
-** 'checkmemory' can check that all gray objects are in a gray list
+** Check objects in gray lists.
*/
-static void markgrays (global_State *g) {
+static void checkgrays (global_State *g) {
if (!keepinvariant(g)) return;
checkgraylist(g, g->gray);
checkgraylist(g, g->grayagain);
@@ -456,17 +453,6 @@
}
-static void checkgray (global_State *g, GCObject *o) {
- for (; o != NULL; o = o->next) {
- if ((isgray(o) && o->tt != LUA_TUPVAL) || getage(o) == G_TOUCHED2) {
- lua_assert(!keepinvariant(g) || testbit(o->marked, TESTGRAYBIT));
- resetbit(o->marked, TESTGRAYBIT);
- }
- lua_assert(!testbit(o->marked, TESTGRAYBIT));
- }
-}
-
-
static void checklist (global_State *g, int maybedead, int tof,
GCObject *newl, GCObject *survival, GCObject *old, GCObject *reallyold) {
GCObject *o;
@@ -499,7 +485,7 @@
}
lua_assert(!isdead(g, gcvalue(&g->l_registry)));
lua_assert(g->sweepgc == NULL || issweepphase(g));
- markgrays(g);
+ checkgrays(g);
/* check 'fixedgc' list */
for (o = g->fixedgc; o != NULL; o = o->next) {
@@ -507,16 +493,13 @@
}
/* check 'allgc' list */
- checkgray(g, g->allgc);
maybedead = (GCSatomic < g->gcstate && g->gcstate <= GCSswpallgc);
checklist(g, maybedead, 0, g->allgc, g->survival, g->old, g->reallyold);
/* check 'finobj' list */
- checkgray(g, g->finobj);
checklist(g, 0, 1, g->finobj, g->finobjsur, g->finobjold, g->finobjrold);
/* check 'tobefnz' list */
- checkgray(g, g->tobefnz);
for (o = g->tobefnz; o != NULL; o = o->next) {
checkobject(g, o, 0, G_NEW);
lua_assert(tofinalize(o));