aboutsummaryrefslogtreecommitdiff
path: root/lobject.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2022-10-29 12:06:37 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2022-10-29 12:06:37 -0300
commit413a393e6222482f46599e138bebac162610a572 (patch)
tree181517f8ec8d56f9101de33f4891729044f244de /lobject.h
parentba089bcb08a0efc6c26fb5c1e3c9d61c00cc012c (diff)
downloadlua-413a393e6222482f46599e138bebac162610a572.tar.gz
lua-413a393e6222482f46599e138bebac162610a572.tar.bz2
lua-413a393e6222482f46599e138bebac162610a572.zip
Stack indices changed to union's
That will allow to change pointers to offsets while reallocating the stack.
Diffstat (limited to 'lobject.h')
-rw-r--r--lobject.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/lobject.h b/lobject.h
index 77cc606f..7af7bd89 100644
--- a/lobject.h
+++ b/lobject.h
@@ -157,6 +157,12 @@ typedef union StackValue {
157/* index to stack elements */ 157/* index to stack elements */
158typedef StackValue *StkId; 158typedef StackValue *StkId;
159 159
160
161typedef union {
162 StkId p; /* actual pointer */
163} StkIdRel;
164
165
160/* convert a 'StackValue' to a 'TValue' */ 166/* convert a 'StackValue' to a 'TValue' */
161#define s2v(o) (&(o)->val) 167#define s2v(o) (&(o)->val)
162 168
@@ -618,7 +624,9 @@ typedef struct Proto {
618typedef struct UpVal { 624typedef struct UpVal {
619 CommonHeader; 625 CommonHeader;
620 lu_byte tbc; /* true if it represents a to-be-closed variable */ 626 lu_byte tbc; /* true if it represents a to-be-closed variable */
621 TValue *v; /* points to stack or to its own value */ 627 union {
628 TValue *p; /* points to stack or to its own value */
629 } v;
622 union { 630 union {
623 struct { /* (when open) */ 631 struct { /* (when open) */
624 struct UpVal *next; /* linked list */ 632 struct UpVal *next; /* linked list */