mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-06-12 10:31:04 +00:00
Revert "implement immutable variables codegen"
This reverts commit 0e6a6d12c3.
This commit is contained in:
@@ -45,7 +45,7 @@ impl Element {
|
||||
fn pop_arguments_llvm<'ctx, D>(
|
||||
&mut self,
|
||||
context: &mut revive_llvm_context::PolkaVMContext<'ctx, D>,
|
||||
) -> anyhow::Result<Vec<inkwell::values::BasicValueEnum<'ctx>>>
|
||||
) -> Vec<inkwell::values::BasicValueEnum<'ctx>>
|
||||
where
|
||||
D: revive_llvm_context::PolkaVMDependency + Clone,
|
||||
{
|
||||
@@ -57,13 +57,15 @@ impl Element {
|
||||
[self.stack.elements.len() + input_size - output_size - 1 - index]
|
||||
.to_llvm()
|
||||
.into_pointer_value();
|
||||
let value = context.build_load(
|
||||
revive_llvm_context::PolkaVMPointer::new_stack_field(context, pointer),
|
||||
format!("argument_{index}").as_str(),
|
||||
)?;
|
||||
let value = context
|
||||
.build_load(
|
||||
revive_llvm_context::PolkaVMPointer::new_stack_field(context, pointer),
|
||||
format!("argument_{index}").as_str(),
|
||||
)
|
||||
.unwrap();
|
||||
arguments.push(value);
|
||||
}
|
||||
Ok(arguments)
|
||||
arguments
|
||||
}
|
||||
}
|
||||
|
||||
@@ -424,7 +426,7 @@ where
|
||||
InstructionName::JUMPDEST => Ok(None),
|
||||
|
||||
InstructionName::ADD => {
|
||||
let arguments = self.pop_arguments_llvm(context)?;
|
||||
let arguments = self.pop_arguments_llvm(context);
|
||||
revive_llvm_context::polkavm_evm_arithmetic::addition(
|
||||
context,
|
||||
arguments[0].into_int_value(),
|
||||
@@ -433,7 +435,7 @@ where
|
||||
.map(Some)
|
||||
}
|
||||
InstructionName::SUB => {
|
||||
let arguments = self.pop_arguments_llvm(context)?;
|
||||
let arguments = self.pop_arguments_llvm(context);
|
||||
revive_llvm_context::polkavm_evm_arithmetic::subtraction(
|
||||
context,
|
||||
arguments[0].into_int_value(),
|
||||
@@ -442,7 +444,7 @@ where
|
||||
.map(Some)
|
||||
}
|
||||
InstructionName::MUL => {
|
||||
let arguments = self.pop_arguments_llvm(context)?;
|
||||
let arguments = self.pop_arguments_llvm(context);
|
||||
revive_llvm_context::polkavm_evm_arithmetic::multiplication(
|
||||
context,
|
||||
arguments[0].into_int_value(),
|
||||
@@ -451,7 +453,7 @@ where
|
||||
.map(Some)
|
||||
}
|
||||
InstructionName::DIV => {
|
||||
let arguments = self.pop_arguments_llvm(context)?;
|
||||
let arguments = self.pop_arguments_llvm(context);
|
||||
revive_llvm_context::polkavm_evm_arithmetic::division(
|
||||
context,
|
||||
arguments[0].into_int_value(),
|
||||
@@ -460,7 +462,7 @@ where
|
||||
.map(Some)
|
||||
}
|
||||
InstructionName::MOD => {
|
||||
let arguments = self.pop_arguments_llvm(context)?;
|
||||
let arguments = self.pop_arguments_llvm(context);
|
||||
revive_llvm_context::polkavm_evm_arithmetic::remainder(
|
||||
context,
|
||||
arguments[0].into_int_value(),
|
||||
@@ -469,7 +471,7 @@ where
|
||||
.map(Some)
|
||||
}
|
||||
InstructionName::SDIV => {
|
||||
let arguments = self.pop_arguments_llvm(context)?;
|
||||
let arguments = self.pop_arguments_llvm(context);
|
||||
revive_llvm_context::polkavm_evm_arithmetic::division_signed(
|
||||
context,
|
||||
arguments[0].into_int_value(),
|
||||
@@ -478,7 +480,7 @@ where
|
||||
.map(Some)
|
||||
}
|
||||
InstructionName::SMOD => {
|
||||
let arguments = self.pop_arguments_llvm(context)?;
|
||||
let arguments = self.pop_arguments_llvm(context);
|
||||
revive_llvm_context::polkavm_evm_arithmetic::remainder_signed(
|
||||
context,
|
||||
arguments[0].into_int_value(),
|
||||
@@ -488,7 +490,7 @@ where
|
||||
}
|
||||
|
||||
InstructionName::LT => {
|
||||
let arguments = self.pop_arguments_llvm(context)?;
|
||||
let arguments = self.pop_arguments_llvm(context);
|
||||
revive_llvm_context::polkavm_evm_comparison::compare(
|
||||
context,
|
||||
arguments[0].into_int_value(),
|
||||
@@ -498,7 +500,7 @@ where
|
||||
.map(Some)
|
||||
}
|
||||
InstructionName::GT => {
|
||||
let arguments = self.pop_arguments_llvm(context)?;
|
||||
let arguments = self.pop_arguments_llvm(context);
|
||||
revive_llvm_context::polkavm_evm_comparison::compare(
|
||||
context,
|
||||
arguments[0].into_int_value(),
|
||||
@@ -508,7 +510,7 @@ where
|
||||
.map(Some)
|
||||
}
|
||||
InstructionName::EQ => {
|
||||
let arguments = self.pop_arguments_llvm(context)?;
|
||||
let arguments = self.pop_arguments_llvm(context);
|
||||
revive_llvm_context::polkavm_evm_comparison::compare(
|
||||
context,
|
||||
arguments[0].into_int_value(),
|
||||
@@ -518,7 +520,7 @@ where
|
||||
.map(Some)
|
||||
}
|
||||
InstructionName::ISZERO => {
|
||||
let arguments = self.pop_arguments_llvm(context)?;
|
||||
let arguments = self.pop_arguments_llvm(context);
|
||||
revive_llvm_context::polkavm_evm_comparison::compare(
|
||||
context,
|
||||
arguments[0].into_int_value(),
|
||||
@@ -528,7 +530,7 @@ where
|
||||
.map(Some)
|
||||
}
|
||||
InstructionName::SLT => {
|
||||
let arguments = self.pop_arguments_llvm(context)?;
|
||||
let arguments = self.pop_arguments_llvm(context);
|
||||
revive_llvm_context::polkavm_evm_comparison::compare(
|
||||
context,
|
||||
arguments[0].into_int_value(),
|
||||
@@ -538,7 +540,7 @@ where
|
||||
.map(Some)
|
||||
}
|
||||
InstructionName::SGT => {
|
||||
let arguments = self.pop_arguments_llvm(context)?;
|
||||
let arguments = self.pop_arguments_llvm(context);
|
||||
revive_llvm_context::polkavm_evm_comparison::compare(
|
||||
context,
|
||||
arguments[0].into_int_value(),
|
||||
@@ -549,7 +551,7 @@ where
|
||||
}
|
||||
|
||||
InstructionName::OR => {
|
||||
let arguments = self.pop_arguments_llvm(context)?;
|
||||
let arguments = self.pop_arguments_llvm(context);
|
||||
revive_llvm_context::polkavm_evm_bitwise::or(
|
||||
context,
|
||||
arguments[0].into_int_value(),
|
||||
@@ -558,7 +560,7 @@ where
|
||||
.map(Some)
|
||||
}
|
||||
InstructionName::XOR => {
|
||||
let arguments = self.pop_arguments_llvm(context)?;
|
||||
let arguments = self.pop_arguments_llvm(context);
|
||||
revive_llvm_context::polkavm_evm_bitwise::xor(
|
||||
context,
|
||||
arguments[0].into_int_value(),
|
||||
@@ -567,7 +569,7 @@ where
|
||||
.map(Some)
|
||||
}
|
||||
InstructionName::NOT => {
|
||||
let arguments = self.pop_arguments_llvm(context)?;
|
||||
let arguments = self.pop_arguments_llvm(context);
|
||||
revive_llvm_context::polkavm_evm_bitwise::xor(
|
||||
context,
|
||||
arguments[0].into_int_value(),
|
||||
@@ -576,7 +578,7 @@ where
|
||||
.map(Some)
|
||||
}
|
||||
InstructionName::AND => {
|
||||
let arguments = self.pop_arguments_llvm(context)?;
|
||||
let arguments = self.pop_arguments_llvm(context);
|
||||
revive_llvm_context::polkavm_evm_bitwise::and(
|
||||
context,
|
||||
arguments[0].into_int_value(),
|
||||
@@ -585,7 +587,7 @@ where
|
||||
.map(Some)
|
||||
}
|
||||
InstructionName::SHL => {
|
||||
let arguments = self.pop_arguments_llvm(context)?;
|
||||
let arguments = self.pop_arguments_llvm(context);
|
||||
revive_llvm_context::polkavm_evm_bitwise::shift_left(
|
||||
context,
|
||||
arguments[0].into_int_value(),
|
||||
@@ -594,7 +596,7 @@ where
|
||||
.map(Some)
|
||||
}
|
||||
InstructionName::SHR => {
|
||||
let arguments = self.pop_arguments_llvm(context)?;
|
||||
let arguments = self.pop_arguments_llvm(context);
|
||||
revive_llvm_context::polkavm_evm_bitwise::shift_right(
|
||||
context,
|
||||
arguments[0].into_int_value(),
|
||||
@@ -603,7 +605,7 @@ where
|
||||
.map(Some)
|
||||
}
|
||||
InstructionName::SAR => {
|
||||
let arguments = self.pop_arguments_llvm(context)?;
|
||||
let arguments = self.pop_arguments_llvm(context);
|
||||
revive_llvm_context::polkavm_evm_bitwise::shift_right_arithmetic(
|
||||
context,
|
||||
arguments[0].into_int_value(),
|
||||
@@ -612,7 +614,7 @@ where
|
||||
.map(Some)
|
||||
}
|
||||
InstructionName::BYTE => {
|
||||
let arguments = self.pop_arguments_llvm(context)?;
|
||||
let arguments = self.pop_arguments_llvm(context);
|
||||
revive_llvm_context::polkavm_evm_bitwise::byte(
|
||||
context,
|
||||
arguments[0].into_int_value(),
|
||||
@@ -622,7 +624,7 @@ where
|
||||
}
|
||||
|
||||
InstructionName::ADDMOD => {
|
||||
let arguments = self.pop_arguments_llvm(context)?;
|
||||
let arguments = self.pop_arguments_llvm(context);
|
||||
revive_llvm_context::polkavm_evm_math::add_mod(
|
||||
context,
|
||||
arguments[0].into_int_value(),
|
||||
@@ -632,7 +634,7 @@ where
|
||||
.map(Some)
|
||||
}
|
||||
InstructionName::MULMOD => {
|
||||
let arguments = self.pop_arguments_llvm(context)?;
|
||||
let arguments = self.pop_arguments_llvm(context);
|
||||
revive_llvm_context::polkavm_evm_math::mul_mod(
|
||||
context,
|
||||
arguments[0].into_int_value(),
|
||||
@@ -642,7 +644,7 @@ where
|
||||
.map(Some)
|
||||
}
|
||||
InstructionName::EXP => {
|
||||
let arguments = self.pop_arguments_llvm(context)?;
|
||||
let arguments = self.pop_arguments_llvm(context);
|
||||
revive_llvm_context::polkavm_evm_math::exponent(
|
||||
context,
|
||||
arguments[0].into_int_value(),
|
||||
@@ -651,7 +653,7 @@ where
|
||||
.map(Some)
|
||||
}
|
||||
InstructionName::SIGNEXTEND => {
|
||||
let arguments = self.pop_arguments_llvm(context)?;
|
||||
let arguments = self.pop_arguments_llvm(context);
|
||||
revive_llvm_context::polkavm_evm_math::sign_extend(
|
||||
context,
|
||||
arguments[0].into_int_value(),
|
||||
@@ -661,7 +663,7 @@ where
|
||||
}
|
||||
|
||||
InstructionName::SHA3 | InstructionName::KECCAK256 => {
|
||||
let arguments = self.pop_arguments_llvm(context)?;
|
||||
let arguments = self.pop_arguments_llvm(context);
|
||||
revive_llvm_context::polkavm_evm_crypto::sha3(
|
||||
context,
|
||||
arguments[0].into_int_value(),
|
||||
@@ -671,7 +673,7 @@ where
|
||||
}
|
||||
|
||||
InstructionName::MLOAD => {
|
||||
let arguments = self.pop_arguments_llvm(context)?;
|
||||
let arguments = self.pop_arguments_llvm(context);
|
||||
revive_llvm_context::polkavm_evm_memory::load(
|
||||
context,
|
||||
arguments[0].into_int_value(),
|
||||
@@ -679,7 +681,7 @@ where
|
||||
.map(Some)
|
||||
}
|
||||
InstructionName::MSTORE => {
|
||||
let arguments = self.pop_arguments_llvm(context)?;
|
||||
let arguments = self.pop_arguments_llvm(context);
|
||||
revive_llvm_context::polkavm_evm_memory::store(
|
||||
context,
|
||||
arguments[0].into_int_value(),
|
||||
@@ -688,7 +690,7 @@ where
|
||||
.map(|_| None)
|
||||
}
|
||||
InstructionName::MSTORE8 => {
|
||||
let arguments = self.pop_arguments_llvm(context)?;
|
||||
let arguments = self.pop_arguments_llvm(context);
|
||||
revive_llvm_context::polkavm_evm_memory::store_byte(
|
||||
context,
|
||||
arguments[0].into_int_value(),
|
||||
@@ -697,7 +699,7 @@ where
|
||||
.map(|_| None)
|
||||
}
|
||||
InstructionName::MCOPY => {
|
||||
let arguments = self.pop_arguments_llvm(context)?;
|
||||
let arguments = self.pop_arguments_llvm(context);
|
||||
let destination = revive_llvm_context::PolkaVMPointer::new_with_offset(
|
||||
context,
|
||||
revive_llvm_context::PolkaVMAddressSpace::Heap,
|
||||
@@ -723,7 +725,7 @@ where
|
||||
}
|
||||
|
||||
InstructionName::SLOAD => {
|
||||
let arguments = self.pop_arguments_llvm(context)?;
|
||||
let arguments = self.pop_arguments_llvm(context);
|
||||
revive_llvm_context::polkavm_evm_storage::load(
|
||||
context,
|
||||
arguments[0].into_int_value(),
|
||||
@@ -731,7 +733,7 @@ where
|
||||
.map(Some)
|
||||
}
|
||||
InstructionName::SSTORE => {
|
||||
let arguments = self.pop_arguments_llvm(context)?;
|
||||
let arguments = self.pop_arguments_llvm(context);
|
||||
revive_llvm_context::polkavm_evm_storage::store(
|
||||
context,
|
||||
arguments[0].into_int_value(),
|
||||
@@ -740,7 +742,7 @@ where
|
||||
.map(|_| None)
|
||||
}
|
||||
InstructionName::TLOAD => {
|
||||
let arguments = self.pop_arguments_llvm(context)?;
|
||||
let arguments = self.pop_arguments_llvm(context);
|
||||
revive_llvm_context::polkavm_evm_storage::transient_load(
|
||||
context,
|
||||
arguments[0].into_int_value(),
|
||||
@@ -748,7 +750,7 @@ where
|
||||
.map(Some)
|
||||
}
|
||||
InstructionName::TSTORE => {
|
||||
let arguments = self.pop_arguments_llvm(context)?;
|
||||
let arguments = self.pop_arguments_llvm(context);
|
||||
revive_llvm_context::polkavm_evm_storage::transient_store(
|
||||
context,
|
||||
arguments[0].into_int_value(),
|
||||
@@ -764,28 +766,27 @@ where
|
||||
|
||||
let offset = context
|
||||
.solidity_mut()
|
||||
.get_or_allocate_immutable(key.as_str())
|
||||
/ revive_common::BYTE_LENGTH_WORD;
|
||||
.get_or_allocate_immutable(key.as_str());
|
||||
|
||||
let index = context.word_const(offset as u64);
|
||||
revive_llvm_context::polkavm_evm_immutable::load(context, index).map(Some)
|
||||
}
|
||||
InstructionName::ASSIGNIMMUTABLE => {
|
||||
let mut arguments = self.pop_arguments_llvm(context)?;
|
||||
let mut arguments = self.pop_arguments_llvm(context);
|
||||
|
||||
let key = self
|
||||
.instruction
|
||||
.value
|
||||
.ok_or_else(|| anyhow::anyhow!("Instruction value missing"))?;
|
||||
|
||||
let offset = context.solidity_mut().allocate_immutable(key.as_str())
|
||||
/ revive_common::BYTE_LENGTH_WORD;
|
||||
let offset = context.solidity_mut().allocate_immutable(key.as_str());
|
||||
|
||||
let index = context.word_const(offset as u64);
|
||||
let value = arguments.pop().expect("Always exists").into_int_value();
|
||||
revive_llvm_context::polkavm_evm_immutable::store(context, index, value)
|
||||
.map(|_| None)
|
||||
}
|
||||
|
||||
InstructionName::CALLDATALOAD => {
|
||||
match context
|
||||
.code_type()
|
||||
@@ -795,7 +796,7 @@ where
|
||||
Ok(Some(context.word_const(0).as_basic_value_enum()))
|
||||
}
|
||||
revive_llvm_context::PolkaVMCodeType::Runtime => {
|
||||
let arguments = self.pop_arguments_llvm(context)?;
|
||||
let arguments = self.pop_arguments_llvm(context);
|
||||
revive_llvm_context::polkavm_evm_calldata::load(
|
||||
context,
|
||||
arguments[0].into_int_value(),
|
||||
@@ -818,7 +819,7 @@ where
|
||||
}
|
||||
}
|
||||
InstructionName::CALLDATACOPY => {
|
||||
let arguments = self.pop_arguments_llvm(context)?;
|
||||
let arguments = self.pop_arguments_llvm(context);
|
||||
|
||||
match context
|
||||
.code_type()
|
||||
@@ -861,7 +862,7 @@ where
|
||||
}
|
||||
}
|
||||
InstructionName::CODECOPY => {
|
||||
let arguments = self.pop_arguments_llvm(context)?;
|
||||
let arguments = self.pop_arguments_llvm(context);
|
||||
|
||||
let parent = context.module().get_name().to_str().expect("Always valid");
|
||||
let source = &self.stack_input.elements[1];
|
||||
@@ -916,7 +917,7 @@ where
|
||||
revive_llvm_context::polkavm_evm_return_data::size(context).map(Some)
|
||||
}
|
||||
InstructionName::RETURNDATACOPY => {
|
||||
let arguments = self.pop_arguments_llvm(context)?;
|
||||
let arguments = self.pop_arguments_llvm(context);
|
||||
revive_llvm_context::polkavm_evm_return_data::copy(
|
||||
context,
|
||||
arguments[0].into_int_value(),
|
||||
@@ -926,7 +927,7 @@ where
|
||||
.map(|_| None)
|
||||
}
|
||||
InstructionName::EXTCODESIZE => {
|
||||
let arguments = self.pop_arguments_llvm(context)?;
|
||||
let arguments = self.pop_arguments_llvm(context);
|
||||
revive_llvm_context::polkavm_evm_ext_code::size(
|
||||
context,
|
||||
Some(arguments[0].into_int_value()),
|
||||
@@ -934,7 +935,7 @@ where
|
||||
.map(Some)
|
||||
}
|
||||
InstructionName::EXTCODEHASH => {
|
||||
let arguments = self.pop_arguments_llvm(context)?;
|
||||
let arguments = self.pop_arguments_llvm(context);
|
||||
revive_llvm_context::polkavm_evm_ext_code::hash(
|
||||
context,
|
||||
arguments[0].into_int_value(),
|
||||
@@ -943,7 +944,7 @@ where
|
||||
}
|
||||
|
||||
InstructionName::RETURN => {
|
||||
let arguments = self.pop_arguments_llvm(context)?;
|
||||
let arguments = self.pop_arguments_llvm(context);
|
||||
revive_llvm_context::polkavm_evm_return::r#return(
|
||||
context,
|
||||
arguments[0].into_int_value(),
|
||||
@@ -952,7 +953,7 @@ where
|
||||
.map(|_| None)
|
||||
}
|
||||
InstructionName::REVERT => {
|
||||
let arguments = self.pop_arguments_llvm(context)?;
|
||||
let arguments = self.pop_arguments_llvm(context);
|
||||
revive_llvm_context::polkavm_evm_return::revert(
|
||||
context,
|
||||
arguments[0].into_int_value(),
|
||||
@@ -968,7 +969,7 @@ where
|
||||
}
|
||||
|
||||
InstructionName::LOG0 => {
|
||||
let mut arguments = self.pop_arguments_llvm(context)?;
|
||||
let mut arguments = self.pop_arguments_llvm(context);
|
||||
revive_llvm_context::polkavm_evm_event::log(
|
||||
context,
|
||||
arguments.remove(0).into_int_value(),
|
||||
@@ -981,7 +982,7 @@ where
|
||||
.map(|_| None)
|
||||
}
|
||||
InstructionName::LOG1 => {
|
||||
let mut arguments = self.pop_arguments_llvm(context)?;
|
||||
let mut arguments = self.pop_arguments_llvm(context);
|
||||
revive_llvm_context::polkavm_evm_event::log(
|
||||
context,
|
||||
arguments.remove(0).into_int_value(),
|
||||
@@ -994,7 +995,7 @@ where
|
||||
.map(|_| None)
|
||||
}
|
||||
InstructionName::LOG2 => {
|
||||
let mut arguments = self.pop_arguments_llvm(context)?;
|
||||
let mut arguments = self.pop_arguments_llvm(context);
|
||||
revive_llvm_context::polkavm_evm_event::log(
|
||||
context,
|
||||
arguments.remove(0).into_int_value(),
|
||||
@@ -1007,7 +1008,7 @@ where
|
||||
.map(|_| None)
|
||||
}
|
||||
InstructionName::LOG3 => {
|
||||
let mut arguments = self.pop_arguments_llvm(context)?;
|
||||
let mut arguments = self.pop_arguments_llvm(context);
|
||||
revive_llvm_context::polkavm_evm_event::log(
|
||||
context,
|
||||
arguments.remove(0).into_int_value(),
|
||||
@@ -1020,7 +1021,7 @@ where
|
||||
.map(|_| None)
|
||||
}
|
||||
InstructionName::LOG4 => {
|
||||
let mut arguments = self.pop_arguments_llvm(context)?;
|
||||
let mut arguments = self.pop_arguments_llvm(context);
|
||||
revive_llvm_context::polkavm_evm_event::log(
|
||||
context,
|
||||
arguments.remove(0).into_int_value(),
|
||||
@@ -1034,7 +1035,7 @@ where
|
||||
}
|
||||
|
||||
InstructionName::CALL => {
|
||||
let mut arguments = self.pop_arguments_llvm(context)?;
|
||||
let mut arguments = self.pop_arguments_llvm(context);
|
||||
|
||||
let gas = arguments.remove(0).into_int_value();
|
||||
let address = arguments.remove(0).into_int_value();
|
||||
@@ -1059,7 +1060,7 @@ where
|
||||
.map(Some)
|
||||
}
|
||||
InstructionName::STATICCALL => {
|
||||
let mut arguments = self.pop_arguments_llvm(context)?;
|
||||
let mut arguments = self.pop_arguments_llvm(context);
|
||||
|
||||
let gas = arguments.remove(0).into_int_value();
|
||||
let address = arguments.remove(0).into_int_value();
|
||||
@@ -1083,7 +1084,7 @@ where
|
||||
.map(Some)
|
||||
}
|
||||
InstructionName::DELEGATECALL => {
|
||||
let mut arguments = self.pop_arguments_llvm(context)?;
|
||||
let mut arguments = self.pop_arguments_llvm(context);
|
||||
|
||||
let gas = arguments.remove(0).into_int_value();
|
||||
let address = arguments.remove(0).into_int_value();
|
||||
@@ -1107,7 +1108,7 @@ where
|
||||
}
|
||||
|
||||
InstructionName::CREATE | InstructionName::ZK_CREATE => {
|
||||
let arguments = self.pop_arguments_llvm(context)?;
|
||||
let arguments = self.pop_arguments_llvm(context);
|
||||
|
||||
let value = arguments[0].into_int_value();
|
||||
let input_offset = arguments[1].into_int_value();
|
||||
@@ -1123,7 +1124,7 @@ where
|
||||
.map(Some)
|
||||
}
|
||||
InstructionName::CREATE2 | InstructionName::ZK_CREATE2 => {
|
||||
let arguments = self.pop_arguments_llvm(context)?;
|
||||
let arguments = self.pop_arguments_llvm(context);
|
||||
|
||||
let value = arguments[0].into_int_value();
|
||||
let input_offset = arguments[1].into_int_value();
|
||||
@@ -1154,7 +1155,7 @@ where
|
||||
revive_llvm_context::polkavm_evm_ether_gas::gas(context).map(Some)
|
||||
}
|
||||
InstructionName::BALANCE => {
|
||||
let arguments = self.pop_arguments_llvm(context)?;
|
||||
let arguments = self.pop_arguments_llvm(context);
|
||||
|
||||
let address = arguments[0].into_int_value();
|
||||
revive_llvm_context::polkavm_evm_ether_gas::balance(context, address).map(Some)
|
||||
@@ -1183,7 +1184,7 @@ where
|
||||
revive_llvm_context::polkavm_evm_contract_context::block_number(context).map(Some)
|
||||
}
|
||||
InstructionName::BLOCKHASH => {
|
||||
let arguments = self.pop_arguments_llvm(context)?;
|
||||
let arguments = self.pop_arguments_llvm(context);
|
||||
let index = arguments[0].into_int_value();
|
||||
|
||||
revive_llvm_context::polkavm_evm_contract_context::block_hash(context, index)
|
||||
@@ -1221,7 +1222,7 @@ where
|
||||
anyhow::bail!("The `EXTCODECOPY` instruction is not supported");
|
||||
}
|
||||
InstructionName::SELFDESTRUCT => {
|
||||
let _arguments = self.pop_arguments_llvm(context)?;
|
||||
let _arguments = self.pop_arguments_llvm(context);
|
||||
anyhow::bail!("The `SELFDESTRUCT` instruction is not supported");
|
||||
}
|
||||
|
||||
@@ -1233,7 +1234,7 @@ where
|
||||
return_address,
|
||||
..
|
||||
} => {
|
||||
let mut arguments = self.pop_arguments_llvm(context)?;
|
||||
let mut arguments = self.pop_arguments_llvm(context);
|
||||
arguments.pop();
|
||||
arguments.reverse();
|
||||
arguments.pop();
|
||||
@@ -1296,7 +1297,7 @@ where
|
||||
return Ok(());
|
||||
}
|
||||
InstructionName::RecursiveReturn { .. } => {
|
||||
let mut arguments = self.pop_arguments_llvm(context)?;
|
||||
let mut arguments = self.pop_arguments_llvm(context);
|
||||
arguments.reverse();
|
||||
arguments.pop();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user