@agoric/swingset-vat 0.32.3-dev-d8f6bce.0.d8f6bce → 0.32.3-dev-b3de433.0.b3de433
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/package.json +12 -12
- package/src/kernel/state/vatKeeper.js +35 -42
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/swingset-vat",
|
|
3
|
-
"version": "0.32.3-dev-
|
|
3
|
+
"version": "0.32.3-dev-b3de433.0.b3de433",
|
|
4
4
|
"description": "Vat/Container Launcher",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"lint:eslint": "yarn run -T eslint ."
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@agoric/xsnap": "0.14.3-dev-
|
|
25
|
+
"@agoric/xsnap": "0.14.3-dev-b3de433.0.b3de433",
|
|
26
26
|
"@types/better-sqlite3": "^7.6.13",
|
|
27
27
|
"@types/microtime": "^2.1.0",
|
|
28
28
|
"@types/tmp": "^0.2.0",
|
|
@@ -30,15 +30,15 @@
|
|
|
30
30
|
"ava": "^5.3.0"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@agoric/internal": "0.3.3-dev-
|
|
34
|
-
"@agoric/kmarshal": "0.1.1-dev-
|
|
35
|
-
"@agoric/store": "0.9.3-dev-
|
|
36
|
-
"@agoric/swing-store": "0.9.2-dev-
|
|
37
|
-
"@agoric/swingset-liveslots": "0.10.3-dev-
|
|
38
|
-
"@agoric/swingset-xsnap-supervisor": "0.10.3-dev-
|
|
39
|
-
"@agoric/time": "0.3.3-dev-
|
|
40
|
-
"@agoric/vat-data": "0.5.3-dev-
|
|
41
|
-
"@agoric/xsnap-lockdown": "0.14.1-dev-
|
|
33
|
+
"@agoric/internal": "0.3.3-dev-b3de433.0.b3de433",
|
|
34
|
+
"@agoric/kmarshal": "0.1.1-dev-b3de433.0.b3de433",
|
|
35
|
+
"@agoric/store": "0.9.3-dev-b3de433.0.b3de433",
|
|
36
|
+
"@agoric/swing-store": "0.9.2-dev-b3de433.0.b3de433",
|
|
37
|
+
"@agoric/swingset-liveslots": "0.10.3-dev-b3de433.0.b3de433",
|
|
38
|
+
"@agoric/swingset-xsnap-supervisor": "0.10.3-dev-b3de433.0.b3de433",
|
|
39
|
+
"@agoric/time": "0.3.3-dev-b3de433.0.b3de433",
|
|
40
|
+
"@agoric/vat-data": "0.5.3-dev-b3de433.0.b3de433",
|
|
41
|
+
"@agoric/xsnap-lockdown": "0.14.1-dev-b3de433.0.b3de433",
|
|
42
42
|
"@endo/base64": "^1.0.12",
|
|
43
43
|
"@endo/bundle-source": "^4.1.2",
|
|
44
44
|
"@endo/captp": "^4.4.8",
|
|
@@ -105,5 +105,5 @@
|
|
|
105
105
|
"typeCoverage": {
|
|
106
106
|
"atLeast": 76.71
|
|
107
107
|
},
|
|
108
|
-
"gitHead": "
|
|
108
|
+
"gitHead": "b3de4336b200fe768939266b07f1687dd6c065e4"
|
|
109
109
|
}
|
|
@@ -369,54 +369,47 @@ export function makeVatKeeper(
|
|
|
369
369
|
required = false,
|
|
370
370
|
requireNew = false,
|
|
371
371
|
} = options;
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
"'required' and 'requireNew' are mutually exclusive",
|
|
375
|
-
);
|
|
372
|
+
!(required && requireNew) ||
|
|
373
|
+
Fail`'required' and 'requireNew' are mutually exclusive`;
|
|
376
374
|
typeof vatSlot === 'string' || Fail`non-string vatSlot: ${vatSlot}`;
|
|
377
375
|
const { type, allocatedByVat } = parseVatSlot(vatSlot);
|
|
378
376
|
const vatKey = `${vatID}.c.${vatSlot}`;
|
|
379
|
-
if (
|
|
377
|
+
if (kvStore.has(vatKey)) {
|
|
378
|
+
!requireNew || Fail`vref ${q(vatSlot)} is already allocated`;
|
|
379
|
+
} else {
|
|
380
380
|
!required || Fail`vref ${vatSlot} not in clist`;
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
} else {
|
|
391
|
-
Fail`unknown type ${type}`;
|
|
392
|
-
}
|
|
393
|
-
// now increment the refcount with isExport=true and
|
|
394
|
-
// onlyRecognizable=true, which will skip object exports (we only
|
|
395
|
-
// count imports) and leave the reachability count at zero
|
|
396
|
-
const incopts = { isExport: true, onlyRecognizable: true };
|
|
397
|
-
incrementRefCount(kernelSlot, `${vatID}|vk|clist`, incopts);
|
|
398
|
-
const kernelKey = `${vatID}.c.${kernelSlot}`;
|
|
399
|
-
incStat('clistEntries');
|
|
400
|
-
// we add the key as "unreachable" but "recognizable", and then rely
|
|
401
|
-
// on setReachableFlag() at the end to both mark it reachable and to
|
|
402
|
-
// update any necessary refcounts consistently
|
|
403
|
-
kvStore.set(kernelKey, buildReachableAndVatSlot(false, vatSlot));
|
|
404
|
-
kvStore.set(vatKey, kernelSlot);
|
|
405
|
-
kernelSlog.changeCList(
|
|
406
|
-
vatID,
|
|
407
|
-
getCrankNumber(),
|
|
408
|
-
'export',
|
|
409
|
-
kernelSlot,
|
|
410
|
-
vatSlot,
|
|
411
|
-
);
|
|
412
|
-
kdebug(`Add mapping v->k ${kernelKey}<=>${vatKey}`);
|
|
381
|
+
allocatedByVat || Fail`unknown vatSlot ${q(vatSlot)}`;
|
|
382
|
+
let kernelSlot;
|
|
383
|
+
if (type === 'object') {
|
|
384
|
+
// this sets the initial refcount to reachable:0 recognizable:0
|
|
385
|
+
kernelSlot = addKernelObject(vatID);
|
|
386
|
+
} else if (type === 'device') {
|
|
387
|
+
Fail`normal vats aren't allowed to export device nodes`;
|
|
388
|
+
} else if (type === 'promise') {
|
|
389
|
+
kernelSlot = addKernelPromiseForVat(vatID);
|
|
413
390
|
} else {
|
|
414
|
-
|
|
415
|
-
// (else it would have been in the c-list), so it must be bogus
|
|
416
|
-
Fail`unknown vatSlot ${q(vatSlot)}`;
|
|
391
|
+
Fail`unknown type ${type}`;
|
|
417
392
|
}
|
|
418
|
-
|
|
419
|
-
|
|
393
|
+
// now increment the refcount with isExport=true and
|
|
394
|
+
// onlyRecognizable=true, which will skip object exports (we only
|
|
395
|
+
// count imports) and leave the reachability count at zero
|
|
396
|
+
const incopts = { isExport: true, onlyRecognizable: true };
|
|
397
|
+
incrementRefCount(kernelSlot, `${vatID}|vk|clist`, incopts);
|
|
398
|
+
const kernelKey = `${vatID}.c.${kernelSlot}`;
|
|
399
|
+
incStat('clistEntries');
|
|
400
|
+
// we add the key as "unreachable" but "recognizable", and then rely
|
|
401
|
+
// on setReachableFlag() at the end to both mark it reachable and to
|
|
402
|
+
// update any necessary refcounts consistently
|
|
403
|
+
kvStore.set(kernelKey, buildReachableAndVatSlot(false, vatSlot));
|
|
404
|
+
kvStore.set(vatKey, kernelSlot);
|
|
405
|
+
kernelSlog.changeCList(
|
|
406
|
+
vatID,
|
|
407
|
+
getCrankNumber(),
|
|
408
|
+
'export',
|
|
409
|
+
kernelSlot,
|
|
410
|
+
vatSlot,
|
|
411
|
+
);
|
|
412
|
+
kdebug(`Add mapping v->k ${kernelKey}<=>${vatKey}`);
|
|
420
413
|
}
|
|
421
414
|
const kernelSlot = getRequired(vatKey);
|
|
422
415
|
|