pub struct BasicInterpreterState<Regs, ExtState, Memory, IF, InstructionHandler> {
pub regs: Regs,
pub ext_state: ExtState,
pub memory: Memory,
pub instruction_fetcher: IF,
pub system_instruction_handler: InstructionHandler,
}Expand description
Basic interpreter state.
This is a simple container, which is not required to be used, is helpful for storing the whole state related to the interpreter together.
Fields§
§regs: RegsGeneral purpose registers
ext_state: ExtStateExtended state.
Extensions might use this to place additional constraints on ExtState to require
additional registers or other resources. If no such extension is used, () can be used as
a placeholder.
memory: MemoryMemory
instruction_fetcher: IFInstruction fetcher
system_instruction_handler: InstructionHandlerSystem instruction handler
Implementations§
Source§impl<Regs, ExtState, Memory, IF, InstructionHandler> BasicInterpreterState<Regs, ExtState, Memory, IF, InstructionHandler>
impl<Regs, ExtState, Memory, IF, InstructionHandler> BasicInterpreterState<Regs, ExtState, Memory, IF, InstructionHandler>
Sourcepub fn execute<I>(
&mut self,
) -> Result<(), ExecutionError<<<I as Instruction>::Reg as Register>::Type>>where
Regs: RegisterFile<<I as Instruction>::Reg>,
I: ExecutableInstruction<Regs, ExtState, Memory, IF, InstructionHandler>,
Memory: VirtualMemory,
IF: InstructionFetcher<I, Memory> + ProgramCounter<<<I as Instruction>::Reg as Register>::Type, Memory>,
pub fn execute<I>(
&mut self,
) -> Result<(), ExecutionError<<<I as Instruction>::Reg as Register>::Type>>where
Regs: RegisterFile<<I as Instruction>::Reg>,
I: ExecutableInstruction<Regs, ExtState, Memory, IF, InstructionHandler>,
Memory: VirtualMemory,
IF: InstructionFetcher<I, Memory> + ProgramCounter<<<I as Instruction>::Reg as Register>::Type, Memory>,
Execute the program with a given basic interpreter state.
The implementation is designed to be efficient with little left to optimize further. Though it is still possible to improve performance by applying additional constraints on the program.
Trait Implementations§
Auto Trait Implementations§
impl<Regs, ExtState, Memory, IF, InstructionHandler> Freeze for BasicInterpreterState<Regs, ExtState, Memory, IF, InstructionHandler>
impl<Regs, ExtState, Memory, IF, InstructionHandler> RefUnwindSafe for BasicInterpreterState<Regs, ExtState, Memory, IF, InstructionHandler>where
Regs: RefUnwindSafe,
ExtState: RefUnwindSafe,
Memory: RefUnwindSafe,
IF: RefUnwindSafe,
InstructionHandler: RefUnwindSafe,
impl<Regs, ExtState, Memory, IF, InstructionHandler> Send for BasicInterpreterState<Regs, ExtState, Memory, IF, InstructionHandler>
impl<Regs, ExtState, Memory, IF, InstructionHandler> Sync for BasicInterpreterState<Regs, ExtState, Memory, IF, InstructionHandler>
impl<Regs, ExtState, Memory, IF, InstructionHandler> Unpin for BasicInterpreterState<Regs, ExtState, Memory, IF, InstructionHandler>
impl<Regs, ExtState, Memory, IF, InstructionHandler> UnsafeUnpin for BasicInterpreterState<Regs, ExtState, Memory, IF, InstructionHandler>where
Regs: UnsafeUnpin,
ExtState: UnsafeUnpin,
Memory: UnsafeUnpin,
IF: UnsafeUnpin,
InstructionHandler: UnsafeUnpin,
impl<Regs, ExtState, Memory, IF, InstructionHandler> UnwindSafe for BasicInterpreterState<Regs, ExtState, Memory, IF, InstructionHandler>where
Regs: UnwindSafe,
ExtState: UnwindSafe,
Memory: UnwindSafe,
IF: UnwindSafe,
InstructionHandler: UnwindSafe,
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