Skip to content

Commit c3896c1

Browse files
committed
feat(swingset-tools): [replay] option to synchronize syscalls
1 parent f7c1cea commit c3896c1

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

packages/SwingSet/misc-tools/replay-transcript.js

+17-3
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@ const argv = yargsParser(process.argv.slice(2), {
8484
// previous syscalls for the same metadata were recorded.
8585
'simulateVcSyscalls',
8686

87+
// Deliver all syscall responses in lockstep between concurrent workers.
88+
// When this option is disabled, concurrent workers are only synchronized
89+
// at delivery boundaries.
90+
'synchronizeSyscalls',
91+
8792
// Use a simplified snapstore which derives the snapshot filename from the
8893
// transcript and doesn't compress the snapshot
8994
'useCustomSnapStore',
@@ -137,6 +142,7 @@ const argv = yargsParser(process.argv.slice(2), {
137142
keepWorkerTransactionNums: [],
138143
skipExtraVcSyscalls: true,
139144
simulateVcSyscalls: true,
145+
synchronizeSyscalls: false,
140146
useCustomSnapStore: false,
141147
recordXsnapTrace: false,
142148
useXsnapDebug: false,
@@ -542,7 +548,7 @@ async function replay(transcriptFile) {
542548

543549
/**
544550
* @param {WorkerData} workerData
545-
* @returns {import('../src/kernel/vat-loader/transcript.js').CompareSyscalls}
551+
* @returns {import('../src/kernel/vat-loader/transcript.js').CompareSyscalls<boolean>}
546552
*/
547553
const makeCompareSyscalls = workerData => {
548554
const doCompare = (
@@ -618,8 +624,16 @@ async function replay(transcriptFile) {
618624
originalSyscall,
619625
newSyscall,
620626
});
621-
workerData.timeOfLastCommand = performance.now();
622-
return result;
627+
const finish = () => {
628+
workerData.timeOfLastCommand = performance.now();
629+
return result;
630+
};
631+
if (argv.synchronizeSyscalls && result !== missingSyscall) {
632+
completeWorkerStep(workerData);
633+
return workersSynced.then(finish);
634+
} else {
635+
return finish();
636+
}
623637
};
624638
return compareSyscalls;
625639
};

0 commit comments

Comments
 (0)