From 549c3019c3513cfeb35211bc42178cd0102c6543 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Wed, 19 May 2021 23:35:37 -0700 Subject: [PATCH] fix(swingset): remove liveslots "safety pins" 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 --- packages/SwingSet/src/kernel/liveSlots.js | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/packages/SwingSet/src/kernel/liveSlots.js b/packages/SwingSet/src/kernel/liveSlots.js index 4ffdb8e3d94..48f9ed308f5 100644 --- a/packages/SwingSet/src/kernel/liveSlots.js +++ b/packages/SwingSet/src/kernel/liveSlots.js @@ -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) { @@ -428,7 +427,7 @@ 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 @@ -436,18 +435,6 @@ function build( 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) { @@ -716,7 +703,6 @@ function build( if (p) { valToSlot.delete(p); pendingPromises.delete(p); - safetyPins.delete(p); } slotToVal.delete(promiseID); }