diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2009-11-05 15:43:54 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2009-11-05 15:43:54 -0200 |
commit | 9756f56354af72d62b4f63c85000d4ae1db6b130 (patch) | |
tree | 93d9ddf16bf75b75be809611f7d11e046bfb6927 /lgc.c | |
parent | b7d5f18d71f691df752e220f844ea613a8f6d722 (diff) | |
download | lua-9756f56354af72d62b4f63c85000d4ae1db6b130.tar.gz lua-9756f56354af72d62b4f63c85000d4ae1db6b130.tar.bz2 lua-9756f56354af72d62b4f63c85000d4ae1db6b130.zip |
better control over accesses to TValue fields
Diffstat (limited to 'lgc.c')
-rw-r--r-- | lgc.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lgc.c,v 2.57 2009/09/28 16:32:50 roberto Exp roberto $ | 2 | ** $Id: lgc.c,v 2.58 2009/10/23 19:12:19 roberto Exp roberto $ |
3 | ** Garbage Collector | 3 | ** Garbage Collector |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -96,7 +96,7 @@ void luaC_barrierf (lua_State *L, GCObject *o, GCObject *v) { | |||
96 | global_State *g = G(L); | 96 | global_State *g = G(L); |
97 | lua_assert(isblack(o) && iswhite(v) && !isdead(g, v) && !isdead(g, o)); | 97 | lua_assert(isblack(o) && iswhite(v) && !isdead(g, v) && !isdead(g, o)); |
98 | lua_assert(g->gcstate != GCSfinalize && g->gcstate != GCSpause); | 98 | lua_assert(g->gcstate != GCSfinalize && g->gcstate != GCSpause); |
99 | lua_assert(ttype(gch(o)) != LUA_TTABLE); | 99 | lua_assert(gch(o)->tt != LUA_TTABLE); |
100 | /* must keep invariant? */ | 100 | /* must keep invariant? */ |
101 | if (g->gcstate == GCSpropagate) | 101 | if (g->gcstate == GCSpropagate) |
102 | reallymarkobject(g, v); /* restore invariant */ | 102 | reallymarkobject(g, v); /* restore invariant */ |
@@ -544,7 +544,7 @@ static GCObject **sweeplist (lua_State *L, GCObject **p, lu_mem count) { | |||
544 | int deadmask = otherwhite(g); | 544 | int deadmask = otherwhite(g); |
545 | while ((curr = *p) != NULL && count-- > 0) { | 545 | while ((curr = *p) != NULL && count-- > 0) { |
546 | int alive = (gch(curr)->marked ^ WHITEBITS) & deadmask; | 546 | int alive = (gch(curr)->marked ^ WHITEBITS) & deadmask; |
547 | if (ttisthread(gch(curr))) | 547 | if (gch(curr)->tt == LUA_TTHREAD) |
548 | sweepthread(L, gco2th(curr), alive); | 548 | sweepthread(L, gco2th(curr), alive); |
549 | if (alive) { | 549 | if (alive) { |
550 | lua_assert(!isdead(g, curr) || testbit(gch(curr)->marked, FIXEDBIT)); | 550 | lua_assert(!isdead(g, curr) || testbit(gch(curr)->marked, FIXEDBIT)); |
@@ -645,7 +645,7 @@ size_t luaC_separateudata (lua_State *L, int all) { | |||
645 | /* find last 'next' field in 'tobefnz' list (to insert elements in its end) */ | 645 | /* find last 'next' field in 'tobefnz' list (to insert elements in its end) */ |
646 | while (*lastnext != NULL) lastnext = &gch(*lastnext)->next; | 646 | while (*lastnext != NULL) lastnext = &gch(*lastnext)->next; |
647 | while ((curr = *p) != NULL) { /* traverse all finalizable objects */ | 647 | while ((curr = *p) != NULL) { /* traverse all finalizable objects */ |
648 | lua_assert(ttisuserdata(gch(curr)) && !isfinalized(gco2u(curr))); | 648 | lua_assert(gch(curr)->tt == LUA_TUSERDATA && !isfinalized(gco2u(curr))); |
649 | lua_assert(testbit(gch(curr)->marked, SEPARATED)); | 649 | lua_assert(testbit(gch(curr)->marked, SEPARATED)); |
650 | if (!(all || iswhite(curr))) /* not being collected? */ | 650 | if (!(all || iswhite(curr))) /* not being collected? */ |
651 | p = &gch(curr)->next; /* don't bother with it */ | 651 | p = &gch(curr)->next; /* don't bother with it */ |