[Vm-dev] Ephemerons - hope it is right this time :)

Eliot Miranda eliot.miranda at gmail.com
Thu Jun 2 18:38:52 UTC 2011

Hi Igor,

On Thu, Jun 2, 2011 at 5:00 AM, Igor Stasenko <siguctua at gmail.com> wrote:

> I have corrected implementation, hope it is right this time :)
> If Ephemeron's key is almost-collectable (reachable only by ephemeron
> itself),
> then it is reported to image side.

That's not right.  The correct definition is "reachable only by ephemerons"
(plural).  The way to think about it is that at any stage in the GCs trace
it has traced from the roots up to, but not through ephemerons that have
keys not reachable from the roots.  So it has collected the current set of
ephemerons whose keys are only reachable from ephemerons.  This set of
ephemerons are to mourn (be activated, to be queued for finalization) since
their keys are otherwise unreachable.  This set is added to the finalization
queue and now tracing continues through those ephemerons.  This subsequent
tracing may also encounter a new set of ephemerons whose keys are only
reachable from ephemerons.  So this set is added to the finalization queue
and so on until no more objects can be traced.  The GC can now finish and
all the ephemerons in the finalization queue can mourn their keys.

This is really important as it allows one to add mounr behaviours
independent of a particular object.  One can have more than one mourn
action, each occurring through a different ephemeron.

And that reminds me, in your implementation how is an object marked as being
an ephemeron?  Is it a header bit or does it depend on a class?  If it
depends on a class that's an unsatisfactory, but acceptable limitation,
since we can't create different types of ephemeron for different tasks.
 Instead, if we want different mourn behaviours they have to be based on
some mapping from ephemeron to something else, such as the dictionary an
ephemeron is in (ephemerons are specifically designed to look like
Associations so they can liv comfortably in Dictionaries).


> Then VM continues tracing ephemeron as object with all strong slots,
> and if there are other ephemerons
> which need to be reported as well, same procedure will be done for them.
> It will loop until no other ephemerons with almost-collectable keys
> can be found and nothing left to be traced.
> See
> http://code.google.com/p/cog/issues/detail?id=44
> for the code.
> (I will upload the VMMaker package with changes now).
> --
> Best regards,
> Igor Stasenko AKA sig.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20110602/6db229c2/attachment-0001.htm

More information about the Vm-dev mailing list