|
@@ -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 @@ static void checkgraylist (global_State *g, GCObject *o) {
|
|
|
((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 @@ static void checkgraylist (global_State *g, GCObject *o) {
|
|
|
|
|
|
|
|
|
/*
|
|
|
-** 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 markgrays (global_State *g) {
|
|
|
}
|
|
|
|
|
|
|
|
|
-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 @@ int lua_checkmemory (lua_State *L) {
|
|
|
}
|
|
|
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 @@ int lua_checkmemory (lua_State *L) {
|
|
|
}
|
|
|
|
|
|
/* 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));
|