Skip to content

Commit

Permalink
chore(swingsetset): use 'gcTools' consistently on all vat workers
Browse files Browse the repository at this point in the history
This removes `vatDecref` from manager-local, which will be replaced by a
syscall-based mechanism as part of #2615.
  • Loading branch information
warner committed Mar 15, 2021
1 parent b9c1a69 commit 60a74b9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
4 changes: 3 additions & 1 deletion packages/SwingSet/src/kernel/liveSlots.js
Original file line number Diff line number Diff line change
Expand Up @@ -634,13 +634,14 @@ function build(syscall, forVatID, cacheSize, vatPowers, vatParameters) {
* @param {*} vatPowers
* @param {*} vatParameters
* @param {number} cacheSize Upper bound on virtual object cache size
* @param {*} _gcTools
* @returns {*} { vatGlobals, dispatch, setBuildRootObject }
*
* setBuildRootObject should be called, once, with a function that will
* create a root object for the new vat The caller provided buildRootObject
* function produces and returns the new vat's root object:
*
* buildRootObject(vatPowers, vatParameters)
* buildRootObject(vatPowers, vatParameters)
*
* Within the vat, `import { E } from '@agoric/eventual-send'` will
* provide the E wrapper. For any object x, E(x) returns a proxy object
Expand All @@ -664,6 +665,7 @@ export function makeLiveSlots(
vatPowers = harden({}),
vatParameters = harden({}),
cacheSize = DEFAULT_VIRTUAL_OBJECT_CACHE_SIZE,
_gcTools,
) {
const allVatPowers = {
...vatPowers,
Expand Down
7 changes: 1 addition & 6 deletions packages/SwingSet/src/kernel/vatManager/manager-local.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export function makeLocalVatManagerFactory(tools) {
} = tools;

const { makeGetMeter, refillAllMeters, stopGlobalMeter } = meterManager;
const { WeakRef, FinalizationRegistry } = gcTools;
const baseVP = {
makeMarshal: allVatPowers.makeMarshal,
transformTildot: allVatPowers.transformTildot,
Expand Down Expand Up @@ -101,10 +100,6 @@ export function makeLocalVatManagerFactory(tools) {
vatParameters,
testLog: allVatPowers.testLog,
});
function vatDecref(vref, count) {
gcTools.decref(vatID, vref, count);
}
const lsgc = harden({ WeakRef, FinalizationRegistry, vatDecref });

// we might or might not use this, depending upon whether the vat exports
// 'buildRootObject' or a default 'setup' function
Expand All @@ -114,7 +109,7 @@ export function makeLocalVatManagerFactory(tools) {
vatPowers,
vatParameters,
virtualObjectCacheSize,
lsgc,
gcTools,
);

let meterRecord = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,13 +229,15 @@ function makeWorker(port) {
? virtualObjectCacheSize
: undefined;

const gcTools = {}; // future expansion

const ls = makeLiveSlots(
syscall,
vatID,
vatPowers,
vatParameters,
cacheSize,
// TODO: lsgc? API drift?
gcTools,
);

const endowments = {
Expand Down

0 comments on commit 60a74b9

Please sign in to comment.