diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-11-29 18:22:22 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-11-29 18:22:22 -0200 |
commit | 413fc7334bf8ceaea71417d73edef15c99d3a793 (patch) | |
tree | 50e762d979ad8e80681902cdeb8aa42b041ae323 /lobject.h | |
parent | fca0a12e23f964006ce43d35ab86b27c6bbb0a48 (diff) | |
download | lua-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.h | 20 |
1 files changed, 10 insertions, 10 deletions
@@ -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) | 176 | typedef 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 | ||
222 | typedef struct Node { | 222 | typedef 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 | ||