Skip to content

Commit

Permalink
fix(swingset): remove liveslots "safety pins"
Browse files Browse the repository at this point in the history
This removes the liveslots 'safety pins' that have inhibited collection of
objects until we were ready. I believe the collection of `pendingPromises`,
`exportedRemotables`, `importedDevices`, and the VOM's `reachableRemotables`
should keep everything alive that needs to be.

refs #3106
  • Loading branch information
warner committed May 25, 2021
1 parent f5c47ee commit 549c301
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions packages/SwingSet/src/kernel/liveSlots.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ function build(
const exportedRemotables = new Set(); // objects
const pendingPromises = new Set(); // Promises
const importedDevices = new Set(); // device nodes
const safetyPins = new Set(); // temporary
const deadSet = new Set(); // vrefs that are finalized but not yet reported

function retainExportedRemotable(vref) {
Expand Down Expand Up @@ -428,26 +427,14 @@ function build(
}

function registerValue(slot, val) {
const { type, virtual } = parseVatSlot(slot);
const { type } = parseVatSlot(slot);
slotToVal.set(slot, new WeakRef(val));
valToSlot.set(val, slot);
// we don't dropImports on promises, to avoid interaction with retire
if (type === 'object') {
deadSet.delete(slot); // might have been FINALIZED before, no longer
droppedRegistry.register(val, slot);
}

// TODO: until #2724 is implemented, we cannot actually release
// Presences, else WeakMaps would forget their entries. I'm also
// uncertain about releasing Promises early. We disable GC by stashing
// everything in the (strong) `safetyPins` Set. Promises are deleted from
// this set when we retire their identifiers in retirePromiseID. Note
// that test-liveslots.js test('dropImports') passes despite this,
// because it uses a fake WeakRef that doesn't care about the strong
// reference.
if (!virtual) {
safetyPins.add(val);
}
}

function convertSlotToVal(slot, iface = undefined) {
Expand Down Expand Up @@ -716,7 +703,6 @@ function build(
if (p) {
valToSlot.delete(p);
pendingPromises.delete(p);
safetyPins.delete(p);
}
slotToVal.delete(promiseID);
}
Expand Down

0 comments on commit 549c301

Please sign in to comment.