diff options
author | Li Jin <dragon-fly@qq.com> | 2020-08-06 01:00:41 +0800 |
---|---|---|
committer | Li Jin <dragon-fly@qq.com> | 2020-08-06 01:00:41 +0800 |
commit | 2506c1b429e952245295e54e71dac4b345e88984 (patch) | |
tree | ef9f243b6ca18d07b2734041c93fb496cdd8d796 /src/lua/lstate.h | |
parent | c74f45ba9778792e6f5a239539d25fd7918252f7 (diff) | |
download | yuescript-2506c1b429e952245295e54e71dac4b345e88984.tar.gz yuescript-2506c1b429e952245295e54e71dac4b345e88984.tar.bz2 yuescript-2506c1b429e952245295e54e71dac4b345e88984.zip |
update Lua 5.4.
Diffstat (limited to 'src/lua/lstate.h')
-rw-r--r-- | src/lua/lstate.h | 39 |
1 files changed, 31 insertions, 8 deletions
diff --git a/src/lua/lstate.h b/src/lua/lstate.h index 2e8bd6c..697d73b 100644 --- a/src/lua/lstate.h +++ b/src/lua/lstate.h | |||
@@ -32,13 +32,29 @@ | |||
32 | ** | 32 | ** |
33 | ** 'allgc' -> 'survival': new objects; | 33 | ** 'allgc' -> 'survival': new objects; |
34 | ** 'survival' -> 'old': objects that survived one collection; | 34 | ** 'survival' -> 'old': objects that survived one collection; |
35 | ** 'old' -> 'reallyold': objects that became old in last collection; | 35 | ** 'old1' -> 'reallyold': objects that became old in last collection; |
36 | ** 'reallyold' -> NULL: objects old for more than one cycle. | 36 | ** 'reallyold' -> NULL: objects old for more than one cycle. |
37 | ** | 37 | ** |
38 | ** 'finobj' -> 'finobjsur': new objects marked for finalization; | 38 | ** 'finobj' -> 'finobjsur': new objects marked for finalization; |
39 | ** 'finobjsur' -> 'finobjold': survived """"; | 39 | ** 'finobjsur' -> 'finobjold1': survived """"; |
40 | ** 'finobjold' -> 'finobjrold': just old """"; | 40 | ** 'finobjold1' -> 'finobjrold': just old """"; |
41 | ** 'finobjrold' -> NULL: really old """". | 41 | ** 'finobjrold' -> NULL: really old """". |
42 | ** | ||
43 | ** All lists can contain elements older than their main ages, due | ||
44 | ** to 'luaC_checkfinalizer' and 'udata2finalize', which move | ||
45 | ** objects between the normal lists and the "marked for finalization" | ||
46 | ** lists. Moreover, barriers can age young objects in young lists as | ||
47 | ** OLD0, which then become OLD1. However, a list never contains | ||
48 | ** elements younger than their main ages. | ||
49 | ** | ||
50 | ** The generational collector also uses a pointer 'firstold1', which | ||
51 | ** points to the first OLD1 object in the list. It is used to optimize | ||
52 | ** 'markold'. (Potentially OLD1 objects can be anywhere between 'allgc' | ||
53 | ** and 'reallyold', but often the list has no OLD1 objects or they are | ||
54 | ** after 'old1'.) Note the difference between it and 'old1': | ||
55 | ** 'firstold1': no OLD1 objects before this point; there can be all | ||
56 | ** ages after it. | ||
57 | ** 'old1': no objects younger than OLD1 after this point. | ||
42 | */ | 58 | */ |
43 | 59 | ||
44 | /* | 60 | /* |
@@ -47,7 +63,7 @@ | |||
47 | ** can become gray have such a field. The field is not the same | 63 | ** can become gray have such a field. The field is not the same |
48 | ** in all objects, but it always has this name.) Any gray object | 64 | ** in all objects, but it always has this name.) Any gray object |
49 | ** must belong to one of these lists, and all objects in these lists | 65 | ** must belong to one of these lists, and all objects in these lists |
50 | ** must be gray: | 66 | ** must be gray (with one exception explained below): |
51 | ** | 67 | ** |
52 | ** 'gray': regular gray objects, still waiting to be visited. | 68 | ** 'gray': regular gray objects, still waiting to be visited. |
53 | ** 'grayagain': objects that must be revisited at the atomic phase. | 69 | ** 'grayagain': objects that must be revisited at the atomic phase. |
@@ -58,6 +74,12 @@ | |||
58 | ** 'weak': tables with weak values to be cleared; | 74 | ** 'weak': tables with weak values to be cleared; |
59 | ** 'ephemeron': ephemeron tables with white->white entries; | 75 | ** 'ephemeron': ephemeron tables with white->white entries; |
60 | ** 'allweak': tables with weak keys and/or weak values to be cleared. | 76 | ** 'allweak': tables with weak keys and/or weak values to be cleared. |
77 | ** | ||
78 | ** The exception to that "gray rule" is the TOUCHED2 objects in | ||
79 | ** generational mode. Those objects stay in a gray list (because they | ||
80 | ** must be visited again at the end of the cycle), but they are marked | ||
81 | ** black (because assignments to them must activate barriers, to move | ||
82 | ** them back to TOUCHED1). | ||
61 | */ | 83 | */ |
62 | 84 | ||
63 | 85 | ||
@@ -257,10 +279,11 @@ typedef struct global_State { | |||
257 | GCObject *fixedgc; /* list of objects not to be collected */ | 279 | GCObject *fixedgc; /* list of objects not to be collected */ |
258 | /* fields for generational collector */ | 280 | /* fields for generational collector */ |
259 | GCObject *survival; /* start of objects that survived one GC cycle */ | 281 | GCObject *survival; /* start of objects that survived one GC cycle */ |
260 | GCObject *old; /* start of old objects */ | 282 | GCObject *old1; /* start of old1 objects */ |
261 | GCObject *reallyold; /* old objects with more than one cycle */ | 283 | GCObject *reallyold; /* objects more than one cycle old ("really old") */ |
284 | GCObject *firstold1; /* first OLD1 object in the list (if any) */ | ||
262 | GCObject *finobjsur; /* list of survival objects with finalizers */ | 285 | GCObject *finobjsur; /* list of survival objects with finalizers */ |
263 | GCObject *finobjold; /* list of old objects with finalizers */ | 286 | GCObject *finobjold1; /* list of old1 objects with finalizers */ |
264 | GCObject *finobjrold; /* list of really old objects with finalizers */ | 287 | GCObject *finobjrold; /* list of really old objects with finalizers */ |
265 | struct lua_State *twups; /* list of threads with open upvalues */ | 288 | struct lua_State *twups; /* list of threads with open upvalues */ |
266 | lua_CFunction panic; /* to be called in unprotected errors */ | 289 | lua_CFunction panic; /* to be called in unprotected errors */ |
@@ -286,7 +309,6 @@ struct lua_State { | |||
286 | StkId top; /* first free slot in the stack */ | 309 | StkId top; /* first free slot in the stack */ |
287 | global_State *l_G; | 310 | global_State *l_G; |
288 | CallInfo *ci; /* call info for current function */ | 311 | CallInfo *ci; /* call info for current function */ |
289 | const Instruction *oldpc; /* last pc traced */ | ||
290 | StkId stack_last; /* last free slot in the stack */ | 312 | StkId stack_last; /* last free slot in the stack */ |
291 | StkId stack; /* stack base */ | 313 | StkId stack; /* stack base */ |
292 | UpVal *openupval; /* list of open upvalues in this stack */ | 314 | UpVal *openupval; /* list of open upvalues in this stack */ |
@@ -297,6 +319,7 @@ struct lua_State { | |||
297 | volatile lua_Hook hook; | 319 | volatile lua_Hook hook; |
298 | ptrdiff_t errfunc; /* current error handling function (stack index) */ | 320 | ptrdiff_t errfunc; /* current error handling function (stack index) */ |
299 | l_uint32 nCcalls; /* number of allowed nested C calls - 'nci' */ | 321 | l_uint32 nCcalls; /* number of allowed nested C calls - 'nci' */ |
322 | int oldpc; /* last pc traced */ | ||
300 | int stacksize; | 323 | int stacksize; |
301 | int basehookcount; | 324 | int basehookcount; |
302 | int hookcount; | 325 | int hookcount; |