diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1995-01-12 12:19:04 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1995-01-12 12:19:04 -0200 |
commit | 8faf4d1de2cbda61ae871fc23091deff3672e0fc (patch) | |
tree | c31722dca150cfc776ce5cb92dd771399446631f | |
parent | 53c0a0f43c5ced8e5f7435aa50f1bfb1e5371992 (diff) | |
download | lua-8faf4d1de2cbda61ae871fc23091deff3672e0fc.tar.gz lua-8faf4d1de2cbda61ae871fc23091deff3672e0fc.tar.bz2 lua-8faf4d1de2cbda61ae871fc23091deff3672e0fc.zip |
control of garbage collection is done with Longs, as there can be
more than WORD objects to collect.
-rw-r--r-- | hash.c | 6 | ||||
-rw-r--r-- | hash.h | 6 | ||||
-rw-r--r-- | table.c | 8 | ||||
-rw-r--r-- | tree.c | 6 | ||||
-rw-r--r-- | tree.h | 4 |
5 files changed, 16 insertions, 14 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.21 1994/12/16 15:55:04 roberto Exp roberto $"; | 6 | char *rcs_hash="$Id: hash.c,v 2.22 1994/12/20 21:20:36 roberto Exp roberto $"; |
7 | 7 | ||
8 | #include "mem.h" | 8 | #include "mem.h" |
9 | #include "opcode.h" | 9 | #include "opcode.h" |
@@ -185,10 +185,10 @@ static void call_fallbacks (void) | |||
185 | ** Garbage collection to arrays | 185 | ** Garbage collection to arrays |
186 | ** Delete all unmarked arrays. | 186 | ** Delete all unmarked arrays. |
187 | */ | 187 | */ |
188 | Word lua_hashcollector (void) | 188 | Long lua_hashcollector (void) |
189 | { | 189 | { |
190 | Hash *curr_array = listhead, *prev = NULL; | 190 | Hash *curr_array = listhead, *prev = NULL; |
191 | Word counter = 0; | 191 | Long counter = 0; |
192 | call_fallbacks(); | 192 | call_fallbacks(); |
193 | while (curr_array != NULL) | 193 | while (curr_array != NULL) |
194 | { | 194 | { |
@@ -2,12 +2,14 @@ | |||
2 | ** hash.h | 2 | ** hash.h |
3 | ** hash manager for lua | 3 | ** hash manager for lua |
4 | ** Luiz Henrique de Figueiredo - 17 Aug 90 | 4 | ** Luiz Henrique de Figueiredo - 17 Aug 90 |
5 | ** $Id: hash.h,v 2.6 1994/11/17 13:58:57 roberto Stab roberto $ | 5 | ** $Id: hash.h,v 2.7 1994/12/20 21:20:36 roberto Exp roberto $ |
6 | */ | 6 | */ |
7 | 7 | ||
8 | #ifndef hash_h | 8 | #ifndef hash_h |
9 | #define hash_h | 9 | #define hash_h |
10 | 10 | ||
11 | #include "types.h" | ||
12 | |||
11 | typedef struct node | 13 | typedef struct node |
12 | { | 14 | { |
13 | Object ref; | 15 | Object ref; |
@@ -27,7 +29,7 @@ typedef struct Hash | |||
27 | Bool lua_equalObj (Object *t1, Object *t2); | 29 | Bool lua_equalObj (Object *t1, Object *t2); |
28 | Hash *lua_createarray (Word nhash); | 30 | Hash *lua_createarray (Word nhash); |
29 | void lua_hashmark (Hash *h); | 31 | void lua_hashmark (Hash *h); |
30 | Word lua_hashcollector (void); | 32 | Long lua_hashcollector (void); |
31 | Object *lua_hashget (Hash *t, Object *ref); | 33 | Object *lua_hashget (Hash *t, Object *ref); |
32 | Object *lua_hashdefine (Hash *t, Object *ref); | 34 | Object *lua_hashdefine (Hash *t, Object *ref); |
33 | void lua_next (void); | 35 | void lua_next (void); |
@@ -3,7 +3,7 @@ | |||
3 | ** Module to control static tables | 3 | ** Module to control static tables |
4 | */ | 4 | */ |
5 | 5 | ||
6 | char *rcs_table="$Id: table.c,v 2.24 1994/12/16 15:55:04 roberto Exp roberto $"; | 6 | char *rcs_table="$Id: table.c,v 2.25 1994/12/20 21:20:36 roberto Exp roberto $"; |
7 | 7 | ||
8 | #include <string.h> | 8 | #include <string.h> |
9 | 9 | ||
@@ -173,9 +173,9 @@ void lua_markobject (Object *o) | |||
173 | */ | 173 | */ |
174 | void lua_pack (void) | 174 | void lua_pack (void) |
175 | { | 175 | { |
176 | static Word block = GARBAGE_BLOCK; /* when garbage collector will be called */ | 176 | static Long block = GARBAGE_BLOCK; /* when garbage collector will be called */ |
177 | static Word nentity = 0; /* counter of new entities (strings and arrays) */ | 177 | static Long nentity = 0; /* counter of new entities (strings and arrays) */ |
178 | Word recovered = 0; | 178 | Long recovered = 0; |
179 | if (nentity++ < block) return; | 179 | if (nentity++ < block) return; |
180 | lua_travstack(lua_markobject); /* mark stack objects */ | 180 | lua_travstack(lua_markobject); /* mark stack objects */ |
181 | lua_travsymbol(lua_markobject); /* mark symbol table objects */ | 181 | lua_travsymbol(lua_markobject); /* mark symbol table objects */ |
@@ -3,7 +3,7 @@ | |||
3 | ** TecCGraf - PUC-Rio | 3 | ** TecCGraf - PUC-Rio |
4 | */ | 4 | */ |
5 | 5 | ||
6 | char *rcs_tree="$Id: tree.c,v 1.11 1994/11/25 19:27:03 roberto Exp roberto $"; | 6 | char *rcs_tree="$Id: tree.c,v 1.12 1994/12/20 21:20:36 roberto Exp roberto $"; |
7 | 7 | ||
8 | 8 | ||
9 | #include <string.h> | 9 | #include <string.h> |
@@ -78,10 +78,10 @@ TreeNode *lua_constcreate (char *str) | |||
78 | ** Garbage collection function. | 78 | ** Garbage collection function. |
79 | ** This function traverse the string list freeing unindexed strings | 79 | ** This function traverse the string list freeing unindexed strings |
80 | */ | 80 | */ |
81 | Word lua_strcollector (void) | 81 | Long lua_strcollector (void) |
82 | { | 82 | { |
83 | StringNode *curr = string_root, *prev = NULL; | 83 | StringNode *curr = string_root, *prev = NULL; |
84 | Word counter = 0; | 84 | Long counter = 0; |
85 | while (curr) | 85 | while (curr) |
86 | { | 86 | { |
87 | StringNode *next = curr->next; | 87 | StringNode *next = curr->next; |
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | ** tree.h | 2 | ** tree.h |
3 | ** TecCGraf - PUC-Rio | 3 | ** TecCGraf - PUC-Rio |
4 | ** $Id: tree.h,v 1.7 1994/11/25 19:27:03 roberto Exp roberto $ | 4 | ** $Id: tree.h,v 1.8 1994/12/20 21:20:36 roberto Exp roberto $ |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #ifndef tree_h | 7 | #ifndef tree_h |
@@ -31,7 +31,7 @@ typedef struct TreeNode | |||
31 | 31 | ||
32 | TaggedString *lua_createstring (char *str); | 32 | TaggedString *lua_createstring (char *str); |
33 | TreeNode *lua_constcreate (char *str); | 33 | TreeNode *lua_constcreate (char *str); |
34 | Word lua_strcollector (void); | 34 | Long lua_strcollector (void); |
35 | TreeNode *lua_varnext (char *n); | 35 | TreeNode *lua_varnext (char *n); |
36 | 36 | ||
37 | #endif | 37 | #endif |