lua-users home
lua-l archive

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


> What about the average lifetime of objects?
> Are there cases where temporary white object
> turns gray because of a write barrier
> (even if the reference is quickly lost), and so
> always survives the first collection?
> 
> Sorry for the question, but I don't really follow the
> barrier code in the generational case.

It is the same as for the incremental case. There are two kinds of
barriers, forward and backward. Suppose Lua creates a new link from
A (an old object) to B (a new object). Forward barriers will make B
old. Backward barriers will add A to a remembered set (adding it to
a gray list), so they do not make B old.

Assignments to metatables, C upvalues, userdata environments, and closed
Lua upvalues use forward barriers. Assignment to table fields use
backward barriers. The stacks and all open upvalues are never black
(old), so assignment to them (local variables, temporaries, and open
upvalues) never trigger a barrier.

-- Roberto