99
1010#include "lua.h"
1111
12+
13+ /* Some header files included here need this definition */
14+ typedef struct CallInfo CallInfo ;
15+
16+
1217#include "lobject.h"
1318#include "ltm.h"
1419#include "lzio.h"
@@ -139,7 +144,7 @@ struct lua_longjmp; /* defined in ldo.c */
139144
140145#define BASIC_STACK_SIZE (2*LUA_MINSTACK)
141146
142- #define stacksize (th ) cast_int((th)->stack_last - (th)->stack)
147+ #define stacksize (th ) cast_int((th)->stack_last.p - (th)->stack.p )
143148
144149
145150/* kinds of Garbage Collection */
@@ -169,9 +174,9 @@ typedef struct stringtable {
169174** - field 'transferinfo' is used only during call/returnhooks,
170175** before the function starts or after it ends.
171176*/
172- typedef struct CallInfo {
173- StkId func ; /* function index in the stack */
174- StkId top ; /* top for this function */
177+ struct CallInfo {
178+ StkIdRel func ; /* function index in the stack */
179+ StkIdRel top ; /* top for this function */
175180 struct CallInfo * previous , * next ; /* dynamic call link */
176181 union {
177182 struct { /* only for Lua functions */
@@ -196,7 +201,7 @@ typedef struct CallInfo {
196201 } u2 ;
197202 short nresults ; /* expected number of results from this function */
198203 unsigned short callstatus ;
199- } CallInfo ;
204+ };
200205
201206
202207/*
@@ -291,7 +296,7 @@ typedef struct global_State {
291296 struct lua_State * mainthread ;
292297 TString * memerrmsg ; /* message for memory-allocation errors */
293298 TString * tmname [TM_N ]; /* array with tag-method names */
294- struct Table * mt [LUA_NUMTAGS ]; /* metatables for basic types */
299+ struct Table * mt [LUA_NUMTYPES ]; /* metatables for basic types */
295300 TString * strcache [STRCACHE_N ][STRCACHE_M ]; /* cache for strings in API */
296301 lua_WarnFunction warnf ; /* warning function */
297302 void * ud_warn ; /* auxiliary data to 'warnf' */
@@ -306,13 +311,13 @@ struct lua_State {
306311 lu_byte status ;
307312 lu_byte allowhook ;
308313 unsigned short nci ; /* number of items in 'ci' list */
309- StkId top ; /* first free slot in the stack */
314+ StkIdRel top ; /* first free slot in the stack */
310315 global_State * l_G ;
311316 CallInfo * ci ; /* call info for current function */
312- StkId stack_last ; /* end of stack (last element + 1) */
313- StkId stack ; /* stack base */
317+ StkIdRel stack_last ; /* end of stack (last element + 1) */
318+ StkIdRel stack ; /* stack base */
314319 UpVal * openupval ; /* list of open upvalues in this stack */
315- StkId tbclist ; /* list of to-be-closed variables */
320+ StkIdRel tbclist ; /* list of to-be-closed variables */
316321 GCObject * gclist ;
317322 struct lua_State * twups ; /* list of threads with open upvalues */
318323 struct lua_longjmp * errorJmp ; /* current error recover point */
0 commit comments