On 9/9/20 8:43 PM, Esteban Maringolo wrote:
On Wed, Sep 9, 2020 at 11:58 PM Eliot Miranda <eliot.mira...@gmail.com> wrote:
In VisualWorks, for example, a WeakArray is primed with an Object instance, and
this gets collected every scavenge.
So the WeakArray is notified. From this VW builds a notification system.
I guess this is how VisualWorks changes its cursor from a regular
pointer to the, sometimes dreadful, "GC" icon during garbage
collection.
Isn't it?
No, that wouldn't work. Notification based on a weak array can only
notify after the scavenge (or other GC) has happened, at which point
it's too late to put up the GC cursor.
And a weak array doesn't seem like it could be reliable for notification
of scavenge -- what if the Object in the weak array gets tenured? Then
only an incremental or full GC could collect it and notify. Scavenge
notification is done by the VM signaling a semaphore that a scavenge
notification thread is waiting on.
And the GC cursor is simple -- it's explicitly set by Smalltalk code
before a compacting GC, and set back afterward.
Regards,
-Martin