#268·wasm3

Snapshots: Suspend/resume execution state

Author: thomasballingerCreated Aug 1, 2021Updated Sep 18, 2026
Labelsfeaturein progress

Related to metering https://github.com/wasm3/wasm3/issues/127 and being able to run a set number of instructions, I'd like to be able to serialize a paused interpreter's state and deserialize it to a new interpreter instance; very roughly,

const interp = new wasm3.Interpreter(module);
interp.interpretNInstructions(100);
const interpState = interp.serializeState();
const interp2 = wasm3.Interpretr.fromState(interpState);

// we forked the interpreter!
interp2.interpret();
interp1.interpret();

(apologies for the totally wrong API here! I've used JavaScript syntax because I'm hoping to use this from a browser, which would apparently be possible once I stub out enough WASI)