structlua_State { CommonHeader; unsignedshort nci; /* number of items in 'ci' list */ lu_byte status; StkId top; /* first free slot in the stack */ global_State *l_G; CallInfo *ci; /* call info for current function */ const Instruction *oldpc; /* last pc traced */ StkId stack_last; /* last free slot in the stack */ StkId stack; /* stack base */ UpVal *openupval; /* list of open upvalues in this stack */ GCObject *gclist; structlua_State *twups;/* list of threads with open upvalues */ structlua_longjmp *errorJmp;/* current error recover point */ CallInfo base_ci; /* CallInfo for first level (C calling Lua) */ volatile lua_Hook hook; ptrdiff_t errfunc; /* current error handling function (stack index) */ int stacksize; int basehookcount; int hookcount; unsignedshort nny; /* number of non-yieldable calls in stack */ unsignedshort nCcalls; /* number of nested C calls */ l_signalT hookmask; lu_byte allowhook; };
可以看到,stack 的 base 是一个 StkId,StkId 定义如下:
1
typedef TValue *StkId; /* index to stack elements */