Disassembler

Struct Disassembler 

Source
pub struct Disassembler {
    pub(crate) parser: Parser,
    pub(crate) cursor: usize,
    pub(crate) functions: Vec<Function>,
}

Fields§

§parser: Parser§cursor: usize§functions: Vec<Function>

Implementations§

Source§

impl Disassembler

Source

pub fn new(path: impl AsRef<Path>, nls: Nls) -> Result<Self>

Source

pub fn get_parser(&self) -> &Parser

Source

pub fn get_pc(&self) -> usize

Source

pub fn nop(&mut self) -> Result<()>

0x00 nop instruction nop, no operation

Source

pub fn init_stack(&mut self, parser: &mut Parser) -> Result<()>

0x01 init stack instruction initialize the local routine stack, as well as the post-phase of perforimg call instruction or launching a new routine

Source

pub fn call(&mut self, parser: &mut Parser) -> Result<()>

0x02 call instruction call a routine

Source

pub fn syscall(&mut self, parser: &mut Parser) -> Result<()>

0x03 syscall call a system call

Source

pub fn ret(&mut self) -> Result<()>

0x04 ret instruction return from a routine

Source

pub fn retv(&mut self) -> Result<()>

0x05 retv instruction return from a routine with a value

Source

pub fn jmp(&mut self, parser: &mut Parser) -> Result<()>

0x06 jmp instruction jump to the address

Source

pub fn jz(&mut self, parser: &mut Parser) -> Result<()>

0x07 jz instruction jump to the address if the top of the stack is zero

Source

pub fn push_nil(&mut self) -> Result<()>

0x08 push nil push a nil value onto the stack

Source

pub fn push_true(&mut self) -> Result<()>

0x09 push true push a true value onto the stack

Source

pub fn push_i32(&mut self, parser: &mut Parser) -> Result<()>

0x0A push i32 push an i32 value onto the stack

Source

pub fn push_i16(&mut self, parser: &mut Parser) -> Result<()>

0x0B push i16 push an i16 value onto the stack

Source

pub fn push_i8(&mut self, parser: &mut Parser) -> Result<()>

0x0C push i8 push an i8 value onto the stack

Source

pub fn push_f32(&mut self, parser: &mut Parser) -> Result<()>

0x0D push f32 push an f32 value onto the stack

Source

pub fn push_string(&mut self, parser: &mut Parser) -> Result<()>

0x0E push string push a string onto the stack

Source

pub fn push_global(&mut self, parser: &mut Parser) -> Result<()>

0x0F push global push a global variable onto the stack

Source

pub fn push_stack(&mut self, parser: &mut Parser) -> Result<()>

0x10 push stack push a stack variable onto the stack

Source

pub fn push_global_table(&mut self, parser: &mut Parser) -> Result<()>

0x11 push global table push a value than stored in the global table by immediate key onto the stack we assume that if any failure occurs, such as the key not found, we will push a nil value onto the stack for compatibility reasons.

Source

pub fn push_local_table(&mut self, parser: &mut Parser) -> Result<()>

0x12 push local table push a value than stored in the local table by key onto the stack

Source

pub fn push_top(&mut self) -> Result<()>

0x13 push top push the top of the stack onto the stack

Source

pub fn push_return_value(&mut self) -> Result<()>

0x14 push return value push the return value onto the stack

Source

pub fn pop_global(&mut self, parser: &mut Parser) -> Result<()>

0x15 pop global pop the top of the stack and store it in the global table

Source

pub fn local_copy(&mut self, parser: &mut Parser) -> Result<()>

0x16 local copy copy the top of the stack to the local variable

Source

pub fn pop_global_table(&mut self, parser: &mut Parser) -> Result<()>

0x17 pop global table pop the top of the stack and store it in the global table by key

Source

pub fn pop_local_table(&mut self, parser: &mut Parser) -> Result<()>

0x18 pop local table pop the top of the stack and store it in the local table by key

Source

pub fn neg(&mut self) -> Result<()>

0x19 neg negate the top of the stack, only works for integers and floats

Source

pub fn add(&mut self) -> Result<()>

0x1A add add the top two values on the stack

Source

pub fn sub(&mut self) -> Result<()>

0x1B sub subtract the top two values on the stack

Source

pub fn mul(&mut self) -> Result<()>

0x1C mul multiply the top two values on the stack

Source

pub fn div(&mut self) -> Result<()>

0x1D div divide the top two values on the stack

Source

pub fn modulo(&mut self) -> Result<()>

0x1E modulo modulo the top two values on the stack

Source

pub fn bittest(&mut self) -> Result<()>

0x1F bittest test with the top two values on the stack

Source

pub fn and(&mut self) -> Result<()>

0x20 and push true if both the top two values on the stack are none-nil

Source

pub fn or(&mut self) -> Result<()>

0x21 or push true if either of the top two values on the stack is none-nil

Source

pub fn sete(&mut self) -> Result<()>

0x22 sete set the top of the stack to true if the top two values on the stack are equal

Source

pub fn setne(&mut self) -> Result<()>

0x23 setne set the top of the stack to true if the top two values on the stack are not equal

Source

pub fn setg(&mut self) -> Result<()>

0x24 setg set the top of the stack to true if the top two values on the stack are greater

Source

pub fn setle(&mut self) -> Result<()>

0x25 setle set the top of the stack to true if the top two values on the stack are less or equal

Source

pub fn setl(&mut self) -> Result<()>

0x26 setl set the top of the stack to true if the top two values on the stack are less

Source

pub fn setge(&mut self) -> Result<()>

0x27 setge set the top of the stack to true if the top two values on the stack are greater or equal

Source

pub(crate) fn disassemble_opcode(&mut self, parser: &mut Parser) -> Result<()>

Source

pub fn disassemble(&mut self) -> Result<()>

Source

pub fn write_insts(&self, path: impl AsRef<Path>) -> Result<()>

Auto Trait Implementations§

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
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<S> FromSample<S> for S

§

fn from_sample_(s: S) -> S

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

§

fn into_sample(self) -> T

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

§

fn to_sample_(self) -> U

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.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> Component for T
where T: Send + Sync + 'static,

§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T
where T: WasmNotSend + WasmNotSync,

§

impl<T> WasmNotSync for T
where T: Sync,