aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2025-03-12 12:35:36 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2025-03-12 12:35:36 -0300
commit808976bb59d91a031d9832b5482a9fb5a41faee3 (patch)
tree962f4874a0c04932facbef5debb7b15c3dcd568f
parentb5b1995f2925b2f9be4a48304ac97a38f8608648 (diff)
downloadlua-808976bb59d91a031d9832b5482a9fb5a41faee3.tar.gz
lua-808976bb59d91a031d9832b5482a9fb5a41faee3.tar.bz2
lua-808976bb59d91a031d9832b5482a9fb5a41faee3.zip
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.)
-rw-r--r--lgc.c6
1 files 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) {
497 hasclears = 1; /* table will have to be cleared */ 497 hasclears = 1; /* table will have to be cleared */
498 } 498 }
499 } 499 }
500 if (g->gcstate == GCSatomic && hasclears) 500 if (g->gcstate == GCSpropagate)
501 linkgclist(h, g->weak); /* has to be cleared later */
502 else
503 linkgclist(h, g->grayagain); /* must retraverse it in atomic phase */ 501 linkgclist(h, g->grayagain); /* must retraverse it in atomic phase */
502 else if (hasclears)
503 linkgclist(h, g->weak); /* has to be cleared later */
504} 504}
505 505
506 506