pub struct Chunk {
pub code: Vec<u8>,
pub file_name: &'static str,
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>>,
/* private fields */
}
Fields§
§code: Vec<u8>
§file_name: &'static str
§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
impl Chunk
pub fn new(file_name: &'static str, start_line: u32) -> Self
pub fn offset_to_line(&self, offset: usize) -> Option<u32>
pub fn line_to_offset(&self, line: u32) -> Option<usize>
pub fn add_constant(&mut self, value: Value) -> usize
pub fn add_jump(&mut self, offset: u32) -> usize
pub fn update_jump(&mut self, jmp: usize, offset: u32)
pub fn encode0( &mut self, op_code: OpCode, line_number: Option<u32>, ) -> VMResult<()>
pub fn encode1( &mut self, opcode: OpCode, op1: u16, line_number: Option<u32>, ) -> VMResult<()>
pub fn encode2( &mut self, opcode: OpCode, op1: u16, op2: u16, line_number: Option<u32>, ) -> VMResult<()>
pub fn encode_def( &mut self, reg: u16, global: u32, line_number: Option<u32>, is_defv: bool, ) -> VMResult<()>
pub fn encode_refi( &mut self, reg: u16, global: u32, line_number: Option<u32>, ) -> VMResult<()>
pub fn encode_callg( &mut self, global: u32, num_args: u16, first_reg: u16, line_number: Option<u32>, ) -> VMResult<()>
pub fn encode_tcallg( &mut self, global: u32, num_args: u16, line_number: Option<u32>, ) -> VMResult<()>
pub fn encode3( &mut self, opcode: OpCode, op1: u16, op2: u16, op3: u16, line_number: Option<u32>, ) -> VMResult<()>
Trait Implementations§
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> 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