Skip to content

Commit

Permalink
fix: fake VOM bitrot
Browse files Browse the repository at this point in the history
Closes #4591
  • Loading branch information
FUDCo committed Feb 17, 2022
1 parent dba86ff commit c9faf9c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 18 deletions.
6 changes: 0 additions & 6 deletions packages/SwingSet/src/kernel/virtualObjectManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,6 @@ export function makeCache(size, fetch, store) {
* instances, writing any changed state to the persistent store. This
* provided for testing; it otherwise has little use.
*
* - `makeVirtualObjectRepresentative` will provide a useeable, in-memory
* version of a virtual object, given its vat slot ID. This is used when
* deserializing a reference to an object that has been received in a message
* or is part of the persistent state of another virtual object that is being
* swapped in from storage.
*
* `makeKind` and `makeDurableKind` are made available to user vat code in the
* `VatData` global. The other two methods are for internal use by liveslots.
*/
Expand Down
2 changes: 0 additions & 2 deletions packages/SwingSet/tools/fakeVirtualObjectManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export function makeFakeVirtualObjectManager(vrm, fakeStuff, options = {}) {
makeDurableKind,
VirtualObjectAwareWeakMap,
VirtualObjectAwareWeakSet,
makeVirtualObjectRepresentative,
flushCache,
} = makeVirtualObjectManager(
fakeStuff.syscall,
Expand All @@ -37,7 +36,6 @@ export function makeFakeVirtualObjectManager(vrm, fakeStuff, options = {}) {
makeDurableKind,
VirtualObjectAwareWeakMap,
VirtualObjectAwareWeakSet,
makeVirtualObjectRepresentative,
};

const debugTools = {
Expand Down
20 changes: 10 additions & 10 deletions packages/SwingSet/tools/fakeVirtualSupport.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ class FakeFinalizationRegistry {
}

export function makeFakeLiveSlotsStuff(options = {}) {
let vom;
function setVom(vomToUse) {
assert(!vom, 'vom already configured');
vom = vomToUse;
let vrm;
function setVrm(vrmToUse) {
assert(!vrm, 'vrm already configured');
vrm = vrmToUse;
}

const {
Expand Down Expand Up @@ -174,10 +174,10 @@ export function makeFakeLiveSlotsStuff(options = {}) {
const { type, virtual } = parseVatSlot(slot);
assert.equal(type, 'object');
if (virtual) {
if (vom) {
return vom.makeVirtualObjectRepresentative(slot);
if (vrm) {
return vrm.reanimate(slot, false);
} else {
assert.fail('fake liveSlots stuff configured without vom');
assert.fail('fake liveSlots stuff configured without vrm');
}
} else {
return getValForSlot(slot);
Expand Down Expand Up @@ -216,7 +216,7 @@ export function makeFakeLiveSlotsStuff(options = {}) {
addToPossiblyDeadSet,
addToPossiblyRetiredSet,
dumpStore,
setVom,
setVrm,
};
}

Expand All @@ -235,7 +235,7 @@ export function makeFakeVirtualStuff(options = {}) {
const fakeStuff = makeFakeLiveSlotsStuff(options);
const vrm = makeFakeVirtualReferenceManager(fakeStuff);
const vom = makeFakeVirtualObjectManager(vrm, fakeStuff, options);
fakeStuff.setVom(vom);
fakeStuff.setVrm(vrm);
const cm = makeFakeCollectionManager(vrm, fakeStuff, options);
return { fakeStuff, vrm, vom, cm };
}
Expand All @@ -244,7 +244,7 @@ export function makeStandaloneFakeVirtualObjectManager(options = {}) {
const fakeStuff = makeFakeLiveSlotsStuff(options);
const vrm = makeFakeVirtualReferenceManager(fakeStuff);
const vom = makeFakeVirtualObjectManager(vrm, fakeStuff, options);
fakeStuff.setVom(vom);
fakeStuff.setVrm(vrm);
return vom;
}

Expand Down

0 comments on commit c9faf9c

Please sign in to comment.