[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: 51w6 upvalue GC bug
- From: Mike Pall <mikelu-0508@...>
- Date: Wed, 3 Aug 2005 15:32:35 +0200
Hi,
Rici Lake wrote:
> Moving the call to propagateall() at line 532 so that it comes after
> line 534 seems to solve the problem.
Indeed it does. I can't trigger the bug anymore.
> However, it is *just* possible that singlestep calls
> propagatemark on the stack (at line 569) and then luaC_step decides to
> return before singlestep is called again. Just at that moment, a new
> object could be put on the stack, and would not be marked.
Well, only changing this one does not help. The assertion still
triggers.
Combining both changes works fine, of course. I guess it's
pretty hard to find a test case that triggers when the 2nd
change is not in.
Anyway, combined patch below. Although I'd advise anyone to wait
for Roberto's opinion about it (when he's back in Rio), before
applying it.
Thanks for the comprehensive analysis, Ricky. ;-)
Bye,
Mike
--- 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;
@@ -565,12 +565,10 @@
return 0;
}
case GCSpropagate: {
- if (g->gray)
- return propagatemark(g);
- else { /* no more `gray' objects */
- atomic(L); /* finish mark phase */
- return 0;
- }
+ l_mem n = g->gray ? propagatemark(g) : 0;
+ if (!g->gray) /* no more `gray' objects */
+ atomic(L); /* finish mark phase */
+ return n;
}
case GCSsweepstring: {
lu_mem old = g->totalbytes;