pub struct GVm<ENV> { /* private fields */ }
Implementations§
Source§impl<ENV> GVm<ENV>
impl<ENV> GVm<ENV>
pub fn clear_err_frame(&mut self)
pub fn err_frame(&self) -> &Option<CallFrame>
pub fn get_registers(&self, start: usize, end: usize) -> &[Value]
pub fn get_current_registers(&self) -> &[Value]
pub fn get_stack(&self, idx: usize) -> Value
pub fn stack_max(&self) -> usize
pub fn get_interned(&self, i: Interned) -> &'static str
pub fn intern_static(&mut self, string: &'static str) -> Interned
pub fn intern(&mut self, string: &str) -> Interned
pub fn get_if_interned(&self, string: &str) -> Option<Interned>
pub fn set_global(&mut self, slot: u32, value: Value)
pub fn reserve_global(&mut self) -> u32
pub fn get_call_stack(&self) -> CallStackIter<'_, ENV>
pub fn sizeof_heap_object() -> usize
pub fn alloc_pair(&mut self, car: Value, cdr: Value) -> Value
pub fn alloc_pair_ro(&mut self, car: Value, cdr: Value) -> Value
pub fn alloc_string(&mut self, s: String) -> Value
pub fn alloc_string_ro(&mut self, s: String) -> Value
pub fn alloc_char(&mut self, ch: &str) -> Value
pub fn alloc_vector(&mut self, v: Vec<Value>) -> Value
pub fn alloc_vector_ro(&mut self, v: Vec<Value>) -> Value
pub fn alloc_map(&mut self, map: VMHashMap) -> Value
pub fn alloc_map_ro(&mut self, map: VMHashMap) -> Value
pub fn alloc_list_ro(&mut self, v: Vec<Value>) -> Value
pub fn alloc_bytes(&mut self, v: Vec<u8>) -> Value
pub fn alloc_lambda(&mut self, l: Arc<Chunk>) -> Value
pub fn alloc_closure(&mut self, l: Arc<Chunk>, v: Vec<Handle>) -> Value
pub fn alloc_continuation(&mut self, k: Continuation) -> Value
pub fn alloc_callframe(&mut self, frame: CallFrame) -> Value
Sourcepub fn alloc_value(&mut self, val: Value) -> Value
pub fn alloc_value(&mut self, val: Value) -> Value
Allocate a Value on the heap. Moving a value to the heap is useful for captured variable for instance.
Sourcepub fn alloc_error(&mut self, err: Error) -> Value
pub fn alloc_error(&mut self, err: Error) -> Value
Allocate an Error on the heap.
Sourcepub fn alloc_io(&mut self, io: HeapIo) -> Value
pub fn alloc_io(&mut self, io: HeapIo) -> Value
Allocate a Value on the heap. Moving a value to the heap is useful for captured variable for instance.
pub fn heap_immutable(&mut self, val: Value)
pub fn heap_sticky(&mut self, val: Value)
pub fn heap_unsticky(&mut self, val: Value)
Sourcepub fn pause_gc(&mut self)
pub fn pause_gc(&mut self)
Pause garbage collection. Each pause_gc must have an unpause_gc before GC resumes (it is a counter that must be 0).
Sourcepub fn unpause_gc(&mut self)
pub fn unpause_gc(&mut self)
UnPause garbage collection. Each pause_gc must have an unpause_gc before GC resumes (it is a counter that must be 0).
pub fn get_heap_property(&self, key_val: Value, prop: &str) -> Option<Value>
pub fn set_heap_property(&mut self, key_val: Value, prop: &str, value: Value)
pub fn get_heap_property_interned( &self, key_val: Value, prop: Interned, ) -> Option<Value>
pub fn set_heap_property_interned( &mut self, key_val: Value, prop: Interned, value: Value, )
pub fn get_global_property(&self, global: u32, prop: Interned) -> Option<Value>
pub fn set_global_property(&mut self, global: u32, prop: Interned, value: Value)
pub fn get_global(&self, idx: u32) -> Value
pub fn get_string(&self, handle: Handle) -> &str
pub fn get_string_mut(&mut self, handle: Handle) -> VMResult<&mut String>
pub fn get_vector(&self, handle: Handle) -> &[Value]
pub fn get_vector_mut(&mut self, handle: Handle) -> VMResult<&mut Vec<Value>>
pub fn get_map(&self, handle: Handle) -> &VMHashMap
pub fn get_map_mut(&mut self, handle: Handle) -> VMResult<&mut VMHashMap>
pub fn get_bytes(&self, handle: Handle) -> &[u8] ⓘ
pub fn get_pair(&self, handle: Handle) -> (Value, Value)
pub fn get_pair_mut( &mut self, handle: Handle, ) -> VMResult<(&mut Value, &mut Value)>
pub fn get_pair_mut_override( &mut self, handle: Handle, ) -> (&mut Value, &mut Value)
pub fn get_lambda(&self, handle: Handle) -> Arc<Chunk>
pub fn get_closure(&self, handle: Handle) -> (Arc<Chunk>, &[Handle])
pub fn get_continuation(&self, handle: Handle) -> &Continuation
pub fn get_callframe(&self, handle: Handle) -> &CallFrame
pub fn get_value(&self, handle: Handle) -> Value
pub fn get_value_mut(&mut self, handle: Handle) -> &mut Value
pub fn get_error(&self, handle: Handle) -> Error
pub fn get_io(&self, handle: Handle) -> &HeapIo ⓘ
pub fn new_upval(&mut self, val: Value) -> Value
pub fn call_frame(&self) -> Option<&CallFrame>
pub fn make_err(&mut self, key: &'static str, data: Value) -> Value
Source§impl<ENV> GVm<ENV>
impl<ENV> GVm<ENV>
pub fn new_with_env(env: ENV) -> Self
pub fn this_fn(&self) -> Option<Value>
pub fn stack(&self, idx: usize) -> Value
pub fn stack_mut(&mut self, idx: usize) -> &mut Value
pub fn stack_slice(&self) -> &[Value]
pub fn stack_slice_mut(&mut self) -> &mut [Value]
pub fn register_slice<'b>(&self) -> &'b [Value]
Sourcepub fn register_int(&self, idx: usize) -> VMResult<i64>
pub fn register_int(&self, idx: usize) -> VMResult<i64>
Return the int representation of register idx or error if not an integral type.
Sourcepub fn register_unref(&self, idx: usize) -> Value
pub fn register_unref(&self, idx: usize) -> Value
Return the current register for idx, if it is stored on heap then dereference it first.
pub fn register_mut<'b>(&self, idx: usize) -> &'b mut Value
pub fn env(&self) -> &ENV
pub fn env_mut(&mut self) -> &mut ENV
pub fn add_builtin(&mut self, func: CallFuncSig<ENV>) -> Value
Sourcepub fn get_builtin(&self, idx: u32) -> &CallFuncSig<ENV>
pub fn get_builtin(&self, idx: u32) -> &CallFuncSig<ENV>
Return the builtin function at idx. Note, will panic if idx is not a valid builtin index.
pub fn is_equal_pair(&self, val1: Value, val2: Value) -> VMResult<Value>
Sourcepub fn do_call(
&mut self,
chunk: Arc<Chunk>,
params: &[Value],
caps: Option<&[Handle]>,
) -> VMResult<Value>
pub fn do_call( &mut self, chunk: Arc<Chunk>, params: &[Value], caps: Option<&[Handle]>, ) -> VMResult<Value>
Runs a lambda. Will save and restore the VM state even on error, chunk is expected to be a callable with params and any captures (closure) in caps. This is useful for macro expansion, eval and things like that. It can be safely used while the VM is currently executing bytecode.