From 8faf4d1de2cbda61ae871fc23091deff3672e0fc Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Thu, 12 Jan 1995 12:19:04 -0200 Subject: control of garbage collection is done with Longs, as there can be more than WORD objects to collect. --- hash.c | 6 +++--- hash.h | 6 ++++-- table.c | 8 ++++---- tree.c | 6 +++--- tree.h | 4 ++-- 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/hash.c b/hash.c index db87645b..e5a0a485 100644 --- a/hash.c +++ b/hash.c @@ -3,7 +3,7 @@ ** hash manager for lua */ -char *rcs_hash="$Id: hash.c,v 2.21 1994/12/16 15:55:04 roberto Exp roberto $"; +char *rcs_hash="$Id: hash.c,v 2.22 1994/12/20 21:20:36 roberto Exp roberto $"; #include "mem.h" #include "opcode.h" @@ -185,10 +185,10 @@ static void call_fallbacks (void) ** Garbage collection to arrays ** Delete all unmarked arrays. */ -Word lua_hashcollector (void) +Long lua_hashcollector (void) { Hash *curr_array = listhead, *prev = NULL; - Word counter = 0; + Long counter = 0; call_fallbacks(); while (curr_array != NULL) { diff --git a/hash.h b/hash.h index f51edd00..e594a9cd 100644 --- a/hash.h +++ b/hash.h @@ -2,12 +2,14 @@ ** hash.h ** hash manager for lua ** Luiz Henrique de Figueiredo - 17 Aug 90 -** $Id: hash.h,v 2.6 1994/11/17 13:58:57 roberto Stab roberto $ +** $Id: hash.h,v 2.7 1994/12/20 21:20:36 roberto Exp roberto $ */ #ifndef hash_h #define hash_h +#include "types.h" + typedef struct node { Object ref; @@ -27,7 +29,7 @@ typedef struct Hash Bool lua_equalObj (Object *t1, Object *t2); Hash *lua_createarray (Word nhash); void lua_hashmark (Hash *h); -Word lua_hashcollector (void); +Long lua_hashcollector (void); Object *lua_hashget (Hash *t, Object *ref); Object *lua_hashdefine (Hash *t, Object *ref); void lua_next (void); diff --git a/table.c b/table.c index f17f1ca4..85311b21 100644 --- a/table.c +++ b/table.c @@ -3,7 +3,7 @@ ** Module to control static tables */ -char *rcs_table="$Id: table.c,v 2.24 1994/12/16 15:55:04 roberto Exp roberto $"; +char *rcs_table="$Id: table.c,v 2.25 1994/12/20 21:20:36 roberto Exp roberto $"; #include @@ -173,9 +173,9 @@ void lua_markobject (Object *o) */ void lua_pack (void) { - static Word block = GARBAGE_BLOCK; /* when garbage collector will be called */ - static Word nentity = 0; /* counter of new entities (strings and arrays) */ - Word recovered = 0; + static Long block = GARBAGE_BLOCK; /* when garbage collector will be called */ + static Long nentity = 0; /* counter of new entities (strings and arrays) */ + Long recovered = 0; if (nentity++ < block) return; lua_travstack(lua_markobject); /* mark stack objects */ lua_travsymbol(lua_markobject); /* mark symbol table objects */ diff --git a/tree.c b/tree.c index ac0f096d..c34b0560 100644 --- a/tree.c +++ b/tree.c @@ -3,7 +3,7 @@ ** TecCGraf - PUC-Rio */ -char *rcs_tree="$Id: tree.c,v 1.11 1994/11/25 19:27:03 roberto Exp roberto $"; +char *rcs_tree="$Id: tree.c,v 1.12 1994/12/20 21:20:36 roberto Exp roberto $"; #include @@ -78,10 +78,10 @@ TreeNode *lua_constcreate (char *str) ** Garbage collection function. ** This function traverse the string list freeing unindexed strings */ -Word lua_strcollector (void) +Long lua_strcollector (void) { StringNode *curr = string_root, *prev = NULL; - Word counter = 0; + Long counter = 0; while (curr) { StringNode *next = curr->next; diff --git a/tree.h b/tree.h index 6a42dfa4..f322e833 100644 --- a/tree.h +++ b/tree.h @@ -1,7 +1,7 @@ /* ** tree.h ** TecCGraf - PUC-Rio -** $Id: tree.h,v 1.7 1994/11/25 19:27:03 roberto Exp roberto $ +** $Id: tree.h,v 1.8 1994/12/20 21:20:36 roberto Exp roberto $ */ #ifndef tree_h @@ -31,7 +31,7 @@ typedef struct TreeNode TaggedString *lua_createstring (char *str); TreeNode *lua_constcreate (char *str); -Word lua_strcollector (void); +Long lua_strcollector (void); TreeNode *lua_varnext (char *n); #endif -- cgit v1.2.3-55-g6feb