From aa468af0a4ee66a5da429f63b70222fe74f461e2 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Thu, 22 Aug 2024 11:37:25 -0700 Subject: [PATCH] WIP: possible fix --- packages/swingset-liveslots/src/liveslots.js | 24 +++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/packages/swingset-liveslots/src/liveslots.js b/packages/swingset-liveslots/src/liveslots.js index 4490679c4d56..20de4cf302a5 100644 --- a/packages/swingset-liveslots/src/liveslots.js +++ b/packages/swingset-liveslots/src/liveslots.js @@ -284,19 +284,31 @@ function build( for (const vref of possiblyRetiredSet) { // eslint-disable-next-line no-use-before-define - if (!getValForSlot(vref) && !deadSet.has(vref)) { - // Don't retire things that haven't yet made the transition to dead, - // i.e., always drop before retiring - // eslint-disable-next-line no-use-before-define - if (!vrm.isVrefRecognizable(vref)) { - importsToRetire.add(vref); + if (getValForSlot(vref)) { + continue; // reachable by RAM pillar inhibits retirement + } + const { virtual, durable, allocatedByVat, type } = parseVatSlot(vref); + if (type !== 'object') { + continue; // we only retire objects + } + if (!virtual && !durable && !allocatedByVat) { + if (vrm.isPresenceReachable(vref)) { + continue; // reachable by vdata pillar inhibits retirement } } + // TODO: what was the deadSet check for? it wasn't sufficient. + // if (deadSet.has(vref)) { + // continue; + // } + if (!vrm.isVrefRecognizable(vref)) { + importsToRetire.add(vref); + } } possiblyRetiredSet.clear(); const deadBaseRefs = Array.from(deadSet); deadBaseRefs.sort(); + console.log(`== sFDO scanning deadBaseRefs`, deadBaseRefs); for (const baseRef of deadBaseRefs) { const { virtual, durable, allocatedByVat, type } = parseVatSlot(baseRef);