Changed signal of GC debt

Positive debts seems more natural then negative ones.
This commit is contained in:
Roberto Ierusalimschy
2022-12-13 15:45:57 -03:00
parent 40565b4a08
commit 5d8b5b9290
6 changed files with 22 additions and 25 deletions

View File

@@ -89,9 +89,9 @@ static unsigned int luai_makeseed (lua_State *L) {
void luaE_setdebt (global_State *g, l_obj debt) {
l_obj tb = gettotalobjs(g);
lua_assert(tb > 0);
if (debt < tb - MAX_LMEM)
debt = tb - MAX_LMEM; /* will make 'totalobjs == MAX_LMEM' */
g->totalobjs = tb - debt;
if (debt > MAX_LOBJ - tb)
debt = MAX_LOBJ - tb; /* will make 'totalobjs == MAX_LMEM' */
g->totalobjs = tb + debt;
g->GCdebt = debt;
}