Rename of fields in global state that control GC

All fields in the global state that control the pace of the garbage
collector prefixed with 'GC'.
This commit is contained in:
Roberto Ierusalimschy
2024-09-06 14:38:39 -03:00
parent 007b8c7a01
commit a04e0ffdb9
5 changed files with 32 additions and 32 deletions

View File

@@ -74,15 +74,15 @@ typedef struct LG {
/*
** set GCdebt to a new value keeping the real number of allocated
** objects (totalobjs - GCdebt) invariant and avoiding overflows in
** 'totalobjs'.
** objects (GCtotalobjs - GCdebt) invariant and avoiding overflows in
** 'GCtotalobjs'.
*/
void luaE_setdebt (global_State *g, l_obj debt) {
l_obj tb = gettotalobjs(g);
lua_assert(tb > 0);
if (debt > MAX_LOBJ - tb)
debt = MAX_LOBJ - tb; /* will make 'totalobjs == MAX_LMEM' */
g->totalobjs = tb + debt;
debt = MAX_LOBJ - tb; /* will make GCtotalobjs == MAX_LOBJ */
g->GCtotalobjs = tb + debt;
g->GCdebt = debt;
}
@@ -269,7 +269,7 @@ static void close_state (lua_State *L) {
}
luaM_freearray(L, G(L)->strt.hash, cast_sizet(G(L)->strt.size));
freestack(L);
lua_assert(g->totalbytes == sizeof(LG));
lua_assert(g->GCtotalbytes == sizeof(LG));
lua_assert(gettotalobjs(g) == 1);
(*g->frealloc)(g->ud, fromstate(L), sizeof(LG), 0); /* free main block */
}
@@ -378,9 +378,9 @@ LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud, unsigned seed) {
g->gray = g->grayagain = NULL;
g->weak = g->ephemeron = g->allweak = NULL;
g->twups = NULL;
g->totalbytes = sizeof(LG);
g->totalobjs = 1;
g->marked = 0;
g->GCtotalbytes = sizeof(LG);
g->GCtotalobjs = 1;
g->GCmarked = 0;
g->GCdebt = 0;
setivalue(&g->nilvalue, 0); /* to signal that state is not yet built */
setgcparam(g, PAUSE, LUAI_GCPAUSE);