Skip to main content

VM

Struct VM 

Source
pub struct VM {
    pub registers: Vec<JSValue>,
    pub frames: Vec<CallFrame>,
    pub frame_index: usize,
    pub pc: usize,
    /* private fields */
}

Fields§

§registers: Vec<JSValue>§frames: Vec<CallFrame>§frame_index: usize§pc: usize

Implementations§

Source§

impl VM

Source

pub fn new() -> Self

Source

pub fn find_var_in_frame_stack(&self, name_atom: u32) -> Option<(usize, u16)>

Source

pub fn get_var_in_caller_vm(&self, name_atom: u32) -> Option<JSValue>

Source

pub fn set_var_in_caller_vm( &mut self, ctx: &mut JSContext, name_atom: u32, value: JSValue, ) -> bool

Source

pub fn init_var_in_caller_vm( &mut self, ctx: &mut JSContext, name_atom: u32, value: JSValue, ) -> bool

Source

pub fn set_var_in_frame_stack( &mut self, ctx: &mut JSContext, name: &str, value: JSValue, )

Source

pub fn collect_roots(&self, ctx: &JSContext) -> Vec<JSValue>

Source

pub fn maybe_gc(&mut self, ctx: &mut JSContext)

Source

pub fn minor_gc(&mut self, ctx: &mut JSContext) -> usize

Source

pub fn run_gc(&mut self, ctx: &mut JSContext) -> usize

Source

pub fn call_function( &mut self, ctx: &mut JSContext, func: JSValue, args: &[JSValue], ) -> Result<JSValue, String>

Source

pub fn call_function_with_this( &mut self, ctx: &mut JSContext, func: JSValue, this_value: JSValue, args: &[JSValue], ) -> Result<JSValue, String>

Source

pub fn execute( &mut self, ctx: &mut JSContext, bytecode: &Bytecode, ) -> Result<ExecutionOutcome, String>

Source

pub fn execute_preserving_registers( &mut self, ctx: &mut JSContext, bytecode: &Bytecode, ) -> Result<ExecutionOutcome, String>

Source

pub fn execute_eval( &mut self, ctx: &mut JSContext, bytecode: &Bytecode, this_value: JSValue, caller_vm_ptr: Option<usize>, ) -> Result<ExecutionOutcome, String>

Source

pub fn direct_eval( &mut self, ctx: &mut JSContext, source: &str, ) -> Result<JSValue, String>

Source

pub fn execute_generator_step( &mut self, ctx: &mut JSContext, bytecode: &Bytecode, registers_snapshot: &[JSValue], start_pc: usize, ) -> Result<(JSValue, Vec<JSValue>, usize, bool), String>

Auto Trait Implementations§

§

impl Freeze for VM

§

impl !RefUnwindSafe for VM

§

impl !Send for VM

§

impl !Sync for VM

§

impl Unpin for VM

§

impl UnsafeUnpin for VM

§

impl !UnwindSafe for VM

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.

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.