Skip to content

Commit

Permalink
feat: refresh slogulator to account for smallcaps and improve UX
Browse files Browse the repository at this point in the history
This is in support of #8647
  • Loading branch information
FUDCo committed Dec 18, 2023
1 parent 1b6f03b commit 8125ad9
Show file tree
Hide file tree
Showing 7 changed files with 330 additions and 112 deletions.
15 changes: 15 additions & 0 deletions packages/SwingSet/src/kernel/kernel.js
Original file line number Diff line number Diff line change
Expand Up @@ -1202,6 +1202,19 @@ export default function buildKernel(
return results;
}

function getCrankVatForSlog(message) {
if (message.type === 'send') {
const { type } = parseKernelSlot(message.target);
if (type !== 'promise') {
return kernelKeeper.ownerOfKernelObject(message.target);
} else {
return '<unknown vat>';
}
} else {
return message.vatID;
}
}

/**
* @param {RunQueueEvent} message
* @returns {Promise<PolicyInput>}
Expand All @@ -1216,6 +1229,7 @@ export default function buildKernel(
crankType: 'delivery',
crankNum: kernelKeeper.getCrankNumber(),
message,
vatID: getCrankVatForSlog(message),
});
/** @type { PolicyInput } */
let policyInput = ['none', {}];
Expand Down Expand Up @@ -1375,6 +1389,7 @@ export default function buildKernel(
crankType: 'routing',
crankNum: kernelKeeper.getCrankNumber(),
message,
vatID: getCrankVatForSlog(message),
});
/** @type { PolicyInput } */
const policyInput = ['none', {}];
Expand Down
1 change: 1 addition & 0 deletions packages/SwingSet/src/kernel/state/kernelKeeper.js
Original file line number Diff line number Diff line change
Expand Up @@ -1517,6 +1517,7 @@ export default function makeKernelKeeper(kernelStorage, kernelSlog) {
const acceptanceQueue = dumpQueue('acceptanceQueue');

return harden({
crankNumber: kvStore.get('crankNumber'),
vatTables,
kernelTable,
promises,
Expand Down
4 changes: 2 additions & 2 deletions packages/SwingSet/tools/run-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ export const makeRunUtils = (controller, log = (..._) => {}) => {

const result = controller.run().then(cranks => {
cranksRun += cranks;
log(`kernel ran ${cranks} cranks`);
// log(`kernel ran ${cranks} cranks`);
return thunkResult;
});
mutex.put(result.then(sink, sink));
return result;
};

const queueAndRun = async (deliveryThunk, voidResult = false) => {
log('queueAndRun at', cranksRun);
// log('queueAndRun at', cranksRun);

const kpid = await runThunk(deliveryThunk);

Expand Down
1 change: 1 addition & 0 deletions packages/swingset-runner/bin/slogulator-debug
17 changes: 17 additions & 0 deletions packages/swingset-runner/src/slogulator-debug-entrypoint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env node --inspect-brk
/* eslint-env node */

/**
* Simple boilerplate program providing linkage to launch an application written using modules within the
* as yet not-entirely-ESM-supporting version of NodeJS.
*/
import '@endo/init';
import { main } from './slogulator.js';

process.exitCode = 1;
try {
main();
process.exitCode = 0;
} catch (error) {
console.error(error);
}
14 changes: 6 additions & 8 deletions packages/swingset-runner/src/slogulator-entrypoint.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@ import '@endo/init';
import { main } from './slogulator.js';

process.exitCode = 1;
main().then(
() => {
process.exitCode = 0;
},
error => {
console.error(error);
},
);
try {
main();
process.exitCode = 0;
} catch (error) {
console.error(error);
}
Loading

0 comments on commit 8125ad9

Please sign in to comment.