Struct yksom::vm::core::VM [−][src]
pub struct VM {Show fields
pub array_cls: Val,
pub block_cls: Val,
pub block1_cls: Val,
pub block2_cls: Val,
pub block3_cls: Val,
pub bool_cls: Val,
pub cls_cls: Val,
pub double_cls: Val,
pub false_cls: Val,
pub int_cls: Val,
pub metacls_cls: Val,
pub method_cls: Val,
pub nil_cls: Val,
pub obj_cls: Val,
pub str_cls: Val,
pub sym_cls: Val,
pub system_cls: Val,
pub true_cls: Val,
pub false_: Val,
pub nil: Val,
pub system: Val,
pub true_: Val,
// some fields omitted
}The core VM struct.
Fields
array_cls: Valblock_cls: Valblock1_cls: Valblock2_cls: Valblock3_cls: Valbool_cls: Valcls_cls: Valdouble_cls: Valfalse_cls: Valint_cls: Valmetacls_cls: Valmethod_cls: Valnil_cls: Valobj_cls: Valstr_cls: Valsym_cls: Valsystem_cls: Valtrue_cls: Valfalse_: Valnil: Valsystem: Valtrue_: ValImplementations
impl VM[src]
pub fn new(classpath: Vec<PathBuf>) -> Self[src]
pub fn load_class(&mut self, name: &str) -> Result<Val, ()>[src]
Load the class name. Note that this looks name up in the globals, so you can get a
successful value back which isn’t a class (e.g. nil, which is Object’s superclass).
pub fn error(&self, error: &str) -> ![src]
Inform the user of the error string error and then exit.
pub fn top_level_send(
&mut self,
rcv: Val,
msg: &str,
args: Vec<Val>
) -> Result<Val, Box<VMError>>[src]
&mut self,
rcv: Val,
msg: &str,
args: Vec<Val>
) -> Result<Val, Box<VMError>>
Send the message msg to the receiver rcv with arguments args.
pub fn str_is<F>(&mut self, rcv: Val, f: F) -> Result<(), Box<VMError>> where
F: Fn(char) -> bool, [src]
F: Fn(char) -> bool,
Does every character in the SOM string in rcv satisfy the condition f? Pushes true/false onto the SOM
stack. Note that empty strings are considered not to satisfy the condition by definition.
pub fn flush_inline_caches(&mut self)[src]
pub fn new_inline_cache(&mut self) -> usize[src]
Add an empty inline cache to the VM, returning its index.
pub fn inline_cache_lookup(
&mut self,
idx: usize,
rcv_cls: Val,
name: &str
) -> Result<Gc<Method>, Box<VMError>>[src]
&mut self,
idx: usize,
rcv_cls: Val,
name: &str
) -> Result<Gc<Method>, Box<VMError>>
Lookup the method name in the class rcv_cls, utilising the inline cache at index idx.
pub fn instrs_len(&self) -> usize[src]
How many instructions are currently present in the VM?
pub fn instrs_push(&mut self, instr: Instr, span: Span)[src]
Push instr to the end of the current vector of instructions, associating span with it
for the purposes of backtraces.
pub fn instrs_set(&mut self, idx: usize, instr: Instr, span: Span)[src]
Push instr to the end of the current vector of instructions, associating span with it
for the purposes of backtraces.
pub fn add_send(&mut self, send: (SmartString, usize)) -> usize[src]
Add the send send to the VM, returning its index. Note that sends are reused, so indexes
are also reused.
pub fn add_bigint(&mut self, x: BigInt) -> usize[src]
Add the BigInt x to the VM, returning its index. Note that these might (or might not)
be cached, so indexes might be reused.
pub fn add_string(&mut self, s: SmartString) -> usize[src]
Add the string s to the VM, returning its index. Note that strings are reused, so indexes
are also reused.
pub fn add_symbol(&mut self, s: SmartString) -> usize[src]
Add the symbol s to the VM, returning its index. Note that symbols are reused, so indexes
are also reused.
pub fn add_global(&mut self, s: &str) -> usize[src]
Add the global n to the VM, returning its index. Note that global names (like strings)
are reused, so indexes are also reused.
pub fn get_global_or_nil(&self, name: &str) -> Val[src]
Lookup the global name: if it has not been added, or has been added but not set, then
self.nil will be returned.
pub fn get_legal_global(&self, i: usize) -> Result<Val, Box<VMError>>[src]
Get the global at position i: if it has not been set (i.e. is ValKind::ILLEGAL) this
will return Err(...).
pub fn set_global(&mut self, name: &str, v: Val)[src]
Set the global name to the value v, overwriting the previous value (if any).
Auto Trait Implementations
impl !NoTrace for VM
impl !RefUnwindSafe for VM
impl Send for VM
impl !Sync for VM
impl Unpin for VM
impl !UnwindSafe for VM
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
U: TryFrom<T>,