[Vm-dev] Re: [squeak-dev] Image Segment semantics and weakness
eliot.miranda at gmail.com
Mon Oct 20 04:19:21 UTC 2014
On Oct 19, 2014, at 9:05 PM, Andres Valloud <avalloud at smalltalk.comcastbiz.net> wrote:
>>> Ephemerons are still problematic. Should they be finalized both in
>>> the host image, as well as in other images that load the image
>>> segment? I'd consider letting ephemerons queued for finalization
>>> during step 4 become regular strong objects in the image segment,
>>> such that loading them into a new image does not trigger random
>>> finalization. Steps 4 and 5 produce that for free (because
>>> ephemerons in the finalization queue become regular strong
>> IMO the only sane thing is to treat then as strong objects. If
>> something gets finalized twice so be it; there's no way to complete
>> finalization while the segment is being created anyway, so even if
>> segment creation queues ephemerons fir finalization they'll still be
>> in the segment. There are lots of potential issues here which the
>> segment creation primitive can't deal with ( stale file handles,
>> dangling C pointers ), so expecting it to work miracles with
>> ephemeral references is a waste of effort. KISS. No queuing of
>> ephemerons for finalization; just mark as if strong.
> Hang on, why would the finalization queue live in the segment?
I didn't say they did. My point re finalization is that the segment creation prim only dies a mark and an unmarked, not a GC. So no finalization is done then.
> I'd imagine it will be referenced from the system roots, so queuing ephemerons will do that in the host image. By the time the queued ephemerons are seen in the segment by someone else, they will be strong objects (because they got to the finalization queue) so they won't finalize when loaded from a segment by construction.
> Ideally, the mechanism would treat both weak arrays and ephemerons' gc-special behavior the same way. So, if the desire is to prevent weak arrays from pulling in garbage, then I'd say that finalizing ephemerons in the host image should also happen for the sake of consistency.
> I agree that if some _other_ ephemerons try to finalize after loading the segment... how about users do that at their own risk? :)
More information about the Vm-dev