Contract calls (#19)

This commit is contained in:
Cyrill Leutwiler
2024-06-01 20:48:20 +02:00
committed by GitHub
parent 532721f3be
commit 1ba806be1f
27 changed files with 540 additions and 929 deletions
@@ -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,