From 9756f56354af72d62b4f63c85000d4ae1db6b130 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Thu, 5 Nov 2009 15:43:54 -0200 Subject: better control over accesses to TValue fields --- lgc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lgc.c') diff --git a/lgc.c b/lgc.c index b372bb09..ba6dcf43 100644 --- a/lgc.c +++ b/lgc.c @@ -1,5 +1,5 @@ /* -** $Id: lgc.c,v 2.57 2009/09/28 16:32:50 roberto Exp roberto $ +** $Id: lgc.c,v 2.58 2009/10/23 19:12:19 roberto Exp roberto $ ** Garbage Collector ** See Copyright Notice in lua.h */ @@ -96,7 +96,7 @@ void luaC_barrierf (lua_State *L, GCObject *o, GCObject *v) { global_State *g = G(L); lua_assert(isblack(o) && iswhite(v) && !isdead(g, v) && !isdead(g, o)); lua_assert(g->gcstate != GCSfinalize && g->gcstate != GCSpause); - lua_assert(ttype(gch(o)) != LUA_TTABLE); + lua_assert(gch(o)->tt != LUA_TTABLE); /* must keep invariant? */ if (g->gcstate == GCSpropagate) reallymarkobject(g, v); /* restore invariant */ @@ -544,7 +544,7 @@ static GCObject **sweeplist (lua_State *L, GCObject **p, lu_mem count) { int deadmask = otherwhite(g); while ((curr = *p) != NULL && count-- > 0) { int alive = (gch(curr)->marked ^ WHITEBITS) & deadmask; - if (ttisthread(gch(curr))) + if (gch(curr)->tt == LUA_TTHREAD) sweepthread(L, gco2th(curr), alive); if (alive) { lua_assert(!isdead(g, curr) || testbit(gch(curr)->marked, FIXEDBIT)); @@ -645,7 +645,7 @@ size_t luaC_separateudata (lua_State *L, int all) { /* find last 'next' field in 'tobefnz' list (to insert elements in its end) */ while (*lastnext != NULL) lastnext = &gch(*lastnext)->next; while ((curr = *p) != NULL) { /* traverse all finalizable objects */ - lua_assert(ttisuserdata(gch(curr)) && !isfinalized(gco2u(curr))); + lua_assert(gch(curr)->tt == LUA_TUSERDATA && !isfinalized(gco2u(curr))); lua_assert(testbit(gch(curr)->marked, SEPARATED)); if (!(all || iswhite(curr))) /* not being collected? */ p = &gch(curr)->next; /* don't bother with it */ -- cgit v1.2.3-55-g6feb