pub struct InterpreterState<'a> {
pub functions: FunctionStore<'a>,
pub libcall_handler: LibCallHandler,
pub frame_stack: Vec<Frame<'a>>,
pub frame_offset: usize,
pub stack: Vec<u8>,
pub pinned_reg: DataValue,
pub native_endianness: Endianness,
}Expand description
Maintains the Interpreter’s state, implementing the State trait.
Fields§
§functions: FunctionStore<'a>§libcall_handler: LibCallHandler§frame_stack: Vec<Frame<'a>>§frame_offset: usizeNumber of bytes from the bottom of the stack where the current frame’s stack space is
stack: Vec<u8>§pinned_reg: DataValue§native_endianness: EndiannessImplementations§
source§impl<'a> InterpreterState<'a>
impl<'a> InterpreterState<'a>
pub fn with_function_store(self, functions: FunctionStore<'a>) -> Self
sourcepub fn with_libcall_handler(self, handler: LibCallHandler) -> Self
pub fn with_libcall_handler(self, handler: LibCallHandler) -> Self
Registers a libcall handler
Trait Implementations§
source§impl Default for InterpreterState<'_>
impl Default for InterpreterState<'_>
source§impl<'a> State<'a> for InterpreterState<'a>
impl<'a> State<'a> for InterpreterState<'a>
source§fn resolve_global_value(
&self,
gv: GlobalValue
) -> Result<DataValue, MemoryError>
fn resolve_global_value( &self, gv: GlobalValue ) -> Result<DataValue, MemoryError>
Non-Recursively resolves a global value until its address is found
source§fn get_function(&self, func_ref: FuncRef) -> Option<&'a Function>
fn get_function(&self, func_ref: FuncRef) -> Option<&'a Function>
Retrieve a reference to a Function.
source§fn get_current_function(&self) -> &'a Function
fn get_current_function(&self) -> &'a Function
Retrieve a reference to the currently executing Function.
source§fn get_libcall_handler(&self) -> LibCallHandler
fn get_libcall_handler(&self) -> LibCallHandler
Retrieve the handler callback for a LibCall
source§fn push_frame(&mut self, function: &'a Function)
fn push_frame(&mut self, function: &'a Function)
Record that an interpreter has called into a new Function.
fn current_frame_mut(&mut self) -> &mut Frame<'a>
fn current_frame(&self) -> &Frame<'a>
source§fn stack_address(
&self,
size: AddressSize,
slot: StackSlot,
offset: u64
) -> Result<Address, MemoryError>
fn stack_address( &self, size: AddressSize, slot: StackSlot, offset: u64 ) -> Result<Address, MemoryError>
Computes the stack address for this stack slot, including an offset.
source§fn checked_load(
&self,
addr: Address,
ty: Type,
mem_flags: MemFlags
) -> Result<DataValue, MemoryError>
fn checked_load( &self, addr: Address, ty: Type, mem_flags: MemFlags ) -> Result<DataValue, MemoryError>
Retrieve a value
V from memory at the given address, checking if it belongs either to the
stack or to one of the heaps; the number of bytes loaded corresponds to the specified Type.source§fn checked_store(
&mut self,
addr: Address,
v: DataValue,
mem_flags: MemFlags
) -> Result<(), MemoryError>
fn checked_store( &mut self, addr: Address, v: DataValue, mem_flags: MemFlags ) -> Result<(), MemoryError>
Store a value
V into memory at the given address, checking if it belongs either to the
stack or to one of the heaps; the number of bytes stored corresponds to the specified Type.source§fn function_address(
&self,
size: AddressSize,
name: &ExternalName
) -> Result<Address, MemoryError>
fn function_address( &self, size: AddressSize, name: &ExternalName ) -> Result<Address, MemoryError>
Compute the address of a function given its name.
source§fn get_function_from_address(
&self,
address: Address
) -> Option<InterpreterFunctionRef<'a>>
fn get_function_from_address( &self, address: Address ) -> Option<InterpreterFunctionRef<'a>>
Retrieve a reference to a Function given its address.
source§fn get_pinned_reg(&self) -> DataValue
fn get_pinned_reg(&self) -> DataValue
Retrieves the current pinned reg value
source§fn set_pinned_reg(&mut self, v: DataValue)
fn set_pinned_reg(&mut self, v: DataValue)
Sets a value for the pinned reg
source§fn collect_values(&self, names: &[Value]) -> SmallVec<[DataValue; 1]>
fn collect_values(&self, names: &[Value]) -> SmallVec<[DataValue; 1]>
Collect a list of values
V by their value references.Auto Trait Implementations§
impl<'a> RefUnwindSafe for InterpreterState<'a>
impl<'a> Send for InterpreterState<'a>
impl<'a> Sync for InterpreterState<'a>
impl<'a> Unpin for InterpreterState<'a>
impl<'a> UnwindSafe for InterpreterState<'a>
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
Mutably borrows from an owned value. Read more