summaryrefslogtreecommitdiff
path: root/src/lua51/lstate.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lua51/lstate.h')
-rw-r--r--src/lua51/lstate.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/lua51/lstate.h b/src/lua51/lstate.h
index 1c049e1..8da0640 100644
--- a/src/lua51/lstate.h
+++ b/src/lua51/lstate.h
@@ -58,10 +58,13 @@ typedef struct CallInfo {
StkId base; /* base for this function */
//c 函数原型在lua_State数据栈上的位置
StkId func; /* function index in the stack */
+ //c 此函数调用过程中的top指针
StkId top; /* top for this function */
//c 当前执行到的指令位置
const Instruction *savedpc;
+ //c 期待的返回值个数
int nresults; /* expected number of results from this function */
+ //c 尾调用个数
int tailcalls; /* number of tail calls lost under this entry */
} CallInfo;
@@ -129,11 +132,13 @@ struct lua_State {
lu_byte status;
//c 当前栈的下一个可用位置
StkId top; /* first free slot in the stack */
- //c 当前*函数栈*的基地址,给某个函数用,在luad_precall函数中设置L->base = ci->base = ci->func + 1;
- StkId base; /* base of current function */ //c 每个方法被调用时都会得到自己的一组虚拟寄存器
+ //c 当前函数栈的基地址,给某个函数用,在luad_precall函数中设置L->base = ci->base = ci->func + 1;
+ //c 每个方法被调用时都会得到自己的一组虚拟“寄存器”,也就是栈上面的数据
+ StkId base; /* base of current function */
global_State *l_G;
- //c 当前函数的调用信息,是base_ci数组中的某个
+ //c 当前执行中函数的调用信息,是base_ci数组中的某个
CallInfo *ci; /* call info for current function */
+ //c 当前执行到的指令位置。为了处理函数的调用和恢复,会在luaD_precall和luaD_poscall设置和恢复
const Instruction *savedpc; /* `savedpc' of current function */
//c lua_State数据栈的终点
StkId stack_last; /* last free slot in the stack */