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 pub 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
26 #[inline(always)]
27 fn should_suspend<F>(
28 instret: u64,
29 _pc: u32,
30 instret_end: u64,
31 _exec_state: &mut VmExecState<F, GuestMemory, Self>,
32 ) -> bool {
33 instret >= instret_end
34 }
35}