aboutsummaryrefslogtreecommitdiff
path: root/ltests.c
diff options
context:
space:
mode:
Diffstat (limited to 'ltests.c')
-rw-r--r--ltests.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/ltests.c b/ltests.c
index 803b3be2..f054b2f0 100644
--- a/ltests.c
+++ b/ltests.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltests.c,v 2.175 2014/07/16 14:51:36 roberto Exp roberto $ 2** $Id: ltests.c,v 2.176 2014/07/17 13:53:37 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*/
@@ -190,8 +190,8 @@ static int testobjref1 (global_State *g, GCObject *f, GCObject *t) {
190 190
191static void printobj (global_State *g, GCObject *o) { 191static void printobj (global_State *g, GCObject *o) {
192 printf("||%s(%p)-%c(%02X)||", 192 printf("||%s(%p)-%c(%02X)||",
193 ttypename(novariant(gch(o)->tt)), (void *)o, 193 ttypename(novariant(o->tt)), (void *)o,
194 isdead(g,o)?'d':isblack(o)?'b':iswhite(o)?'w':'g', gch(o)->marked); 194 isdead(g,o)?'d':isblack(o)?'b':iswhite(o)?'w':'g', o->marked);
195} 195}
196 196
197 197
@@ -316,7 +316,7 @@ static void checkobject (global_State *g, GCObject *o, int maybedead) {
316 lua_assert(maybedead); 316 lua_assert(maybedead);
317 else { 317 else {
318 lua_assert(g->gcstate != GCSpause || iswhite(o)); 318 lua_assert(g->gcstate != GCSpause || iswhite(o));
319 switch (gch(o)->tt) { 319 switch (o->tt) {
320 case LUA_TUSERDATA: { 320 case LUA_TUSERDATA: {
321 TValue uservalue; 321 TValue uservalue;
322 Table *mt = gco2u(o)->metatable; 322 Table *mt = gco2u(o)->metatable;
@@ -362,9 +362,9 @@ static void checkgraylist (global_State *g, GCObject *o) {
362 ((void)g); /* better to keep it available if we need to print an object */ 362 ((void)g); /* better to keep it available if we need to print an object */
363 while (o) { 363 while (o) {
364 lua_assert(isgray(o)); 364 lua_assert(isgray(o));
365 lua_assert(!testbit(o->gch.marked, TESTGRAYBIT)); 365 lua_assert(!testbit(o->marked, TESTGRAYBIT));
366 l_setbit(o->gch.marked, TESTGRAYBIT); 366 l_setbit(o->marked, TESTGRAYBIT);
367 switch (gch(o)->tt) { 367 switch (o->tt) {
368 case LUA_TTABLE: o = gco2t(o)->gclist; break; 368 case LUA_TTABLE: o = gco2t(o)->gclist; break;
369 case LUA_TLCL: o = gco2lcl(o)->gclist; break; 369 case LUA_TLCL: o = gco2lcl(o)->gclist; break;
370 case LUA_TCCL: o = gco2ccl(o)->gclist; break; 370 case LUA_TCCL: o = gco2ccl(o)->gclist; break;
@@ -391,12 +391,12 @@ static void markgrays (global_State *g) {
391 391
392 392
393static void checkgray (global_State *g, GCObject *o) { 393static void checkgray (global_State *g, GCObject *o) {
394 for (; o != NULL; o = gch(o)->next) { 394 for (; o != NULL; o = o->next) {
395 if (isgray(o)) { 395 if (isgray(o)) {
396 lua_assert(!keepinvariant(g) || testbit(o->gch.marked, TESTGRAYBIT)); 396 lua_assert(!keepinvariant(g) || testbit(o->marked, TESTGRAYBIT));
397 resetbit(o->gch.marked, TESTGRAYBIT); 397 resetbit(o->marked, TESTGRAYBIT);
398 } 398 }
399 lua_assert(!testbit(o->gch.marked, TESTGRAYBIT)); 399 lua_assert(!testbit(o->marked, TESTGRAYBIT));
400 } 400 }
401} 401}
402 402
@@ -415,29 +415,29 @@ int lua_checkmemory (lua_State *L) {
415 lua_assert(g->sweepgc == NULL || issweepphase(g)); 415 lua_assert(g->sweepgc == NULL || issweepphase(g));
416 markgrays(g); 416 markgrays(g);
417 /* check 'fixedgc' list */ 417 /* check 'fixedgc' list */
418 for (o = g->fixedgc; o != NULL; o = gch(o)->next) { 418 for (o = g->fixedgc; o != NULL; o = o->next) {
419 lua_assert(gch(o)->tt == LUA_TSHRSTR && isgray(o)); 419 lua_assert(o->tt == LUA_TSHRSTR && isgray(o));
420 } 420 }
421 /* check 'allgc' list */ 421 /* check 'allgc' list */
422 checkgray(g, g->allgc); 422 checkgray(g, g->allgc);
423 maybedead = (GCSatomic < g->gcstate && g->gcstate <= GCSswpallgc); 423 maybedead = (GCSatomic < g->gcstate && g->gcstate <= GCSswpallgc);
424 for (o = g->allgc; o != NULL; o = gch(o)->next) { 424 for (o = g->allgc; o != NULL; o = o->next) {
425 checkobject(g, o, maybedead); 425 checkobject(g, o, maybedead);
426 lua_assert(!tofinalize(o)); 426 lua_assert(!tofinalize(o));
427 } 427 }
428 /* check 'finobj' list */ 428 /* check 'finobj' list */
429 checkgray(g, g->finobj); 429 checkgray(g, g->finobj);
430 for (o = g->finobj; o != NULL; o = gch(o)->next) { 430 for (o = g->finobj; o != NULL; o = o->next) {
431 checkobject(g, o, 0); 431 checkobject(g, o, 0);
432 lua_assert(tofinalize(o)); 432 lua_assert(tofinalize(o));
433 lua_assert(gch(o)->tt == LUA_TUSERDATA || gch(o)->tt == LUA_TTABLE); 433 lua_assert(o->tt == LUA_TUSERDATA || o->tt == LUA_TTABLE);
434 } 434 }
435 /* check 'tobefnz' list */ 435 /* check 'tobefnz' list */
436 checkgray(g, g->tobefnz); 436 checkgray(g, g->tobefnz);
437 for (o = g->tobefnz; o != NULL; o = gch(o)->next) { 437 for (o = g->tobefnz; o != NULL; o = o->next) {
438 checkobject(g, o, 0); 438 checkobject(g, o, 0);
439 lua_assert(tofinalize(o)); 439 lua_assert(tofinalize(o));
440 lua_assert(gch(o)->tt == LUA_TUSERDATA || gch(o)->tt == LUA_TTABLE); 440 lua_assert(o->tt == LUA_TUSERDATA || o->tt == LUA_TTABLE);
441 } 441 }
442 return 0; 442 return 0;
443} 443}