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
-18
View File
@@ -3,7 +3,6 @@
use inkwell::values::BasicValue;
use crate::polkavm::context::address_space::AddressSpace;
use crate::polkavm::context::function::llvm_runtime::LLVMRuntime;
use crate::polkavm::context::Context;
use crate::polkavm::Dependency;
@@ -40,23 +39,6 @@ where
Ok(result.into_int_value())
}
/// Generates an exception.
pub fn throw<D>(context: &Context<D>)
where
D: Dependency + Clone,
{
context.build_call(
context.llvm_runtime().cxa_throw,
&[context
.llvm()
.ptr_type(AddressSpace::Stack.into())
.get_undef()
.as_basic_value_enum(); 3],
LLVMRuntime::FUNCTION_CXA_THROW,
);
context.build_unreachable();
}
/// Returns the full list of arguments for an external call.
/// Performs the extra ABI data padding and adds the mimic call extra argument.
pub fn external_call_arguments<'ctx, D>(