Skip to main content

Module vm

Module vm 

Source
Expand description

The run loop: a machine that owns its code, discovers more of it as the guest reaches it, and stops with a reason instead of an error.

Two things separate this from driving StandaloneEmulator directly.

The context is owned, not borrowed. Lifting new code mutates the module, which a &Context cannot allow. This is why the VM is built on StandaloneEmulator — the lifetime-free emulator that takes &Context per call — rather than on Emulator<'ctx>, which would pin the module for as long as the machine exists.

Stopping is a value. A guest that reads unmapped memory has not broken the emulator; it has taken a fault, which a harness may want to report, resume from, or count as a crash. So the loop returns VmExit and leaves the machine intact and inspectable.

Structs§

Executed
Where an executor left the machine.
Vm
A machine: an owned module, a memory, and a position in the code.

Enums§

CodeError
Why a lifting attempt failed.
VmExit
Why the machine stopped.

Traits§

BlockExecutor
An alternative way to execute a block’s body.
CodeSource
Supplies code the machine has not seen yet.