Right, it would cost another pass over the chain of weak handles. We might be able to avoid that if we had more control over handle chain traversal during gc, where we could preprocess the handle chain, for instance divide the handles into buckets depending on their state in one pass, and from then on only look into the relevant buckets.
On Thu, Oct 29, 2009 at 2:46 PM, Anton Muhin <[email protected]> wrote: > Christian, nice generalization of only held by really weak handler. I > will need some more time to think about it. One immediate concern: if > I got you algorithm right, that would require traversal starting from > only weakly reachable nodes which takes additional time (we didn't > need this traversal before), so there might be perf regressions. > > yours, > anton. > > On Thu, Oct 29, 2009 at 3:56 PM, Christian Plesner Hansen > <[email protected]> wrote: >> You're right, there is a problem here but I think we can fix it. >> Right now marking happens in several phases: >> >> - mark everything reachable from roots >> - remember which standard weak handles hold unmarked objects >> - mark those objects as well >> - finish gc >> - execute weak callbacks >> >> If we extend this with another phase it should solve the problem: >> >> - mark everything reachable from roots >> - remember which standard weak handles hold unmarked objects >> - mark those objects >> - remember which really weak handles hold unmarked objects >> - finish gc >> - execute weak and really-weak callbacks >> >> This way we conservatively assume that any object held transitively by >> standard weak handle is unsafe to collect eagerly through a really >> weak handle. >> >> >> -- Christian >> > --~--~---------~--~----~------------~-------~--~----~ v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev -~----------~----~----~----~------~----~------~--~---
