diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2025-01-31 13:51:38 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2025-01-31 13:51:38 -0300 |
commit | fa1382b5cd504bdfc5fc3f5c447ed09a4c9804fd (patch) | |
tree | 5c5f4f75e46a0ce1e82eca4395457627895c665c /lgc.c | |
parent | d1e677c52be3b107a7a29fdc482158f6d9251e79 (diff) | |
download | lua-fa1382b5cd504bdfc5fc3f5c447ed09a4c9804fd.tar.gz lua-fa1382b5cd504bdfc5fc3f5c447ed09a4c9804fd.tar.bz2 lua-fa1382b5cd504bdfc5fc3f5c447ed09a4c9804fd.zip |
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.
Diffstat (limited to 'lgc.c')
-rw-r--r-- | lgc.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -78,7 +78,7 @@ | |||
78 | ((*getArrTag(t,i) & BIT_ISCOLLECTABLE) ? getArrVal(t,i)->gc : NULL) | 78 | ((*getArrTag(t,i) & BIT_ISCOLLECTABLE) ? getArrVal(t,i)->gc : NULL) |
79 | 79 | ||
80 | 80 | ||
81 | #define markvalue(g,o) { checkliveness(g->mainthread,o); \ | 81 | #define markvalue(g,o) { checkliveness(mainthread(g),o); \ |
82 | if (valiswhite(o)) reallymarkobject(g,gcvalue(o)); } | 82 | if (valiswhite(o)) reallymarkobject(g,gcvalue(o)); } |
83 | 83 | ||
84 | #define markkey(g, n) { if keyiswhite(n) reallymarkobject(g,gckey(n)); } | 84 | #define markkey(g, n) { if keyiswhite(n) reallymarkobject(g,gckey(n)); } |
@@ -441,7 +441,7 @@ static void cleargraylists (global_State *g) { | |||
441 | static void restartcollection (global_State *g) { | 441 | static void restartcollection (global_State *g) { |
442 | cleargraylists(g); | 442 | cleargraylists(g); |
443 | g->GCmarked = 0; | 443 | g->GCmarked = 0; |
444 | markobject(g, g->mainthread); | 444 | markobject(g, mainthread(g)); |
445 | markvalue(g, &g->l_registry); | 445 | markvalue(g, &g->l_registry); |
446 | markmt(g); | 446 | markmt(g); |
447 | markbeingfnz(g); /* mark any finalizing object left from previous cycle */ | 447 | markbeingfnz(g); /* mark any finalizing object left from previous cycle */ |
@@ -1513,7 +1513,7 @@ void luaC_freeallobjects (lua_State *L) { | |||
1513 | separatetobefnz(g, 1); /* separate all objects with finalizers */ | 1513 | separatetobefnz(g, 1); /* separate all objects with finalizers */ |
1514 | lua_assert(g->finobj == NULL); | 1514 | lua_assert(g->finobj == NULL); |
1515 | callallpendingfinalizers(L); | 1515 | callallpendingfinalizers(L); |
1516 | deletelist(L, g->allgc, obj2gco(g->mainthread)); | 1516 | deletelist(L, g->allgc, obj2gco(mainthread(g))); |
1517 | lua_assert(g->finobj == NULL); /* no new finalizers */ | 1517 | lua_assert(g->finobj == NULL); /* no new finalizers */ |
1518 | deletelist(L, g->fixedgc, NULL); /* collect fixed objects */ | 1518 | deletelist(L, g->fixedgc, NULL); /* collect fixed objects */ |
1519 | lua_assert(g->strt.nuse == 0); | 1519 | lua_assert(g->strt.nuse == 0); |
@@ -1526,7 +1526,7 @@ static void atomic (lua_State *L) { | |||
1526 | GCObject *grayagain = g->grayagain; /* save original list */ | 1526 | GCObject *grayagain = g->grayagain; /* save original list */ |
1527 | g->grayagain = NULL; | 1527 | g->grayagain = NULL; |
1528 | lua_assert(g->ephemeron == NULL && g->weak == NULL); | 1528 | lua_assert(g->ephemeron == NULL && g->weak == NULL); |
1529 | lua_assert(!iswhite(g->mainthread)); | 1529 | lua_assert(!iswhite(mainthread(g))); |
1530 | g->gcstate = GCSatomic; | 1530 | g->gcstate = GCSatomic; |
1531 | markobject(g, L); /* mark running thread */ | 1531 | markobject(g, L); /* mark running thread */ |
1532 | /* registry and global metatables may be changed by API */ | 1532 | /* registry and global metatables may be changed by API */ |