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.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/lua51/lstate.h b/src/lua51/lstate.h
index 1ec30a8..2f71e57 100644
--- a/src/lua51/lstate.h
+++ b/src/lua51/lstate.h
@@ -93,20 +93,20 @@ typedef struct global_State {
GCObject **sweepgc; /* position of sweep in `rootgc' */
//c 灰色链表
GCObject *gray; /* list of gray objects */
- //c 不可被打断的对象的灰色链表
+ //c 不可被打断的对象的灰色链表,比如LUA_THREAD
GCObject *grayagain; /* list of objects to be traversed atomically */
//c 弱表
GCObject *weak; /* list of weak tables (to be cleared) */
- //c 有__gc方法的userdata
+ //c 有__gc方法的userdata,会在GC阶段调用__gc释放native侧的引用
GCObject *tmudata; /* last element of list of userdata to be GC */
Mbuffer buff; /* temporary buffer for string concatentation */
lu_mem GCthreshold;
//c 开始进行GC的阈值,当超过这个值时开始GC
lu_mem totalbytes; /* number of bytes currently allocated */
- //c 内存大小的估计值
+ //c 当前使用的内存大小的估计值
lu_mem estimate; /* an estimate of number of bytes actually in use */
lu_mem gcdept; /* how much GC is `behind schedule' */
- //c 控制下一轮GC开始时机
+ //c 一个百分数,控制下一轮GC开始时机,越大,下次gc开始的时间越长
int gcpause; /* size of pause between successive GCs */
//c 控制GC回收速度
int gcstepmul; /* GC `granularity' */
@@ -131,7 +131,7 @@ struct lua_State {
//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 */
+ StkId base; /* base of current function */ //c 每个方法被调用时都会得到自己的一组虚拟寄存器
global_State *l_G;
//c 当前函数的调用信息,是base_ci数组中的某个
CallInfo *ci; /* call info for current function */