pub struct MacroAssembler {
pub(crate) asm: Assembler,
}
Expand description
EVM MacroAssembler.
Fields§
§asm: Assembler
Low level assembler.
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
Sourcepub(crate) fn _load(&mut self) -> Result<()>
pub(crate) fn _load(&mut self) -> Result<()>
Load n bytes to extend self as another number type.
Just for adapting the WASM instructions, this method makes no sense for EVM since all of the numbers as U256.
Sourcepub(crate) fn _load8(&mut self) -> Result<()>
pub(crate) fn _load8(&mut self) -> Result<()>
Load 1 byte to extend self as another number type.
Just for adapting the WASM instructions, this method makes no sense for EVM since all of the numbers as U256.
Sourcepub(crate) fn _load16(&mut self) -> Result<()>
pub(crate) fn _load16(&mut self) -> Result<()>
Load 2 bytes to extend self as another number type.
Just for adapting the WASM instructions, this method makes no sense for EVM since all of the numbers as U256.
Sourcepub(crate) fn _load32(&mut self) -> Result<()>
pub(crate) fn _load32(&mut self) -> Result<()>
Load 4 bytes to extend self as another number type.
Just for adapting the WASM instructions, this method makes no sense for EVM since all of the numbers as U256.
Source§impl MacroAssembler
impl MacroAssembler
Sourcepub(crate) fn handle_empty_return(&mut self) -> Result<()>
pub(crate) fn handle_empty_return(&mut self) -> Result<()>
Return with nothing.
Sourcepub fn main_return(&mut self, results: &[ValType]) -> Result<()>
pub fn main_return(&mut self, results: &[ValType]) -> Result<()>
Handle the end of the main function.
Sourcepub fn call_return(&mut self, results: &[ValType]) -> Result<()>
pub fn call_return(&mut self, results: &[ValType]) -> Result<()>
Handle the return of a call.
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: u16) -> Result<()>
pub fn increment_sp(&mut self, items: u16) -> Result<()>
Increment stack pointer
Sourcepub fn decrement_sp(&mut self, items: u16) -> Result<()>
pub fn decrement_sp(&mut self, items: u16) -> 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<()>
Emit SIGNEXTEND
Sourcepub fn _keccak256(&mut self) -> Result<()>
pub fn _keccak256(&mut self) -> Result<()>
Emit KECCAK256
Sourcepub fn _callvalue(&mut self) -> Result<()>
pub fn _callvalue(&mut self) -> Result<()>
Emit CALLVALUE
Sourcepub fn _calldataload(&mut self) -> Result<()>
pub fn _calldataload(&mut self) -> Result<()>
Emit CALLDATALOAD
Sourcepub fn _calldatasize(&mut self) -> Result<()>
pub fn _calldatasize(&mut self) -> Result<()>
Emit CALLDATASIZE
Sourcepub fn _calldatacopy(&mut self) -> Result<()>
pub fn _calldatacopy(&mut self) -> Result<()>
Emit CALLDATACOPY
Sourcepub fn _extcodesize(&mut self) -> Result<()>
pub fn _extcodesize(&mut self) -> Result<()>
Emit EXTCODESIZE
Sourcepub fn _extcodecopy(&mut self) -> Result<()>
pub fn _extcodecopy(&mut self) -> Result<()>
Emit EXTCODECOPY
Sourcepub fn _returndatasize(&mut self) -> Result<()>
pub fn _returndatasize(&mut self) -> Result<()>
Emit RETURNDATASIZE
Sourcepub fn _returndatacopy(&mut self) -> Result<()>
pub fn _returndatacopy(&mut self) -> Result<()>
Emit RETURNDATACOPY
Sourcepub fn _extcodehash(&mut self) -> Result<()>
pub fn _extcodehash(&mut self) -> Result<()>
Emit EXTCODEHASH
Sourcepub fn _blockhash(&mut self) -> Result<()>
pub fn _blockhash(&mut self) -> Result<()>
Emit BLOCKHASH
Sourcepub fn _timestamp(&mut self) -> Result<()>
pub fn _timestamp(&mut self) -> Result<()>
Emit TIMESTAMP
Sourcepub fn _difficulty(&mut self) -> Result<()>
pub fn _difficulty(&mut self) -> Result<()>
Emit DIFFICULTY
Sourcepub fn _selfbalance(&mut self) -> Result<()>
pub fn _selfbalance(&mut self) -> Result<()>
Emit SELFBALANCE
Sourcepub fn _blobbasefee(&mut self) -> Result<()>
pub fn _blobbasefee(&mut self) -> Result<()>
Emit BLOBBASEFEE
Sourcepub fn _delegatecall(&mut self) -> Result<()>
pub fn _delegatecall(&mut self) -> Result<()>
Emit DELEGATECALL
Sourcepub fn _staticcall(&mut self) -> Result<()>
pub fn _staticcall(&mut self) -> Result<()>
Emit STATICCALL
Sourcepub fn _selfdestruct(&mut self) -> Result<()>
pub fn _selfdestruct(&mut self) -> Result<()>
Emit SELFDESTRUCT
Trait Implementations§
Source§impl Clone for MacroAssembler
impl Clone for MacroAssembler
Source§fn clone(&self) -> MacroAssembler
fn clone(&self) -> MacroAssembler
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more