mirror of
https://github.com/mii443/wasmer.git
synced 2025-09-04 08:29:16 +00:00
Merge #2656
2656: update(compiler) switched upstream Inkwell (for #2645) r=Amanieu a=ptitSeb # Description Use upstream Inkwell instead of custom version Co-authored-by: ptitSeb <sebastien.chev@gmail.com>
This commit is contained in:
@ -25,8 +25,8 @@ rayon = "1.5"
|
||||
loupe = "0.1"
|
||||
|
||||
[dependencies.inkwell]
|
||||
package = "wasmer_inkwell"
|
||||
version = "0.2.0-alpha.2"
|
||||
package = "inkwell"
|
||||
version = "0.1.0-beta.4"
|
||||
default-features = false
|
||||
features = ["llvm11-0", "target-x86", "target-aarch64"]
|
||||
|
||||
|
@ -14,6 +14,7 @@ use inkwell::{
|
||||
AddressSpace, DLLStorageClass,
|
||||
};
|
||||
use std::cmp;
|
||||
use std::convert::TryFrom;
|
||||
use std::convert::TryInto;
|
||||
use wasmer_compiler::{CompileError, FunctionBody, RelocationTarget};
|
||||
use wasmer_types::{FunctionType, LocalFunctionIndex};
|
||||
@ -346,7 +347,8 @@ impl FuncTrampoline {
|
||||
args_vec.push(arg.into());
|
||||
}
|
||||
|
||||
let call_site = builder.build_call(func_ptr, args_vec.as_slice().into(), "call");
|
||||
let callable_func = inkwell::values::CallableValue::try_from(func_ptr).unwrap();
|
||||
let call_site = builder.build_call(callable_func, args_vec.as_slice().into(), "call");
|
||||
for (attr, attr_loc) in func_attrs {
|
||||
call_site.add_attribute(*attr_loc, *attr);
|
||||
}
|
||||
@ -441,7 +443,8 @@ impl FuncTrampoline {
|
||||
.into_pointer_value();
|
||||
|
||||
let values_ptr = builder.build_pointer_cast(values, intrinsics.i128_ptr_ty, "");
|
||||
builder.build_call(callee, &[vmctx.into(), values_ptr.into()], "");
|
||||
let callable_func = inkwell::values::CallableValue::try_from(callee).unwrap();
|
||||
builder.build_call(callable_func, &[vmctx.into(), values_ptr.into()], "");
|
||||
|
||||
if func_sig.results().is_empty() {
|
||||
builder.build_return(None);
|
||||
|
@ -24,6 +24,7 @@ use smallvec::SmallVec;
|
||||
use crate::abi::{get_abi, Abi};
|
||||
use crate::config::{CompiledKind, LLVM};
|
||||
use crate::object_file::{load_object_file, CompiledFunction};
|
||||
use std::convert::TryFrom;
|
||||
use wasmer_compiler::wasmparser::{MemoryImmediate, Operator};
|
||||
use wasmer_compiler::{
|
||||
wptype_to_type, CompileError, FunctionBinaryReader, FunctionBodyData, MiddlewareBinaryReader,
|
||||
@ -2225,8 +2226,9 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
|
||||
}
|
||||
*/
|
||||
|
||||
let callable_func = inkwell::values::CallableValue::try_from(func).unwrap();
|
||||
let call_site = self.builder.build_call(
|
||||
func,
|
||||
callable_func,
|
||||
params
|
||||
.iter()
|
||||
.copied()
|
||||
@ -2517,8 +2519,10 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
|
||||
}
|
||||
}
|
||||
*/
|
||||
let callable_func =
|
||||
inkwell::values::CallableValue::try_from(typed_func_ptr).unwrap();
|
||||
let call_site = self.builder.build_call(
|
||||
typed_func_ptr,
|
||||
callable_func,
|
||||
params
|
||||
.iter()
|
||||
.copied()
|
||||
@ -10910,8 +10914,9 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
|
||||
let memory_index = MemoryIndex::from_u32(mem);
|
||||
let delta = self.state.pop1()?;
|
||||
let grow_fn_ptr = self.ctx.memory_grow(memory_index, self.intrinsics);
|
||||
let callable_func = inkwell::values::CallableValue::try_from(grow_fn_ptr).unwrap();
|
||||
let grow = self.builder.build_call(
|
||||
grow_fn_ptr,
|
||||
callable_func,
|
||||
&[
|
||||
vmctx.as_basic_value_enum().into(),
|
||||
delta.into(),
|
||||
@ -10924,8 +10929,9 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
|
||||
Operator::MemorySize { mem, mem_byte: _ } => {
|
||||
let memory_index = MemoryIndex::from_u32(mem);
|
||||
let size_fn_ptr = self.ctx.memory_size(memory_index, self.intrinsics);
|
||||
let callable_func = inkwell::values::CallableValue::try_from(size_fn_ptr).unwrap();
|
||||
let size = self.builder.build_call(
|
||||
size_fn_ptr,
|
||||
callable_func,
|
||||
&[
|
||||
vmctx.as_basic_value_enum().into(),
|
||||
self.intrinsics.i32_ty.const_int(mem.into(), false).into(),
|
||||
|
@ -1685,7 +1685,9 @@ pub fn tbaa_label<'ctx>(
|
||||
.get_global_metadata("wasmer_tbaa_root")
|
||||
.pop()
|
||||
.unwrap_or_else(|| {
|
||||
module.add_global_metadata("wasmer_tbaa_root", &context.metadata_node(&[]));
|
||||
module
|
||||
.add_global_metadata("wasmer_tbaa_root", &context.metadata_node(&[]))
|
||||
.unwrap();
|
||||
module.get_global_metadata("wasmer_tbaa_root")[0]
|
||||
});
|
||||
|
||||
@ -1696,10 +1698,12 @@ pub fn tbaa_label<'ctx>(
|
||||
.get_global_metadata(label.as_str())
|
||||
.pop()
|
||||
.unwrap_or_else(|| {
|
||||
module.add_global_metadata(
|
||||
label.as_str(),
|
||||
&context.metadata_node(&[type_label.into(), tbaa_root.into()]),
|
||||
);
|
||||
module
|
||||
.add_global_metadata(
|
||||
label.as_str(),
|
||||
&context.metadata_node(&[type_label.into(), tbaa_root.into()]),
|
||||
)
|
||||
.unwrap();
|
||||
module.get_global_metadata(label.as_str())[0]
|
||||
});
|
||||
|
||||
@ -1714,18 +1718,20 @@ pub fn tbaa_label<'ctx>(
|
||||
.get_global_metadata(label.as_str())
|
||||
.pop()
|
||||
.unwrap_or_else(|| {
|
||||
module.add_global_metadata(
|
||||
label.as_str(),
|
||||
&context.metadata_node(&[
|
||||
type_tbaa.into(),
|
||||
type_tbaa.into(),
|
||||
intrinsics.i64_zero.into(),
|
||||
]),
|
||||
);
|
||||
module
|
||||
.add_global_metadata(
|
||||
label.as_str(),
|
||||
&context.metadata_node(&[
|
||||
type_tbaa.into(),
|
||||
type_tbaa.into(),
|
||||
intrinsics.i64_zero.into(),
|
||||
]),
|
||||
)
|
||||
.unwrap();
|
||||
module.get_global_metadata(label.as_str())[0]
|
||||
});
|
||||
|
||||
// Attach the access tag to the instruction.
|
||||
let tbaa_kind = context.get_kind_id("tbaa");
|
||||
instruction.set_metadata(type_tbaa, tbaa_kind);
|
||||
instruction.set_metadata(type_tbaa, tbaa_kind).unwrap();
|
||||
}
|
||||
|
Reference in New Issue
Block a user