summaryrefslogtreecommitdiff
path: root/lgc.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-03-29 17:19:20 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-03-29 17:19:20 -0300
commita69356e9e0a7525b1cebadc928a0efcce8c39b46 (patch)
treec676ee2997c699d3e0b036323ecbafa7ea0d786f /lgc.c
parentb53dc0c4853c56694dda727793e5f6188de39dd8 (diff)
downloadlua-a69356e9e0a7525b1cebadc928a0efcce8c39b46.tar.gz
lua-a69356e9e0a7525b1cebadc928a0efcce8c39b46.tar.bz2
lua-a69356e9e0a7525b1cebadc928a0efcce8c39b46.zip
no more special cases for closures with 0 upvalues (performance is the same,
memory use a little higher, code much simpler).
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 ae14c9ab..9adbc385 100644
--- a/lgc.c
+++ b/lgc.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lgc.c,v 1.43 2000/03/27 20:08:02 roberto Exp roberto $ 2** $Id: lgc.c,v 1.44 2000/03/27 20:10:21 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*/
@@ -43,9 +43,9 @@ static void protomark (lua_State *L, Proto *f) {
43 43
44static void closuremark (lua_State *L, Closure *f) { 44static void closuremark (lua_State *L, Closure *f) {
45 if (!f->marked) { 45 if (!f->marked) {
46 int i; 46 int i = f->nelems;
47 f->marked = 1; 47 f->marked = 1;
48 for (i=f->nelems; i>=0; i--) 48 while (i--)
49 markobject(L, &f->consts[i]); 49 markobject(L, &f->consts[i]);
50 } 50 }
51} 51}
@@ -103,13 +103,12 @@ static int markobject (lua_State *L, TObject *o) {
103 hashmark(L, avalue(o)); 103 hashmark(L, avalue(o));
104 break; 104 break;
105 case TAG_LCLOSURE: case TAG_LCLMARK: 105 case TAG_LCLOSURE: case TAG_LCLMARK:
106 protomark(L, clvalue(o)->f.l);
107 /* go trhough */
106 case TAG_CCLOSURE: case TAG_CCLMARK: 108 case TAG_CCLOSURE: case TAG_CCLMARK:
107 closuremark(L, o->value.cl); 109 closuremark(L, clvalue(o));
108 break;
109 case TAG_LPROTO: case TAG_LMARK:
110 protomark(L, o->value.tf);
111 break; 110 break;
112 default: break; /* numbers, cprotos, etc */ 111 default: break; /* numbers, etc */
113 } 112 }
114 return 0; 113 return 0;
115} 114}