Skip to main content

CPU

Struct CPU 

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

Implementations§

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, 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: Word) -> Result<StepOutcome>

Source§

impl CPU

Source

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

Source

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

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) -> &[Word]

Source

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

Trait Implementations§

Source§

impl Component for CPU

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

Source§

type Runtime = Instruction

The instruction consumed by the runtime device.
Source§

type Syntax = Instruction

The instruction parsed from source syntax.
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 = u64

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> 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,

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.