diff options
Diffstat (limited to 'src/lua51/lobject.h')
| -rw-r--r-- | src/lua51/lobject.h | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/lua51/lobject.h b/src/lua51/lobject.h index 25dc341..4e9daee 100644 --- a/src/lua51/lobject.h +++ b/src/lua51/lobject.h @@ -40,10 +40,10 @@ typedef union GCObject GCObject; ** Common Header for all collectable objects (in macro form, to be ** included in other objects) */ -// 需要垃圾回收的类型包含这个头 -//c next 指向下一个gc链表的成员 -//c tt 数据类型 -//c GC标记,用来保存颜色,有白色(2种),灰色和黑色 +// 需要垃圾回收的类型包含这个头,包含TString, Udata, Proto, UpVal, Closure, Table以及lua_State七个 +//c next 指向下一个gc链表的成员 +//c tt 数据类型 +//c marked GC标记,用来保存颜色,有白色(2种),灰色和黑色 #define CommonHeader GCObject *next; lu_byte tt; lu_byte marked @@ -211,17 +211,17 @@ typedef union TString { L_Umaxalign dummy; /* ensures maximum alignment for strings */ struct { CommonHeader; - lu_byte reserved;//标记字符串是否是lua的关键字,如果是,不会被GC回收 - unsigned int hash;//字符串的哈希值,比较字符串的依据 - size_t len; - } tsv; + lu_byte reserved;//c 标记字符串是否是lua的关键字,如果是,不会被GC回收 + unsigned int hash;//c 字符串的哈希值,比较字符串的依据 + size_t len; //c 字符串长度 + } tsv; //c tstring value } TString; #define getstr(ts) cast(const char *, (ts) + 1) #define svalue(o) getstr(rawtsvalue(o)) -// userdata,和TString比较像 +//c userdata,和TString比较像 typedef union Udata { L_Umaxalign dummy; /* ensures maximum alignment for `local' udata */ struct { @@ -240,7 +240,7 @@ typedef union Udata { */ typedef struct Proto { CommonHeader; - //c 函数的常量 + //c 常量表,能看出来lua保存常量的单元是函数原型,所有代码片段都会被编译为proto TValue *k; /* constants used by the function */ //c 函数字节码 Instruction *code; |
