[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: 51w6 upvalue GC bug
- From: Roberto Ierusalimschy <roberto@...>
- Date: Wed, 03 Aug 2005 16:09:11 -0300
As far as I can see, the (2nd) patch is correct.
> I'm still not completely convinced about weak tables; I can't shake the
> feeling that they ought to be done after the re-marking of the stacks
> rather than before. But don't take that as gospel.
I think it makes no difference. At that stage all of them work as
different "root" objects. All are gray and must be traversed. The
order should be irrelevant. (Actually, we also could concatenate all
lists [gray, weak, and grayagain] and call propagateall once. But
it is slightly more efficient as it is, because we avoid the list
About why weak tables are kept gray, it is really tricky. (Actually,
when you talked about the subject I could not remember the reason ;)
The point is that we must keep a list of weak tables so that we can
clear them after the collection. That list uses the gclist field. But
that means that we cannot link them to the grayagain list, even if we
modify them. The solution is to keep them gray, which avoids them being
"stopped" by the write barrier.