Skip to content
Snippets Groups Projects
Commit df7d3982 authored by Sergey Pepyakin's avatar Sergey Pepyakin Committed by Bastian Köcher
Browse files

Use crates.io version of wasmtime (#4135)

* Use crates.io version of wasmtime

* Update cranelift-* to 0.50

* Update trampoline generation code.

* Update wasmtime to 0.8

* pretty print trampoline compilation errors
parent 75b6b517
Branches
No related merge requests found
This diff is collapsed.
......@@ -23,14 +23,14 @@ parking_lot = "0.9.0"
log = "0.4.8"
libsecp256k1 = "0.3.2"
cranelift-codegen = { version = "0.46.1", optional = true }
cranelift-entity = { version = "0.46.1", optional = true }
cranelift-frontend = { version = "0.46.1", optional = true }
cranelift-native = { version = "0.46.1", optional = true }
cranelift-wasm = { version = "0.46.1", optional = true }
wasmtime-environ = { version = "0.2", optional = true, git = "https://github.com/CraneStation/wasmtime.git", rev = "71dd73d6" }
wasmtime-jit = { version = "0.2", optional = true, git = "https://github.com/CraneStation/wasmtime.git", rev = "71dd73d6" }
wasmtime-runtime = { version = "0.2", optional = true, git = "https://github.com/CraneStation/wasmtime.git", rev = "71dd73d6" }
cranelift-codegen = { version = "0.50", optional = true }
cranelift-entity = { version = "0.50", optional = true }
cranelift-frontend = { version = "0.50", optional = true }
cranelift-native = { version = "0.50", optional = true }
cranelift-wasm = { version = "0.50", optional = true }
wasmtime-environ = { version = "0.8", optional = true }
wasmtime-jit = { version = "0.8", optional = true }
wasmtime-runtime = { version = "0.8", optional = true }
[dev-dependencies]
assert_matches = "1.3.0"
......
......@@ -22,7 +22,9 @@
use cranelift_codegen::{Context, binemit, ir, isa};
use cranelift_codegen::ir::{InstBuilder, StackSlotData, StackSlotKind, TrapCode};
use cranelift_frontend::{FunctionBuilder, FunctionBuilderContext};
use cranelift_codegen::print_errors::pretty_error;
use wasmtime_jit::{CodeMemory, Compiler};
use wasmtime_environ::CompiledFunction;
use wasmtime_runtime::{VMContext, VMFunctionBody};
use wasm_interface::{Function, Value, ValueType};
use std::{cmp, panic::{self, AssertUnwindSafe}, ptr};
......@@ -279,10 +281,22 @@ pub fn make_trampoline(
&mut trap_sink,
&mut stackmap_sink,
)
.map_err(|e| WasmError::Instantiation(format!("failed to compile trampoline: {}", e)))?;
.map_err(|e| {
WasmError::Instantiation(format!(
"failed to compile trampoline: {}",
pretty_error(&context.func, Some(isa), e)
))
})?;
let mut unwind_info = Vec::new();
context.emit_unwind_info(isa, &mut unwind_info);
let func_ref = code_memory
.allocate_copy_of_byte_slice(&code_buf)
.allocate_for_function(&CompiledFunction {
body: code_buf,
jt_offsets: context.func.jt_offsets,
unwind_info,
})
.map_err(|e| WasmError::Instantiation(format!("failed to allocate code memory: {}", e)))?;
Ok(func_ref.as_ptr())
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment