Skip to main content

Insn

Struct Insn 

Source
pub struct Insn {
    pub op: Opcode,
    pub fused: Fused,
    pub a: u32,
    pub b: u32,
    pub imm: u32,
    pub offset: u32,
}
Expand description

One decoded instruction.

a and b are the two operands: a slot index, a constant-pool index, an atom, an immediate — or, for a jump, the index of the target instruction.

Fields§

§op: Opcode

The opcode.

§fused: Fused

A fused form of this instruction and the next few, when they match a pattern worth collapsing. Fused::None means “run op as it is”.

The fused form is a shorthand for a sequence the bytecode still contains: the dispatcher runs one record and skips the rest, so the bytecode, the disassembly and every jump target are unchanged. This is the one optimisation that reduces the number of dispatches rather than their cost, which is why it is worth the extra pass.

§a: u32

First operand, or a jump target as an instruction index.

§b: u32

Second operand.

§imm: u32

Third operand, used only by fusions that need a slot, an immediate and a jump target at once (currently Fused::LtLocImmJump).

§offset: u32

Where this instruction started in the bytecode, for stack traces and the line table. (pc is an index, and no longer answers that question.)

Implementations§

Source§

impl Insn

Source

pub fn width(&self) -> usize

How many bytecode instructions this record replaces.

Trait Implementations§

Source§

impl Clone for Insn

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for Insn

Source§

impl Debug for Insn

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Forget for Insn

§

impl Freeze for Insn

§

impl Move for Insn

§

impl RefUnwindSafe for Insn

§

impl Send for Insn

§

impl Sync for Insn

§

impl Unpin for Insn

§

impl UnsafeUnpin for Insn

§

impl UnwindSafe for Insn

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, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.