<div dir="ltr">Hi All,<div><br></div><div>    I want to check my understanding of reference semantics for image segments as I&#39;m close to completing the Spur implementation.  Specifically the question is whether objects reachable only through weak pointers should be included in an image segment or not.</div><div><br></div><div>Remember that an image segment is created from the transitive closure of an Array of root objects, the <i>segment roots</i>. i.e. we can think of an image segment as a set of objects created by tracing the object graph from the segment roots.</div><div><br></div><div>The segment always includes the segment roots.  Except for the roots, objects are excluded from the segment that are also reachable form the roots of the system (the <i>system roots</i>, effectively the root environment, Smalltalk, and the stack of the current process).</div><div><br></div><div>Consider a weak array in the transitive closure that is not reachable from the system roots, and hence should be included in the segment.  Objects referenced from that weak array may be in one of three categories</div><div><br></div><div>- reachable from the system roots (and hence not to be included in the segment)</div><div>- <i>not</i> reachable form the system roots, but reachable from the segment roots via strong pointers (and hence to be included in the segment)<br clear="all"><div>- <i>not</i> reachable form the system roots, <i>not</i> reachable from the segment roots via strong pointers<br></div><div><br></div><div>Should this last category be included or excluded from the segment?  I think that it makes no difference, and excluding them is only an optimization.  The argument is as follows.  Imagine that immediately after loading the image segment there is a garbage collection.  That garbage collection will collect all the objects in the last category as they are only reachable from the weak arrays in the segment.  Hence we are free to follow weak references as if they are strong when we create the image segment, leaving it to subsequent events to reclaim those objects.  </div><div><br></div><div>An analogous argument accounts for objects reachable from ephemerons.  Is my reasoning sound?</div>-- <br>best,<div>Eliot</div>
</div></div>