control of garbage collection is done with Longs, as there can be
more than WORD objects to collect.
This commit is contained in:
6
hash.c
6
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)
|
||||
{
|
||||
|
||||
6
hash.h
6
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);
|
||||
|
||||
8
table.c
8
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 <string.h>
|
||||
|
||||
@@ -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 */
|
||||
|
||||
6
tree.c
6
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 <string.h>
|
||||
@@ -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;
|
||||
|
||||
4
tree.h
4
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
|
||||
|
||||
Reference in New Issue
Block a user