diff options
Diffstat (limited to 'ltests.c')
-rw-r--r-- | ltests.c | 26 |
1 files changed, 5 insertions, 21 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltests.c,v 2.138 2013/05/07 19:01:16 roberto Exp roberto $ | 2 | ** $Id: ltests.c,v 2.139 2013/06/20 21:59:13 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 | */ |
@@ -405,15 +405,8 @@ static void markgrays (global_State *g) { | |||
405 | } | 405 | } |
406 | 406 | ||
407 | 407 | ||
408 | static void checkold (global_State *g, GCObject *o) { | 408 | static void checkgray (global_State *g, GCObject *o) { |
409 | int isold = 0; | ||
410 | for (; o != NULL; o = gch(o)->next) { | 409 | for (; o != NULL; o = gch(o)->next) { |
411 | if (isold(o)) { /* old generation? */ | ||
412 | lua_assert(isgenerational(g)); | ||
413 | if (!issweepphase(g)) | ||
414 | isold = 1; | ||
415 | } | ||
416 | else lua_assert(!isold); /* non-old object cannot be after an old one */ | ||
417 | if (isgray(o)) { | 410 | if (isgray(o)) { |
418 | lua_assert(!keepinvariant(g) || testbit(o->gch.marked, TESTGRAYBIT)); | 411 | lua_assert(!keepinvariant(g) || testbit(o->gch.marked, TESTGRAYBIT)); |
419 | resetbit(o->gch.marked, TESTGRAYBIT); | 412 | resetbit(o->gch.marked, TESTGRAYBIT); |
@@ -432,14 +425,12 @@ int lua_checkmemory (lua_State *L) { | |||
432 | lua_assert(!iswhite(obj2gco(g->mainthread))); | 425 | lua_assert(!iswhite(obj2gco(g->mainthread))); |
433 | lua_assert(!iswhite(gcvalue(&g->l_registry))); | 426 | lua_assert(!iswhite(gcvalue(&g->l_registry))); |
434 | } | 427 | } |
435 | else /* generational mode keeps collector in 'propagate' state */ | ||
436 | lua_assert(!isgenerational(g)); | ||
437 | lua_assert(!isdead(g, gcvalue(&g->l_registry))); | 428 | lua_assert(!isdead(g, gcvalue(&g->l_registry))); |
438 | checkstack(g, g->mainthread); | 429 | checkstack(g, g->mainthread); |
439 | resetbit(g->mainthread->marked, TESTGRAYBIT); | 430 | resetbit(g->mainthread->marked, TESTGRAYBIT); |
440 | /* check 'allgc' list */ | 431 | /* check 'allgc' list */ |
441 | markgrays(g); | 432 | markgrays(g); |
442 | checkold(g, g->allgc); | 433 | checkgray(g, g->allgc); |
443 | lua_assert(g->sweepgc == NULL || issweepphase(g)); | 434 | lua_assert(g->sweepgc == NULL || issweepphase(g)); |
444 | maybedead = 0; | 435 | maybedead = 0; |
445 | for (o = g->allgc; o != NULL; o = gch(o)->next) { | 436 | for (o = g->allgc; o != NULL; o = gch(o)->next) { |
@@ -449,7 +440,7 @@ int lua_checkmemory (lua_State *L) { | |||
449 | lua_assert(!testbit(o->gch.marked, SEPARATED)); | 440 | lua_assert(!testbit(o->gch.marked, SEPARATED)); |
450 | } | 441 | } |
451 | /* check 'finobj' list */ | 442 | /* check 'finobj' list */ |
452 | checkold(g, g->finobj); | 443 | checkgray(g, g->finobj); |
453 | for (o = g->finobj; o != NULL; o = gch(o)->next) { | 444 | for (o = g->finobj; o != NULL; o = gch(o)->next) { |
454 | lua_assert(testbit(o->gch.marked, SEPARATED)); | 445 | lua_assert(testbit(o->gch.marked, SEPARATED)); |
455 | lua_assert(gch(o)->tt == LUA_TUSERDATA || | 446 | lua_assert(gch(o)->tt == LUA_TUSERDATA || |
@@ -457,7 +448,7 @@ int lua_checkmemory (lua_State *L) { | |||
457 | checkobject(g, o, 0); | 448 | checkobject(g, o, 0); |
458 | } | 449 | } |
459 | /* check 'tobefnz' list */ | 450 | /* check 'tobefnz' list */ |
460 | checkold(g, g->tobefnz); | 451 | checkgray(g, g->tobefnz); |
461 | for (o = g->tobefnz; o != NULL; o = gch(o)->next) { | 452 | for (o = g->tobefnz; o != NULL; o = gch(o)->next) { |
462 | lua_assert(!iswhite(o) || g->gcstate == GCSpause); | 453 | lua_assert(!iswhite(o) || g->gcstate == GCSpause); |
463 | lua_assert(!isdead(g, o) && testbit(o->gch.marked, SEPARATED)); | 454 | lua_assert(!isdead(g, o) && testbit(o->gch.marked, SEPARATED)); |
@@ -645,9 +636,6 @@ static int get_gccolor (lua_State *L) { | |||
645 | if (testbit(marked, FIXEDBIT)) { | 636 | if (testbit(marked, FIXEDBIT)) { |
646 | lua_pushliteral(L, "/fixed"); n++; | 637 | lua_pushliteral(L, "/fixed"); n++; |
647 | } | 638 | } |
648 | if (testbit(marked, OLDBIT)) { | ||
649 | lua_pushliteral(L, "/old"); n++; | ||
650 | } | ||
651 | lua_concat(L, n); | 639 | lua_concat(L, n); |
652 | } | 640 | } |
653 | return 1; | 641 | return 1; |
@@ -664,13 +652,9 @@ static int gc_state (lua_State *L) { | |||
664 | } | 652 | } |
665 | else { | 653 | else { |
666 | global_State *g = G(L); | 654 | global_State *g = G(L); |
667 | if (g->gckind == KGC_GEN && option == GCSpause) | ||
668 | luaL_error(L, "cannot go to 'pause' state in generational mode"); | ||
669 | lua_lock(L); | 655 | lua_lock(L); |
670 | if (option < g->gcstate) { /* must cross 'pause'? */ | 656 | if (option < g->gcstate) { /* must cross 'pause'? */ |
671 | luaC_runtilstate(L, bitmask(GCSpause)); /* run until pause */ | 657 | luaC_runtilstate(L, bitmask(GCSpause)); /* run until pause */ |
672 | if (g->gckind == KGC_GEN) | ||
673 | g->gcstate = GCSpropagate; /* skip pause in gen. mode */ | ||
674 | } | 658 | } |
675 | luaC_runtilstate(L, bitmask(option)); | 659 | luaC_runtilstate(L, bitmask(option)); |
676 | lua_assert(G(L)->gcstate == option); | 660 | lua_assert(G(L)->gcstate == option); |