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
Call
call Arity Label — local function call
CallLast
call_last Arity Label Deallocate — tail call
CallExt
call_ext Arity Destination — external call
CallExtLast
call_ext_last Arity Destination Deallocate — external tail call
CallFun
call_fun Arity — call a fun value
Move
move Source Destination — move a register or literal to register
PutTuple
put_tuple Arity Destination — begin tuple construction
Put(BeamVal)
put Value — add element to tuple under construction
GetTupleElement
get_tuple_element Source Index Destination
SetTupleElement
set_tuple_element Value Tuple Index
IsEq
is_eq FailLabel Arg1 Arg2 — equality test
IsEqExact
is_eq_exact FailLabel Arg1 Arg2 — strict equality test
IsNe
is_ne FailLabel Arg1 Arg2 — inequality test
IsLt
is_lt FailLabel Arg1 Arg2 — less-than test
IsGe
is_ge FailLabel Arg1 Arg2 — greater-than-or-equal test
IsInteger
is_integer FailLabel Arg — type check
IsFloat
is_float FailLabel Arg
IsAtom
is_atom FailLabel Arg
IsNil
is_nil FailLabel Arg
IsList
is_list FailLabel Arg
IsTuple
is_tuple FailLabel Arg
IsBinary
is_binary FailLabel Arg
IsFunction
is_function FailLabel Arg
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
Wait(u32)
wait Label — wait for message
WaitTimeout
wait_timeout FailLabel Time
GcBif
gc_bif Name FailLabel Live Args Destination — garbage-collecting BIF
Bif0
bif0 Name Destination — 0-argument BIF
Allocate
allocate StackNeed Live — allocate stack frame
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
PutList
put_list Head Tail Destination — construct list cell
Raise
raise Class Reason — raise exception
TryBegin
try Label Register — begin try block
TryEnd(BeamReg)
try_end Register — end try block
TryCase(BeamReg)
try_case Register — enter catch handler
Comment(String)
Raw comment for readability in dumps