summaryrefslogtreecommitdiff
path: root/lgc.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-08-05 11:50:39 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-08-05 11:50:39 -0300
commit5037196f6fddb828056578b1c0d352cdef672d6a (patch)
treed1be52a5ad8fd5cebf30f7023a9c66b7bdc9563f /lgc.c
parent9fb80bde3c80557f8ad2d5642bcbeac343999994 (diff)
downloadlua-5037196f6fddb828056578b1c0d352cdef672d6a.tar.gz
lua-5037196f6fddb828056578b1c0d352cdef672d6a.tar.bz2
lua-5037196f6fddb828056578b1c0d352cdef672d6a.zip
new macros `ttis*'
Diffstat (limited to 'lgc.c')
-rw-r--r--lgc.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/lgc.c b/lgc.c
index 47513769..3b2c3fa4 100644
--- a/lgc.c
+++ b/lgc.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lgc.c,v 1.142 2002/07/08 18:21:33 roberto Exp roberto $ 2** $Id: lgc.c,v 1.143 2002/07/17 16:25:13 roberto Exp $
3** Garbage Collector 3** Garbage Collector
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -71,7 +71,7 @@ static void protomark (Proto *f) {
71 f->marked = 1; 71 f->marked = 1;
72 strmark(f->source); 72 strmark(f->source);
73 for (i=0; i<f->sizek; i++) { 73 for (i=0; i<f->sizek; i++) {
74 if (ttype(f->k+i) == LUA_TSTRING) 74 if (ttisstring(f->k+i))
75 strmark(tsvalue(f->k+i)); 75 strmark(tsvalue(f->k+i));
76 } 76 }
77 for (i=0; i<f->sizep; i++) 77 for (i=0; i<f->sizep; i++)
@@ -148,7 +148,7 @@ static void checkstacksizes (lua_State *L, StkId max) {
148 if (4*used < L->size_ci && 2*BASIC_CI_SIZE < L->size_ci) 148 if (4*used < L->size_ci && 2*BASIC_CI_SIZE < L->size_ci)
149 luaD_reallocCI(L, L->size_ci/2); /* still big enough... */ 149 luaD_reallocCI(L, L->size_ci/2); /* still big enough... */
150 used = max - L->stack; /* part of stack in use */ 150 used = max - L->stack; /* part of stack in use */
151 if (4*used < L->stacksize && 2*BASIC_STACK_SIZE < L->stacksize) 151 if (4*used < L->stacksize && 2*(BASIC_STACK_SIZE+EXTRA_STACK) < L->stacksize)
152 luaD_reallocstack(L, L->stacksize/2); /* still big enough... */ 152 luaD_reallocstack(L, L->stacksize/2); /* still big enough... */
153} 153}
154 154
@@ -158,7 +158,7 @@ static void markstacks (GCState *st) {
158 do { /* for each thread */ 158 do { /* for each thread */
159 StkId o, lim; 159 StkId o, lim;
160 CallInfo *ci; 160 CallInfo *ci;
161 if (L1->base_ci == NULL) { /* incomplete state? */ 161 if (ttisnil(defaultmeta(L1))) { /* incomplete state? */
162 lua_assert(L1 != st->L); 162 lua_assert(L1 != st->L);
163 L1 = L1->next; 163 L1 = L1->next;
164 luaE_closethread(st->L, L1->previous); /* collect it */ 164 luaE_closethread(st->L, L1->previous); /* collect it */
@@ -227,7 +227,7 @@ static void traversetable (GCState *st, Table *h) {
227 marktable(st, h->metatable); 227 marktable(st, h->metatable);
228 lua_assert(h->lsizenode || h->node == G(st->L)->dummynode); 228 lua_assert(h->lsizenode || h->node == G(st->L)->dummynode);
229 mode = fasttm(st->L, h->metatable, TM_MODE); 229 mode = fasttm(st->L, h->metatable, TM_MODE);
230 if (mode && ttype(mode) == LUA_TSTRING) { /* weak table? */ 230 if (mode && ttisstring(mode)) { /* weak table? */
231 h->mark = st->toclear; /* must be cleared after GC, ... */ 231 h->mark = st->toclear; /* must be cleared after GC, ... */
232 st->toclear = h; /* ...put in the appropriate list */ 232 st->toclear = h; /* ...put in the appropriate list */
233 weakkey = (strchr(svalue(mode), 'k') != NULL); 233 weakkey = (strchr(svalue(mode), 'k') != NULL);
@@ -243,8 +243,8 @@ static void traversetable (GCState *st, Table *h) {
243 i = sizenode(h); 243 i = sizenode(h);
244 while (i--) { 244 while (i--) {
245 Node *n = node(h, i); 245 Node *n = node(h, i);
246 if (ttype(val(n)) != LUA_TNIL) { 246 if (!ttisnil(val(n))) {
247 lua_assert(ttype(key(n)) != LUA_TNIL); 247 lua_assert(!ttisnil(key(n)));
248 if (!weakkey) markobject(st, key(n)); 248 if (!weakkey) markobject(st, key(n));
249 if (!weakvalue) markobject(st, val(n)); 249 if (!weakvalue) markobject(st, val(n));
250 } 250 }