pub enum ExecutionResult<Reg>where
Reg: Register,{
Continue {
rd: Reg,
value: Reg::Type,
},
ContinueNoWrite,
Branch {
offset: i32,
},
Jump {
target: Reg::Type,
},
Break,
Err(ExecutionError<Reg::Type>),
}Expand description
Where execution continues after an instruction, or why it could not.
Instructions describe control flow rather than performing it: they say where execution goes next instead of moving the program counter themselves. This keeps instruction bodies independent of how the program counter is represented, which is what allows the same bodies to drive both an interpreter loop that owns a program counter and one that carries it in a register.
Variants§
Continue
Write the register and continue with the instruction that follows this one
ContinueNoWrite
Continue with the instruction that follows this one without writing to rd register
Branch
Continue offset bytes away from the address of this instruction.
Keeping it relative rather than resolving it against the program counter here means a pre-decoded interpreter can reach the target by moving within the decoded stream instead of converting an address back into a position.
Jump
Continue at an absolute guest address, as jalr-style jumps produce
Break
Stop execution
Err(ExecutionError<Reg::Type>)
Execution failed
Trait Implementations§
Source§impl<Reg> Debug for ExecutionResult<Reg>
impl<Reg> Debug for ExecutionResult<Reg>
Source§impl<Reg> From<ExecutionError<<Reg as Register>::Type>> for ExecutionResult<Reg>where
Reg: Register,
impl<Reg> From<ExecutionError<<Reg as Register>::Type>> for ExecutionResult<Reg>where
Reg: Register,
Source§fn from(error: ExecutionError<Reg::Type>) -> Self
fn from(error: ExecutionError<Reg::Type>) -> Self
Source§impl<Reg> FromResidual<Result<Infallible, CsrError>> for ExecutionResult<Reg>where
Reg: Register,
impl<Reg> FromResidual<Result<Infallible, CsrError>> for ExecutionResult<Reg>where
Reg: Register,
Source§fn from_residual(residual: Result<Infallible, CsrError>) -> Self
fn from_residual(residual: Result<Infallible, CsrError>) -> Self
try_trait_v2)Residual type. Read moreSource§impl<Reg> FromResidual<Result<Infallible, ExecutionError<<Reg as Register>::Type>>> for ExecutionResult<Reg>where
Reg: Register,
impl<Reg> FromResidual<Result<Infallible, ExecutionError<<Reg as Register>::Type>>> for ExecutionResult<Reg>where
Reg: Register,
Source§fn from_residual(
residual: Result<Infallible, ExecutionError<Reg::Type>>,
) -> Self
fn from_residual( residual: Result<Infallible, ExecutionError<Reg::Type>>, ) -> Self
try_trait_v2)Residual type. Read moreSource§impl<Reg> FromResidual<Result<Infallible, VirtualMemoryError>> for ExecutionResult<Reg>where
Reg: Register,
impl<Reg> FromResidual<Result<Infallible, VirtualMemoryError>> for ExecutionResult<Reg>where
Reg: Register,
Source§fn from_residual(residual: Result<Infallible, VirtualMemoryError>) -> Self
fn from_residual(residual: Result<Infallible, VirtualMemoryError>) -> Self
try_trait_v2)Residual type. Read more