openvm_circuit/arch/execution_mode/
pure.rs1use crate::{
2 arch::{execution_mode::ExecutionCtxTrait, VmExecState},
3 system::memory::online::GuestMemory,
4};
5
6pub struct ExecutionCtx {
7 instret_end: u64,
8}
9
10impl ExecutionCtx {
11 pub fn new(instret_end: Option<u64>) -> Self {
12 ExecutionCtx {
13 instret_end: if let Some(end) = instret_end {
14 end
15 } else {
16 u64::MAX
17 },
18 }
19 }
20}
21
22impl ExecutionCtxTrait for ExecutionCtx {
23 #[inline(always)]
24 fn on_memory_operation(&mut self, _address_space: u32, _ptr: u32, _size: u32) {}
25 #[inline(always)]
26 fn should_suspend<F>(vm_state: &mut VmExecState<F, GuestMemory, Self>) -> bool {
27 vm_state.instret >= vm_state.ctx.instret_end
28 }
29}