Skip to main content

ExecutionResult

Enum ExecutionResult 

Source
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

Fields

§rd: Reg

Register to write

§value: Reg::Type

Value to write into it

§

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.

Fields

§offset: i32

Signed byte offset from this instruction

§

Jump

Continue at an absolute guest address, as jalr-style jumps produce

Fields

§target: Reg::Type

Address to continue at

§

Break

Stop execution

§

Err(ExecutionError<Reg::Type>)

Execution failed

Trait Implementations§

Source§

impl<Reg> Debug for ExecutionResult<Reg>
where Reg: Register + Debug, Reg::Type: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<Reg> From<ExecutionError<<Reg as Register>::Type>> for ExecutionResult<Reg>
where Reg: Register,

Source§

fn from(error: ExecutionError<Reg::Type>) -> Self

Converts to this type from the input type.
Source§

impl<Reg> FromResidual<Result<Infallible, CsrError>> for ExecutionResult<Reg>
where Reg: Register,

Source§

fn from_residual(residual: Result<Infallible, CsrError>) -> Self

🔬This is a nightly-only experimental API. (try_trait_v2)
Constructs the type from a compatible Residual type. Read more
Source§

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

🔬This is a nightly-only experimental API. (try_trait_v2)
Constructs the type from a compatible Residual type. Read more
Source§

impl<Reg> FromResidual<Result<Infallible, VirtualMemoryError>> for ExecutionResult<Reg>
where Reg: Register,

Source§

fn from_residual(residual: Result<Infallible, VirtualMemoryError>) -> Self

🔬This is a nightly-only experimental API. (try_trait_v2)
Constructs the type from a compatible Residual type. Read more

Auto Trait Implementations§

§

impl<Reg> Freeze for ExecutionResult<Reg>
where Reg: Freeze, <Reg as Register>::Type: Freeze, ExecutionError<<Reg as Register>::Type>: Freeze,

§

impl<Reg> RefUnwindSafe for ExecutionResult<Reg>

§

impl<Reg> Send for ExecutionResult<Reg>
where <Reg as Register>::Type: Send, ExecutionError<<Reg as Register>::Type>: Send,

§

impl<Reg> Sync for ExecutionResult<Reg>
where <Reg as Register>::Type: Sync, ExecutionError<<Reg as Register>::Type>: Sync,

§

impl<Reg> Unpin for ExecutionResult<Reg>
where Reg: Unpin, <Reg as Register>::Type: Unpin, ExecutionError<<Reg as Register>::Type>: Unpin,

§

impl<Reg> UnsafeUnpin for ExecutionResult<Reg>

§

impl<Reg> UnwindSafe for ExecutionResult<Reg>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.