mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-06-12 06:01:00 +00:00
Contract calls (#19)
This commit is contained in:
@@ -191,11 +191,6 @@ where
|
||||
let mut entry = revive_llvm_context::PolkaVMEntryFunction::default();
|
||||
entry.declare(context)?;
|
||||
|
||||
let mut runtime = revive_llvm_context::PolkaVMRuntime::new(
|
||||
revive_llvm_context::PolkaVMAddressSpace::Heap,
|
||||
);
|
||||
runtime.declare(context)?;
|
||||
|
||||
revive_llvm_context::PolkaVMDeployCodeFunction::new(
|
||||
revive_llvm_context::PolkaVMDummyLLVMWritable::default(),
|
||||
)
|
||||
@@ -207,8 +202,6 @@ where
|
||||
|
||||
entry.into_llvm(context)?;
|
||||
|
||||
runtime.into_llvm(context)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ where
|
||||
.integer_type(revive_common::BIT_LENGTH_BOOLEAN)
|
||||
.const_int(0, false),
|
||||
};
|
||||
context.build_invoke(
|
||||
context.build_call(
|
||||
target,
|
||||
&[is_deploy_code.as_basic_value_enum()],
|
||||
format!("call_link_{}", EtherealIR::DEFAULT_ENTRY_FUNCTION_NAME).as_str(),
|
||||
|
||||
@@ -1026,19 +1026,16 @@ where
|
||||
InstructionName::CALL => {
|
||||
let mut arguments = self.pop_arguments_llvm(context);
|
||||
|
||||
let _gas = arguments.remove(0).into_int_value();
|
||||
let _address = arguments.remove(0).into_int_value();
|
||||
let _value = arguments.remove(0).into_int_value();
|
||||
let _input_offset = arguments.remove(0).into_int_value();
|
||||
let _input_size = arguments.remove(0).into_int_value();
|
||||
let _output_offset = arguments.remove(0).into_int_value();
|
||||
let _output_size = arguments.remove(0).into_int_value();
|
||||
let gas = arguments.remove(0).into_int_value();
|
||||
let address = arguments.remove(0).into_int_value();
|
||||
let value = arguments.remove(0).into_int_value();
|
||||
let input_offset = arguments.remove(0).into_int_value();
|
||||
let input_size = arguments.remove(0).into_int_value();
|
||||
let output_offset = arguments.remove(0).into_int_value();
|
||||
let output_size = arguments.remove(0).into_int_value();
|
||||
|
||||
todo!()
|
||||
/*
|
||||
revive_llvm_context::polkavm_evm_call::default(
|
||||
revive_llvm_context::polkavm_evm_call::call(
|
||||
context,
|
||||
context.llvm_runtime().far_call,
|
||||
gas,
|
||||
address,
|
||||
Some(value),
|
||||
@@ -1047,9 +1044,9 @@ where
|
||||
output_offset,
|
||||
output_size,
|
||||
vec![],
|
||||
false,
|
||||
)
|
||||
.map(Some)
|
||||
*/
|
||||
}
|
||||
InstructionName::STATICCALL => {
|
||||
let mut arguments = self.pop_arguments_llvm(context);
|
||||
@@ -1061,9 +1058,8 @@ where
|
||||
let output_offset = arguments.remove(0).into_int_value();
|
||||
let output_size = arguments.remove(0).into_int_value();
|
||||
|
||||
revive_llvm_context::polkavm_evm_call::default(
|
||||
revive_llvm_context::polkavm_evm_call::call(
|
||||
context,
|
||||
context.llvm_runtime().static_call,
|
||||
gas,
|
||||
address,
|
||||
None,
|
||||
@@ -1072,6 +1068,7 @@ where
|
||||
output_offset,
|
||||
output_size,
|
||||
vec![],
|
||||
true,
|
||||
)
|
||||
.map(Some)
|
||||
}
|
||||
@@ -1085,9 +1082,8 @@ where
|
||||
let output_offset = arguments.remove(0).into_int_value();
|
||||
let output_size = arguments.remove(0).into_int_value();
|
||||
|
||||
revive_llvm_context::polkavm_evm_call::default(
|
||||
revive_llvm_context::polkavm_evm_call::delegate_call(
|
||||
context,
|
||||
context.llvm_runtime().delegate_call,
|
||||
gas,
|
||||
address,
|
||||
None,
|
||||
|
||||
@@ -155,7 +155,7 @@ impl FunctionCall {
|
||||
);
|
||||
}
|
||||
|
||||
let return_value = context.build_invoke(
|
||||
let return_value = context.build_call(
|
||||
function.borrow().declaration(),
|
||||
values.as_slice(),
|
||||
format!("{name}_call").as_str(),
|
||||
@@ -731,24 +731,21 @@ impl FunctionCall {
|
||||
Name::Call => {
|
||||
let arguments = self.pop_arguments::<D, 7>(context)?;
|
||||
|
||||
let _gas = arguments[0].value.into_int_value();
|
||||
let _address = arguments[1].value.into_int_value();
|
||||
let _value = arguments[2].value.into_int_value();
|
||||
let _input_offset = arguments[3].value.into_int_value();
|
||||
let _input_size = arguments[4].value.into_int_value();
|
||||
let _output_offset = arguments[5].value.into_int_value();
|
||||
let _output_size = arguments[6].value.into_int_value();
|
||||
let gas = arguments[0].value.into_int_value();
|
||||
let address = arguments[1].value.into_int_value();
|
||||
let value = arguments[2].value.into_int_value();
|
||||
let input_offset = arguments[3].value.into_int_value();
|
||||
let input_size = arguments[4].value.into_int_value();
|
||||
let output_offset = arguments[5].value.into_int_value();
|
||||
let output_size = arguments[6].value.into_int_value();
|
||||
|
||||
let _simulation_address: Vec<Option<num::BigUint>> = arguments
|
||||
let simulation_address: Vec<Option<num::BigUint>> = arguments
|
||||
.into_iter()
|
||||
.map(|mut argument| argument.constant.take())
|
||||
.collect();
|
||||
|
||||
todo!()
|
||||
/*
|
||||
revive_llvm_context::polkavm_evm_call::default(
|
||||
revive_llvm_context::polkavm_evm_call::call(
|
||||
context,
|
||||
context.llvm_runtime().far_call,
|
||||
gas,
|
||||
address,
|
||||
Some(value),
|
||||
@@ -757,9 +754,9 @@ impl FunctionCall {
|
||||
output_offset,
|
||||
output_size,
|
||||
simulation_address,
|
||||
false,
|
||||
)
|
||||
.map(Some)
|
||||
*/
|
||||
}
|
||||
Name::StaticCall => {
|
||||
let arguments = self.pop_arguments::<D, 6>(context)?;
|
||||
@@ -776,9 +773,8 @@ impl FunctionCall {
|
||||
.map(|mut argument| argument.constant.take())
|
||||
.collect();
|
||||
|
||||
revive_llvm_context::polkavm_evm_call::default(
|
||||
revive_llvm_context::polkavm_evm_call::call(
|
||||
context,
|
||||
context.llvm_runtime().static_call,
|
||||
gas,
|
||||
address,
|
||||
None,
|
||||
@@ -787,6 +783,7 @@ impl FunctionCall {
|
||||
output_offset,
|
||||
output_size,
|
||||
simulation_address,
|
||||
true,
|
||||
)
|
||||
.map(Some)
|
||||
}
|
||||
@@ -805,9 +802,8 @@ impl FunctionCall {
|
||||
.map(|mut argument| argument.constant.take())
|
||||
.collect();
|
||||
|
||||
revive_llvm_context::polkavm_evm_call::default(
|
||||
revive_llvm_context::polkavm_evm_call::delegate_call(
|
||||
context,
|
||||
context.llvm_runtime().delegate_call,
|
||||
gas,
|
||||
address,
|
||||
None,
|
||||
|
||||
@@ -186,11 +186,6 @@ where
|
||||
let mut entry = revive_llvm_context::PolkaVMEntryFunction::default();
|
||||
entry.declare(context)?;
|
||||
|
||||
let mut runtime = revive_llvm_context::PolkaVMRuntime::new(
|
||||
revive_llvm_context::PolkaVMAddressSpace::Heap,
|
||||
);
|
||||
runtime.declare(context)?;
|
||||
|
||||
revive_llvm_context::PolkaVMDeployCodeFunction::new(
|
||||
revive_llvm_context::PolkaVMDummyLLVMWritable::default(),
|
||||
)
|
||||
@@ -226,16 +221,8 @@ where
|
||||
revive_llvm_context::PolkaVMDeployCodeFunction::new(self.code).into_llvm(context)?;
|
||||
}
|
||||
|
||||
match self.inner_object {
|
||||
Some(object) => {
|
||||
object.into_llvm(context)?;
|
||||
}
|
||||
None => {
|
||||
let runtime = revive_llvm_context::PolkaVMRuntime::new(
|
||||
revive_llvm_context::PolkaVMAddressSpace::Heap,
|
||||
);
|
||||
runtime.into_llvm(context)?;
|
||||
}
|
||||
if let Some(object) = self.inner_object {
|
||||
object.into_llvm(context)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user