You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The vat-side delivery of GC events is driven by FinalizationRegistry callbacks firing at end-of-crank, after GC has been provoked and finalizers have had a chance to run. This populates the "dead set", which is then scanned to see what items are safe to drop, which can be retired, and what needs to be processed further.
GC as a whole will start saving RAM when:
the liveslots "safety pins" are removed, allowing objects to be collected (this ticket)
liveslots responds to finalizers and emits dropImport at the right time (this ticket)
the kernel processes refcounts and emits dispatch.dropExport
the kernel acts upon syscall.dropImport by decrementing refcounts
liveslots acts upon dispatch.dropExport (by dropping its strongref to the Remotable)
currently it waits for the userspace to become idle, then returns
instead, when userspace becomes idle, it will use gcAndFinalize to provoke a GC sweep (using some engine-specific means) and wait long enough for finalizers to run
then processDeadSet() will be called
finalizers already collect dead vrefs in the dead set, no change needed there
processDeadSet must examine each now-un-strong-referenced vref and decide what to do:
later, we'll also ask the VOM if the vref is in use as a key of a Weak Map/Set, and thus still recognizable, and if not, also send it to retireImport. but not today.
Representatives are exports, and for now are ignored
Remotables are sent to syscall.retireExport, since once the Remotable is gone, nobody can ever reach it again
Dependencies
It won't be safe to remove the safety pins until everything inside the vat is holding on to the objects they're supposed to. This means:
Unit tests which create a liveslots instance (without a kernel) whose userspace code creates and unreferences various objects. The test will observe the syscalls it makes to assert they are the expected ones.
The text was updated successfully, but these errors were encountered:
Change liveslots to provoke GC at mid-crank, then process the "dead set" and
emit `syscall.dropImports` for everything we can.
For now, we conservatively assume that everything remains recognizable, so we
do *not* emit `syscall.retireImport` for anything. The vref might be used as
a WeakMap/WeakSet key, and the VOM isn't yet tracking those. When #3161 is
done, we'll change liveslots to ask the VOM about each vref, and retire the
ones it does not know how to recognize (which will hopefully be the majority
of them).
closes#3147
refs #2615
refs #2660
Change liveslots to provoke GC at mid-crank, then process the "dead set" and
emit `syscall.dropImports` for everything we can.
For now, we conservatively assume that everything remains recognizable, so we
do *not* emit `syscall.retireImport` for anything. The vref might be used as
a WeakMap/WeakSet key, and the VOM isn't yet tracking those. When #3161 is
done, we'll change liveslots to ask the VOM about each vref, and retire the
ones it does not know how to recognize (which will hopefully be the majority
of them).
closes#3147
refs #2615
refs #2660
What is the Problem Being Solved?
The vat-side delivery of GC events is driven by
FinalizationRegistry
callbacks firing at end-of-crank, after GC has been provoked and finalizers have had a chance to run. This populates the "dead set", which is then scanned to see what items are safe to drop, which can be retired, and what needs to be processed further.GC as a whole will start saving RAM when:
dropImport
at the right time (this ticket)dispatch.dropExport
syscall.dropImport
by decrementing refcountsdispatch.dropExport
(by dropping its strongref to the Remotable)part of #3106
Description of the Design
dispatch
function.gcAndFinalize
to provoke a GC sweep (using some engine-specific means) and wait long enough for finalizers to runprocessDeadSet()
will be calleddropImport
#3133), can be sent todropImport
retireImport
. but not today.syscall.retireExport
, since once the Remotable is gone, nobody can ever reach it againDependencies
It won't be safe to remove the safety pins until everything inside the vat is holding on to the objects they're supposed to. This means:
Test Plan
Unit tests which create a liveslots instance (without a kernel) whose userspace code creates and unreferences various objects. The test will observe the syscalls it makes to assert they are the expected ones.
The text was updated successfully, but these errors were encountered: