From 413fc7334bf8ceaea71417d73edef15c99d3a793 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Thu, 29 Nov 2001 18:22:22 -0200 Subject: new implementation for lua upvalues (sugested by E.T.): simpler and solves a bug for multi-stacks --- lobject.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'lobject.h') 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 { /* -** Upvalues in the heap. There is a small trick here: to allow a closure to -** diferentiate between upvalues in the heap and in the stack, upvalues in -** the heap always have another TObject before them (like those in the stack), -** but those `prefix' objects have a tag that cannot happen in the stack. -** Moreover, we use these extra `prexif' object to store GC-related -** information. +** Upvalues */ -#define isclosed(u) (ttype((u)-1) == LUA_HEAPUPVAL) +typedef struct UpVal { + TObject *v; /* points to stack or to its own value */ + int mark; + struct UpVal *next; + TObject value; /* the value (when closed) */ +} UpVal; /* @@ -201,7 +201,7 @@ typedef struct LClosure { lu_byte marked; union Closure *next; /* first four fields must be equal to CClosure!! */ struct Proto *p; - TObject *upvals[1]; + UpVal *upvals[1]; } LClosure; @@ -221,8 +221,8 @@ typedef union Closure { typedef struct Node { struct Node *next; /* for chaining */ - TObject key; - TObject val; + TObject _key; + TObject _val; } Node; -- cgit v1.2.3-55-g6feb