Skip to content

Commit

Permalink
Merge pull request #7479 from Agoric/acknowledge-universal-worker-blo…
Browse files Browse the repository at this point in the history
…ckability

Eliminate nugatory "workerCanBlock" support
  • Loading branch information
mergify[bot] authored Apr 22, 2023
2 parents 9ec9ce2 + 8c50966 commit 18a0516
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 46 deletions.
2 changes: 1 addition & 1 deletion packages/SwingSet/src/kernel/vat-loader/manager-local.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
}

Expand Down
23 changes: 1 addition & 22 deletions packages/SwingSet/src/supervisors/supervisor-helper.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { assert } from '@agoric/assert';
import {
insistVatSyscallObject,
insistVatSyscallResult,
Expand Down Expand Up @@ -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 } */
Expand All @@ -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;
Expand Down Expand Up @@ -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);
}

Expand Down
23 changes: 1 addition & 22 deletions packages/swingset-xsnap-supervisor/lib/supervisor-helper.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { assert } from '@agoric/assert';
import {
insistVatSyscallObject,
insistVatSyscallResult,
Expand Down Expand Up @@ -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 } */
Expand All @@ -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;
Expand Down Expand Up @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ function makeWorker(port) {
return result;
}

const syscall = makeSupervisorSyscall(syscallToManager, true);
const syscall = makeSupervisorSyscall(syscallToManager);

const vatPowers = {
makeMarshal,
Expand Down

0 comments on commit 18a0516

Please sign in to comment.