diff options
Diffstat (limited to 'lgc.c')
-rw-r--r-- | lgc.c | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lgc.c,v 1.24 1999/08/11 17:00:59 roberto Exp roberto $ | 2 | ** $Id: lgc.c,v 1.25 1999/08/16 20:52:00 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 | */ |
@@ -143,10 +143,10 @@ static GCnode *listcollect (GCnode *l) { | |||
143 | } | 143 | } |
144 | 144 | ||
145 | 145 | ||
146 | static void strmark (TaggedString *s) { | 146 | /* |
147 | if (!s->head.marked) | 147 | ** mark a string; marks bigger than 1 cannot be changed. |
148 | s->head.marked = 1; | 148 | */ |
149 | } | 149 | #define strmark(s) {if ((s)->head.marked == 0) (s)->head.marked = 1;} |
150 | 150 | ||
151 | 151 | ||
152 | static void protomark (TProtoFunc *f) { | 152 | static void protomark (TProtoFunc *f) { |
@@ -154,7 +154,7 @@ static void protomark (TProtoFunc *f) { | |||
154 | int i; | 154 | int i; |
155 | f->head.marked = 1; | 155 | f->head.marked = 1; |
156 | strmark(f->source); | 156 | strmark(f->source); |
157 | for (i=0; i<f->nconsts; i++) | 157 | for (i=f->nconsts-1; i>=0; i--) |
158 | markobject(&f->consts[i]); | 158 | markobject(&f->consts[i]); |
159 | } | 159 | } |
160 | } | 160 | } |
@@ -174,7 +174,7 @@ static void hashmark (Hash *h) { | |||
174 | if (!h->head.marked) { | 174 | if (!h->head.marked) { |
175 | int i; | 175 | int i; |
176 | h->head.marked = 1; | 176 | h->head.marked = 1; |
177 | for (i=0; i<nhash(h); i++) { | 177 | for (i=nhash(h)-1; i>=0; i--) { |
178 | Node *n = node(h,i); | 178 | Node *n = node(h,i); |
179 | if (ttype(ref(n)) != LUA_T_NIL) { | 179 | if (ttype(ref(n)) != LUA_T_NIL) { |
180 | markobject(&n->ref); | 180 | markobject(&n->ref); |