Skip to main content

BeamInstr

Enum BeamInstr 

Source
pub enum BeamInstr {
Show 45 variants Label(u32), FuncInfo { module: String, function: String, arity: u32, }, Call { arity: u32, label: u32, }, CallLast { arity: u32, label: u32, deallocate: u32, }, CallExt { arity: u32, destination: BeamExtFunc, }, CallExtLast { arity: u32, destination: BeamExtFunc, deallocate: u32, }, CallFun { arity: u32, }, Move { src: BeamReg, dst: BeamReg, }, PutTuple { arity: u32, dst: BeamReg, }, Put(BeamVal), GetTupleElement { src: BeamReg, index: u32, dst: BeamReg, }, SetTupleElement { value: BeamVal, tuple: BeamReg, index: u32, }, IsEq { fail: u32, lhs: BeamVal, rhs: BeamVal, }, IsEqExact { fail: u32, lhs: BeamVal, rhs: BeamVal, }, IsNe { fail: u32, lhs: BeamVal, rhs: BeamVal, }, IsLt { fail: u32, lhs: BeamVal, rhs: BeamVal, }, IsGe { fail: u32, lhs: BeamVal, rhs: BeamVal, }, IsInteger { fail: u32, arg: BeamVal, }, IsFloat { fail: u32, arg: BeamVal, }, IsAtom { fail: u32, arg: BeamVal, }, IsNil { fail: u32, arg: BeamVal, }, IsList { fail: u32, arg: BeamVal, }, IsTuple { fail: u32, arg: BeamVal, }, IsBinary { fail: u32, arg: BeamVal, }, IsFunction { fail: u32, arg: BeamVal, }, Jump(u32), Return, Send, RemoveMessage, LoopRec { fail: u32, dst: BeamReg, }, Wait(u32), WaitTimeout { fail: u32, timeout: BeamVal, }, GcBif { name: String, fail: u32, live: u32, args: Vec<BeamVal>, dst: BeamReg, }, Bif0 { name: String, dst: BeamReg, }, Allocate { stack_need: u32, live: u32, }, Deallocate(u32), Init(BeamReg), MakeFun2(u32), GetList { src: BeamReg, head: BeamReg, tail: BeamReg, }, PutList { head: BeamVal, tail: BeamVal, dst: BeamReg, }, Raise { class: BeamVal, reason: BeamVal, }, TryBegin { label: u32, reg: BeamReg, }, TryEnd(BeamReg), TryCase(BeamReg), Comment(String),
}
Expand description

Low-level BEAM instruction set representation.

These correspond to actual BEAM opcodes as documented in https://github.com/erlang/otp/blob/master/lib/compiler/src/beam_opcodes.erl

Variants§

§

Label(u32)

label L — defines a jump label

§

FuncInfo

func_info Mod Func Arity — function header

Fields

§module: String
§function: String
§arity: u32
§

Call

call Arity Label — local function call

Fields

§arity: u32
§label: u32
§

CallLast

call_last Arity Label Deallocate — tail call

Fields

§arity: u32
§label: u32
§deallocate: u32
§

CallExt

call_ext Arity Destination — external call

Fields

§arity: u32
§destination: BeamExtFunc
§

CallExtLast

call_ext_last Arity Destination Deallocate — external tail call

Fields

§arity: u32
§destination: BeamExtFunc
§deallocate: u32
§

CallFun

call_fun Arity — call a fun value

Fields

§arity: u32
§

Move

move Source Destination — move a register or literal to register

Fields

§

PutTuple

put_tuple Arity Destination — begin tuple construction

Fields

§arity: u32
§

Put(BeamVal)

put Value — add element to tuple under construction

§

GetTupleElement

get_tuple_element Source Index Destination

Fields

§index: u32
§

SetTupleElement

set_tuple_element Value Tuple Index

Fields

§value: BeamVal
§tuple: BeamReg
§index: u32
§

IsEq

is_eq FailLabel Arg1 Arg2 — equality test

Fields

§fail: u32
§

IsEqExact

is_eq_exact FailLabel Arg1 Arg2 — strict equality test

Fields

§fail: u32
§

IsNe

is_ne FailLabel Arg1 Arg2 — inequality test

Fields

§fail: u32
§

IsLt

is_lt FailLabel Arg1 Arg2 — less-than test

Fields

§fail: u32
§

IsGe

is_ge FailLabel Arg1 Arg2 — greater-than-or-equal test

Fields

§fail: u32
§

IsInteger

is_integer FailLabel Arg — type check

Fields

§fail: u32
§

IsFloat

is_float FailLabel Arg

Fields

§fail: u32
§

IsAtom

is_atom FailLabel Arg

Fields

§fail: u32
§

IsNil

is_nil FailLabel Arg

Fields

§fail: u32
§

IsList

is_list FailLabel Arg

Fields

§fail: u32
§

IsTuple

is_tuple FailLabel Arg

Fields

§fail: u32
§

IsBinary

is_binary FailLabel Arg

Fields

§fail: u32
§

IsFunction

is_function FailLabel Arg

Fields

§fail: u32
§

Jump(u32)

jump Label — unconditional jump

§

Return

return — return X0

§

Send

send — send message: X0 ! X1

§

RemoveMessage

remove_message — consume current message

§

LoopRec

loop_rec FailLabel Destination — receive loop

Fields

§fail: u32
§

Wait(u32)

wait Label — wait for message

§

WaitTimeout

wait_timeout FailLabel Time

Fields

§fail: u32
§timeout: BeamVal
§

GcBif

gc_bif Name FailLabel Live Args Destination — garbage-collecting BIF

Fields

§name: String
§fail: u32
§live: u32
§args: Vec<BeamVal>
§

Bif0

bif0 Name Destination — 0-argument BIF

Fields

§name: String
§

Allocate

allocate StackNeed Live — allocate stack frame

Fields

§stack_need: u32
§live: u32
§

Deallocate(u32)

deallocate N — deallocate stack frame

§

Init(BeamReg)

init Destination — initialize to nil

§

MakeFun2(u32)

make_fun2 Index — create closure from lambda table

§

GetList

get_list Source Head Tail — deconstruct list

Fields

§head: BeamReg
§tail: BeamReg
§

PutList

put_list Head Tail Destination — construct list cell

Fields

§head: BeamVal
§tail: BeamVal
§

Raise

raise Class Reason — raise exception

Fields

§class: BeamVal
§reason: BeamVal
§

TryBegin

try Label Register — begin try block

Fields

§label: u32
§

TryEnd(BeamReg)

try_end Register — end try block

§

TryCase(BeamReg)

try_case Register — enter catch handler

§

Comment(String)

Raw comment for readability in dumps

Trait Implementations§

Source§

impl Clone for BeamInstr

Source§

fn clone(&self) -> BeamInstr

Returns a duplicate 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 BeamInstr

Source§

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

Formats the value using the given formatter. Read more

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