mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-05-09 00:08:00 +00:00
@@ -139,11 +139,11 @@ where
|
||||
identifier.inner,
|
||||
)
|
||||
})?;
|
||||
context.build_store(pointer, value.access(context)?)?;
|
||||
context.build_store(pointer, value.to_value(context)?)?;
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let value = value.access(context)?;
|
||||
let value = value.to_value(context)?;
|
||||
let llvm_type = value.into_struct_value().get_type();
|
||||
let tuple_pointer = context.build_alloca(llvm_type, "assignment_pointer");
|
||||
context.build_store(tuple_pointer, value)?;
|
||||
|
||||
@@ -131,7 +131,7 @@ impl FunctionCall {
|
||||
let value = argument
|
||||
.into_llvm(context)?
|
||||
.expect("Always exists")
|
||||
.access(context)?;
|
||||
.to_value(context)?;
|
||||
values.push(value);
|
||||
}
|
||||
values.reverse();
|
||||
@@ -510,7 +510,7 @@ impl FunctionCall {
|
||||
let offset = context.solidity_mut().allocate_immutable(key.as_str())
|
||||
/ revive_common::BYTE_LENGTH_WORD;
|
||||
let index = context.xlen_type().const_int(offset as u64, false);
|
||||
let value = arguments[2].access(context)?.into_int_value();
|
||||
let value = arguments[2].to_value(context)?.into_int_value();
|
||||
revive_llvm_context::polkavm_evm_immutable::store(context, index, value)
|
||||
.map(|_| None)
|
||||
}
|
||||
@@ -716,15 +716,16 @@ impl FunctionCall {
|
||||
Name::Call => {
|
||||
let arguments = self.pop_arguments::<D, 7>(context)?;
|
||||
|
||||
let gas = arguments[0].access(context)?.into_int_value();
|
||||
let address = arguments[1].access(context)?.into_int_value();
|
||||
let value = arguments[2].access(context)?.into_int_value();
|
||||
let input_offset = arguments[3].access(context)?.into_int_value();
|
||||
let input_size = arguments[4].access(context)?.into_int_value();
|
||||
let output_offset = arguments[5].access(context)?.into_int_value();
|
||||
let output_size = arguments[6].access(context)?.into_int_value();
|
||||
let gas = &arguments[0];
|
||||
let address = &arguments[1];
|
||||
let value = &arguments[2];
|
||||
let input_offset = &arguments[3];
|
||||
let input_size = &arguments[4];
|
||||
let output_offset = &arguments[5];
|
||||
let output_size = &arguments[6];
|
||||
|
||||
let simulation_address: Vec<Option<num::BigUint>> = arguments
|
||||
.clone()
|
||||
.into_iter()
|
||||
.map(|mut argument| argument.constant.take())
|
||||
.collect();
|
||||
@@ -746,14 +747,15 @@ impl FunctionCall {
|
||||
Name::StaticCall => {
|
||||
let arguments = self.pop_arguments::<D, 6>(context)?;
|
||||
|
||||
let gas = arguments[0].access(context)?.into_int_value();
|
||||
let address = arguments[1].access(context)?.into_int_value();
|
||||
let input_offset = arguments[2].access(context)?.into_int_value();
|
||||
let input_size = arguments[3].access(context)?.into_int_value();
|
||||
let output_offset = arguments[4].access(context)?.into_int_value();
|
||||
let output_size = arguments[5].access(context)?.into_int_value();
|
||||
let gas = &arguments[0];
|
||||
let address = &arguments[1];
|
||||
let input_offset = &arguments[2];
|
||||
let input_size = &arguments[3];
|
||||
let output_offset = &arguments[4];
|
||||
let output_size = &arguments[5];
|
||||
|
||||
let simulation_address: Vec<Option<num::BigUint>> = arguments
|
||||
.clone()
|
||||
.into_iter()
|
||||
.map(|mut argument| argument.constant.take())
|
||||
.collect();
|
||||
@@ -775,12 +777,12 @@ impl FunctionCall {
|
||||
Name::DelegateCall => {
|
||||
let arguments = self.pop_arguments::<D, 6>(context)?;
|
||||
|
||||
let gas = arguments[0].access(context)?.into_int_value();
|
||||
let address = arguments[1].access(context)?.into_int_value();
|
||||
let input_offset = arguments[2].access(context)?.into_int_value();
|
||||
let input_size = arguments[3].access(context)?.into_int_value();
|
||||
let output_offset = arguments[4].access(context)?.into_int_value();
|
||||
let output_size = arguments[5].access(context)?.into_int_value();
|
||||
let gas = arguments[0].to_value(context)?.into_int_value();
|
||||
let address = arguments[1].to_value(context)?.into_int_value();
|
||||
let input_offset = arguments[2].to_value(context)?.into_int_value();
|
||||
let input_size = arguments[3].to_value(context)?.into_int_value();
|
||||
let output_offset = arguments[4].to_value(context)?.into_int_value();
|
||||
let output_size = arguments[5].to_value(context)?.into_int_value();
|
||||
|
||||
let simulation_address: Vec<Option<num::BigUint>> = arguments
|
||||
.into_iter()
|
||||
@@ -841,7 +843,7 @@ impl FunctionCall {
|
||||
})?;
|
||||
|
||||
revive_llvm_context::polkavm_evm_create::contract_hash(context, identifier)
|
||||
.and_then(|argument| argument.access(context))
|
||||
.and_then(|argument| argument.to_value(context))
|
||||
.map(Some)
|
||||
}
|
||||
Name::DataSize => {
|
||||
@@ -852,7 +854,7 @@ impl FunctionCall {
|
||||
})?;
|
||||
|
||||
revive_llvm_context::polkavm_evm_create::header_size(context, identifier)
|
||||
.and_then(|argument| argument.access(context))
|
||||
.and_then(|argument| argument.to_value(context))
|
||||
.map(Some)
|
||||
}
|
||||
Name::DataCopy => {
|
||||
@@ -991,7 +993,7 @@ impl FunctionCall {
|
||||
expression
|
||||
.into_llvm(context)?
|
||||
.expect("Always exists")
|
||||
.access(context)?,
|
||||
.to_value(context)?,
|
||||
);
|
||||
}
|
||||
arguments.reverse();
|
||||
|
||||
@@ -78,7 +78,7 @@ where
|
||||
.condition
|
||||
.into_llvm(context)?
|
||||
.expect("Always exists")
|
||||
.access(context)?
|
||||
.to_value(context)?
|
||||
.into_int_value();
|
||||
let condition = context.builder().build_int_z_extend_or_bit_cast(
|
||||
condition,
|
||||
|
||||
@@ -57,7 +57,7 @@ where
|
||||
.condition
|
||||
.into_llvm(context)?
|
||||
.expect("Always exists")
|
||||
.access(context)?
|
||||
.to_value(context)?
|
||||
.into_int_value();
|
||||
let condition = context.builder().build_int_z_extend_or_bit_cast(
|
||||
condition,
|
||||
|
||||
@@ -188,6 +188,9 @@ where
|
||||
revive_llvm_context::PolkaVMLoadImmutableDataFunction.declare(context)?;
|
||||
revive_llvm_context::PolkaVMStoreImmutableDataFunction.declare(context)?;
|
||||
|
||||
revive_llvm_context::PolkaVMCallFunction.declare(context)?;
|
||||
revive_llvm_context::PolkaVMCallReentrancyHeuristicFunction.declare(context)?;
|
||||
|
||||
revive_llvm_context::PolkaVMLoadHeapWordFunction.declare(context)?;
|
||||
revive_llvm_context::PolkaVMStoreHeapWordFunction.declare(context)?;
|
||||
revive_llvm_context::PolkaVMLoadStorageWordFunction.declare(context)?;
|
||||
@@ -240,6 +243,9 @@ where
|
||||
revive_llvm_context::PolkaVMLoadImmutableDataFunction.into_llvm(context)?;
|
||||
revive_llvm_context::PolkaVMStoreImmutableDataFunction.into_llvm(context)?;
|
||||
|
||||
revive_llvm_context::PolkaVMCallFunction.into_llvm(context)?;
|
||||
revive_llvm_context::PolkaVMCallReentrancyHeuristicFunction.into_llvm(context)?;
|
||||
|
||||
revive_llvm_context::PolkaVMLoadHeapWordFunction.into_llvm(context)?;
|
||||
revive_llvm_context::PolkaVMStoreHeapWordFunction.into_llvm(context)?;
|
||||
revive_llvm_context::PolkaVMLoadStorageWordFunction.into_llvm(context)?;
|
||||
|
||||
@@ -137,7 +137,7 @@ where
|
||||
|
||||
let mut branches = Vec::with_capacity(self.cases.len());
|
||||
for (index, case) in self.cases.into_iter().enumerate() {
|
||||
let constant = case.literal.into_llvm(context)?.access(context)?;
|
||||
let constant = case.literal.into_llvm(context)?.to_value(context)?;
|
||||
|
||||
let expression_block = context
|
||||
.append_basic_block(format!("switch_case_branch_{}_block", index + 1).as_str());
|
||||
@@ -163,7 +163,7 @@ where
|
||||
context.builder().build_switch(
|
||||
scrutinee
|
||||
.expect("Always exists")
|
||||
.access(context)?
|
||||
.to_value(context)?
|
||||
.into_int_value(),
|
||||
default_block,
|
||||
branches.as_slice(),
|
||||
|
||||
@@ -121,7 +121,7 @@ where
|
||||
.insert_constant(identifier.inner.clone(), constant);
|
||||
}
|
||||
|
||||
value.access(context)?
|
||||
value.to_value(context)?
|
||||
}
|
||||
None => r#type.const_zero().as_basic_value_enum(),
|
||||
}
|
||||
@@ -175,7 +175,7 @@ where
|
||||
.collect::<Vec<inkwell::types::BasicTypeEnum<'ctx>>>()
|
||||
.as_slice(),
|
||||
);
|
||||
let value = expression.access(context)?;
|
||||
let value = expression.to_value(context)?;
|
||||
if value.get_type() != llvm_type.as_basic_type_enum() {
|
||||
anyhow::bail!(
|
||||
"{} Assignment to {:?} received an invalid number of arguments",
|
||||
|
||||
Reference in New Issue
Block a user