From fa1382b5cd504bdfc5fc3f5c447ed09a4c9804fd Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 31 Jan 2025 13:51:38 -0300 Subject: Main thread is a regular field of global_State They were already allocated as a single block, so there is no need for the global_State to point to its main thread. --- lgc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lgc.c') diff --git a/lgc.c b/lgc.c index 8a82b6d9..e8533052 100644 --- a/lgc.c +++ b/lgc.c @@ -78,7 +78,7 @@ ((*getArrTag(t,i) & BIT_ISCOLLECTABLE) ? getArrVal(t,i)->gc : NULL) -#define markvalue(g,o) { checkliveness(g->mainthread,o); \ +#define markvalue(g,o) { checkliveness(mainthread(g),o); \ if (valiswhite(o)) reallymarkobject(g,gcvalue(o)); } #define markkey(g, n) { if keyiswhite(n) reallymarkobject(g,gckey(n)); } @@ -441,7 +441,7 @@ static void cleargraylists (global_State *g) { static void restartcollection (global_State *g) { cleargraylists(g); g->GCmarked = 0; - markobject(g, g->mainthread); + markobject(g, mainthread(g)); markvalue(g, &g->l_registry); markmt(g); markbeingfnz(g); /* mark any finalizing object left from previous cycle */ @@ -1513,7 +1513,7 @@ void luaC_freeallobjects (lua_State *L) { separatetobefnz(g, 1); /* separate all objects with finalizers */ lua_assert(g->finobj == NULL); callallpendingfinalizers(L); - deletelist(L, g->allgc, obj2gco(g->mainthread)); + deletelist(L, g->allgc, obj2gco(mainthread(g))); lua_assert(g->finobj == NULL); /* no new finalizers */ deletelist(L, g->fixedgc, NULL); /* collect fixed objects */ lua_assert(g->strt.nuse == 0); @@ -1526,7 +1526,7 @@ static void atomic (lua_State *L) { GCObject *grayagain = g->grayagain; /* save original list */ g->grayagain = NULL; lua_assert(g->ephemeron == NULL && g->weak == NULL); - lua_assert(!iswhite(g->mainthread)); + lua_assert(!iswhite(mainthread(g))); g->gcstate = GCSatomic; markobject(g, L); /* mark running thread */ /* registry and global metatables may be changed by API */ -- cgit v1.2.3-55-g6feb