Enum fuel_asm::Instruction
source · pub enum Instruction {
Show 109 variants
ADD(ADD),
AND(AND),
DIV(DIV),
EQ(EQ),
EXP(EXP),
GT(GT),
LT(LT),
MLOG(MLOG),
MROO(MROO),
MOD(MOD),
MOVE(MOVE),
MUL(MUL),
NOT(NOT),
OR(OR),
SLL(SLL),
SRL(SRL),
SUB(SUB),
XOR(XOR),
MLDV(MLDV),
RET(RET),
RETD(RETD),
ALOC(ALOC),
MCL(MCL),
MCP(MCP),
MEQ(MEQ),
BHSH(BHSH),
BHEI(BHEI),
BURN(BURN),
CALL(CALL),
CCP(CCP),
CROO(CROO),
CSIZ(CSIZ),
CB(CB),
LDC(LDC),
LOG(LOG),
LOGD(LOGD),
MINT(MINT),
RVRT(RVRT),
SCWQ(SCWQ),
SRW(SRW),
SRWQ(SRWQ),
SWW(SWW),
SWWQ(SWWQ),
TR(TR),
TRO(TRO),
ECK1(ECK1),
ECR1(ECR1),
ED19(ED19),
K256(K256),
S256(S256),
TIME(TIME),
NOOP(NOOP),
FLAG(FLAG),
BAL(BAL),
JMP(JMP),
JNE(JNE),
SMO(SMO),
ADDI(ADDI),
ANDI(ANDI),
DIVI(DIVI),
EXPI(EXPI),
MODI(MODI),
MULI(MULI),
ORI(ORI),
SLLI(SLLI),
SRLI(SRLI),
SUBI(SUBI),
XORI(XORI),
JNEI(JNEI),
LB(LB),
LW(LW),
SB(SB),
SW(SW),
MCPI(MCPI),
GTF(GTF),
MCLI(MCLI),
GM(GM),
MOVI(MOVI),
JNZI(JNZI),
JMPF(JMPF),
JMPB(JMPB),
JNZF(JNZF),
JNZB(JNZB),
JNEF(JNEF),
JNEB(JNEB),
JI(JI),
CFEI(CFEI),
CFSI(CFSI),
CFE(CFE),
CFS(CFS),
PSHL(PSHL),
PSHH(PSHH),
POPL(POPL),
POPH(POPH),
WDCM(WDCM),
WQCM(WQCM),
WDOP(WDOP),
WQOP(WQOP),
WDML(WDML),
WQML(WQML),
WDDV(WDDV),
WQDV(WQDV),
WDMD(WDMD),
WQMD(WQMD),
WDAM(WDAM),
WQAM(WQAM),
WDMM(WDMM),
WQMM(WQMM),
ECAL(ECAL),
}
Expand description
Representation of a single instruction for the interpreter.
The opcode is represented in the tag (variant), or may be retrieved in the form of an
Opcode
byte using the opcode
method.
The register and immediate data associated with the instruction is represented within an inner unit type wrapper around the 3 remaining bytes.
Variants§
ADD(ADD)
Adds two registers.
AND(AND)
Bitwise ANDs two registers.
DIV(DIV)
Divides two registers.
EQ(EQ)
Compares two registers for equality.
EXP(EXP)
Raises one register to the power of another.
GT(GT)
Compares two registers for greater-than.
LT(LT)
Compares two registers for less-than.
MLOG(MLOG)
The integer logarithm of a register.
MROO(MROO)
The integer root of a register.
MOD(MOD)
Modulo remainder of two registers.
MOVE(MOVE)
Copy from one register to another.
MUL(MUL)
Multiplies two registers.
NOT(NOT)
Bitwise NOT a register.
OR(OR)
Bitwise ORs two registers.
SLL(SLL)
Left shifts a register by a register.
SRL(SRL)
Right shifts a register by a register.
SUB(SUB)
Subtracts two registers.
XOR(XOR)
Bitwise XORs two registers.
MLDV(MLDV)
Fused multiply-divide with arbitrary precision intermediate step.
RET(RET)
Return from context.
RETD(RETD)
Return from context with data.
ALOC(ALOC)
Allocate a number of bytes from the heap.
MCL(MCL)
Clear a variable number of bytes in memory.
MCP(MCP)
Copy a variable number of bytes in memory.
MEQ(MEQ)
Compare bytes in memory.
BHSH(BHSH)
Get block header hash for height.
BHEI(BHEI)
Get current block height.
BURN(BURN)
Burns amount
coins of the asset ID created from sub_id
for the current contract.
CALL(CALL)
Call a contract.
CCP(CCP)
Copy contract code for a contract.
CROO(CROO)
Get code root of a contract.
CSIZ(CSIZ)
Get code size of a contract.
CB(CB)
Get current block proposer’s address.
LDC(LDC)
Load a contract’s code as executable.
LOG(LOG)
Log an event.
LOGD(LOGD)
Log data.
MINT(MINT)
Mints amount
coins of the asset ID created from sub_id
for the current contract.
RVRT(RVRT)
Halt execution, reverting state changes and returning a value.
SCWQ(SCWQ)
Clear a series of slots from contract storage.
SRW(SRW)
Load a word from contract storage.
SRWQ(SRWQ)
Load a series of 32 byte slots from contract storage.
SWW(SWW)
Store a word in contract storage.
SWWQ(SWWQ)
Store a series of 32 byte slots in contract storage.
TR(TR)
Transfer coins to a contract unconditionally.
TRO(TRO)
Transfer coins to a variable output.
ECK1(ECK1)
The 64-byte public key (x, y) recovered from 64-byte signature on 32-byte message.
ECR1(ECR1)
The 64-byte Secp256r1 public key (x, y) recovered from 64-byte signature on 32-byte message.
ED19(ED19)
Verify ED25519 public key and signature match a 32-byte message.
K256(K256)
The keccak-256 hash of a slice.
S256(S256)
The SHA-2-256 hash of a slice.
TIME(TIME)
Get timestamp of block at given height.
NOOP(NOOP)
Performs no operation.
FLAG(FLAG)
Set flag register to a register.
BAL(BAL)
Get the balance of contract of an asset ID.
JMP(JMP)
Dynamic jump.
JNE(JNE)
Conditional dynamic jump.
SMO(SMO)
Send a message to recipient address with call abi, coins, and output.
ADDI(ADDI)
Adds a register and an immediate value.
ANDI(ANDI)
Bitwise ANDs a register and an immediate value.
DIVI(DIVI)
Divides a register and an immediate value.
EXPI(EXPI)
Raises one register to the power of an immediate value.
MODI(MODI)
Modulo remainder of a register and an immediate value.
MULI(MULI)
Multiplies a register and an immediate value.
ORI(ORI)
Bitwise ORs a register and an immediate value.
SLLI(SLLI)
Left shifts a register by an immediate value.
SRLI(SRLI)
Right shifts a register by an immediate value.
SUBI(SUBI)
Subtracts a register and an immediate value.
XORI(XORI)
Bitwise XORs a register and an immediate value.
JNEI(JNEI)
Conditional jump.
LB(LB)
A byte is loaded from the specified address offset by an immediate value.
LW(LW)
A word is loaded from the specified address offset by an immediate value.
SB(SB)
Write the least significant byte of a register to memory.
SW(SW)
Write a register to memory.
MCPI(MCPI)
Copy an immediate number of bytes in memory.
GTF(GTF)
Get transaction fields.
MCLI(MCLI)
Clear an immediate number of bytes in memory.
GM(GM)
Get metadata from memory.
MOVI(MOVI)
Copy immediate value into a register
JNZI(JNZI)
Conditional jump against zero.
JMPF(JMPF)
Unconditional dynamic relative jump forwards, with a constant offset.
JMPB(JMPB)
Unconditional dynamic relative jump backwards, with a constant offset.
JNZF(JNZF)
Dynamic relative jump forwards, conditional against zero, with a constant offset.
JNZB(JNZB)
Dynamic relative jump backwards, conditional against zero, with a constant offset.
JNEF(JNEF)
Dynamic relative jump forwards, conditional on comparsion, with a constant offset.
JNEB(JNEB)
Dynamic relative jump backwards, conditional on comparsion, with a constant offset.
JI(JI)
Jump.
CFEI(CFEI)
Extend the current call frame’s stack by an immediate value.
CFSI(CFSI)
Shrink the current call frame’s stack by an immediate value.
CFE(CFE)
Extend the current call frame’s stack
CFS(CFS)
Shrink the current call frame’s stack
PSHL(PSHL)
Push a bitmask-selected set of registers in range 16..40 to the stack.
PSHH(PSHH)
Push a bitmask-selected set of registers in range 40..64 to the stack.
POPL(POPL)
Pop a bitmask-selected set of registers in range 16..40 to the stack.
POPH(POPH)
Pop a bitmask-selected set of registers in range 40..64 to the stack.
WDCM(WDCM)
Compare 128bit integers
WQCM(WQCM)
Compare 256bit integers
WDOP(WDOP)
Simple 128bit operations
WQOP(WQOP)
Simple 256bit operations
WDML(WDML)
Multiply 128bit
WQML(WQML)
Multiply 256bit
WDDV(WDDV)
Divide 128bit
WQDV(WQDV)
Divide 256bit
WDMD(WDMD)
Fused multiply-divide 128bit
WQMD(WQMD)
Fused multiply-divide 256bit
WDAM(WDAM)
AddMod 128bit
WQAM(WQAM)
AddMod 256bit
WDMM(WDMM)
MulMod 128bit
WQMM(WQMM)
MulMod 256bit
ECAL(ECAL)
Call external function
Implementations§
source§impl Instruction
impl Instruction
Trait Implementations§
source§impl Clone for Instruction
impl Clone for Instruction
source§fn clone(&self) -> Instruction
fn clone(&self) -> Instruction
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for Instruction
impl Debug for Instruction
source§impl<'de> Deserialize<'de> for Instruction
impl<'de> Deserialize<'de> for Instruction
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl From<ADD> for Instruction
impl From<ADD> for Instruction
source§impl From<ADDI> for Instruction
impl From<ADDI> for Instruction
source§impl From<ALOC> for Instruction
impl From<ALOC> for Instruction
source§impl From<AND> for Instruction
impl From<AND> for Instruction
source§impl From<ANDI> for Instruction
impl From<ANDI> for Instruction
source§impl From<BAL> for Instruction
impl From<BAL> for Instruction
source§impl From<BHEI> for Instruction
impl From<BHEI> for Instruction
source§impl From<BHSH> for Instruction
impl From<BHSH> for Instruction
source§impl From<BURN> for Instruction
impl From<BURN> for Instruction
source§impl From<CALL> for Instruction
impl From<CALL> for Instruction
source§impl From<CB> for Instruction
impl From<CB> for Instruction
source§impl From<CCP> for Instruction
impl From<CCP> for Instruction
source§impl From<CFE> for Instruction
impl From<CFE> for Instruction
source§impl From<CFEI> for Instruction
impl From<CFEI> for Instruction
source§impl From<CFS> for Instruction
impl From<CFS> for Instruction
source§impl From<CFSI> for Instruction
impl From<CFSI> for Instruction
source§impl From<CROO> for Instruction
impl From<CROO> for Instruction
source§impl From<CSIZ> for Instruction
impl From<CSIZ> for Instruction
source§impl From<DIV> for Instruction
impl From<DIV> for Instruction
source§impl From<DIVI> for Instruction
impl From<DIVI> for Instruction
source§impl From<ECAL> for Instruction
impl From<ECAL> for Instruction
source§impl From<ECK1> for Instruction
impl From<ECK1> for Instruction
source§impl From<ECR1> for Instruction
impl From<ECR1> for Instruction
source§impl From<ED19> for Instruction
impl From<ED19> for Instruction
source§impl From<EQ> for Instruction
impl From<EQ> for Instruction
source§impl From<EXP> for Instruction
impl From<EXP> for Instruction
source§impl From<EXPI> for Instruction
impl From<EXPI> for Instruction
source§impl From<FLAG> for Instruction
impl From<FLAG> for Instruction
source§impl From<GM> for Instruction
impl From<GM> for Instruction
source§impl From<GT> for Instruction
impl From<GT> for Instruction
source§impl From<GTF> for Instruction
impl From<GTF> for Instruction
source§impl From<Instruction> for [u8; 4]
impl From<Instruction> for [u8; 4]
source§fn from(inst: Instruction) -> Self
fn from(inst: Instruction) -> Self
source§impl From<Instruction> for RawInstruction
impl From<Instruction> for RawInstruction
source§fn from(inst: Instruction) -> Self
fn from(inst: Instruction) -> Self
source§impl From<JI> for Instruction
impl From<JI> for Instruction
source§impl From<JMP> for Instruction
impl From<JMP> for Instruction
source§impl From<JMPB> for Instruction
impl From<JMPB> for Instruction
source§impl From<JMPF> for Instruction
impl From<JMPF> for Instruction
source§impl From<JNE> for Instruction
impl From<JNE> for Instruction
source§impl From<JNEB> for Instruction
impl From<JNEB> for Instruction
source§impl From<JNEF> for Instruction
impl From<JNEF> for Instruction
source§impl From<JNEI> for Instruction
impl From<JNEI> for Instruction
source§impl From<JNZB> for Instruction
impl From<JNZB> for Instruction
source§impl From<JNZF> for Instruction
impl From<JNZF> for Instruction
source§impl From<JNZI> for Instruction
impl From<JNZI> for Instruction
source§impl From<K256> for Instruction
impl From<K256> for Instruction
source§impl From<LB> for Instruction
impl From<LB> for Instruction
source§impl From<LDC> for Instruction
impl From<LDC> for Instruction
source§impl From<LOG> for Instruction
impl From<LOG> for Instruction
source§impl From<LOGD> for Instruction
impl From<LOGD> for Instruction
source§impl From<LT> for Instruction
impl From<LT> for Instruction
source§impl From<LW> for Instruction
impl From<LW> for Instruction
source§impl From<MCL> for Instruction
impl From<MCL> for Instruction
source§impl From<MCLI> for Instruction
impl From<MCLI> for Instruction
source§impl From<MCP> for Instruction
impl From<MCP> for Instruction
source§impl From<MCPI> for Instruction
impl From<MCPI> for Instruction
source§impl From<MEQ> for Instruction
impl From<MEQ> for Instruction
source§impl From<MINT> for Instruction
impl From<MINT> for Instruction
source§impl From<MLDV> for Instruction
impl From<MLDV> for Instruction
source§impl From<MLOG> for Instruction
impl From<MLOG> for Instruction
source§impl From<MOD> for Instruction
impl From<MOD> for Instruction
source§impl From<MODI> for Instruction
impl From<MODI> for Instruction
source§impl From<MOVE> for Instruction
impl From<MOVE> for Instruction
source§impl From<MOVI> for Instruction
impl From<MOVI> for Instruction
source§impl From<MROO> for Instruction
impl From<MROO> for Instruction
source§impl From<MUL> for Instruction
impl From<MUL> for Instruction
source§impl From<MULI> for Instruction
impl From<MULI> for Instruction
source§impl From<NOOP> for Instruction
impl From<NOOP> for Instruction
source§impl From<NOT> for Instruction
impl From<NOT> for Instruction
source§impl From<OR> for Instruction
impl From<OR> for Instruction
source§impl From<ORI> for Instruction
impl From<ORI> for Instruction
source§impl From<POPH> for Instruction
impl From<POPH> for Instruction
source§impl From<POPL> for Instruction
impl From<POPL> for Instruction
source§impl From<PSHH> for Instruction
impl From<PSHH> for Instruction
source§impl From<PSHL> for Instruction
impl From<PSHL> for Instruction
source§impl From<RET> for Instruction
impl From<RET> for Instruction
source§impl From<RETD> for Instruction
impl From<RETD> for Instruction
source§impl From<RVRT> for Instruction
impl From<RVRT> for Instruction
source§impl From<S256> for Instruction
impl From<S256> for Instruction
source§impl From<SB> for Instruction
impl From<SB> for Instruction
source§impl From<SCWQ> for Instruction
impl From<SCWQ> for Instruction
source§impl From<SLL> for Instruction
impl From<SLL> for Instruction
source§impl From<SLLI> for Instruction
impl From<SLLI> for Instruction
source§impl From<SMO> for Instruction
impl From<SMO> for Instruction
source§impl From<SRL> for Instruction
impl From<SRL> for Instruction
source§impl From<SRLI> for Instruction
impl From<SRLI> for Instruction
source§impl From<SRW> for Instruction
impl From<SRW> for Instruction
source§impl From<SRWQ> for Instruction
impl From<SRWQ> for Instruction
source§impl From<SUB> for Instruction
impl From<SUB> for Instruction
source§impl From<SUBI> for Instruction
impl From<SUBI> for Instruction
source§impl From<SW> for Instruction
impl From<SW> for Instruction
source§impl From<SWW> for Instruction
impl From<SWW> for Instruction
source§impl From<SWWQ> for Instruction
impl From<SWWQ> for Instruction
source§impl From<TIME> for Instruction
impl From<TIME> for Instruction
source§impl From<TR> for Instruction
impl From<TR> for Instruction
source§impl From<TRO> for Instruction
impl From<TRO> for Instruction
source§impl From<WDAM> for Instruction
impl From<WDAM> for Instruction
source§impl From<WDCM> for Instruction
impl From<WDCM> for Instruction
source§impl From<WDDV> for Instruction
impl From<WDDV> for Instruction
source§impl From<WDMD> for Instruction
impl From<WDMD> for Instruction
source§impl From<WDML> for Instruction
impl From<WDML> for Instruction
source§impl From<WDMM> for Instruction
impl From<WDMM> for Instruction
source§impl From<WDOP> for Instruction
impl From<WDOP> for Instruction
source§impl From<WQAM> for Instruction
impl From<WQAM> for Instruction
source§impl From<WQCM> for Instruction
impl From<WQCM> for Instruction
source§impl From<WQDV> for Instruction
impl From<WQDV> for Instruction
source§impl From<WQMD> for Instruction
impl From<WQMD> for Instruction
source§impl From<WQML> for Instruction
impl From<WQML> for Instruction
source§impl From<WQMM> for Instruction
impl From<WQMM> for Instruction
source§impl From<WQOP> for Instruction
impl From<WQOP> for Instruction
source§impl From<XOR> for Instruction
impl From<XOR> for Instruction
source§impl From<XORI> for Instruction
impl From<XORI> for Instruction
source§impl FromIterator<Instruction> for Vec<u32>
Available on crate feature alloc
only.
impl FromIterator<Instruction> for Vec<u32>
alloc
only.source§fn from_iter<I: IntoIterator<Item = Instruction>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = Instruction>>(iter: I) -> Self
source§impl FromIterator<Instruction> for Vec<u8>
Available on crate feature alloc
only.
impl FromIterator<Instruction> for Vec<u8>
alloc
only.source§fn from_iter<I: IntoIterator<Item = Instruction>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = Instruction>>(iter: I) -> Self
source§impl Hash for Instruction
impl Hash for Instruction
source§impl PartialEq for Instruction
impl PartialEq for Instruction
source§fn eq(&self, other: &Instruction) -> bool
fn eq(&self, other: &Instruction) -> bool
self
and other
values to be equal, and is used
by ==
.