Support for multi-value wasm (#399)
* deps: bump wasmparser to 0.39.2 This has a bug fix for multi-value Wasm validation that is required for getting the spec tests passing. https://github.com/yurydelendik/wasmparser.rs/pull/135 * Update cranelift to 0.46.1 to get multi-value Wasm support The `cranelift_wasm` APIs had to change a little bit to maintain state necessary when translating multi-value Wasm blocks. The `translate_module` function now returns a `ModuleTranslationState` that is borrowed during each function's translation. * Enable multi-value proposal's spec tests This enables all the Wasm multi-value proposal's spec tests other than the ones that rely on functions having more return values than registers available on the target. That is not supported by cranelift yet. * wasmtime-interface-types: always use multi-value Wasm And remove the return pointer hacks that work around the lack of multi-value.
This commit is contained in:
committed by
Dan Gohman
parent
9d54f84a32
commit
842faf5aa6
@@ -11,10 +11,10 @@ readme = "README.md"
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
cranelift-codegen = { version = "0.44.0", features = ["enable-serde"] }
|
||||
cranelift-entity = { version = "0.44.0", features = ["enable-serde"] }
|
||||
cranelift-wasm = { version = "0.44.0", features = ["enable-serde"] }
|
||||
cranelift-frontend = "0.44.0"
|
||||
cranelift-codegen = { version = "0.46.1", features = ["enable-serde"] }
|
||||
cranelift-entity = { version = "0.46.1", features = ["enable-serde"] }
|
||||
cranelift-wasm = { version = "0.46.1", features = ["enable-serde"] }
|
||||
cranelift-frontend = "0.46.1"
|
||||
wasmtime-environ = { path = "../wasmtime-environ", default-features = false }
|
||||
wasmtime-runtime = { path = "../wasmtime-runtime", default-features = false }
|
||||
wasmtime-debug = { path = "../wasmtime-debug", default-features = false }
|
||||
@@ -23,7 +23,7 @@ failure = { version = "0.1.3", default-features = false }
|
||||
failure_derive = { version = "0.1.3", default-features = false }
|
||||
target-lexicon = { version = "0.8.1", default-features = false }
|
||||
hashbrown = { version = "0.6.0", optional = true }
|
||||
wasmparser = { version = "0.39.1", default-features = false }
|
||||
wasmparser = { version = "0.39.2", default-features = false }
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
|
||||
@@ -14,7 +14,7 @@ use cranelift_codegen::Context;
|
||||
use cranelift_codegen::{binemit, ir};
|
||||
use cranelift_entity::{EntityRef, PrimaryMap};
|
||||
use cranelift_frontend::{FunctionBuilder, FunctionBuilderContext};
|
||||
use cranelift_wasm::{DefinedFuncIndex, DefinedMemoryIndex};
|
||||
use cranelift_wasm::{DefinedFuncIndex, DefinedMemoryIndex, ModuleTranslationState};
|
||||
use wasmtime_debug::{emit_debugsections_image, DebugInfoData};
|
||||
use wasmtime_environ::{
|
||||
Compilation, CompileError, Compiler as _C, FunctionBodyData, Module, ModuleVmctxInfo,
|
||||
@@ -104,6 +104,7 @@ impl Compiler {
|
||||
pub(crate) fn compile<'data>(
|
||||
&mut self,
|
||||
module: &Module,
|
||||
module_translation: &ModuleTranslationState,
|
||||
function_body_inputs: PrimaryMap<DefinedFuncIndex, FunctionBodyData<'data>>,
|
||||
debug_data: Option<DebugInfoData>,
|
||||
) -> Result<
|
||||
@@ -122,6 +123,7 @@ impl Compiler {
|
||||
CompilationStrategy::Auto | CompilationStrategy::Cranelift => {
|
||||
wasmtime_environ::cranelift::Cranelift::compile_module(
|
||||
module,
|
||||
module_translation,
|
||||
function_body_inputs,
|
||||
&*self.isa,
|
||||
debug_data.is_some(),
|
||||
|
||||
@@ -80,6 +80,7 @@ impl<'data> RawCompiledModule<'data> {
|
||||
|
||||
let (allocated_functions, jt_offsets, relocations, dbg_image) = compiler.compile(
|
||||
&translation.module,
|
||||
translation.module_translation.as_ref().unwrap(),
|
||||
translation.function_body_inputs,
|
||||
debug_data,
|
||||
)?;
|
||||
|
||||
Reference in New Issue
Block a user