Skip to main content

CPU

Struct CPU 

Source
pub struct CPU { /* private fields */ }

Implementations§

Source§

impl CPU

Source§

impl CPU

Source

pub fn op_span( &mut self, file: u32, start: u32, end: u32, ) -> Result<StepOutcome>

Source

pub fn op_branch(&mut self, target: u32) -> Result<StepOutcome>

Source

pub fn op_conditional_branch( &mut self, true_target: u32, false_target: u32, ) -> Result<StepOutcome>

Source

pub fn op_return(&mut self, keep: u32) -> Result<StepOutcome>

Source

pub fn op_call(&mut self, arity: u32, target: u32) -> Result<StepOutcome>

Source

pub fn op_indirect_call(&mut self) -> Result<StepOutcome>

Source

pub fn op_store(&mut self, ty: Type, addr: u32) -> Result<StepOutcome>

Source

pub fn op_dup(&mut self) -> Result<StepOutcome>

Source

pub fn op_heap_alloc(&mut self, n_elements: u32) -> Result<StepOutcome>

Source

pub fn op_get_item(&mut self) -> Result<StepOutcome>

Source

pub fn op_heap_dealloc(&mut self) -> Result<StepOutcome>

Source

pub fn op_const(&mut self, v: Value) -> Result<StepOutcome>

Source§

impl CPU

Source

pub fn op_add(&mut self, ty: Type) -> Result<StepOutcome>

Source

pub fn op_sub(&mut self, ty: Type) -> Result<StepOutcome>

Source

pub fn op_mul(&mut self, ty: Type) -> Result<StepOutcome>

Source

pub fn op_div(&mut self, ty: Type) -> Result<StepOutcome>

Source

pub fn op_rem(&mut self, ty: Type) -> Result<StepOutcome>

Source

pub fn op_neg(&mut self, ty: Type) -> Result<StepOutcome>

Source§

impl CPU

Source

pub fn op_shl(&mut self, ty: Type) -> Result<StepOutcome>

Source

pub fn op_shr(&mut self, ty: Type) -> Result<StepOutcome>

Source§

impl CPU

Source

pub fn op_rol(&mut self, ty: Type) -> Result<StepOutcome>

Source

pub fn op_ror(&mut self, ty: Type) -> Result<StepOutcome>

Source§

impl CPU

Source

pub fn op_bitand(&mut self, ty: Type) -> Result<StepOutcome>

Source

pub fn op_bitor(&mut self, ty: Type) -> Result<StepOutcome>

Source

pub fn op_bitxor(&mut self, ty: Type) -> Result<StepOutcome>

Source§

impl CPU

Source

pub fn op_not(&mut self) -> Result<StepOutcome>

Source

pub fn op_and(&mut self) -> Result<StepOutcome>

Source

pub fn op_or(&mut self) -> Result<StepOutcome>

Source

pub fn op_xor(&mut self) -> Result<StepOutcome>

Source§

impl CPU

Source

pub fn op_eq(&mut self, ty: Type) -> Result<StepOutcome>

Source

pub fn op_ne(&mut self, ty: Type) -> Result<StepOutcome>

Source§

impl CPU

Source

pub fn op_lt(&mut self, ty: Type) -> Result<StepOutcome>

Source

pub fn op_le(&mut self, ty: Type) -> Result<StepOutcome>

Source

pub fn op_gt(&mut self, ty: Type) -> Result<StepOutcome>

Source

pub fn op_ge(&mut self, ty: Type) -> Result<StepOutcome>

Source§

impl CPU

Source

pub fn push_heap_object(&mut self, values: Box<[Value]>) -> u32

Source

pub fn heap_object(&self, id: u32) -> Result<&[Value]>

Source

pub fn dealloc_heap_object(&mut self, id: u32) -> Result<()>

Source

pub fn take_pending_pc(&mut self) -> Option<u32>

Source

pub fn set_pending_pc(&mut self, pc: u32)

Source

pub fn clear_pending_pc(&mut self)

Source

pub fn set_current_pc(&mut self, pc: u32)

Source

pub fn return_values(&self) -> &[Value]

Source

pub fn set_return_values(&mut self, values: Vec<Value>)

Trait Implementations§

Source§

impl Clone for CPU

Source§

fn clone(&self) -> CPU

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 Debug for CPU

Source§

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

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

impl Default for CPU

Source§

fn default() -> CPU

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

impl FrameMemory for CPU

Source§

fn frame_base(&self) -> Result<usize>

Source§

fn get_local(&self, index: usize) -> Result<&Self::Value>

Source§

fn get_local_mut(&mut self, index: usize) -> Result<&mut Self::Value>

Source§

impl GeneratedComponent for CPU

Source§

type Instruction = Instruction

Source§

type Message = CPUMessage

Source§

type Effect = StepOutcome

Source§

fn execute_generated( &mut self, inst: Self::Instruction, msg: Self::Message, ) -> Result<Effects<Self::Effect>>

Source§

impl Reset for CPU

Source§

fn reset(&mut self)

reset the component state into initial state
Source§

impl StackFrame for CPU

Source§

fn get_frame(&self) -> Result<&Frame>

Source§

fn get_frame_mut(&mut self) -> Result<&mut Frame>

Source§

fn push_frame(&mut self, frame: Frame)

Source§

fn pop_frame(&mut self) -> Result<Frame>

Source§

impl StackMemory for CPU

Source§

type Value = Value

Source§

fn stack(&self) -> &Vec<Self::Value>

Source§

fn stack_mut(&mut self) -> &mut Vec<Self::Value>

Source§

fn stack_is_empty(&self) -> bool

Source§

fn stack_len(&self) -> usize

Source§

fn stack_get(&self, pos: usize) -> Result<&Self::Value>

Source§

fn stack_get_mut(&mut self, pos: usize) -> Result<&mut Self::Value>

Source§

fn stack_pop(&mut self) -> Result<Self::Value>

Source§

fn stack_push<T: Into<Self::Value>>(&mut self, v: T)

§

fn stack_top(&self) -> Result<&Self::Value, Report>

§

fn stack_top_mut(&mut self) -> Result<&mut Self::Value, Report>

Auto Trait Implementations§

§

impl Freeze for CPU

§

impl RefUnwindSafe for CPU

§

impl Send for CPU

§

impl Sync for CPU

§

impl Unpin for CPU

§

impl UnsafeUnpin for CPU

§

impl UnwindSafe for CPU

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.

§

impl<'src, T> IntoMaybe<'src, T> for T
where T: 'src,

§

type Proj<U: 'src> = U

§

fn map_maybe<R>( self, _f: impl FnOnce(&'src T) -> &'src R, g: impl FnOnce(T) -> R, ) -> <T as IntoMaybe<'src, T>>::Proj<R>
where R: 'src,

§

impl<'p, T> Seq<'p, T> for T
where T: Clone,

§

type Item<'a> = &'a T where T: 'a

The item yielded by the iterator.
§

type Iter<'a> = Once<&'a T> where T: 'a

An iterator over the items within this container, by reference.
§

fn seq_iter(&self) -> <T as Seq<'p, T>>::Iter<'_>

Iterate over the elements of the container.
§

fn contains(&self, val: &T) -> bool
where T: PartialEq,

Check whether an item is contained within this sequence.
§

fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>
where 'p: 'b,

Convert an item of the sequence into a [MaybeRef].
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.
§

impl<T> OrderedSeq<'_, T> for T
where T: Clone,