lua-users home
lua-l archive

Re: pushclosure may be has a BUG

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


ok, I see.
I known why crash. I try write a backend thread gc. not use color, just push object new/fix/attach/detach operator to gc thread, I rewrite luaC_objbarrier as attach.

in that case, I need proto var "p" attach to "ncl", I saw luaC_objbarrier(ncl, upvals[I]) in the next few lines. so I think it's maybe a leak.

---- Replied Message ----
Date 12/25/2022 23:33
Subject Re: pushclosure may be has a BUG
> lua 5.4.4 lvm.c:794
> static void pushclosure(...) {
> ...
> ncl->p = p; /* it need barrier */
> luaC_objbarrier(L, ncl, p) /* fix BUG */
> ...
> }
> when I test my modified code on GC,I find it cause crash.

Are you sure? The sequence is this:

LClosure *ncl = luaF_newLclosure(L, nup);
ncl->p = p;
luaC_objbarrier(L, ncl, p); /* ??? */

As 'ncl' was just created, it must be white; but 'luaC_objbarrier' is
a macro that would only do anything if 'ncl' was black. That is,
the barrier would never be activated.

-- Roberto

AltStyle によって変換されたページ (->オリジナル) /