pub struct CPU { /* private fields */ }Implementations§
Source§impl CPU
impl CPU
pub fn execute_instruction(&mut self, inst: Instruction) -> Result<StepOutcome>
Source§impl CPU
impl CPU
pub fn op_span( &mut self, file: u32, start: u32, end: u32, ) -> Result<StepOutcome>
pub fn op_branch(&mut self, target: u32) -> Result<StepOutcome>
pub fn op_conditional_branch( &mut self, true_target: u32, false_target: u32, ) -> Result<StepOutcome>
pub fn op_return(&mut self, keep: u32) -> Result<StepOutcome>
pub fn op_call(&mut self, arity: u32, target: u32) -> Result<StepOutcome>
pub fn op_indirect_call(&mut self) -> Result<StepOutcome>
pub fn op_store(&mut self, ty: Type, addr: u32) -> Result<StepOutcome>
pub fn op_dup(&mut self) -> Result<StepOutcome>
pub fn op_heap_alloc(&mut self, n_elements: u32) -> Result<StepOutcome>
pub fn op_get_item(&mut self) -> Result<StepOutcome>
pub fn op_heap_dealloc(&mut self) -> Result<StepOutcome>
pub fn op_const(&mut self, v: Value) -> Result<StepOutcome>
Source§impl CPU
impl CPU
pub fn op_add(&mut self, ty: Type) -> Result<StepOutcome>
pub fn op_sub(&mut self, ty: Type) -> Result<StepOutcome>
pub fn op_mul(&mut self, ty: Type) -> Result<StepOutcome>
pub fn op_div(&mut self, ty: Type) -> Result<StepOutcome>
pub fn op_rem(&mut self, ty: Type) -> Result<StepOutcome>
pub fn op_neg(&mut self, ty: Type) -> Result<StepOutcome>
Source§impl CPU
impl CPU
pub fn op_shl(&mut self, ty: Type) -> Result<StepOutcome>
pub fn op_shr(&mut self, ty: Type) -> Result<StepOutcome>
Source§impl CPU
impl CPU
pub fn op_rol(&mut self, ty: Type) -> Result<StepOutcome>
pub fn op_ror(&mut self, ty: Type) -> Result<StepOutcome>
Source§impl CPU
impl CPU
pub fn op_bitand(&mut self, ty: Type) -> Result<StepOutcome>
pub fn op_bitor(&mut self, ty: Type) -> Result<StepOutcome>
pub fn op_bitxor(&mut self, ty: Type) -> Result<StepOutcome>
Source§impl CPU
impl CPU
pub fn op_not(&mut self) -> Result<StepOutcome>
pub fn op_and(&mut self) -> Result<StepOutcome>
pub fn op_or(&mut self) -> Result<StepOutcome>
pub fn op_xor(&mut self) -> Result<StepOutcome>
Source§impl CPU
impl CPU
pub fn op_eq(&mut self, ty: Type) -> Result<StepOutcome>
pub fn op_ne(&mut self, ty: Type) -> Result<StepOutcome>
Source§impl CPU
impl CPU
pub fn op_lt(&mut self, ty: Type) -> Result<StepOutcome>
pub fn op_le(&mut self, ty: Type) -> Result<StepOutcome>
pub fn op_gt(&mut self, ty: Type) -> Result<StepOutcome>
pub fn op_ge(&mut self, ty: Type) -> Result<StepOutcome>
Source§impl CPU
impl CPU
pub fn push_heap_object(&mut self, values: Box<[Value]>) -> u32
pub fn heap_object(&self, id: u32) -> Result<&[Value]>
pub fn dealloc_heap_object(&mut self, id: u32) -> Result<()>
pub fn take_pending_pc(&mut self) -> Option<u32>
pub fn set_pending_pc(&mut self, pc: u32)
pub fn clear_pending_pc(&mut self)
pub fn set_current_pc(&mut self, pc: u32)
pub fn return_values(&self) -> &[Value]
pub fn set_return_values(&mut self, values: Vec<Value>)
Trait Implementations§
Source§impl GeneratedComponent for CPU
impl GeneratedComponent for CPU
type Instruction = Instruction
type Message = CPUMessage
type Effect = StepOutcome
fn execute_generated( &mut self, inst: Self::Instruction, msg: Self::Message, ) -> Result<Effects<Self::Effect>>
Source§impl StackMemory for CPU
impl StackMemory for CPU
type Value = Value
fn stack(&self) -> &Vec<Self::Value>
fn stack_mut(&mut self) -> &mut Vec<Self::Value>
fn stack_is_empty(&self) -> bool
fn stack_len(&self) -> usize
fn stack_get(&self, pos: usize) -> Result<&Self::Value>
fn stack_get_mut(&mut self, pos: usize) -> Result<&mut Self::Value>
fn stack_pop(&mut self) -> Result<Self::Value>
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> 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<'src, T> IntoMaybe<'src, T> for Twhere
T: 'src,
impl<'src, T> IntoMaybe<'src, T> for Twhere
T: 'src,
§impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
§type Iter<'a> = Once<&'a T>
where
T: 'a
type Iter<'a> = Once<&'a T> where T: 'a
An iterator over the items within this container, by reference.
§fn contains(&self, val: &T) -> boolwhere
T: PartialEq,
fn contains(&self, val: &T) -> boolwhere
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,
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].