diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-12-26 16:46:09 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-12-26 16:46:09 -0200 |
commit | 8c49e198654567f770a7d5081b886a7c35201d81 (patch) | |
tree | 8c1de3e885ef138574e51a8868f175feeaab71e2 /lgc.c | |
parent | 6af005ec20323defd2a5ead01e2d389462884d04 (diff) | |
download | lua-8c49e198654567f770a7d5081b886a7c35201d81.tar.gz lua-8c49e198654567f770a7d5081b886a7c35201d81.tar.bz2 lua-8c49e198654567f770a7d5081b886a7c35201d81.zip |
explicit control of size for growing vectors
Diffstat (limited to 'lgc.c')
-rw-r--r-- | lgc.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lgc.c,v 1.72 2000/10/26 12:47:05 roberto Exp roberto $ | 2 | ** $Id: lgc.c,v 1.73 2000/11/24 17:39:56 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 | */ |
@@ -56,7 +56,7 @@ static void markstack (lua_State *L, GCState *st) { | |||
56 | 56 | ||
57 | static void marklock (lua_State *L, GCState *st) { | 57 | static void marklock (lua_State *L, GCState *st) { |
58 | int i; | 58 | int i; |
59 | for (i=0; i<L->refSize; i++) { | 59 | for (i=0; i<L->nref; i++) { |
60 | if (L->refArray[i].st == LOCK) | 60 | if (L->refArray[i].st == LOCK) |
61 | markobject(st, &L->refArray[i].o); | 61 | markobject(st, &L->refArray[i].o); |
62 | } | 62 | } |
@@ -77,7 +77,7 @@ static void marktagmethods (lua_State *L, GCState *st) { | |||
77 | int e; | 77 | int e; |
78 | for (e=0; e<TM_N; e++) { | 78 | for (e=0; e<TM_N; e++) { |
79 | int t; | 79 | int t; |
80 | for (t=0; t<=L->last_tag; t++) { | 80 | for (t=0; t<L->ntag; t++) { |
81 | Closure *cl = luaT_gettm(L, t, e); | 81 | Closure *cl = luaT_gettm(L, t, e); |
82 | if (cl) markclosure(st, cl); | 82 | if (cl) markclosure(st, cl); |
83 | } | 83 | } |
@@ -162,7 +162,7 @@ static int hasmark (const TObject *o) { | |||
162 | #define VALIDLINK(L, st,n) (NONEXT <= (st) && (st) < (n)) | 162 | #define VALIDLINK(L, st,n) (NONEXT <= (st) && (st) < (n)) |
163 | 163 | ||
164 | static void invalidaterefs (lua_State *L) { | 164 | static void invalidaterefs (lua_State *L) { |
165 | int n = L->refSize; | 165 | int n = L->nref; |
166 | int i; | 166 | int i; |
167 | for (i=0; i<n; i++) { | 167 | for (i=0; i<n; i++) { |
168 | struct Ref *r = &L->refArray[i]; | 168 | struct Ref *r = &L->refArray[i]; |
@@ -314,7 +314,7 @@ static void callgcTMudata (lua_State *L) { | |||
314 | TObject o; | 314 | TObject o; |
315 | ttype(&o) = LUA_TUSERDATA; | 315 | ttype(&o) = LUA_TUSERDATA; |
316 | L->GCthreshold = 2*L->nblocks; /* avoid GC during tag methods */ | 316 | L->GCthreshold = 2*L->nblocks; /* avoid GC during tag methods */ |
317 | for (tag=L->last_tag; tag>=0; tag--) { /* for each tag (in reverse order) */ | 317 | for (tag=L->ntag-1; tag>=0; tag--) { /* for each tag (in reverse order) */ |
318 | TString *udata; | 318 | TString *udata; |
319 | while ((udata = L->TMtable[tag].collected) != NULL) { | 319 | while ((udata = L->TMtable[tag].collected) != NULL) { |
320 | L->TMtable[tag].collected = udata->nexthash; /* remove it from list */ | 320 | L->TMtable[tag].collected = udata->nexthash; /* remove it from list */ |