Skip to content

Commit

Permalink
fix(swingset): add GC dispatch stubs
Browse files Browse the repository at this point in the history
This adds `dispatch.retireExports` and `dispatch.retireImports` to the
pre-existing `dispatch.dropExports` stub: tolerated but ignored by liveslots,
to allow kernel and liveslots development to proceed in parallel.

refs #2724
  • Loading branch information
warner committed Apr 26, 2021
1 parent a18a860 commit 08a971e
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
24 changes: 24 additions & 0 deletions packages/SwingSet/src/kernel/liveSlots.js
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,20 @@ function build(
console.log(`-- liveslots ignoring dropExports`);
}

function retireExports(vrefs) {
assert(Array.isArray(vrefs));
vrefs.map(vref => insistVatType('object', vref));
vrefs.map(vref => assert(parseVatSlot(vref).allocatedByVat));
console.log(`-- liveslots ignoring retireExports`);
}

function retireImports(vrefs) {
assert(Array.isArray(vrefs));
vrefs.map(vref => insistVatType('object', vref));
vrefs.map(vref => assert(parseVatSlot(vref).allocatedByVat));
console.log(`-- liveslots ignoring retireImports`);
}

// TODO: when we add notifyForward, guard against cycles

function exitVat(completion) {
Expand Down Expand Up @@ -821,6 +835,16 @@ function build(
dropExports(vrefs);
break;
}
case 'retireExports': {
const [vrefs] = args;
retireExports(vrefs);
break;
}
case 'retireImports': {
const [vrefs] = args;
retireImports(vrefs);
break;
}
default:
assert.fail(X`unknown delivery type ${type}`);
}
Expand Down
4 changes: 3 additions & 1 deletion packages/SwingSet/src/message.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ export function insistVatDeliveryObject(vdo) {
}
break;
}
case 'dropExports': {
case 'dropExports':
case 'retireExports':
case 'retireImports': {
const [slots] = rest;
assert(Array.isArray(slots));
for (const slot of slots) {
Expand Down
6 changes: 5 additions & 1 deletion packages/SwingSet/src/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@
* @typedef { [tag: 'message', target: string, msg: Message]} VatDeliveryMessage
* @typedef { [tag: 'notify', resolutions: string[] ]} VatDeliveryNotify
* @typedef { [tag: 'dropExports', vrefs: string[] ]} VatDeliveryDropExports
* @typedef { VatDeliveryMessage | VatDeliveryNotify | VatDeliveryDropExports } VatDeliveryObject
* @typedef { [tag: 'retireExports', vrefs: string[] ]} VatDeliveryRetireExports
* @typedef { [tag: 'retireImports', vrefs: string[] ]} VatDeliveryRetireImports
* @typedef { VatDeliveryMessage | VatDeliveryNotify | VatDeliveryDropExports
* | VatDeliveryRetireExports | VatDeliveryRetireImports
* } VatDeliveryObject
* @typedef { [tag: 'ok', message: null, usage: unknown] | [tag: 'error', message: string, usage: unknown | null] } VatDeliveryResult
*
* @typedef { [tag: 'send', target: string, msg: Message] } VatSyscallSend
Expand Down

0 comments on commit 08a971e

Please sign in to comment.