diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-11-26 12:32:31 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-11-26 12:32:31 -0200 |
commit | 9b7a12c46d85666e0e60efd79b39495589e497e8 (patch) | |
tree | c69acde3d3e300fa0db87004045e7599cbbca7a2 /ltests.c | |
parent | 5b33e398557d7afad4a916bb483e9894e4b9b3d4 (diff) | |
download | lua-9b7a12c46d85666e0e60efd79b39495589e497e8.tar.gz lua-9b7a12c46d85666e0e60efd79b39495589e497e8.tar.bz2 lua-9b7a12c46d85666e0e60efd79b39495589e497e8.zip |
finalizers (__gc) for tables
Diffstat (limited to 'ltests.c')
-rw-r--r-- | ltests.c | 21 |
1 files changed, 11 insertions, 10 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltests.c,v 2.112 2010/07/28 15:51:59 roberto Exp roberto $ | 2 | ** $Id: ltests.c,v 2.113 2010/11/16 17:43:29 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 | */ |
@@ -429,20 +429,21 @@ int lua_checkmemory (lua_State *L) { | |||
429 | checkobject(g, o); | 429 | checkobject(g, o); |
430 | lua_assert(!testbit(o->gch.marked, SEPARATED)); | 430 | lua_assert(!testbit(o->gch.marked, SEPARATED)); |
431 | } | 431 | } |
432 | /* check 'udgc' list */ | 432 | /* check 'finobj' list */ |
433 | checkold(g, g->udgc); | 433 | checkold(g, g->finobj); |
434 | for (o = g->udgc; o != NULL; o = gch(o)->next) { | 434 | for (o = g->finobj; o != NULL; o = gch(o)->next) { |
435 | lua_assert(gch(o)->tt == LUA_TUSERDATA && | 435 | lua_assert(!isdead(g, o) && testbit(o->gch.marked, SEPARATED)); |
436 | !isdead(g, o) && | 436 | lua_assert(gch(o)->tt == LUA_TUSERDATA || |
437 | testbit(o->gch.marked, SEPARATED)); | 437 | gch(o)->tt == LUA_TTABLE); |
438 | checkobject(g, o); | 438 | checkobject(g, o); |
439 | } | 439 | } |
440 | /* check 'tobefnz' list */ | 440 | /* check 'tobefnz' list */ |
441 | checkold(g, g->tobefnz); | 441 | checkold(g, g->tobefnz); |
442 | for (o = g->tobefnz; o != NULL; o = gch(o)->next) { | 442 | for (o = g->tobefnz; o != NULL; o = gch(o)->next) { |
443 | lua_assert(gch(o)->tt == LUA_TUSERDATA); | 443 | lua_assert(!iswhite(o)); |
444 | lua_assert(isblack(o)); | 444 | lua_assert(!isdead(g, o) && testbit(o->gch.marked, SEPARATED)); |
445 | lua_assert(testbit(o->gch.marked, SEPARATED)); | 445 | lua_assert(gch(o)->tt == LUA_TUSERDATA || |
446 | gch(o)->tt == LUA_TTABLE); | ||
446 | } | 447 | } |
447 | /* check 'uvhead' list */ | 448 | /* check 'uvhead' list */ |
448 | for (uv = g->uvhead.u.l.next; uv != &g->uvhead; uv = uv->u.l.next) { | 449 | for (uv = g->uvhead.u.l.next; uv != &g->uvhead; uv = uv->u.l.next) { |