lua-users home
lua-l archive

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


在 2016/3/25 22:48, Wangbo 写道:
As i understand, if set new key/value into one black table object, luaC_barrierback will mark table as gray again. so that at atomic phase  system will re-mark table again. finally previous new key/value will be also marked.

exactly.

How about luaC_barrierback's behavior at sweep phase before GC change table from black to current white? table will be marked as gray from black. yes. no more call luaC_barrierback, but GC still need sweep it and change it to current while.


yes, but this is no harm. at sweep phase, a gray object and a black object has the same meaning: it is not dead.
and the newly inserted entries which triggered the barrier will be __current__ white, so they are not dead either.

i think luaC_barrierback should change table from black to current white directly at sweep phase.  please correct me if my statement is wrong.

this is what the forward barrier will do. the backward barrier could do this at the sweep phase of course, in which
case it just behaves like a forward barrier. IMHO you shift the later sweep operation ahead, but you don't gain much.
when the gc encounter the table when sweep the list, it will check aliveness of the table and sweep it again anyway.

--
the nerdy Peng / 书呆彭 / Sent from Thunderbird