On Sat, Oct 31, 2009 at 1:26 AM, Christian Plesner Hansen
<[email protected]> wrote:
>> Just to recap.  After normal marking which finds strongly reachable
>> objects, you suggest to do another mark to find objects reachable via
>> weak handles only.
>
> No, we don't need to mark the objects kept by really weak handles
> because we're not going to keep them alive.  All we need to do is
> record which really weak handles point to objects that are now dead so
> we can do the callbacks during post-processing.

We discussed this with Anton and I managed to convince him that adding
really weak handles doesn't introduce new problems when making weakly
reachable objects strongly reachable in weak callbacks. Really weak
handles only change how objects are marked by their handles and not
when starting from other handles or other types of roots. So in
Anton's first example above the fact that A's handle is just weak (not
really weak) will keep B alive. The problem here is that even in
existing code B's weak callback will be invoked and may destroy some
related native state that may well be impossible to restore when B
becomes reachable again. We think we know how to fix this. I'll send a
separate email with a proposal.

Anton's second example is partly covered by Christian's comment that
really weak handles should be cleared to prevent accessing garbage.
But it's true that dealing with possibly empty handles can make code
of caches slightly more complex. I think that properly fixing the
issue above will address this one as well.


-- Vitaly

--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to