pub struct EagerTestInstructions { /* private fields */ }Expand description
Instructions decoded upfront, which EagerTestInstructionFetcher walks.
Ownership of the allocation lives here rather than in the fetcher because the fetcher is moved through tail-called instruction handlers by value. A destructor on it would make every handler that can fail (every load, store, branch and jump) responsible for dropping it on the way out, which costs a stack frame, callee-saved register spills and a reload in the hot path of each of them, even though the failing path is never taken.
Implementations§
Source§impl EagerTestInstructions
impl EagerTestInstructions
Sourcepub unsafe fn fetcher(&self, pc: u64) -> EagerTestInstructionFetcher<'_>
pub unsafe fn fetcher(&self, pc: u64) -> EagerTestInstructionFetcher<'_>
Create a fetcher positioned at the instruction that guest address pc corresponds to
§Safety
pc must be a valid and aligned guest address of one of the decoded instructions.
Sourcepub unsafe fn decode(
instructions: &[u8],
return_trap_address: u64,
base_addr: u64,
) -> Self
pub unsafe fn decode( instructions: &[u8], return_trap_address: u64, base_addr: u64, ) -> Self
Decode instructions and create a new instance holding the result.
base_addr is the guest address of the first instruction, and return_trap_address is the
address at which the interpreter will stop execution (gracefully).
§Safety
The instructions processed must be valid and end with a jump instruction, and
return_trap_address must not fall inside them. Instruction fetching does not compare
against the return trap, so an address inside the instructions would stop execution when
jumped to but not when reached by falling through.
Trait Implementations§
Source§impl Debug for EagerTestInstructions
impl Debug for EagerTestInstructions
Source§impl Drop for EagerTestInstructions
impl Drop for EagerTestInstructions
Auto Trait Implementations§
impl !Send for EagerTestInstructions
impl !Sync for EagerTestInstructions
impl Freeze for EagerTestInstructions
impl RefUnwindSafe for EagerTestInstructions
impl Unpin for EagerTestInstructions
impl UnsafeUnpin for EagerTestInstructions
impl UnwindSafe for EagerTestInstructions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more