@@ -465,6 +465,8 @@ static void restartcollection (global_State *g) {
465465** TOUCHED1 objects need to be in the list. TOUCHED2 doesn't need to go
466466** back to a gray list, but then it must become OLD. (That is what
467467** '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.
468470*/
469471static void genlink (global_State * g , GCObject * o ) {
470472 lua_assert (isblack (o ));
@@ -480,7 +482,8 @@ static void genlink (global_State *g, GCObject *o) {
480482** Traverse a table with weak values and link it to proper list. During
481483** propagate phase, keep it in 'grayagain' list, to be revisited in the
482484** 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.
484487*/
485488static void traverseweakvalue (global_State * g , Table * h ) {
486489 Node * n , * limit = gnodelast (h );
@@ -501,6 +504,8 @@ static void traverseweakvalue (global_State *g, Table *h) {
501504 linkgclist (h , g -> grayagain ); /* must retraverse it in atomic phase */
502505 else if (hasclears )
503506 linkgclist (h , g -> weak ); /* has to be cleared later */
507+ else
508+ genlink (g , obj2gco (h ));
504509}
505510
506511
0 commit comments