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    /// `ecall.jar` (custom-0 funct3=001, no immediate). The
25    /// recompiler-side counterpart to the interpreter's
26    /// EcallKind::Ecall routing. In the kernel, the integration layer
27    /// reads φ\[11\] (mgmt op) and φ\[7\]/φ\[8\] (operands) to dispatch.
28    Ecall,
29}