diff options
Diffstat (limited to 'lstate.h')
-rw-r--r-- | lstate.h | 21 |
1 files changed, 12 insertions, 9 deletions
@@ -150,12 +150,13 @@ struct lua_longjmp; /* defined in ldo.c */ | |||
150 | /* kinds of Garbage Collection */ | 150 | /* kinds of Garbage Collection */ |
151 | #define KGC_INC 0 /* incremental gc */ | 151 | #define KGC_INC 0 /* incremental gc */ |
152 | #define KGC_GEN 1 /* generational gc */ | 152 | #define KGC_GEN 1 /* generational gc */ |
153 | #define KGC_GENMAJOR 2 /* generational in "major" mode */ | ||
153 | 154 | ||
154 | 155 | ||
155 | typedef struct stringtable { | 156 | typedef struct stringtable { |
156 | TString **hash; | 157 | TString **hash; /* array of buckets (linked lists of strings) */ |
157 | int nuse; /* number of elements */ | 158 | int nuse; /* number of elements */ |
158 | int size; | 159 | int size; /* number of buckets */ |
159 | } stringtable; | 160 | } stringtable; |
160 | 161 | ||
161 | 162 | ||
@@ -254,10 +255,11 @@ struct CallInfo { | |||
254 | typedef struct global_State { | 255 | typedef struct global_State { |
255 | lua_Alloc frealloc; /* function to reallocate memory */ | 256 | lua_Alloc frealloc; /* function to reallocate memory */ |
256 | void *ud; /* auxiliary data to 'frealloc' */ | 257 | void *ud; /* auxiliary data to 'frealloc' */ |
257 | l_mem totalbytes; /* number of bytes currently allocated - GCdebt */ | 258 | lu_mem totalbytes; /* number of bytes currently allocated */ |
258 | l_mem GCdebt; /* bytes allocated not yet compensated by the collector */ | 259 | l_obj totalobjs; /* total number of objects allocated + GCdebt */ |
259 | lu_mem GCestimate; /* an estimate of the non-garbage memory in use */ | 260 | l_obj GCdebt; /* objects counted but not yet allocated */ |
260 | lu_mem lastatomic; /* see function 'genstep' in file 'lgc.c' */ | 261 | l_obj marked; /* number of objects marked in a GC cycle */ |
262 | l_obj GClastmajor; /* objects at last major collection */ | ||
261 | stringtable strt; /* hash table for strings */ | 263 | stringtable strt; /* hash table for strings */ |
262 | TValue l_registry; | 264 | TValue l_registry; |
263 | TValue nilvalue; /* a nil value */ | 265 | TValue nilvalue; /* a nil value */ |
@@ -390,10 +392,11 @@ union GCUnion { | |||
390 | #define obj2gco(v) check_exp((v)->tt >= LUA_TSTRING, &(cast_u(v)->gc)) | 392 | #define obj2gco(v) check_exp((v)->tt >= LUA_TSTRING, &(cast_u(v)->gc)) |
391 | 393 | ||
392 | 394 | ||
393 | /* actual number of total bytes allocated */ | 395 | /* actual number of total objects allocated */ |
394 | #define gettotalbytes(g) cast(lu_mem, (g)->totalbytes + (g)->GCdebt) | 396 | #define gettotalobjs(g) ((g)->totalobjs - (g)->GCdebt) |
395 | 397 | ||
396 | LUAI_FUNC void luaE_setdebt (global_State *g, l_mem debt); | 398 | |
399 | LUAI_FUNC void luaE_setdebt (global_State *g, l_obj debt); | ||
397 | LUAI_FUNC void luaE_freethread (lua_State *L, lua_State *L1); | 400 | LUAI_FUNC void luaE_freethread (lua_State *L, lua_State *L1); |
398 | LUAI_FUNC CallInfo *luaE_extendCI (lua_State *L); | 401 | LUAI_FUNC CallInfo *luaE_extendCI (lua_State *L); |
399 | LUAI_FUNC void luaE_freeCI (lua_State *L); | 402 | LUAI_FUNC void luaE_freeCI (lua_State *L); |