pub trait Stopper {
type Processor;
// Required method
fn should_stop(
&self,
processor: &Self::Processor,
continuation_stack: &ContinuationStack,
continuation_after_stop: impl FnOnce() -> Option<Continuation>,
) -> ControlFlow<BreakReason>;
}Expand description
A trait for types that determine whether execution should be stopped after each clock cycle.
This allows for flexible control over the execution process, enabling features such as stepping
through execution (see crate::FastProcessor::step) or limiting execution to a certain number
of clock cycles (used in parallel trace generation to fill the trace for a predetermined trace
fragment).
Required Associated Types§
Required Methods§
Sourcefn should_stop(
&self,
processor: &Self::Processor,
continuation_stack: &ContinuationStack,
continuation_after_stop: impl FnOnce() -> Option<Continuation>,
) -> ControlFlow<BreakReason>
fn should_stop( &self, processor: &Self::Processor, continuation_stack: &ContinuationStack, continuation_after_stop: impl FnOnce() -> Option<Continuation>, ) -> ControlFlow<BreakReason>
Determines whether execution should be stopped at the end of each clock cycle.
This method is guaranteed to be called at the end of each clock cycle, after the processor
state has been updated to reflect the effects of the operations executed during that cycle
(including the processor clock). Hence, a processor clock of N indicates that clock
cycle N - 1 has just completed.
The continuation_after_stop is provided in cases where simply resuming execution from the
top of the continuation stack is not sufficient to continue execution correctly. For
example, when stopping execution in the middle of a basic block, we need to provide a
ResumeBasicBlock continuation to ensure that execution resumes at the correct operation
within the basic block (i.e. the operation right after the one that was last executed before
being stopped). No continuation is provided in case of error, since it is expected that
execution will not be resumed.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.