aboutsummaryrefslogtreecommitdiff
path: root/lobject.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-11-29 18:22:22 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-11-29 18:22:22 -0200
commit413fc7334bf8ceaea71417d73edef15c99d3a793 (patch)
tree50e762d979ad8e80681902cdeb8aa42b041ae323 /lobject.h
parentfca0a12e23f964006ce43d35ab86b27c6bbb0a48 (diff)
downloadlua-413fc7334bf8ceaea71417d73edef15c99d3a793.tar.gz
lua-413fc7334bf8ceaea71417d73edef15c99d3a793.tar.bz2
lua-413fc7334bf8ceaea71417d73edef15c99d3a793.zip
new implementation for lua upvalues (sugested by E.T.): simpler and solves
a bug for multi-stacks
Diffstat (limited to 'lobject.h')
-rw-r--r--lobject.h20
1 files changed, 10 insertions, 10 deletions
diff --git a/lobject.h b/lobject.h
index 3e1e8b36..beb6574f 100644
--- a/lobject.h
+++ b/lobject.h
@@ -170,15 +170,15 @@ typedef struct LocVar {
170 170
171 171
172/* 172/*
173** Upvalues in the heap. There is a small trick here: to allow a closure to 173** Upvalues
174** diferentiate between upvalues in the heap and in the stack, upvalues in
175** the heap always have another TObject before them (like those in the stack),
176** but those `prefix' objects have a tag that cannot happen in the stack.
177** Moreover, we use these extra `prexif' object to store GC-related
178** information.
179*/ 174*/
180 175
181#define isclosed(u) (ttype((u)-1) == LUA_HEAPUPVAL) 176typedef struct UpVal {
177 TObject *v; /* points to stack or to its own value */
178 int mark;
179 struct UpVal *next;
180 TObject value; /* the value (when closed) */
181} UpVal;
182 182
183 183
184/* 184/*
@@ -201,7 +201,7 @@ typedef struct LClosure {
201 lu_byte marked; 201 lu_byte marked;
202 union Closure *next; /* first four fields must be equal to CClosure!! */ 202 union Closure *next; /* first four fields must be equal to CClosure!! */
203 struct Proto *p; 203 struct Proto *p;
204 TObject *upvals[1]; 204 UpVal *upvals[1];
205} LClosure; 205} LClosure;
206 206
207 207
@@ -221,8 +221,8 @@ typedef union Closure {
221 221
222typedef struct Node { 222typedef struct Node {
223 struct Node *next; /* for chaining */ 223 struct Node *next; /* for chaining */
224 TObject key; 224 TObject _key;
225 TObject val; 225 TObject _val;
226} Node; 226} Node;
227 227
228 228