diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1994-11-10 15:36:54 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1994-11-10 15:36:54 -0200 |
| commit | 8a0521fa529ce5091877683bc6f235ff8de7185b (patch) | |
| tree | 309518c1d073c214e130d7634c2b5a24d7cf7ff6 /hash.c | |
| parent | 9deac27704eee47f858f6b41a386c3198bc49587 (diff) | |
| download | lua-8a0521fa529ce5091877683bc6f235ff8de7185b.tar.gz lua-8a0521fa529ce5091877683bc6f235ff8de7185b.tar.bz2 lua-8a0521fa529ce5091877683bc6f235ff8de7185b.zip | |
fallback for garbage collection
Diffstat (limited to 'hash.c')
| -rw-r--r-- | hash.c | 20 |
1 files changed, 19 insertions, 1 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.13 1994/11/07 15:19:51 roberto Exp roberto $"; | 6 | char *rcs_hash="$Id: hash.c,v 2.14 1994/11/07 16:34:44 roberto Exp $"; |
| 7 | 7 | ||
| 8 | #include <string.h> | 8 | #include <string.h> |
| 9 | #include <stdlib.h> | 9 | #include <stdlib.h> |
| @@ -169,6 +169,23 @@ void lua_hashmark (Hash *h) | |||
| 169 | } | 169 | } |
| 170 | } | 170 | } |
| 171 | } | 171 | } |
| 172 | |||
| 173 | |||
| 174 | static void call_fallbacks (void) | ||
| 175 | { | ||
| 176 | Hash *curr_array; | ||
| 177 | Object t; | ||
| 178 | tag(&t) = LUA_T_ARRAY; | ||
| 179 | for (curr_array = listhead; curr_array; curr_array = curr_array->next) | ||
| 180 | if (markarray(curr_array) != 1) | ||
| 181 | { | ||
| 182 | avalue(&t) = curr_array; | ||
| 183 | luaI_gcFB(&t); | ||
| 184 | } | ||
| 185 | tag(&t) = LUA_T_NIL; | ||
| 186 | luaI_gcFB(&t); /* end of list */ | ||
| 187 | } | ||
| 188 | |||
| 172 | 189 | ||
| 173 | /* | 190 | /* |
| 174 | ** Garbage collection to arrays | 191 | ** Garbage collection to arrays |
| @@ -177,6 +194,7 @@ void lua_hashmark (Hash *h) | |||
| 177 | void lua_hashcollector (void) | 194 | void lua_hashcollector (void) |
| 178 | { | 195 | { |
| 179 | Hash *curr_array = listhead, *prev = NULL; | 196 | Hash *curr_array = listhead, *prev = NULL; |
| 197 | call_fallbacks(); | ||
| 180 | while (curr_array != NULL) | 198 | while (curr_array != NULL) |
| 181 | { | 199 | { |
| 182 | Hash *next = curr_array->next; | 200 | Hash *next = curr_array->next; |
