Skip to main content

javm_exec/
exit.rs

1//! `ExitReason`: terminal status from an execution batch.
2//!
3//! The interpreter / recompiler run until one of these reasons is
4//! produced. The caller decides what to do next (handle the host
5//! call, route the page fault, top up gas and continue, etc.).
6
7/// Terminal status from a single `execute()` call.
8#[derive(Clone, Debug, PartialEq, Eq)]
9pub enum ExitReason {
10    /// Normal halt (program executed a halt opcode).
11    Halt,
12    /// Deliberate trap (opcode 0). Program-initiated termination.
13    Trap,
14    /// Runtime error: invalid opcode, bad dynamic jump, etc.
15    Panic,
16    /// Gas counter reached zero mid-execution.
17    OutOfGas,
18    /// Memory access at a page the address space doesn't map.
19    /// The argument is the page-aligned faulting address.
20    PageFault(u32),
21    /// Host-call with the given opcode (the integration layer
22    /// supplies an `EcallHandler` that interprets the opcode).
23    HostCall(u32),
24    /// PVM `ecall` (opcode 3, no immediate). The recompiler-side
25    /// counterpart to the interpreter's EcallKind::Ecall routing.
26    /// In the kernel, the integration layer reads φ\[11\] (mgmt op)
27    /// and φ\[12\] (subject|object) to dispatch; the bench harness
28    /// loops on this to skip the prologue's MGMT_MAP calls.
29    Ecall,
30}