Struct aluvm::Vm

source ·
pub struct Vm<Isa = Instr<ReservedOp>>where
    Isa: InstructionSet,{
    pub registers: Box<CoreRegs>,
    /* private fields */
}
Expand description

Alu virtual machine providing single-core execution environment

Fields§

§registers: Box<CoreRegs>

A set of registers

Implementations§

source§

impl<Isa> Vm<Isa>where Isa: InstructionSet,

Runtime for program execution.

source

pub fn new() -> Self

Constructs new virtual machine instance.

source

pub fn run( &mut self, program: &impl Program<Isa = Isa>, context: &Isa::Context<'_> ) -> bool

Executes the program starting from the provided entry point (set with [Program::set_entrypoint] and [Program::with], or initialized to 0 offset of the first used library if [Program::new] was used).

Returns

Value of the st0 register at the end of the program execution.

source

pub fn call( &mut self, program: &impl Program<Isa = Isa>, method: LibSite, context: &Isa::Context<'_> ) -> bool

Executes the program starting from the provided entry point.

Returns

Value of the st0 register at the end of the program execution.

Trait Implementations§

source§

impl<Isa> Debug for Vm<Isa>where Isa: InstructionSet + Debug,

source§

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

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

impl<Isa> Default for Vm<Isa>where Isa: InstructionSet + Default,

source§

fn default() -> Vm<Isa>

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<Isa> RefUnwindSafe for Vm<Isa>where Isa: RefUnwindSafe,

§

impl<Isa> Send for Vm<Isa>where Isa: Send,

§

impl<Isa> Sync for Vm<Isa>where Isa: Sync,

§

impl<Isa> Unpin for Vm<Isa>where Isa: Unpin,

§

impl<Isa> UnwindSafe for Vm<Isa>where Isa: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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> Same for T

§

type Output = T

Should always be Self
source§

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

§

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 Twhere U: TryFrom<T>,

§

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.