From 8c509660baa5deb17842c301939765c76581c907 Mon Sep 17 00:00:00 2001 From: Chip Morningstar Date: Sat, 22 Apr 2023 01:19:27 -0700 Subject: [PATCH] chore: Eliminate nugatory "workerCanBlock" support --- .../src/kernel/vat-loader/manager-local.js | 2 +- .../src/supervisors/supervisor-helper.js | 23 +------------------ .../lib/supervisor-helper.js | 23 +------------------ .../lib/supervisor-subprocess-xsnap.js | 2 +- 4 files changed, 4 insertions(+), 46 deletions(-) diff --git a/packages/SwingSet/src/kernel/vat-loader/manager-local.js b/packages/SwingSet/src/kernel/vat-loader/manager-local.js index 52fad693e73..4b51cf5b1b6 100644 --- a/packages/SwingSet/src/kernel/vat-loader/manager-local.js +++ b/packages/SwingSet/src/kernel/vat-loader/manager-local.js @@ -35,7 +35,7 @@ export function makeLocalVatManagerFactory({ return mk.getManager(shutdown); } - const syscall = makeSupervisorSyscall(mk.syscallFromWorker, true); + const syscall = makeSupervisorSyscall(mk.syscallFromWorker); return { syscall, finish }; } diff --git a/packages/SwingSet/src/supervisors/supervisor-helper.js b/packages/SwingSet/src/supervisors/supervisor-helper.js index 5cfed5d6856..7a541d5b7be 100644 --- a/packages/SwingSet/src/supervisors/supervisor-helper.js +++ b/packages/SwingSet/src/supervisors/supervisor-helper.js @@ -1,4 +1,3 @@ -import { assert } from '@agoric/assert'; import { insistVatSyscallObject, insistVatSyscallResult, @@ -60,11 +59,10 @@ export { makeSupervisorDispatch }; * VatSyscallObject and (synchronously) returns a VatSyscallResult. * * @param {VatSyscallHandler} syscallToManager - * @param {boolean} workerCanBlock * @typedef { unknown } TheSyscallObjectWithMethodsThatLiveslotsWants * @returns {TheSyscallObjectWithMethodsThatLiveslotsWants} */ -function makeSupervisorSyscall(syscallToManager, workerCanBlock) { +function makeSupervisorSyscall(syscallToManager) { function doSyscall(fields) { insistVatSyscallObject(fields); /** @type { VatSyscallObject } */ @@ -76,10 +74,6 @@ function makeSupervisorSyscall(syscallToManager, workerCanBlock) { console.warn(`worker got error during syscall:`, err); throw err; } - if (!workerCanBlock) { - // we don't expect an answer - return null; - } const vsr = r; insistVatSyscallResult(vsr); const [type, ...rest] = vsr; @@ -127,21 +121,6 @@ function makeSupervisorSyscall(syscallToManager, workerCanBlock) { vatstoreDelete: key => doSyscall(['vatstoreDelete', key]), }; - const blocking = [ - 'callNow', - 'vatstoreGet', - 'vatstoreGetNextKey', - 'vatstoreSet', - 'vatstoreDelete', - ]; - - if (!workerCanBlock) { - for (const name of blocking) { - const err = `this non-blocking worker transport cannot syscall.${name}`; - syscallForVat[name] = () => assert.fail(err); - } - } - return harden(syscallForVat); } diff --git a/packages/swingset-xsnap-supervisor/lib/supervisor-helper.js b/packages/swingset-xsnap-supervisor/lib/supervisor-helper.js index 27c7b6dddd8..88dab6bb734 100644 --- a/packages/swingset-xsnap-supervisor/lib/supervisor-helper.js +++ b/packages/swingset-xsnap-supervisor/lib/supervisor-helper.js @@ -1,4 +1,3 @@ -import { assert } from '@agoric/assert'; import { insistVatSyscallObject, insistVatSyscallResult, @@ -59,11 +58,10 @@ export { makeSupervisorDispatch }; * VatSyscallObject and (synchronously) returns a VatSyscallResult. * * @param {VatSyscallHandler} syscallToManager - * @param {boolean} workerCanBlock * @typedef { unknown } TheSyscallObjectWithMethodsThatLiveslotsWants * @returns {TheSyscallObjectWithMethodsThatLiveslotsWants} */ -function makeSupervisorSyscall(syscallToManager, workerCanBlock) { +function makeSupervisorSyscall(syscallToManager) { function doSyscall(fields) { insistVatSyscallObject(fields); /** @type { VatSyscallObject } */ @@ -75,10 +73,6 @@ function makeSupervisorSyscall(syscallToManager, workerCanBlock) { console.warn(`worker got error during syscall:`, err); throw err; } - if (!workerCanBlock) { - // we don't expect an answer - return null; - } const vsr = r; insistVatSyscallResult(vsr); const [type, ...rest] = vsr; @@ -126,21 +120,6 @@ function makeSupervisorSyscall(syscallToManager, workerCanBlock) { vatstoreDelete: key => doSyscall(['vatstoreDelete', key]), }; - const blocking = [ - 'callNow', - 'vatstoreGet', - 'vatstoreGetNextKey', - 'vatstoreSet', - 'vatstoreDelete', - ]; - - if (!workerCanBlock) { - for (const name of blocking) { - const err = `this non-blocking worker transport cannot syscall.${name}`; - syscallForVat[name] = () => assert.fail(err); - } - } - return harden(syscallForVat); } diff --git a/packages/swingset-xsnap-supervisor/lib/supervisor-subprocess-xsnap.js b/packages/swingset-xsnap-supervisor/lib/supervisor-subprocess-xsnap.js index a86afaa7b34..12974c79fc4 100644 --- a/packages/swingset-xsnap-supervisor/lib/supervisor-subprocess-xsnap.js +++ b/packages/swingset-xsnap-supervisor/lib/supervisor-subprocess-xsnap.js @@ -205,7 +205,7 @@ function makeWorker(port) { return result; } - const syscall = makeSupervisorSyscall(syscallToManager, true); + const syscall = makeSupervisorSyscall(syscallToManager); const vatPowers = { makeMarshal,