diff options
| author | Li Jin <dragon-fly@qq.com> | 2020-06-22 16:50:40 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2020-06-22 16:50:40 +0800 |
| commit | cd2b60b101a398cb9356d746364e70eaed1860f1 (patch) | |
| tree | a1fe71b76faabc4883f16905a94164ce5c23e692 /src/lua/lstate.h | |
| parent | 88c1052e700f38cf3d8ad82d469da4c487760b7e (diff) | |
| download | yuescript-cd2b60b101a398cb9356d746364e70eaed1860f1.tar.gz yuescript-cd2b60b101a398cb9356d746364e70eaed1860f1.tar.bz2 yuescript-cd2b60b101a398cb9356d746364e70eaed1860f1.zip | |
add support for local variable declared with attribute 'close' and 'const' for Lua 5.4.
Diffstat (limited to '')
| -rw-r--r-- | src/lua/lstate.h (renamed from src/lua-5.3/lstate.h) | 195 |
1 files changed, 153 insertions, 42 deletions
diff --git a/src/lua-5.3/lstate.h b/src/lua/lstate.h index 56b3741..2e8bd6c 100644 --- a/src/lua-5.3/lstate.h +++ b/src/lua/lstate.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lstate.h,v 2.133.1.1 2017/04/19 17:39:34 roberto Exp $ | 2 | ** $Id: lstate.h $ |
| 3 | ** Global State | 3 | ** Global State |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -15,7 +15,6 @@ | |||
| 15 | 15 | ||
| 16 | 16 | ||
| 17 | /* | 17 | /* |
| 18 | |||
| 19 | ** Some notes about garbage-collected objects: All objects in Lua must | 18 | ** Some notes about garbage-collected objects: All objects in Lua must |
| 20 | ** be kept somehow accessible until being freed, so all objects always | 19 | ** be kept somehow accessible until being freed, so all objects always |
| 21 | ** belong to one (and only one) of these lists, using field 'next' of | 20 | ** belong to one (and only one) of these lists, using field 'next' of |
| @@ -27,6 +26,22 @@ | |||
| 27 | ** 'fixedgc': all objects that are not to be collected (currently | 26 | ** 'fixedgc': all objects that are not to be collected (currently |
| 28 | ** only small strings, such as reserved words). | 27 | ** only small strings, such as reserved words). |
| 29 | ** | 28 | ** |
| 29 | ** For the generational collector, some of these lists have marks for | ||
| 30 | ** generations. Each mark points to the first element in the list for | ||
| 31 | ** that particular generation; that generation goes until the next mark. | ||
| 32 | ** | ||
| 33 | ** 'allgc' -> 'survival': new objects; | ||
| 34 | ** 'survival' -> 'old': objects that survived one collection; | ||
| 35 | ** 'old' -> 'reallyold': objects that became old in last collection; | ||
| 36 | ** 'reallyold' -> NULL: objects old for more than one cycle. | ||
| 37 | ** | ||
| 38 | ** 'finobj' -> 'finobjsur': new objects marked for finalization; | ||
| 39 | ** 'finobjsur' -> 'finobjold': survived """"; | ||
| 40 | ** 'finobjold' -> 'finobjrold': just old """"; | ||
| 41 | ** 'finobjrold' -> NULL: really old """". | ||
| 42 | */ | ||
| 43 | |||
| 44 | /* | ||
| 30 | ** Moreover, there is another set of lists that control gray objects. | 45 | ** Moreover, there is another set of lists that control gray objects. |
| 31 | ** These lists are linked by fields 'gclist'. (All objects that | 46 | ** These lists are linked by fields 'gclist'. (All objects that |
| 32 | ** can become gray have such a field. The field is not the same | 47 | ** can become gray have such a field. The field is not the same |
| @@ -43,9 +58,77 @@ | |||
| 43 | ** 'weak': tables with weak values to be cleared; | 58 | ** 'weak': tables with weak values to be cleared; |
| 44 | ** 'ephemeron': ephemeron tables with white->white entries; | 59 | ** 'ephemeron': ephemeron tables with white->white entries; |
| 45 | ** 'allweak': tables with weak keys and/or weak values to be cleared. | 60 | ** 'allweak': tables with weak keys and/or weak values to be cleared. |
| 46 | ** The last three lists are used only during the atomic phase. | 61 | */ |
| 62 | |||
| 63 | |||
| 47 | 64 | ||
| 65 | /* | ||
| 66 | ** About 'nCcalls': each thread in Lua (a lua_State) keeps a count of | ||
| 67 | ** how many "C calls" it still can do in the C stack, to avoid C-stack | ||
| 68 | ** overflow. This count is very rough approximation; it considers only | ||
| 69 | ** recursive functions inside the interpreter, as non-recursive calls | ||
| 70 | ** can be considered using a fixed (although unknown) amount of stack | ||
| 71 | ** space. | ||
| 72 | ** | ||
| 73 | ** The count has two parts: the lower part is the count itself; the | ||
| 74 | ** higher part counts the number of non-yieldable calls in the stack. | ||
| 75 | ** (They are together so that we can change both with one instruction.) | ||
| 76 | ** | ||
| 77 | ** Because calls to external C functions can use an unknown amount | ||
| 78 | ** of space (e.g., functions using an auxiliary buffer), calls | ||
| 79 | ** to these functions add more than one to the count (see CSTACKCF). | ||
| 80 | ** | ||
| 81 | ** The proper count excludes the number of CallInfo structures allocated | ||
| 82 | ** by Lua, as a kind of "potential" calls. So, when Lua calls a function | ||
| 83 | ** (and "consumes" one CallInfo), it needs neither to decrement nor to | ||
| 84 | ** check 'nCcalls', as its use of C stack is already accounted for. | ||
| 85 | */ | ||
| 86 | |||
| 87 | /* number of "C stack slots" used by an external C function */ | ||
| 88 | #define CSTACKCF 10 | ||
| 89 | |||
| 90 | |||
| 91 | /* | ||
| 92 | ** The C-stack size is sliced in the following zones: | ||
| 93 | ** - larger than CSTACKERR: normal stack; | ||
| 94 | ** - [CSTACKMARK, CSTACKERR]: buffer zone to signal a stack overflow; | ||
| 95 | ** - [CSTACKCF, CSTACKERRMARK]: error-handling zone; | ||
| 96 | ** - below CSTACKERRMARK: buffer zone to signal overflow during overflow; | ||
| 97 | ** (Because the counter can be decremented CSTACKCF at once, we need | ||
| 98 | ** the so called "buffer zones", with at least that size, to properly | ||
| 99 | ** detect a change from one zone to the next.) | ||
| 48 | */ | 100 | */ |
| 101 | #define CSTACKERR (8 * CSTACKCF) | ||
| 102 | #define CSTACKMARK (CSTACKERR - (CSTACKCF + 2)) | ||
| 103 | #define CSTACKERRMARK (CSTACKCF + 2) | ||
| 104 | |||
| 105 | |||
| 106 | /* initial limit for the C-stack of threads */ | ||
| 107 | #define CSTACKTHREAD (2 * CSTACKERR) | ||
| 108 | |||
| 109 | |||
| 110 | /* true if this thread does not have non-yieldable calls in the stack */ | ||
| 111 | #define yieldable(L) (((L)->nCcalls & 0xffff0000) == 0) | ||
| 112 | |||
| 113 | /* real number of C calls */ | ||
| 114 | #define getCcalls(L) ((L)->nCcalls & 0xffff) | ||
| 115 | |||
| 116 | |||
| 117 | /* Increment the number of non-yieldable calls */ | ||
| 118 | #define incnny(L) ((L)->nCcalls += 0x10000) | ||
| 119 | |||
| 120 | /* Decrement the number of non-yieldable calls */ | ||
| 121 | #define decnny(L) ((L)->nCcalls -= 0x10000) | ||
| 122 | |||
| 123 | /* Increment the number of non-yieldable calls and decrement nCcalls */ | ||
| 124 | #define incXCcalls(L) ((L)->nCcalls += 0x10000 - CSTACKCF) | ||
| 125 | |||
| 126 | /* Decrement the number of non-yieldable calls and increment nCcalls */ | ||
| 127 | #define decXCcalls(L) ((L)->nCcalls -= 0x10000 - CSTACKCF) | ||
| 128 | |||
| 129 | |||
| 130 | |||
| 131 | |||
| 49 | 132 | ||
| 50 | 133 | ||
| 51 | struct lua_longjmp; /* defined in ldo.c */ | 134 | struct lua_longjmp; /* defined in ldo.c */ |
| @@ -69,8 +152,8 @@ struct lua_longjmp; /* defined in ldo.c */ | |||
| 69 | 152 | ||
| 70 | 153 | ||
| 71 | /* kinds of Garbage Collection */ | 154 | /* kinds of Garbage Collection */ |
| 72 | #define KGC_NORMAL 0 | 155 | #define KGC_INC 0 /* incremental gc */ |
| 73 | #define KGC_EMERGENCY 1 /* gc was forced by an allocation failure */ | 156 | #define KGC_GEN 1 /* generational gc */ |
| 74 | 157 | ||
| 75 | 158 | ||
| 76 | typedef struct stringtable { | 159 | typedef struct stringtable { |
| @@ -82,12 +165,6 @@ typedef struct stringtable { | |||
| 82 | 165 | ||
| 83 | /* | 166 | /* |
| 84 | ** Information about a call. | 167 | ** Information about a call. |
| 85 | ** When a thread yields, 'func' is adjusted to pretend that the | ||
| 86 | ** top function has only the yielded values in its stack; in that | ||
| 87 | ** case, the actual 'func' value is saved in field 'extra'. | ||
| 88 | ** When a function calls another with a continuation, 'extra' keeps | ||
| 89 | ** the function index so that, in case of errors, the continuation | ||
| 90 | ** function can be called with the correct top. | ||
| 91 | */ | 168 | */ |
| 92 | typedef struct CallInfo { | 169 | typedef struct CallInfo { |
| 93 | StkId func; /* function index in the stack */ | 170 | StkId func; /* function index in the stack */ |
| @@ -95,8 +172,9 @@ typedef struct CallInfo { | |||
| 95 | struct CallInfo *previous, *next; /* dynamic call link */ | 172 | struct CallInfo *previous, *next; /* dynamic call link */ |
| 96 | union { | 173 | union { |
| 97 | struct { /* only for Lua functions */ | 174 | struct { /* only for Lua functions */ |
| 98 | StkId base; /* base for this function */ | ||
| 99 | const Instruction *savedpc; | 175 | const Instruction *savedpc; |
| 176 | volatile l_signalT trap; | ||
| 177 | int nextraargs; /* # of extra arguments in vararg functions */ | ||
| 100 | } l; | 178 | } l; |
| 101 | struct { /* only for C functions */ | 179 | struct { /* only for C functions */ |
| 102 | lua_KFunction k; /* continuation in case of yields */ | 180 | lua_KFunction k; /* continuation in case of yields */ |
| @@ -104,7 +182,14 @@ typedef struct CallInfo { | |||
| 104 | lua_KContext ctx; /* context info. in case of yields */ | 182 | lua_KContext ctx; /* context info. in case of yields */ |
| 105 | } c; | 183 | } c; |
| 106 | } u; | 184 | } u; |
| 107 | ptrdiff_t extra; | 185 | union { |
| 186 | int funcidx; /* called-function index */ | ||
| 187 | int nyield; /* number of values yielded */ | ||
| 188 | struct { /* info about transferred values (for call/return hooks) */ | ||
| 189 | unsigned short ftransfer; /* offset of first value transferred */ | ||
| 190 | unsigned short ntransfer; /* number of values transferred */ | ||
| 191 | } transferinfo; | ||
| 192 | } u2; | ||
| 108 | short nresults; /* expected number of results from this function */ | 193 | short nresults; /* expected number of results from this function */ |
| 109 | unsigned short callstatus; | 194 | unsigned short callstatus; |
| 110 | } CallInfo; | 195 | } CallInfo; |
| @@ -114,17 +199,22 @@ typedef struct CallInfo { | |||
| 114 | ** Bits in CallInfo status | 199 | ** Bits in CallInfo status |
| 115 | */ | 200 | */ |
| 116 | #define CIST_OAH (1<<0) /* original value of 'allowhook' */ | 201 | #define CIST_OAH (1<<0) /* original value of 'allowhook' */ |
| 117 | #define CIST_LUA (1<<1) /* call is running a Lua function */ | 202 | #define CIST_C (1<<1) /* call is running a C function */ |
| 118 | #define CIST_HOOKED (1<<2) /* call is running a debug hook */ | 203 | #define CIST_HOOKED (1<<2) /* call is running a debug hook */ |
| 119 | #define CIST_FRESH (1<<3) /* call is running on a fresh invocation | 204 | #define CIST_YPCALL (1<<3) /* call is a yieldable protected call */ |
| 120 | of luaV_execute */ | 205 | #define CIST_TAIL (1<<4) /* call was tail called */ |
| 121 | #define CIST_YPCALL (1<<4) /* call is a yieldable protected call */ | 206 | #define CIST_HOOKYIELD (1<<5) /* last hook called yielded */ |
| 122 | #define CIST_TAIL (1<<5) /* call was tail called */ | 207 | #define CIST_FIN (1<<6) /* call is running a finalizer */ |
| 123 | #define CIST_HOOKYIELD (1<<6) /* last hook called yielded */ | 208 | #define CIST_TRAN (1<<7) /* 'ci' has transfer information */ |
| 124 | #define CIST_LEQ (1<<7) /* using __lt for __le */ | 209 | #if defined(LUA_COMPAT_LT_LE) |
| 125 | #define CIST_FIN (1<<8) /* call is running a finalizer */ | 210 | #define CIST_LEQ (1<<8) /* using __lt for __le */ |
| 211 | #endif | ||
| 212 | |||
| 213 | /* active function is a Lua function */ | ||
| 214 | #define isLua(ci) (!((ci)->callstatus & CIST_C)) | ||
| 126 | 215 | ||
| 127 | #define isLua(ci) ((ci)->callstatus & CIST_LUA) | 216 | /* call is running Lua code (not a hook) */ |
| 217 | #define isLuacode(ci) (!((ci)->callstatus & (CIST_C | CIST_HOOKED))) | ||
| 128 | 218 | ||
| 129 | /* assume that CIST_OAH has offset 0 and that 'v' is strictly 0/1 */ | 219 | /* assume that CIST_OAH has offset 0 and that 'v' is strictly 0/1 */ |
| 130 | #define setoah(st,v) ((st) = ((st) & ~CIST_OAH) | (v)) | 220 | #define setoah(st,v) ((st) = ((st) & ~CIST_OAH) | (v)) |
| @@ -139,15 +229,22 @@ typedef struct global_State { | |||
| 139 | void *ud; /* auxiliary data to 'frealloc' */ | 229 | void *ud; /* auxiliary data to 'frealloc' */ |
| 140 | l_mem totalbytes; /* number of bytes currently allocated - GCdebt */ | 230 | l_mem totalbytes; /* number of bytes currently allocated - GCdebt */ |
| 141 | l_mem GCdebt; /* bytes allocated not yet compensated by the collector */ | 231 | l_mem GCdebt; /* bytes allocated not yet compensated by the collector */ |
| 142 | lu_mem GCmemtrav; /* memory traversed by the GC */ | ||
| 143 | lu_mem GCestimate; /* an estimate of the non-garbage memory in use */ | 232 | lu_mem GCestimate; /* an estimate of the non-garbage memory in use */ |
| 233 | lu_mem lastatomic; /* see function 'genstep' in file 'lgc.c' */ | ||
| 144 | stringtable strt; /* hash table for strings */ | 234 | stringtable strt; /* hash table for strings */ |
| 145 | TValue l_registry; | 235 | TValue l_registry; |
| 236 | TValue nilvalue; /* a nil value */ | ||
| 146 | unsigned int seed; /* randomized seed for hashes */ | 237 | unsigned int seed; /* randomized seed for hashes */ |
| 147 | lu_byte currentwhite; | 238 | lu_byte currentwhite; |
| 148 | lu_byte gcstate; /* state of garbage collector */ | 239 | lu_byte gcstate; /* state of garbage collector */ |
| 149 | lu_byte gckind; /* kind of GC running */ | 240 | lu_byte gckind; /* kind of GC running */ |
| 241 | lu_byte genminormul; /* control for minor generational collections */ | ||
| 242 | lu_byte genmajormul; /* control for major generational collections */ | ||
| 150 | lu_byte gcrunning; /* true if GC is running */ | 243 | lu_byte gcrunning; /* true if GC is running */ |
| 244 | lu_byte gcemergency; /* true if this is an emergency collection */ | ||
| 245 | lu_byte gcpause; /* size of pause between successive GCs */ | ||
| 246 | lu_byte gcstepmul; /* GC "speed" */ | ||
| 247 | lu_byte gcstepsize; /* (log2 of) GC granularity */ | ||
| 151 | GCObject *allgc; /* list of all collectable objects */ | 248 | GCObject *allgc; /* list of all collectable objects */ |
| 152 | GCObject **sweepgc; /* current position of sweep in list */ | 249 | GCObject **sweepgc; /* current position of sweep in list */ |
| 153 | GCObject *finobj; /* list of collectable objects with finalizers */ | 250 | GCObject *finobj; /* list of collectable objects with finalizers */ |
| @@ -158,17 +255,23 @@ typedef struct global_State { | |||
| 158 | GCObject *allweak; /* list of all-weak tables */ | 255 | GCObject *allweak; /* list of all-weak tables */ |
| 159 | GCObject *tobefnz; /* list of userdata to be GC */ | 256 | GCObject *tobefnz; /* list of userdata to be GC */ |
| 160 | GCObject *fixedgc; /* list of objects not to be collected */ | 257 | GCObject *fixedgc; /* list of objects not to be collected */ |
| 258 | /* fields for generational collector */ | ||
| 259 | GCObject *survival; /* start of objects that survived one GC cycle */ | ||
| 260 | GCObject *old; /* start of old objects */ | ||
| 261 | GCObject *reallyold; /* old objects with more than one cycle */ | ||
| 262 | GCObject *finobjsur; /* list of survival objects with finalizers */ | ||
| 263 | GCObject *finobjold; /* list of old objects with finalizers */ | ||
| 264 | GCObject *finobjrold; /* list of really old objects with finalizers */ | ||
| 161 | struct lua_State *twups; /* list of threads with open upvalues */ | 265 | struct lua_State *twups; /* list of threads with open upvalues */ |
| 162 | unsigned int gcfinnum; /* number of finalizers to call in each GC step */ | ||
| 163 | int gcpause; /* size of pause between successive GCs */ | ||
| 164 | int gcstepmul; /* GC 'granularity' */ | ||
| 165 | lua_CFunction panic; /* to be called in unprotected errors */ | 266 | lua_CFunction panic; /* to be called in unprotected errors */ |
| 166 | struct lua_State *mainthread; | 267 | struct lua_State *mainthread; |
| 167 | const lua_Number *version; /* pointer to version number */ | 268 | TString *memerrmsg; /* message for memory-allocation errors */ |
| 168 | TString *memerrmsg; /* memory-error message */ | ||
| 169 | TString *tmname[TM_N]; /* array with tag-method names */ | 269 | TString *tmname[TM_N]; /* array with tag-method names */ |
| 170 | struct Table *mt[LUA_NUMTAGS]; /* metatables for basic types */ | 270 | struct Table *mt[LUA_NUMTAGS]; /* metatables for basic types */ |
| 171 | TString *strcache[STRCACHE_N][STRCACHE_M]; /* cache for strings in API */ | 271 | TString *strcache[STRCACHE_N][STRCACHE_M]; /* cache for strings in API */ |
| 272 | lua_WarnFunction warnf; /* warning function */ | ||
| 273 | void *ud_warn; /* auxiliary data to 'warnf' */ | ||
| 274 | unsigned int Cstacklimit; /* current limit for the C stack */ | ||
| 172 | } global_State; | 275 | } global_State; |
| 173 | 276 | ||
| 174 | 277 | ||
| @@ -177,8 +280,9 @@ typedef struct global_State { | |||
| 177 | */ | 280 | */ |
| 178 | struct lua_State { | 281 | struct lua_State { |
| 179 | CommonHeader; | 282 | CommonHeader; |
| 180 | unsigned short nci; /* number of items in 'ci' list */ | ||
| 181 | lu_byte status; | 283 | lu_byte status; |
| 284 | lu_byte allowhook; | ||
| 285 | unsigned short nci; /* number of items in 'ci' list */ | ||
| 182 | StkId top; /* first free slot in the stack */ | 286 | StkId top; /* first free slot in the stack */ |
| 183 | global_State *l_G; | 287 | global_State *l_G; |
| 184 | CallInfo *ci; /* call info for current function */ | 288 | CallInfo *ci; /* call info for current function */ |
| @@ -192,13 +296,11 @@ struct lua_State { | |||
| 192 | CallInfo base_ci; /* CallInfo for first level (C calling Lua) */ | 296 | CallInfo base_ci; /* CallInfo for first level (C calling Lua) */ |
| 193 | volatile lua_Hook hook; | 297 | volatile lua_Hook hook; |
| 194 | ptrdiff_t errfunc; /* current error handling function (stack index) */ | 298 | ptrdiff_t errfunc; /* current error handling function (stack index) */ |
| 299 | l_uint32 nCcalls; /* number of allowed nested C calls - 'nci' */ | ||
| 195 | int stacksize; | 300 | int stacksize; |
| 196 | int basehookcount; | 301 | int basehookcount; |
| 197 | int hookcount; | 302 | int hookcount; |
| 198 | unsigned short nny; /* number of non-yieldable calls in stack */ | 303 | volatile l_signalT hookmask; |
| 199 | unsigned short nCcalls; /* number of nested C calls */ | ||
| 200 | l_signalT hookmask; | ||
| 201 | lu_byte allowhook; | ||
| 202 | }; | 304 | }; |
| 203 | 305 | ||
| 204 | 306 | ||
| @@ -216,6 +318,7 @@ union GCUnion { | |||
| 216 | struct Table h; | 318 | struct Table h; |
| 217 | struct Proto p; | 319 | struct Proto p; |
| 218 | struct lua_State th; /* thread */ | 320 | struct lua_State th; /* thread */ |
| 321 | struct UpVal upv; | ||
| 219 | }; | 322 | }; |
| 220 | 323 | ||
| 221 | 324 | ||
| @@ -224,19 +327,22 @@ union GCUnion { | |||
| 224 | /* macros to convert a GCObject into a specific value */ | 327 | /* macros to convert a GCObject into a specific value */ |
| 225 | #define gco2ts(o) \ | 328 | #define gco2ts(o) \ |
| 226 | check_exp(novariant((o)->tt) == LUA_TSTRING, &((cast_u(o))->ts)) | 329 | check_exp(novariant((o)->tt) == LUA_TSTRING, &((cast_u(o))->ts)) |
| 227 | #define gco2u(o) check_exp((o)->tt == LUA_TUSERDATA, &((cast_u(o))->u)) | 330 | #define gco2u(o) check_exp((o)->tt == LUA_VUSERDATA, &((cast_u(o))->u)) |
| 228 | #define gco2lcl(o) check_exp((o)->tt == LUA_TLCL, &((cast_u(o))->cl.l)) | 331 | #define gco2lcl(o) check_exp((o)->tt == LUA_VLCL, &((cast_u(o))->cl.l)) |
| 229 | #define gco2ccl(o) check_exp((o)->tt == LUA_TCCL, &((cast_u(o))->cl.c)) | 332 | #define gco2ccl(o) check_exp((o)->tt == LUA_VCCL, &((cast_u(o))->cl.c)) |
| 230 | #define gco2cl(o) \ | 333 | #define gco2cl(o) \ |
| 231 | check_exp(novariant((o)->tt) == LUA_TFUNCTION, &((cast_u(o))->cl)) | 334 | check_exp(novariant((o)->tt) == LUA_TFUNCTION, &((cast_u(o))->cl)) |
| 232 | #define gco2t(o) check_exp((o)->tt == LUA_TTABLE, &((cast_u(o))->h)) | 335 | #define gco2t(o) check_exp((o)->tt == LUA_VTABLE, &((cast_u(o))->h)) |
| 233 | #define gco2p(o) check_exp((o)->tt == LUA_TPROTO, &((cast_u(o))->p)) | 336 | #define gco2p(o) check_exp((o)->tt == LUA_VPROTO, &((cast_u(o))->p)) |
| 234 | #define gco2th(o) check_exp((o)->tt == LUA_TTHREAD, &((cast_u(o))->th)) | 337 | #define gco2th(o) check_exp((o)->tt == LUA_VTHREAD, &((cast_u(o))->th)) |
| 338 | #define gco2upv(o) check_exp((o)->tt == LUA_VUPVAL, &((cast_u(o))->upv)) | ||
| 235 | 339 | ||
| 236 | 340 | ||
| 237 | /* macro to convert a Lua object into a GCObject */ | 341 | /* |
| 238 | #define obj2gco(v) \ | 342 | ** macro to convert a Lua object into a GCObject |
| 239 | check_exp(novariant((v)->tt) < LUA_TDEADKEY, (&(cast_u(v)->gc))) | 343 | ** (The access to 'tt' tries to ensure that 'v' is actually a Lua object.) |
| 344 | */ | ||
| 345 | #define obj2gco(v) check_exp((v)->tt >= LUA_TSTRING, &(cast_u(v)->gc)) | ||
| 240 | 346 | ||
| 241 | 347 | ||
| 242 | /* actual number of total bytes allocated */ | 348 | /* actual number of total bytes allocated */ |
| @@ -247,7 +353,12 @@ LUAI_FUNC void luaE_freethread (lua_State *L, lua_State *L1); | |||
| 247 | LUAI_FUNC CallInfo *luaE_extendCI (lua_State *L); | 353 | LUAI_FUNC CallInfo *luaE_extendCI (lua_State *L); |
| 248 | LUAI_FUNC void luaE_freeCI (lua_State *L); | 354 | LUAI_FUNC void luaE_freeCI (lua_State *L); |
| 249 | LUAI_FUNC void luaE_shrinkCI (lua_State *L); | 355 | LUAI_FUNC void luaE_shrinkCI (lua_State *L); |
| 356 | LUAI_FUNC void luaE_enterCcall (lua_State *L); | ||
| 357 | LUAI_FUNC void luaE_warning (lua_State *L, const char *msg, int tocont); | ||
| 358 | LUAI_FUNC void luaE_warnerror (lua_State *L, const char *where); | ||
| 359 | |||
| 250 | 360 | ||
| 361 | #define luaE_exitCcall(L) ((L)->nCcalls++) | ||
| 251 | 362 | ||
| 252 | #endif | 363 | #endif |
| 253 | 364 | ||
