garbage collection tag for strings organized in struct TaggedString

This commit is contained in:
Roberto Ierusalimschy
1994-11-23 12:32:00 -02:00
parent ad0ec203f6
commit d490555ec9
7 changed files with 57 additions and 54 deletions

25
tree.h
View File

@@ -1,34 +1,33 @@
/*
** tree.h
** TecCGraf - PUC-Rio
** $Id: tree.h,v 1.4 1994/11/17 13:58:57 roberto Exp roberto $
** $Id: tree.h,v 1.5 1994/11/18 19:27:38 roberto Exp roberto $
*/
#ifndef tree_h
#define tree_h
#include "opcode.h"
#define NOT_USED 0xFFFE
#define UNMARKED_STRING 0xFFFF
#define MARKED_STRING 0xFFFE
#define MAX_WORD 0xFFFD
typedef struct TaggedString
{
char marked; /* for garbage collection */
char str[1]; /* \0 byte already reserved */
} TaggedString;
typedef struct TreeNode
{
struct TreeNode *right;
struct TreeNode *left;
Word varindex; /* if this is a symbol */
Word constindex; /* if this is a constant; also used for garbage collection */
char str[1]; /* \0 byte already reserved */
unsigned short varindex; /* != NOT_USED if this is a symbol */
unsigned short constindex; /* != NOT_USED if this is a constant */
TaggedString ts;
} TreeNode;
#define indexstring(s) (*(((Word *)s)-1))
char *lua_createstring (char *str);
TaggedString *lua_createstring (char *str);
TreeNode *lua_constcreate (char *str);
int lua_strcollector (void);
TreeNode *lua_varnext (char *n);