openvm_circuit/arch/execution_mode/
mod.rs1use crate::{arch::VmExecState, system::memory::online::GuestMemory};
2
3pub mod metered;
4pub mod metered_cost;
5mod preflight;
6mod pure;
7
8pub use metered::{
9 ctx::{MeteredCtx, MeteredCtxInputs},
10 segment_ctx::{Segment, SegmentationLimits},
11};
12pub use metered_cost::MeteredCostCtx;
13pub use preflight::PreflightCtx;
14pub use pure::ExecutionCtx;
15
16pub trait ExecutionCtxTrait: Sized {
17 fn on_memory_operation(&mut self, address_space: u32, ptr: u32, size: u32);
18
19 fn should_suspend<F>(exec_state: &mut VmExecState<F, GuestMemory, Self>) -> bool;
20
21 fn on_terminate<F>(_exec_state: &mut VmExecState<F, GuestMemory, Self>) {}
22}
23
24pub trait MeteredExecutionCtxTrait: ExecutionCtxTrait {
25 fn on_height_change(&mut self, chip_idx: usize, height_delta: u32);
26}