summaryrefslogtreecommitdiff
path: root/lgc.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-04-23 12:04:39 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-04-23 12:04:39 -0300
commit383e8b9e778d2bed9dc4347f441803e2c4f99d09 (patch)
tree6035d4b69801d535f3042120e549e457fb154068 /lgc.c
parentf1a1bb23fe29264ec0cf81a8bbfa8f30b0a5b76d (diff)
downloadlua-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.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/lgc.c b/lgc.c
index f1d00e09..cdfd6496 100644
--- a/lgc.c
+++ b/lgc.c
@@ -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);