Struct Vm

Source
pub struct Vm<Isa = Instr<LibId>>
where Isa: Instruction<LibId>,
{ pub core: Core<LibId, <Isa as Instruction<LibId>>::Core>, /* private fields */ }
Expand description

Alu virtual machine providing single-core execution environment

Fields§

§core: Core<LibId, <Isa as Instruction<LibId>>::Core>

A set of registers

Implementations§

Source§

impl<Isa> Vm<Isa>
where Isa: Instruction<LibId>,

Runtime for program execution.

Source

pub fn new() -> Vm<Isa>

Constructs new virtual machine instance with default core configuration.

Source

pub fn with( config: CoreConfig, cx_config: <<Isa as Instruction<LibId>>::Core as CoreExt>::Config, ) -> Vm<Isa>

Constructs new virtual machine instance with default core configuration.

Source

pub fn reset(&mut self)

Resets all registers of the VM except those which were set up with the config object.

Source

pub fn exec<L>( &mut self, entry_point: LibSite, context: &<Isa as Instruction<LibId>>::Context<'_>, lib_resolver: impl Fn(LibId) -> Option<L>, ) -> Status
where L: AsRef<Lib>,

Executes the program starting from the provided entry point.

§Returns

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

Trait Implementations§

Source§

impl<Isa> Clone for Vm<Isa>
where Isa: Clone + Instruction<LibId>, <Isa as Instruction<LibId>>::Core: Clone,

Source§

fn clone(&self) -> Vm<Isa>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<Isa> Debug for Vm<Isa>
where Isa: Debug + Instruction<LibId>, <Isa as Instruction<LibId>>::Core: Debug,

Source§

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

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

impl<Isa> Default for Vm<Isa>
where Isa: Default + Instruction<LibId>, <Isa as Instruction<LibId>>::Core: Default,

Source§

fn default() -> Vm<Isa>

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

Auto Trait Implementations§

§

impl<Isa> Freeze for Vm<Isa>
where <Isa as Instruction<LibId>>::Core: Freeze,

§

impl<Isa> RefUnwindSafe for Vm<Isa>

§

impl<Isa> Send for Vm<Isa>
where <Isa as Instruction<LibId>>::Core: Send, Isa: Send,

§

impl<Isa> Sync for Vm<Isa>
where <Isa as Instruction<LibId>>::Core: Sync, Isa: Sync,

§

impl<Isa> Unpin for Vm<Isa>
where <Isa as Instruction<LibId>>::Core: Unpin, Isa: Unpin,

§

impl<Isa> UnwindSafe for Vm<Isa>
where <Isa as Instruction<LibId>>::Core: UnwindSafe, Isa: UnwindSafe,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.