diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-04-23 12:04:39 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-04-23 12:04:39 -0300 |
commit | 383e8b9e778d2bed9dc4347f441803e2c4f99d09 (patch) | |
tree | 6035d4b69801d535f3042120e549e457fb154068 /lgc.c | |
parent | f1a1bb23fe29264ec0cf81a8bbfa8f30b0a5b76d (diff) | |
download | lua-383e8b9e778d2bed9dc4347f441803e2c4f99d09.tar.gz lua-383e8b9e778d2bed9dc4347f441803e2c4f99d09.tar.bz2 lua-383e8b9e778d2bed9dc4347f441803e2c4f99d09.zip |
use of a common `dummynode' for all empty tables
Diffstat (limited to 'lgc.c')
-rw-r--r-- | lgc.c | 15 |
1 files changed, 7 insertions, 8 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lgc.c,v 1.133 2002/03/26 18:55:50 roberto Exp roberto $ | 2 | ** $Id: lgc.c,v 1.134 2002/04/05 18:54:31 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 | */ |
@@ -211,14 +211,13 @@ static void traversetable (GCState *st, Table *h) { | |||
211 | int weakkey = 0; | 211 | int weakkey = 0; |
212 | int weakvalue = 0; | 212 | int weakvalue = 0; |
213 | marktable(st, h->metatable); | 213 | marktable(st, h->metatable); |
214 | lua_assert(h->lsizenode || h->node == G(st->L)->dummynode); | ||
214 | mode = fasttm(st->L, h->metatable, TM_WEAKMODE); | 215 | mode = fasttm(st->L, h->metatable, TM_WEAKMODE); |
215 | if (mode) { /* weak table? must be cleared after GC... */ | 216 | if (mode && ttype(mode) == LUA_TSTRING) { /* weak table? */ |
216 | h->mark = st->toclear; /* put in the appropriate list */ | 217 | h->mark = st->toclear; /* must be cleared after GC, ... */ |
217 | st->toclear = h; | 218 | st->toclear = h; /* ...put in the appropriate list */ |
218 | if (ttype(mode) == LUA_TSTRING) { | 219 | weakkey = (strchr(svalue(mode), 'k') != NULL); |
219 | weakkey = (strchr(svalue(mode), 'k') != NULL); | 220 | weakvalue = (strchr(svalue(mode), 'v') != NULL); |
220 | weakvalue = (strchr(svalue(mode), 'v') != NULL); | ||
221 | } | ||
222 | } | 221 | } |
223 | if (!weakvalue) { | 222 | if (!weakvalue) { |
224 | i = sizearray(h); | 223 | i = sizearray(h); |