Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: vat warehouse for LRU demand paged vats #2784

Merged
merged 22 commits into from
Jun 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
1a1a6b2
refactor(swingset): refine types for ManagerOptions, CapData
dckc May 19, 2021
54ca05b
docs(swingset): panic() does *not* throw
dckc May 25, 2021
e9f65d3
docs(xs-worker): handleCommand on manager side is async
dckc May 17, 2021
5c11f0a
feat(swingset): initial VatWarehouse for demand-paged vats
dckc Feb 9, 2021
ec6435b
style: js idioms, replay in parallel note
dckc May 27, 2021
dcbe73d
chore(vat-warehouse): raise default size of LRU cache to 50
dckc May 27, 2021
1cc7cac
test(vat-warehouse): 4 vats in warehouse with room for 2 online
dckc May 27, 2021
e9f3ff5
feat: get maxVatsOnline from swingset config
dckc May 31, 2021
2f89e0a
chore(vat-warehouse): clean up debug logging, TODOs
dckc May 31, 2021
077fb01
chore(loadVat): kernelSlog can't repeat addVat()
dckc May 31, 2021
86b55d9
chore(vat-warehouse): postpone enablePipelining optimization etc.
dckc May 31, 2021
64f71b6
chore: fix notifyTermination merge
dckc Jun 1, 2021
a9465fc
chore(vat-warehouse): close transcript on evict
dckc Jun 1, 2021
f7be97b
docs(swingset): clean up terminateVat docstring
dckc Jun 2, 2021
8752b93
feat(swingset): controller.getStatus() for online vats etc.
dckc Jun 3, 2021
7e1282e
chore(vat-warehouse): evict old vats when bringing new ones online
dckc Jun 3, 2021
43b43da
test(vat-warehouse): check online vats after each delivery
dckc Jun 3, 2021
7c955bc
docs: fix stray initSwingStore reference in @typedef
dckc Jun 6, 2021
1349c8d
chore(swingset): handle vat page-in in kernelSlog
dckc Jun 7, 2021
4bdd0dc
refactor: findOrCreateTranslators -> provideTranslators
dckc Jun 7, 2021
8b6439f
chore: dont' try to closeTranscript() on a terminated vat
dckc Jun 7, 2021
f2cb120
chore: async call needs await
dckc Jun 8, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/SwingSet/src/capdata.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { assert, details as X } from '@agoric/assert';
* @param {any} capdata The object to be tested
* @throws {Error} if, upon inspection, the parameter does not satisfy the above
* criteria.
* @returns {asserts capdata is CapData}
* @returns {asserts capdata is CapData<unknown>}
*/
export function insistCapData(capdata) {
assert.typeof(
Expand Down
23 changes: 20 additions & 3 deletions packages/SwingSet/src/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ export function makeStartXSnap(bundles, { snapstorePath, env, spawn }) {
* slogCallbacks?: unknown,
* slogFile?: string,
* testTrackDecref?: unknown,
* warehousePolicy?: { maxVatsOnline?: number },
* snapstorePath?: string,
* spawn?: typeof import('child_process').spawn,
* env?: Record<string, string | undefined>
Expand All @@ -148,6 +149,7 @@ export async function makeSwingsetController(
slogFile,
snapstorePath,
spawn = ambientSpawn,
warehousePolicy = {},
} = runtimeOptions;
if (typeof Compartment === 'undefined') {
throw Error('SES must be installed before calling makeSwingsetController');
Expand Down Expand Up @@ -303,7 +305,8 @@ export async function makeSwingsetController(
gcAndFinalize: makeGcAndFinalize(engineGC),
};

const kernelOptions = { verbose };
const kernelOptions = { verbose, warehousePolicy };
/** @type { ReturnType<typeof import('./kernel').default> } */
const kernel = buildKernel(kernelEndowments, deviceEndowments, kernelOptions);

if (runtimeOptions.verbose) {
Expand All @@ -312,6 +315,13 @@ export async function makeSwingsetController(

await kernel.start();

/**
* @param {T} x
* @returns {T}
* @template T
*/
const defensiveCopy = x => JSON.parse(JSON.stringify(x));

// the kernel won't leak our objects into the Vats, we must do
// the same in this wrapper
const controller = harden({
Expand All @@ -322,7 +332,7 @@ export async function makeSwingsetController(
writeSlogObject,

dump() {
return JSON.parse(JSON.stringify(kernel.dump()));
return defensiveCopy(kernel.dump());
},

verboseDebugMode(flag) {
Expand All @@ -342,7 +352,11 @@ export async function makeSwingsetController(
},

getStats() {
return JSON.parse(JSON.stringify(kernel.getStats()));
return defensiveCopy(kernel.getStats());
},

getStatus() {
return defensiveCopy(kernel.getStatus());
},

// these are for tests
Expand Down Expand Up @@ -393,6 +407,7 @@ export async function makeSwingsetController(
* slogCallbacks?: unknown,
* testTrackDecref?: unknown,
* snapstorePath?: string,
* warehousePolicy?: { maxVatsOnline?: number },
* }} runtimeOptions
* @typedef { import('@agoric/swing-store-simple').KVStore } KVStore
*/
Expand All @@ -408,12 +423,14 @@ export async function buildVatController(
debugPrefix,
slogCallbacks,
snapstorePath,
warehousePolicy,
} = runtimeOptions;
const actualRuntimeOptions = {
verbose,
debugPrefix,
slogCallbacks,
snapstorePath,
warehousePolicy,
};
const initializationOptions = { verbose, kernelBundles };
let bootstrapResult;
Expand Down
Loading