diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1994-11-17 11:58:57 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1994-11-17 11:58:57 -0200 |
commit | b234da1cc2053b8919a9b27af67291e48fdf9703 (patch) | |
tree | b32559df54e0d9c79fe271260f69238244ae2fc7 /hash.c | |
parent | d6a1699e37257c0b3d4651a481ce0bf597bc4e45 (diff) | |
download | lua-b234da1cc2053b8919a9b27af67291e48fdf9703.tar.gz lua-b234da1cc2053b8919a9b27af67291e48fdf9703.tar.bz2 lua-b234da1cc2053b8919a9b27af67291e48fdf9703.zip |
changes in garbage collection control
Diffstat (limited to 'hash.c')
-rw-r--r-- | hash.c | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -3,7 +3,7 @@ | |||
3 | ** hash manager for lua | 3 | ** hash manager for lua |
4 | */ | 4 | */ |
5 | 5 | ||
6 | char *rcs_hash="$Id: hash.c,v 2.16 1994/11/14 18:41:15 roberto Exp roberto $"; | 6 | char *rcs_hash="$Id: hash.c,v 2.17 1994/11/16 17:38:08 roberto Exp roberto $"; |
7 | 7 | ||
8 | #include "mem.h" | 8 | #include "mem.h" |
9 | #include "opcode.h" | 9 | #include "opcode.h" |
@@ -183,9 +183,10 @@ static void call_fallbacks (void) | |||
183 | ** Garbage collection to arrays | 183 | ** Garbage collection to arrays |
184 | ** Delete all unmarked arrays. | 184 | ** Delete all unmarked arrays. |
185 | */ | 185 | */ |
186 | void lua_hashcollector (void) | 186 | int lua_hashcollector (void) |
187 | { | 187 | { |
188 | Hash *curr_array = listhead, *prev = NULL; | 188 | Hash *curr_array = listhead, *prev = NULL; |
189 | int counter = 0; | ||
189 | call_fallbacks(); | 190 | call_fallbacks(); |
190 | while (curr_array != NULL) | 191 | while (curr_array != NULL) |
191 | { | 192 | { |
@@ -195,7 +196,7 @@ void lua_hashcollector (void) | |||
195 | if (prev == NULL) listhead = next; | 196 | if (prev == NULL) listhead = next; |
196 | else prev->next = next; | 197 | else prev->next = next; |
197 | hashdelete(curr_array); | 198 | hashdelete(curr_array); |
198 | ++lua_recovered; | 199 | ++counter; |
199 | } | 200 | } |
200 | else | 201 | else |
201 | { | 202 | { |
@@ -204,6 +205,7 @@ void lua_hashcollector (void) | |||
204 | } | 205 | } |
205 | curr_array = next; | 206 | curr_array = next; |
206 | } | 207 | } |
208 | return counter; | ||
207 | } | 209 | } |
208 | 210 | ||
209 | 211 | ||
@@ -215,10 +217,9 @@ void lua_hashcollector (void) | |||
215 | */ | 217 | */ |
216 | Hash *lua_createarray (int nhash) | 218 | Hash *lua_createarray (int nhash) |
217 | { | 219 | { |
218 | Hash *array = hashcreate(nhash); | 220 | Hash *array; |
219 | if (lua_nentity == lua_block) | 221 | lua_pack(); |
220 | lua_pack(); | 222 | array = hashcreate(nhash); |
221 | lua_nentity++; | ||
222 | array->next = listhead; | 223 | array->next = listhead; |
223 | listhead = array; | 224 | listhead = array; |
224 | return array; | 225 | return array; |