** Check consistency of an object: ** - Dead objects can only happen in the 'allgc' list during a sweep ** phase (controlled by the caller through 'maybedead'). ** - During pause, all objects must be white. ** - In generational mode: ** * objects must be old enough for their lists ('listage'). ** * old objects cannot be white. ** * old objects must be black, except for 'touched1', 'old0', **
| 511 | ** threads, and open upvalues. |
| 512 | */ |
| 513 | static void checkobject (global_State *g, GCObject *o, int maybedead, |
| 514 | int listage) { |
| 515 | if (isdead(g, o)) |
| 516 | assert(maybedead); |
| 517 | else { |
| 518 | assert(g->gcstate != GCSpause || iswhite(o)); |
| 519 | if (g->gckind == KGC_GEN) { /* generational mode? */ |
| 520 | assert(getage(o) >= listage); |
| 521 | assert(!iswhite(o) || !isold(o)); |
| 522 | if (isold(o)) { |
| 523 | assert(isblack(o) || |
| 524 | getage(o) == G_TOUCHED1 || |
| 525 | getage(o) == G_OLD0 || |
| 526 | o->tt == LUA_VTHREAD || |
| 527 | (o->tt == LUA_VUPVAL && upisopen(gco2upv(o)))); |
| 528 | } |
| 529 | } |
| 530 | checkrefs(g, o); |
| 531 | } |
| 532 | } |
| 533 | |
| 534 | |
| 535 | static lu_mem checkgraylist (global_State *g, GCObject *o) { |
no test coverage detected