aboutsummaryrefslogtreecommitdiff
path: root/lobject.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-12-05 18:15:18 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-12-05 18:15:18 -0200
commit592a309177edc52847b1196969ad6d49ba21f4fb (patch)
tree06add977885c012ee22cc4f105785c435b6af353 /lobject.h
parent413fc7334bf8ceaea71417d73edef15c99d3a793 (diff)
downloadlua-592a309177edc52847b1196969ad6d49ba21f4fb.tar.gz
lua-592a309177edc52847b1196969ad6d49ba21f4fb.tar.bz2
lua-592a309177edc52847b1196969ad6d49ba21f4fb.zip
tag system replaced by event tables
Diffstat (limited to 'lobject.h')
-rw-r--r--lobject.h22
1 files changed, 5 insertions, 17 deletions
diff --git a/lobject.h b/lobject.h
index beb6574f..bf07e3db 100644
--- a/lobject.h
+++ b/lobject.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lobject.h,v 1.116 2001/11/06 21:41:53 roberto Exp $ 2** $Id: lobject.h,v 1.1 2001/11/29 22:14:34 rieru Exp rieru $
3** Type definitions for Lua objects 3** Type definitions for Lua objects
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -31,15 +31,6 @@
31#define NUM_TAGS 6 31#define NUM_TAGS 6
32 32
33 33
34/*
35** extra tags:
36** first is used locally when moving an upvalue from the stack to the heap;
37** second prefixes upvalues in the heap
38*/
39#define LUA_TUPVAL 6
40#define LUA_HEAPUPVAL 7
41
42
43typedef union { 34typedef union {
44 union TString *ts; 35 union TString *ts;
45 union Udata *u; 36 union Udata *u;
@@ -122,17 +113,14 @@ typedef union TString {
122typedef union Udata { 113typedef union Udata {
123 union L_Umaxalign dummy; /* ensures maximum alignment for `local' udata */ 114 union L_Umaxalign dummy; /* ensures maximum alignment for `local' udata */
124 struct { 115 struct {
125 int tag; /* negative means `marked' (only during GC) */ 116 struct Table *eventtable;
126 void *value; 117 void *value;
127 size_t len; 118 size_t len; /* least bit reserved for gc mark */
128 union Udata *next; /* chain for list of all udata */ 119 union Udata *next; /* chain for list of all udata */
129 } uv; 120 } uv;
130} Udata; 121} Udata;
131 122
132 123
133#define switchudatamark(u) ((u)->uv.tag = (-((u)->uv.tag+1)))
134#define ismarkedudata(u) ((u)->uv.tag < 0)
135
136 124
137 125
138/* 126/*
@@ -175,7 +163,6 @@ typedef struct LocVar {
175 163
176typedef struct UpVal { 164typedef struct UpVal {
177 TObject *v; /* points to stack or to its own value */ 165 TObject *v; /* points to stack or to its own value */
178 int mark;
179 struct UpVal *next; 166 struct UpVal *next;
180 TObject value; /* the value (when closed) */ 167 TObject value; /* the value (when closed) */
181} UpVal; 168} UpVal;
@@ -227,12 +214,13 @@ typedef struct Node {
227 214
228 215
229typedef struct Table { 216typedef struct Table {
217 struct Table *eventtable;
230 TObject *array; /* array part */ 218 TObject *array; /* array part */
231 Node *node; 219 Node *node;
232 int htag;
233 int sizearray; /* size of `array' array */ 220 int sizearray; /* size of `array' array */
234 lu_byte lsizenode; /* log2 of size of `node' array */ 221 lu_byte lsizenode; /* log2 of size of `node' array */
235 lu_byte weakmode; 222 lu_byte weakmode;
223 unsigned short flags; /* 1<<p means tagmethod(p) is not present */
236 Node *firstfree; /* this position is free; all positions after it are full */ 224 Node *firstfree; /* this position is free; all positions after it are full */
237 struct Table *next; 225 struct Table *next;
238 struct Table *mark; /* marked tables (point to itself when not marked) */ 226 struct Table *mark; /* marked tables (point to itself when not marked) */