aboutsummaryrefslogtreecommitdiff
path: root/lstate.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2024-09-19 19:02:14 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2024-09-19 19:02:14 -0300
commitddfa1fbccfe4c1ec69f7396a4f5842abe70927ba (patch)
treedf467dc5dc5c64a21bb976ec661796d17d37f791 /lstate.h
parentb443145ff3415fcaee903a7d95fa7212df5a77db (diff)
downloadlua-ddfa1fbccfe4c1ec69f7396a4f5842abe70927ba.tar.gz
lua-ddfa1fbccfe4c1ec69f7396a4f5842abe70927ba.tar.bz2
lua-ddfa1fbccfe4c1ec69f7396a4f5842abe70927ba.zip
GC back to controling pace counting bytes
Memory is the resource we want to save. Still to be reviewed again.
Diffstat (limited to 'lstate.h')
-rw-r--r--lstate.h15
1 files changed, 7 insertions, 8 deletions
diff --git a/lstate.h b/lstate.h
index 6aa02889..2a03576d 100644
--- a/lstate.h
+++ b/lstate.h
@@ -274,11 +274,10 @@ struct CallInfo {
274typedef struct global_State { 274typedef struct global_State {
275 lua_Alloc frealloc; /* function to reallocate memory */ 275 lua_Alloc frealloc; /* function to reallocate memory */
276 void *ud; /* auxiliary data to 'frealloc' */ 276 void *ud; /* auxiliary data to 'frealloc' */
277 lu_mem GCtotalbytes; /* number of bytes currently allocated */ 277 l_mem GCtotalbytes; /* number of bytes currently allocated + debt */
278 l_obj GCtotalobjs; /* total number of objects allocated + GCdebt */ 278 l_mem GCdebt; /* bytes counted but not yet allocated */
279 l_obj GCdebt; /* objects counted but not yet allocated */ 279 l_mem GCmarked; /* number of objects marked in a GC cycle */
280 l_obj GCmarked; /* number of objects marked in a GC cycle */ 280 l_mem GCmajorminor; /* auxiliary counter to control major-minor shifts */
281 l_obj GCmajorminor; /* auxiliary counter to control major-minor shifts */
282 stringtable strt; /* hash table for strings */ 281 stringtable strt; /* hash table for strings */
283 TValue l_registry; 282 TValue l_registry;
284 TValue nilvalue; /* a nil value */ 283 TValue nilvalue; /* a nil value */
@@ -411,11 +410,11 @@ union GCUnion {
411#define obj2gco(v) check_exp((v)->tt >= LUA_TSTRING, &(cast_u(v)->gc)) 410#define obj2gco(v) check_exp((v)->tt >= LUA_TSTRING, &(cast_u(v)->gc))
412 411
413 412
414/* actual number of total objects allocated */ 413/* actual number of total memory allocated */
415#define gettotalobjs(g) ((g)->GCtotalobjs - (g)->GCdebt) 414#define gettotalbytes(g) ((g)->GCtotalbytes - (g)->GCdebt)
416 415
417 416
418LUAI_FUNC void luaE_setdebt (global_State *g, l_obj debt); 417LUAI_FUNC void luaE_setdebt (global_State *g, l_mem debt);
419LUAI_FUNC void luaE_freethread (lua_State *L, lua_State *L1); 418LUAI_FUNC void luaE_freethread (lua_State *L, lua_State *L1);
420LUAI_FUNC CallInfo *luaE_extendCI (lua_State *L); 419LUAI_FUNC CallInfo *luaE_extendCI (lua_State *L);
421LUAI_FUNC void luaE_shrinkCI (lua_State *L); 420LUAI_FUNC void luaE_shrinkCI (lua_State *L);