lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]



On 3-Aug-05, at 9:17 AM, Rici Lake wrote:

That's a little disturbing, because it seems to imply that something on the stack might not get marked (in this case, the closure in the local 'capture'). I'm sure there are subtleties that I'm not seeing, though.

OK, I found the thing I was missing -- the grayagain list. So all stacks are re-marked in atomic(), which should take care of any mutated objects.

Consequently, the only problem is the loss of the g->gray list after upvals are re-marked.

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.

Here's the corrected patch (really, just a delete of the second patch-chunk; thanks, Mike). (By the way, I, for one, would appreciate a complete work6 patchset -- but if you don't want to post that to the list, I'd settle for email :)

R.

---- cut here

--- lua-5.1-work6/src/lgc.c	2005-05-05 17:34:03 +0200
+++ src/lgc.c	2005-08-03 15:17:17 +0200
@@ -528,10 +528,10 @@
 static void atomic (lua_State *L) {
   global_State *g = G(L);
   size_t udsize;  /* total size of userdata to be finalized */
-  /* remark objects cautch by write barrier */
-  propagateall(g);
   /* remark occasional upvalues of (maybe) dead threads */
   remarkupvals(g);
+  /* remark objects caught by write barrier */
+  propagateall(g);
   /* remark weak tables */
   g->gray = g->weak;
   g->weak = NULL;