Skip to main content

run_instance

Function run_instance 

Source
pub fn run_instance(
    instance: &InstanceCap,
    image: &ImageCap,
    endpoint_idx: u8,
    args: [u64; 4],
    initial_gas: u64,
) -> InvocationResult
Expand description

Run an Instance through the byte-PVM interpreter, returning the same InvocationResult shape nub-arch-x86’s JIT path produces. The exit-reason mapping matches the JIT exit codes (HostCall=4, Trap=7, etc.) so the two backends agree on a well-formed program.

Endpoint dispatch: endpoint_idx selects image.endpoints[endpoint_idx]; the endpoint’s entry_pc is used as the start PC. Caller-supplied args overlay φ[7..=10] on top of the endpoint’s initial_regs. Memory is sized from instance.mem_size and seeded with each entry in instance.rw_overlays laid at its declared start.