Struct zingen::MacroAssembler
source · pub struct MacroAssembler { /* private fields */ }Expand description
EVM MacroAssembler.
Implementations§
source§impl MacroAssembler
impl MacroAssembler
sourcepub fn _ge(&mut self) -> Result<()>
pub fn _ge(&mut self) -> Result<()>
Greater than or equal comparison.
a b ge -> a b-1 gt(lt)
Using lt due to order of stack.
sourcepub fn _sge(&mut self) -> Result<()>
pub fn _sge(&mut self) -> Result<()>
Greater than or equal comparison.
a b sge -> a b-1 sgt(slt)
Using lt due to order of stack.
sourcepub fn _sle(&mut self) -> Result<()>
pub fn _sle(&mut self) -> Result<()>
Greater than or equal comparison.
a b sge -> a b-1 sgt(slt)
Using lt due to order of stack.
sourcepub fn _le(&mut self) -> Result<()>
pub fn _le(&mut self) -> Result<()>
Greater than or equal comparison.
a b le -> a b-1 lt(gt)
Using gt due to order of stack.
sourcepub fn _sgt(&mut self) -> Result<()>
pub fn _sgt(&mut self) -> Result<()>
Greater than and equal comparison.
Using slt due to order of stack.
source§impl MacroAssembler
impl MacroAssembler
sourcepub fn _copysign(&mut self) -> Result<()>
pub fn _copysign(&mut self) -> Result<()>
If z1 and z2 have the same sign, return z1, otherwise return z1 with negated sign.
sourcepub fn _convert_i32_s(&mut self) -> Result<()>
pub fn _convert_i32_s(&mut self) -> Result<()>
Convert a signed 32-bit integer to a (32-bit/64-bit) float
sourcepub fn _convert_i32_u(&mut self) -> Result<()>
pub fn _convert_i32_u(&mut self) -> Result<()>
Convert an unsigned 32-bit integer to a (32-bit/64-bit) float
sourcepub fn _convert_i64_s(&mut self) -> Result<()>
pub fn _convert_i64_s(&mut self) -> Result<()>
Convert a signed 32-bit integer to a (32-bit/64-bit) float
sourcepub fn _convert_i64_u(&mut self) -> Result<()>
pub fn _convert_i64_u(&mut self) -> Result<()>
Convert a unsigned 32-bit integer to a (32-bit/64-bit) float
source§impl MacroAssembler
impl MacroAssembler
sourcepub fn _i32_const(&mut self, value: i32) -> Result<()>
pub fn _i32_const(&mut self, value: i32) -> Result<()>
Push a 32-bit integer value on the stack.
sourcepub fn _i64_const(&mut self, value: i64) -> Result<()>
pub fn _i64_const(&mut self, value: i64) -> Result<()>
Push a 64-bit integer value on the stack.
sourcepub fn _f32_const(&mut self, _value: Ieee32) -> Result<()>
pub fn _f32_const(&mut self, _value: Ieee32) -> Result<()>
Push a 32-bit float value on the stack.
sourcepub fn _f64_const(&mut self, _value: Ieee64) -> Result<()>
pub fn _f64_const(&mut self, _value: Ieee64) -> Result<()>
Push a 64-bit float value on the stack.
sourcepub fn _i32_wrap_i64(&mut self) -> Result<()>
pub fn _i32_wrap_i64(&mut self) -> Result<()>
wrap a 64-bit integer to a 32-bit integer.
sourcepub fn _i64_extend_i32_s(&mut self) -> Result<()>
pub fn _i64_extend_i32_s(&mut self) -> Result<()>
Extend a signed 32-bit integer to a 64-bit integer.
sourcepub fn _i64_extend_i32_u(&mut self) -> Result<()>
pub fn _i64_extend_i32_u(&mut self) -> Result<()>
Extend an unsigned 32-bit integer to a 64-bit integer.
sourcepub fn _f32_demote_f64(&mut self) -> Result<()>
pub fn _f32_demote_f64(&mut self) -> Result<()>
Truncate a 64-bit float to a signed 32-bit integer.
sourcepub fn _f64_promote_f32(&mut self) -> Result<()>
pub fn _f64_promote_f32(&mut self) -> Result<()>
Truncate a 64-bit float to an unsigned 32-bit integer.
sourcepub fn _i32_reinterpret_f32(&mut self) -> Result<()>
pub fn _i32_reinterpret_f32(&mut self) -> Result<()>
Convert a signed 32-bit integer to a 32-bit float.
sourcepub fn _i64_reinterpret_f64(&mut self) -> Result<()>
pub fn _i64_reinterpret_f64(&mut self) -> Result<()>
Convert a signed 64-bit integer to a 64-bit float.
sourcepub fn _f32_reinterpret_i32(&mut self) -> Result<()>
pub fn _f32_reinterpret_i32(&mut self) -> Result<()>
Convert a 32-bit float to a signed 32-bit integer.
sourcepub fn _f64_reinterpret_i64(&mut self) -> Result<()>
pub fn _f64_reinterpret_i64(&mut self) -> Result<()>
Convert a 64-bit float to a signed 64-bit integer.
sourcepub fn _rotl(&mut self) -> Result<()>
pub fn _rotl(&mut self) -> Result<()>
sign-agnostic rotate left
Return the result of rotating i1 left by k bits.
sourcepub fn _rotr(&mut self) -> Result<()>
pub fn _rotr(&mut self) -> Result<()>
sign-agnostic rotate right
Return the result of rotating i1 right by k bits.
sourcepub fn _clz(&mut self) -> Result<()>
pub fn _clz(&mut self) -> Result<()>
sign-agnostic count leading zero bits
Return the number of leading zero bits in i, all zero bits are considered leading if the value is zero.
sourcepub fn _ctz(&mut self) -> Result<()>
pub fn _ctz(&mut self) -> Result<()>
sign-agnostic count leading zero bits
Return the number of leading zero bits in i, all zero bits are considered trailing if the value is zero.
sourcepub fn _popcnt(&mut self) -> Result<()>
pub fn _popcnt(&mut self) -> Result<()>
sign-agnostic count number of one bits
Return the count of no zero bits in i.
sourcepub fn _trunc_f32(&mut self) -> Result<()>
pub fn _trunc_f32(&mut self) -> Result<()>
Truncate a 32-bit float to an integer
sourcepub fn _trunc_f64(&mut self) -> Result<()>
pub fn _trunc_f64(&mut self) -> Result<()>
Truncate a 64-bit float to an integer
source§impl MacroAssembler
impl MacroAssembler
source§impl MacroAssembler
impl MacroAssembler
sourcepub fn memory_write(&mut self, ty: impl Type) -> Result<MemoryInfo>
pub fn memory_write(&mut self, ty: impl Type) -> Result<MemoryInfo>
Store data in memory with at current memory byte pointer.
sourcepub fn memory_write_bytes(&mut self, bytes: &[u8]) -> Result<MemoryInfo>
pub fn memory_write_bytes(&mut self, bytes: &[u8]) -> Result<MemoryInfo>
Write bytes to memory.
sourcepub fn memory_write_at(&mut self, offset: &[u8]) -> Result<()>
pub fn memory_write_at(&mut self, offset: &[u8]) -> Result<()>
Store data in memory at offset.
Returns the size in the lowest significant bytes.
sourcepub fn mp_offset<F>(&self, f: F) -> Result<SmallVec<[u8; 8]>>
pub fn mp_offset<F>(&self, f: F) -> Result<SmallVec<[u8; 8]>>
Get byte offset of the memory pointer.
Methods from Deref<Target = Assembler>§
sourcepub fn buffer_mut(&mut self) -> &mut Buffer
pub fn buffer_mut(&mut self) -> &mut Buffer
Mutable buffer of the assembler.
sourcepub fn increment_gas(&mut self, gas: u128)
pub fn increment_gas(&mut self, gas: u128)
Increment the gas counter.
TODO: use number bigger than u256 for throwing proper errors. (#21)
sourcepub fn increment_sp(&mut self, items: u8) -> Result<()>
pub fn increment_sp(&mut self, items: u8) -> Result<()>
Increment stack pointer
sourcepub fn decrement_sp(&mut self, items: u8) -> Result<()>
pub fn decrement_sp(&mut self, items: u8) -> Result<()>
Decrement stack pointer
sourcepub fn increment_mp(&mut self, offset: usize) -> Result<()>
pub fn increment_mp(&mut self, offset: usize) -> Result<()>
Increment memory pointer
sourcepub fn decrement_mp(&mut self, offset: usize) -> Result<()>
pub fn decrement_mp(&mut self, offset: usize) -> Result<()>
Decrement memory pointer
sourcepub fn emit_op(&mut self, opcode: OpCode) -> Result<()>
pub fn emit_op(&mut self, opcode: OpCode) -> Result<()>
Emit a single opcode.
Mock the stack input and output for checking the stack usages.
sourcepub fn _signextend(&mut self) -> Result<()>
pub fn _signextend(&mut self) -> Result<()>
EmitSIGNEXTEND
sourcepub fn _callvalue(&mut self) -> Result<()>
pub fn _callvalue(&mut self) -> Result<()>
EmitCALLVALUE
sourcepub fn _calldataload(&mut self) -> Result<()>
pub fn _calldataload(&mut self) -> Result<()>
EmitCALLDATALOAD
sourcepub fn _calldatasize(&mut self) -> Result<()>
pub fn _calldatasize(&mut self) -> Result<()>
EmitCALLDATASIZE
sourcepub fn _calldatacopy(&mut self) -> Result<()>
pub fn _calldatacopy(&mut self) -> Result<()>
EmitCALLDATACOPY
sourcepub fn _extcodesize(&mut self) -> Result<()>
pub fn _extcodesize(&mut self) -> Result<()>
EmitEXTCODESIZE
sourcepub fn _extcodecopy(&mut self) -> Result<()>
pub fn _extcodecopy(&mut self) -> Result<()>
EmitEXTCODECOPY
sourcepub fn _returndatasize(&mut self) -> Result<()>
pub fn _returndatasize(&mut self) -> Result<()>
EmitRETURNDATASIZE
sourcepub fn _returndatacopy(&mut self) -> Result<()>
pub fn _returndatacopy(&mut self) -> Result<()>
EmitRETURNDATACOPY
sourcepub fn _blockhash(&mut self) -> Result<()>
pub fn _blockhash(&mut self) -> Result<()>
EmitBLOCKHASH
sourcepub fn _timestamp(&mut self) -> Result<()>
pub fn _timestamp(&mut self) -> Result<()>
EmitTIMESTAMP
sourcepub fn _difficulty(&mut self) -> Result<()>
pub fn _difficulty(&mut self) -> Result<()>
EmitDIFFICULTY
sourcepub fn _delegatecall(&mut self) -> Result<()>
pub fn _delegatecall(&mut self) -> Result<()>
EmitDELEGATECALL
sourcepub fn _staticcall(&mut self) -> Result<()>
pub fn _staticcall(&mut self) -> Result<()>
EmitSTATICCALL
sourcepub fn _selfdestruct(&mut self) -> Result<()>
pub fn _selfdestruct(&mut self) -> Result<()>
EmitSELFDESTRUCT