aboutsummaryrefslogtreecommitdiff
path: root/lstate.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2024-09-06 14:38:39 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2024-09-06 14:38:39 -0300
commita04e0ffdb9be42a77b5657f46cac8d7faa5a0f43 (patch)
treeeb96915b808cf929015452bd08ca1e5c571683ce /lstate.c
parent007b8c7a01eaa97d796561a19c7e9af1ec474495 (diff)
downloadlua-a04e0ffdb9be42a77b5657f46cac8d7faa5a0f43.tar.gz
lua-a04e0ffdb9be42a77b5657f46cac8d7faa5a0f43.tar.bz2
lua-a04e0ffdb9be42a77b5657f46cac8d7faa5a0f43.zip
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'.
Diffstat (limited to 'lstate.c')
-rw-r--r--lstate.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/lstate.c b/lstate.c
index eb71ed8c..f4c9081d 100644
--- a/lstate.c
+++ b/lstate.c
@@ -74,15 +74,15 @@ typedef struct LG {
74 74
75/* 75/*
76** set GCdebt to a new value keeping the real number of allocated 76** set GCdebt to a new value keeping the real number of allocated
77** objects (totalobjs - GCdebt) invariant and avoiding overflows in 77** objects (GCtotalobjs - GCdebt) invariant and avoiding overflows in
78** 'totalobjs'. 78** 'GCtotalobjs'.
79*/ 79*/
80void luaE_setdebt (global_State *g, l_obj debt) { 80void luaE_setdebt (global_State *g, l_obj debt) {
81 l_obj tb = gettotalobjs(g); 81 l_obj tb = gettotalobjs(g);
82 lua_assert(tb > 0); 82 lua_assert(tb > 0);
83 if (debt > MAX_LOBJ - tb) 83 if (debt > MAX_LOBJ - tb)
84 debt = MAX_LOBJ - tb; /* will make 'totalobjs == MAX_LMEM' */ 84 debt = MAX_LOBJ - tb; /* will make GCtotalobjs == MAX_LOBJ */
85 g->totalobjs = tb + debt; 85 g->GCtotalobjs = tb + debt;
86 g->GCdebt = debt; 86 g->GCdebt = debt;
87} 87}
88 88
@@ -269,7 +269,7 @@ static void close_state (lua_State *L) {
269 } 269 }
270 luaM_freearray(L, G(L)->strt.hash, cast_sizet(G(L)->strt.size)); 270 luaM_freearray(L, G(L)->strt.hash, cast_sizet(G(L)->strt.size));
271 freestack(L); 271 freestack(L);
272 lua_assert(g->totalbytes == sizeof(LG)); 272 lua_assert(g->GCtotalbytes == sizeof(LG));
273 lua_assert(gettotalobjs(g) == 1); 273 lua_assert(gettotalobjs(g) == 1);
274 (*g->frealloc)(g->ud, fromstate(L), sizeof(LG), 0); /* free main block */ 274 (*g->frealloc)(g->ud, fromstate(L), sizeof(LG), 0); /* free main block */
275} 275}
@@ -378,9 +378,9 @@ LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud, unsigned seed) {
378 g->gray = g->grayagain = NULL; 378 g->gray = g->grayagain = NULL;
379 g->weak = g->ephemeron = g->allweak = NULL; 379 g->weak = g->ephemeron = g->allweak = NULL;
380 g->twups = NULL; 380 g->twups = NULL;
381 g->totalbytes = sizeof(LG); 381 g->GCtotalbytes = sizeof(LG);
382 g->totalobjs = 1; 382 g->GCtotalobjs = 1;
383 g->marked = 0; 383 g->GCmarked = 0;
384 g->GCdebt = 0; 384 g->GCdebt = 0;
385 setivalue(&g->nilvalue, 0); /* to signal that state is not yet built */ 385 setivalue(&g->nilvalue, 0); /* to signal that state is not yet built */
386 setgcparam(g, PAUSE, LUAI_GCPAUSE); 386 setgcparam(g, PAUSE, LUAI_GCPAUSE);