From 413a393e6222482f46599e138bebac162610a572 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Sat, 29 Oct 2022 12:06:37 -0300 Subject: Stack indices changed to union's That will allow to change pointers to offsets while reallocating the stack. --- lstate.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'lstate.h') diff --git a/lstate.h b/lstate.h index 61e82cde..2e907818 100644 --- a/lstate.h +++ b/lstate.h @@ -139,7 +139,7 @@ struct lua_longjmp; /* defined in ldo.c */ #define BASIC_STACK_SIZE (2*LUA_MINSTACK) -#define stacksize(th) cast_int((th)->stack_last - (th)->stack) +#define stacksize(th) cast_int((th)->stack_last.p - (th)->stack.p) /* kinds of Garbage Collection */ @@ -170,8 +170,8 @@ typedef struct stringtable { ** before the function starts or after it ends. */ typedef struct CallInfo { - StkId func; /* function index in the stack */ - StkId top; /* top for this function */ + StkIdRel func; /* function index in the stack */ + StkIdRel top; /* top for this function */ struct CallInfo *previous, *next; /* dynamic call link */ union { struct { /* only for Lua functions */ @@ -306,13 +306,13 @@ struct lua_State { lu_byte status; lu_byte allowhook; unsigned short nci; /* number of items in 'ci' list */ - StkId top; /* first free slot in the stack */ + StkIdRel top; /* first free slot in the stack */ global_State *l_G; CallInfo *ci; /* call info for current function */ - StkId stack_last; /* end of stack (last element + 1) */ - StkId stack; /* stack base */ + StkIdRel stack_last; /* end of stack (last element + 1) */ + StkIdRel stack; /* stack base */ UpVal *openupval; /* list of open upvalues in this stack */ - StkId tbclist; /* list of to-be-closed variables */ + StkIdRel tbclist; /* list of to-be-closed variables */ GCObject *gclist; struct lua_State *twups; /* list of threads with open upvalues */ struct lua_longjmp *errorJmp; /* current error recover point */ -- cgit v1.2.3-55-g6feb