diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2025-04-15 17:00:30 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2025-04-15 17:00:30 -0300 |
commit | 3dbb1a4b894c0744a331d4319d8d1704dc4ad943 (patch) | |
tree | 53ca693828759df1f56f7adabdeaa022a0db0fc7 /lgc.c | |
parent | 3dd8ea54daa77345a8f193e871f6792722d8e131 (diff) | |
download | lua-3dbb1a4b894c0744a331d4319d8d1704dc4ad943.tar.gz lua-3dbb1a4b894c0744a331d4319d8d1704dc4ad943.tar.bz2 lua-3dbb1a4b894c0744a331d4319d8d1704dc4ad943.zip |
In generational collection, objects marked as touched1 stay in gray
lists between collections. This commit fixes a bug introduced in
commit 808976bb59.
Diffstat (limited to '')
-rw-r--r-- | lgc.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -465,6 +465,8 @@ static void restartcollection (global_State *g) { | |||
465 | ** TOUCHED1 objects need to be in the list. TOUCHED2 doesn't need to go | 465 | ** TOUCHED1 objects need to be in the list. TOUCHED2 doesn't need to go |
466 | ** back to a gray list, but then it must become OLD. (That is what | 466 | ** back to a gray list, but then it must become OLD. (That is what |
467 | ** 'correctgraylist' does when it finds a TOUCHED2 object.) | 467 | ** 'correctgraylist' does when it finds a TOUCHED2 object.) |
468 | ** This function is a no-op in incremental mode, as objects cannot be | ||
469 | ** marked as touched in that mode. | ||
468 | */ | 470 | */ |
469 | static void genlink (global_State *g, GCObject *o) { | 471 | static void genlink (global_State *g, GCObject *o) { |
470 | lua_assert(isblack(o)); | 472 | lua_assert(isblack(o)); |
@@ -480,7 +482,8 @@ static void genlink (global_State *g, GCObject *o) { | |||
480 | ** Traverse a table with weak values and link it to proper list. During | 482 | ** Traverse a table with weak values and link it to proper list. During |
481 | ** propagate phase, keep it in 'grayagain' list, to be revisited in the | 483 | ** propagate phase, keep it in 'grayagain' list, to be revisited in the |
482 | ** atomic phase. In the atomic phase, if table has any white value, | 484 | ** atomic phase. In the atomic phase, if table has any white value, |
483 | ** put it in 'weak' list, to be cleared. | 485 | ** put it in 'weak' list, to be cleared; otherwise, call 'genlink' |
486 | ** to check table age in generational mode. | ||
484 | */ | 487 | */ |
485 | static void traverseweakvalue (global_State *g, Table *h) { | 488 | static void traverseweakvalue (global_State *g, Table *h) { |
486 | Node *n, *limit = gnodelast(h); | 489 | Node *n, *limit = gnodelast(h); |
@@ -501,6 +504,8 @@ static void traverseweakvalue (global_State *g, Table *h) { | |||
501 | linkgclist(h, g->grayagain); /* must retraverse it in atomic phase */ | 504 | linkgclist(h, g->grayagain); /* must retraverse it in atomic phase */ |
502 | else if (hasclears) | 505 | else if (hasclears) |
503 | linkgclist(h, g->weak); /* has to be cleared later */ | 506 | linkgclist(h, g->weak); /* has to be cleared later */ |
507 | else | ||
508 | genlink(g, obj2gco(h)); | ||
504 | } | 509 | } |
505 | 510 | ||
506 | 511 | ||