diff --git a/Cargo.lock b/Cargo.lock index 0796917ce..7abf5a543 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1001,10 +1001,25 @@ dependencies = [ ] [[package]] -name = "inkwell_internals" -version = "0.3.0" +name = "inkwell" +version = "0.1.0-beta.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2e1f71330ccec54ee62533ae88574c4169b67fb4b95cbb1196a1322582abd11" +checksum = "2223d0eba0ae6d40a3e4680c6a3209143471e1f38b41746ea309aa36dde9f90b" +dependencies = [ + "either", + "inkwell_internals", + "libc", + "llvm-sys", + "once_cell", + "parking_lot", + "regex", +] + +[[package]] +name = "inkwell_internals" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c7090af3d300424caa81976b8c97bca41cd70e861272c072e188ae082fb49f9" dependencies = [ "proc-macro2", "quote", @@ -1141,9 +1156,9 @@ dependencies = [ [[package]] name = "llvm-sys" -version = "110.0.1" +version = "110.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21ede189444b8c78907e5d36da5dabcf153170fcff9c1dba48afc4b33c7e19f0" +checksum = "3b7cc88ba864d592f52132ed3a19a97118fe16c92a63961f54b0ab7279c5407f" dependencies = [ "cc", "lazy_static", @@ -2820,6 +2835,7 @@ version = "2.0.0" dependencies = [ "byteorder", "cc", + "inkwell", "itertools", "lazy_static", "libc", @@ -2834,7 +2850,6 @@ dependencies = [ "wasmer-compiler", "wasmer-types", "wasmer-vm", - "wasmer_inkwell", ] [[package]] @@ -3141,21 +3156,6 @@ dependencies = [ "wasmer-wast", ] -[[package]] -name = "wasmer_inkwell" -version = "0.2.0-alpha.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5eca826323f39b29a38cd31c8eb33de76945c6193f30a2806c6cde6f6cd42cb1" -dependencies = [ - "either", - "inkwell_internals", - "libc", - "llvm-sys", - "once_cell", - "parking_lot", - "regex", -] - [[package]] name = "wasmparser" version = "0.78.2" diff --git a/lib/compiler-llvm/Cargo.toml b/lib/compiler-llvm/Cargo.toml index c7f3a9158..cd287e8e9 100644 --- a/lib/compiler-llvm/Cargo.toml +++ b/lib/compiler-llvm/Cargo.toml @@ -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"] diff --git a/lib/compiler-llvm/src/trampoline/wasm.rs b/lib/compiler-llvm/src/trampoline/wasm.rs index eeea64d7e..8c9840074 100644 --- a/lib/compiler-llvm/src/trampoline/wasm.rs +++ b/lib/compiler-llvm/src/trampoline/wasm.rs @@ -15,6 +15,7 @@ use inkwell::{ }; use std::cmp; use std::convert::TryInto; +use std::convert::TryFrom; 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); diff --git a/lib/compiler-llvm/src/translator/code.rs b/lib/compiler-llvm/src/translator/code.rs index e7469799d..1491c82d2 100644 --- a/lib/compiler-llvm/src/translator/code.rs +++ b/lib/compiler-llvm/src/translator/code.rs @@ -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,9 @@ 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 +10913,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 +10928,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(),