From 808976bb59d91a031d9832b5482a9fb5a41faee3 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 12 Mar 2025 12:35:36 -0300 Subject: Small correction in 'traverseweakvalue' After a weak table is traversed in the atomic phase, if it does not have white values ('hasclears') it does not need to be retraversed again. (Comments were correct, but code did not agree with them.) --- lgc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lgc.c b/lgc.c index e8533052..cada07d9 100644 --- a/lgc.c +++ b/lgc.c @@ -497,10 +497,10 @@ static void traverseweakvalue (global_State *g, Table *h) { hasclears = 1; /* table will have to be cleared */ } } - if (g->gcstate == GCSatomic && hasclears) - linkgclist(h, g->weak); /* has to be cleared later */ - else + if (g->gcstate == GCSpropagate) linkgclist(h, g->grayagain); /* must retraverse it in atomic phase */ + else if (hasclears) + linkgclist(h, g->weak); /* has to be cleared later */ } -- cgit v1.2.3-55-g6feb