slvm::chunk

Struct Chunk

Source
pub struct Chunk {
Show 14 fields pub code: Vec<u8>, pub file_name: &'static str, start_line: u32, last_line: u32, line_numbers: Vec<u8>, pub constants: Vec<Value>, pub jump_table: Vec<u32>, pub captures: Option<Vec<u32>>, pub input_regs: usize, pub extra_regs: usize, pub args: u16, pub opt_args: u16, pub rest: bool, pub dbg_args: Option<Vec<Interned>>,
}

Fields§

§code: Vec<u8>§file_name: &'static str§start_line: u32§last_line: u32§line_numbers: Vec<u8>§constants: Vec<Value>§jump_table: Vec<u32>§captures: Option<Vec<u32>>§input_regs: usize§extra_regs: usize§args: u16§opt_args: u16§rest: bool§dbg_args: Option<Vec<Interned>>

Implementations§

Source§

impl Chunk

Source

fn disassemble_instruction<I, ENV>( &self, chunk: I, op: OpCode, wide: bool, _vm: &GVm<ENV>, ) -> VMResult<bool>
where I: IntoIterator<Item = (usize, u8)>,

Source

pub fn disassemble_chunk<ENV>( &self, vm: &GVm<ENV>, indent_level: u16, ) -> VMResult<()>

Source§

impl Chunk

Source

pub fn new(file_name: &'static str, start_line: u32) -> Self

Source

fn encode_operand(&mut self, op: u16, wide: bool)

Source

fn encode_line_number( &mut self, offsets: u8, line_number: Option<u32>, ) -> VMResult<()>

Source

pub fn offset_to_line(&self, offset: usize) -> Option<u32>

Source

pub fn line_to_offset(&self, line: u32) -> Option<usize>

Source

pub fn add_constant(&mut self, value: Value) -> usize

Source

pub fn add_jump(&mut self, offset: u32) -> usize

Source

pub fn update_jump(&mut self, jmp: usize, offset: u32)

Source

pub fn encode0( &mut self, op_code: OpCode, line_number: Option<u32>, ) -> VMResult<()>

Source

pub fn encode1( &mut self, opcode: OpCode, op1: u16, line_number: Option<u32>, ) -> VMResult<()>

Source

pub fn encode2( &mut self, opcode: OpCode, op1: u16, op2: u16, line_number: Option<u32>, ) -> VMResult<()>

Source

pub fn encode_def( &mut self, reg: u16, global: u32, line_number: Option<u32>, is_defv: bool, ) -> VMResult<()>

Source

pub fn encode_refi( &mut self, reg: u16, global: u32, line_number: Option<u32>, ) -> VMResult<()>

Source

pub fn encode_callg( &mut self, global: u32, num_args: u16, first_reg: u16, line_number: Option<u32>, ) -> VMResult<()>

Source

pub fn encode_tcallg( &mut self, global: u32, num_args: u16, line_number: Option<u32>, ) -> VMResult<()>

Source

pub fn encode3( &mut self, opcode: OpCode, op1: u16, op2: u16, op3: u16, line_number: Option<u32>, ) -> VMResult<()>

Trait Implementations§

Source§

impl Clone for Chunk

Source§

fn clone(&self) -> Chunk

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Chunk

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Chunk

§

impl RefUnwindSafe for Chunk

§

impl Send for Chunk

§

impl Sync for Chunk

§

impl Unpin for Chunk

§

impl UnwindSafe for Chunk

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.