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
impl Disassembler
pub fn new(path: impl AsRef<Path>, nls: Nls) -> Result<Self>
pub fn get_parser(&self) -> &Parser
pub fn get_pc(&self) -> usize
Sourcepub fn init_stack(&mut self, parser: &mut Parser) -> Result<()>
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
Sourcepub fn jmp(&mut self, parser: &mut Parser) -> Result<()>
pub fn jmp(&mut self, parser: &mut Parser) -> Result<()>
0x06 jmp instruction jump to the address
Sourcepub fn jz(&mut self, parser: &mut Parser) -> Result<()>
pub fn jz(&mut self, parser: &mut Parser) -> Result<()>
0x07 jz instruction jump to the address if the top of the stack is zero
Sourcepub fn push_i32(&mut self, parser: &mut Parser) -> Result<()>
pub fn push_i32(&mut self, parser: &mut Parser) -> Result<()>
0x0A push i32 push an i32 value onto the stack
Sourcepub fn push_i16(&mut self, parser: &mut Parser) -> Result<()>
pub fn push_i16(&mut self, parser: &mut Parser) -> Result<()>
0x0B push i16 push an i16 value onto the stack
Sourcepub fn push_i8(&mut self, parser: &mut Parser) -> Result<()>
pub fn push_i8(&mut self, parser: &mut Parser) -> Result<()>
0x0C push i8 push an i8 value onto the stack
Sourcepub fn push_f32(&mut self, parser: &mut Parser) -> Result<()>
pub fn push_f32(&mut self, parser: &mut Parser) -> Result<()>
0x0D push f32 push an f32 value onto the stack
Sourcepub fn push_string(&mut self, parser: &mut Parser) -> Result<()>
pub fn push_string(&mut self, parser: &mut Parser) -> Result<()>
0x0E push string push a string onto the stack
Sourcepub fn push_global(&mut self, parser: &mut Parser) -> Result<()>
pub fn push_global(&mut self, parser: &mut Parser) -> Result<()>
0x0F push global push a global variable onto the stack
Sourcepub fn push_stack(&mut self, parser: &mut Parser) -> Result<()>
pub fn push_stack(&mut self, parser: &mut Parser) -> Result<()>
0x10 push stack push a stack variable onto the stack
Sourcepub fn push_global_table(&mut self, parser: &mut Parser) -> Result<()>
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.
Sourcepub fn push_local_table(&mut self, parser: &mut Parser) -> Result<()>
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
Sourcepub fn push_top(&mut self) -> Result<()>
pub fn push_top(&mut self) -> Result<()>
0x13 push top push the top of the stack onto the stack
Sourcepub fn push_return_value(&mut self) -> Result<()>
pub fn push_return_value(&mut self) -> Result<()>
0x14 push return value push the return value onto the stack
Sourcepub fn pop_global(&mut self, parser: &mut Parser) -> Result<()>
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
Sourcepub fn local_copy(&mut self, parser: &mut Parser) -> Result<()>
pub fn local_copy(&mut self, parser: &mut Parser) -> Result<()>
0x16 local copy copy the top of the stack to the local variable
Sourcepub fn pop_global_table(&mut self, parser: &mut Parser) -> Result<()>
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
Sourcepub fn pop_local_table(&mut self, parser: &mut Parser) -> Result<()>
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
Sourcepub fn neg(&mut self) -> Result<()>
pub fn neg(&mut self) -> Result<()>
0x19 neg negate the top of the stack, only works for integers and floats
Sourcepub fn and(&mut self) -> Result<()>
pub fn and(&mut self) -> Result<()>
0x20 and push true if both the top two values on the stack are none-nil
Sourcepub fn or(&mut self) -> Result<()>
pub fn or(&mut self) -> Result<()>
0x21 or push true if either of the top two values on the stack is none-nil
Sourcepub fn sete(&mut self) -> Result<()>
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
Sourcepub fn setne(&mut self) -> Result<()>
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
Sourcepub fn setg(&mut self) -> Result<()>
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
Sourcepub fn setle(&mut self) -> Result<()>
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
Sourcepub fn setl(&mut self) -> Result<()>
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
Sourcepub fn setge(&mut self) -> Result<()>
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
pub(crate) fn disassemble_opcode(&mut self, parser: &mut Parser) -> Result<()>
pub fn disassemble(&mut self) -> Result<()>
pub fn write_insts(&self, path: impl AsRef<Path>) -> Result<()>
Auto Trait Implementations§
impl Freeze for Disassembler
impl RefUnwindSafe for Disassembler
impl Send for Disassembler
impl Sync for Disassembler
impl Unpin for Disassembler
impl UnsafeUnpin for Disassembler
impl UnwindSafe for Disassembler
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&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
impl<T> DowncastSync for T
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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