doRestore() {
const s = this.saveSlot;
if (!s) return false;
const slot = s;
this.load(slot.snap);
this.saveSlot = slot;
this.pc = slot.at;
if (this.version <= 3) {
// continue as if the save succeeded: take its branch
this.branch(true);
} else {
this.store(2);
}
// The caller (the restore instruction) must not store/branch again.
throw new Restored();
}
}
// Thrown by doRestore(): the whole state was replaced mid-instruction, so the
// restore opcode must not write its own result. step() swallows it.
class Restored extends Error {}