@agoric/swingset-vat 0.33.0-upgrade-16-dev-0df76a7.0 → 0.33.0-upgrade-17-dev-a61cdab.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +31 -30
- package/src/controller/controller.js +48 -1
- package/src/controller/initializeKernel.js +35 -10
- package/src/controller/initializeSwingset.js +6 -3
- package/src/controller/startXSnap.js +1 -1
- package/src/controller/upgradeSwingset.js +212 -0
- package/src/devices/bridge/device-bridge.js +1 -1
- package/src/devices/bundle/device-bundle.js +1 -1
- package/src/devices/command/command.js +1 -2
- package/src/devices/command/device-command.js +1 -2
- package/src/devices/lib/deviceTools.js +1 -1
- package/src/devices/loopbox/device-loopbox.js +1 -1
- package/src/devices/loopbox/loopbox.js +1 -1
- package/src/devices/mailbox/device-mailbox.js +1 -2
- package/src/devices/mailbox/mailbox.js +1 -2
- package/src/devices/plugin/device-plugin.js +1 -1
- package/src/devices/timer/device-timer.js +1 -1
- package/src/devices/timer/timer.js +1 -1
- package/src/devices/vat-admin/device-vat-admin.js +4 -2
- package/src/index.js +1 -1
- package/src/kernel/deviceManager.js +1 -1
- package/src/kernel/deviceSlots.js +1 -1
- package/src/kernel/deviceTranslator.js +1 -1
- package/src/kernel/dummyMeterControl.js +1 -1
- package/src/kernel/gc-actions.js +55 -34
- package/src/kernel/kernel.js +216 -51
- package/src/kernel/kernelSyscall.js +2 -13
- package/src/kernel/parseKernelSlots.js +1 -1
- package/src/kernel/slogger.js +2 -2
- package/src/kernel/state/deviceKeeper.js +1 -1
- package/src/kernel/state/kernelKeeper.js +427 -81
- package/src/kernel/state/reachable.js +1 -1
- package/src/kernel/state/stats.js +1 -1
- package/src/kernel/state/storageHelper.js +1 -1
- package/src/kernel/state/vatKeeper.js +159 -44
- package/src/kernel/vat-admin-hooks.js +4 -1
- package/src/kernel/vat-loader/manager-factory.js +1 -2
- package/src/kernel/vat-loader/manager-helper.js +1 -1
- package/src/kernel/vat-loader/manager-local.js +1 -1
- package/src/kernel/vat-loader/manager-subprocess-node.js +1 -1
- package/src/kernel/vat-loader/manager-subprocess-xsnap.js +1 -1
- package/src/kernel/vat-loader/vat-loader.js +2 -2
- package/src/kernel/vat-warehouse.js +5 -1
- package/src/kernel/vatTranslator.js +1 -4
- package/src/lib/assertOptions.js +1 -1
- package/src/lib/capdata.js +1 -1
- package/src/lib/id.js +1 -1
- package/src/lib/message.js +1 -1
- package/src/lib/parseVatSlots.js +1 -1
- package/src/lib/recordVatOptions.js +18 -6
- package/src/lib/runPolicies.js +50 -4
- package/src/lib/storageAPI.js +1 -1
- package/src/lib/workerOptions.js +1 -1
- package/src/supervisors/subprocess-node/supervisor-subprocess-node.js +1 -1
- package/src/types-external.js +71 -22
- package/src/types-internal.js +56 -3
- package/src/vats/comms/clist-inbound.js +1 -1
- package/src/vats/comms/clist-kernel.js +1 -1
- package/src/vats/comms/clist-outbound.js +1 -1
- package/src/vats/comms/controller.js +1 -1
- package/src/vats/comms/delivery.js +1 -1
- package/src/vats/comms/dispatch.js +1 -1
- package/src/vats/comms/gc-comms.js +1 -1
- package/src/vats/comms/parseLocalSlots.js +1 -1
- package/src/vats/comms/parseRemoteSlot.js +1 -1
- package/src/vats/comms/remote.js +1 -1
- package/src/vats/comms/state.js +1 -1
- package/src/vats/timer/vat-timer.js +9 -9
- package/src/vats/vat-admin/vat-vat-admin.js +23 -8
- package/src/vats/vattp/vat-vattp.js +1 -1
- package/tools/bootstrap-relay.js +1 -3
- package/tools/bundleTool.js +9 -1
- package/tools/dvo-test-harness.js +1 -1
- package/tools/manual-timer.js +1 -1
- package/tools/run-utils.js +1 -1
package/src/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
|
-
import { assert, Fail } from '@
|
|
2
|
+
import { assert, Fail } from '@endo/errors';
|
|
3
3
|
import { insistMessage } from '../lib/message.js';
|
|
4
4
|
import { insistKernelType } from './parseKernelSlots.js';
|
|
5
5
|
import { insistVatType, parseVatSlot } from '../lib/parseVatSlots.js';
|
package/src/kernel/gc-actions.js
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import { Fail } from '@
|
|
1
|
+
import { Fail } from '@endo/errors';
|
|
2
2
|
import { insistKernelType } from './parseKernelSlots.js';
|
|
3
3
|
import { insistVatID } from '../lib/id.js';
|
|
4
4
|
|
|
5
|
+
/** @import {TotalMap} from '@agoric/internal'; */
|
|
6
|
+
|
|
5
7
|
/**
|
|
8
|
+
* @typedef {`v${number}`} VatID
|
|
9
|
+
* @typedef {`ko${number}`} KOID
|
|
6
10
|
* @typedef {'dropExport' | 'retireExport' | 'retireImport'} GCActionType
|
|
7
11
|
* @typedef {'dropExports' | 'retireExports' | 'retireImports'} GCQueueEventType
|
|
12
|
+
* @typedef {`${VatID} ${GCActionType} ${KOID}`} GCActionString
|
|
8
13
|
*/
|
|
9
14
|
|
|
10
15
|
/**
|
|
@@ -16,17 +21,23 @@ const actionTypePriorities = ['dropExport', 'retireExport', 'retireImport'];
|
|
|
16
21
|
|
|
17
22
|
/**
|
|
18
23
|
* A mapping of GC action type to queue event type.
|
|
19
|
-
*
|
|
20
|
-
* @type {Map<GCActionType, GCQueueEventType>}
|
|
21
24
|
*/
|
|
22
|
-
const queueTypeFromActionType =
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
]
|
|
25
|
+
const queueTypeFromActionType =
|
|
26
|
+
/** @type {TotalMap<GCActionType, GCQueueEventType>} */ (
|
|
27
|
+
new Map([
|
|
28
|
+
['dropExport', 'dropExports'],
|
|
29
|
+
['retireExport', 'retireExports'],
|
|
30
|
+
['retireImport', 'retireImports'],
|
|
31
|
+
])
|
|
32
|
+
);
|
|
27
33
|
|
|
34
|
+
/**
|
|
35
|
+
* @param {GCActionString} s
|
|
36
|
+
*/
|
|
28
37
|
function parseAction(s) {
|
|
29
|
-
const [vatID, type, kref] =
|
|
38
|
+
const [vatID, type, kref] = /** @type {[VatID, GCActionType, KOID]} */ (
|
|
39
|
+
s.split(' ')
|
|
40
|
+
);
|
|
30
41
|
insistVatID(vatID);
|
|
31
42
|
queueTypeFromActionType.has(type) || Fail`unknown type ${type}`;
|
|
32
43
|
insistKernelType('object', kref);
|
|
@@ -62,11 +73,16 @@ export function processGCActionSet(kernelKeeper) {
|
|
|
62
73
|
// we must bypass the action as redundant (since it's an error to delete
|
|
63
74
|
// the same c-list entry twice).
|
|
64
75
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
76
|
+
/**
|
|
77
|
+
* Inspect a queued GC action and decide whether the current state of c-lists
|
|
78
|
+
* and reference counts warrants processing it, or if it should instead be
|
|
79
|
+
* negated/bypassed.
|
|
80
|
+
*
|
|
81
|
+
* @param {import('../types-external.js').VatKeeper} vatKeeper
|
|
82
|
+
* @param {GCActionType} type
|
|
83
|
+
* @param {KOID} kref
|
|
84
|
+
*/
|
|
85
|
+
function shouldProcessAction(vatKeeper, type, kref) {
|
|
70
86
|
const hasCList = vatKeeper.hasCListEntry(kref);
|
|
71
87
|
const isReachable = hasCList ? vatKeeper.getReachableFlag(kref) : undefined;
|
|
72
88
|
const exists = kernelKeeper.kernelObjectExists(kref);
|
|
@@ -107,12 +123,16 @@ export function processGCActionSet(kernelKeeper) {
|
|
|
107
123
|
// may need to change to support that, to ensure that `dropExport` and
|
|
108
124
|
// `retireExport` can both be delivered.
|
|
109
125
|
|
|
110
|
-
|
|
126
|
+
/**
|
|
127
|
+
* @param {VatID} vatID
|
|
128
|
+
* @param {GCActionString[]} groupedActions
|
|
129
|
+
*/
|
|
130
|
+
function krefsToProcess(vatID, groupedActions) {
|
|
111
131
|
const vatKeeper = kernelKeeper.provideVatKeeper(vatID);
|
|
112
132
|
const krefs = [];
|
|
113
133
|
for (const action of groupedActions) {
|
|
114
134
|
const { type, kref } = parseAction(action);
|
|
115
|
-
if (
|
|
135
|
+
if (shouldProcessAction(vatKeeper, type, kref)) {
|
|
116
136
|
krefs.push(kref);
|
|
117
137
|
}
|
|
118
138
|
allActionsSet.delete(action);
|
|
@@ -121,49 +141,50 @@ export function processGCActionSet(kernelKeeper) {
|
|
|
121
141
|
return krefs;
|
|
122
142
|
}
|
|
123
143
|
|
|
124
|
-
|
|
144
|
+
/** @type {TotalMap<VatID, TotalMap<GCActionType, GCActionString[]>>} */
|
|
145
|
+
const actionsByVat = new Map();
|
|
125
146
|
for (const action of allActionsSet) {
|
|
126
147
|
const { vatID, type } = parseAction(action);
|
|
127
|
-
if (!
|
|
128
|
-
|
|
148
|
+
if (!actionsByVat.has(vatID)) {
|
|
149
|
+
actionsByVat.set(vatID, new Map());
|
|
129
150
|
}
|
|
130
|
-
const
|
|
131
|
-
if (!
|
|
132
|
-
|
|
151
|
+
const actionsForVatByType = actionsByVat.get(vatID);
|
|
152
|
+
if (!actionsForVatByType.has(type)) {
|
|
153
|
+
actionsForVatByType.set(type, []);
|
|
133
154
|
}
|
|
134
|
-
|
|
155
|
+
actionsForVatByType.get(type).push(action);
|
|
135
156
|
}
|
|
136
157
|
|
|
137
|
-
const vatIDs = Array.from(
|
|
158
|
+
const vatIDs = Array.from(actionsByVat.keys());
|
|
138
159
|
vatIDs.sort();
|
|
139
160
|
for (const vatID of vatIDs) {
|
|
140
|
-
const
|
|
161
|
+
const actionsForVatByType = actionsByVat.get(vatID);
|
|
141
162
|
// find the highest-priority type of work to do within this vat
|
|
142
163
|
for (const type of actionTypePriorities) {
|
|
143
|
-
if (
|
|
144
|
-
const actions =
|
|
145
|
-
const krefs =
|
|
164
|
+
if (actionsForVatByType.has(type)) {
|
|
165
|
+
const actions = actionsForVatByType.get(type);
|
|
166
|
+
const krefs = krefsToProcess(vatID, actions);
|
|
146
167
|
if (krefs.length) {
|
|
147
168
|
// at last, we act
|
|
148
169
|
krefs.sort();
|
|
149
170
|
// remove the work we're about to do from the durable set
|
|
150
171
|
kernelKeeper.setGCActions(allActionsSet);
|
|
151
|
-
const queueType =
|
|
152
|
-
queueTypeFromActionType.get(type)
|
|
153
|
-
);
|
|
172
|
+
const queueType = queueTypeFromActionType.get(type);
|
|
154
173
|
return harden({ type: queueType, vatID, krefs });
|
|
155
174
|
}
|
|
156
175
|
}
|
|
157
176
|
}
|
|
158
177
|
}
|
|
178
|
+
|
|
159
179
|
if (actionSetUpdated) {
|
|
160
180
|
// remove negated items from the durable set
|
|
161
181
|
kernelKeeper.setGCActions(allActionsSet);
|
|
162
|
-
// return a special
|
|
182
|
+
// return a special event to tell kernel to record our
|
|
163
183
|
// DB changes in their own crank
|
|
164
184
|
return harden({ type: 'negated-gc-action', vatID: undefined });
|
|
165
|
-
} else {
|
|
166
|
-
return undefined; // no GC work to do and no DB changes
|
|
167
185
|
}
|
|
186
|
+
|
|
187
|
+
// no GC work to do and no DB changes
|
|
188
|
+
return undefined;
|
|
168
189
|
}
|
|
169
190
|
harden(processGCActionSet);
|