From f48d6f6690794ae67de1e6ba4dcb15e68fd0d6e3 Mon Sep 17 00:00:00 2001 From: Brandon Fish Date: Sat, 21 Sep 2019 13:06:54 -0500 Subject: [PATCH] Cranelift backend update to fork of clif version 0.43.1 --- Cargo.lock | 128 +++++++++++++++-------------- lib/clif-backend/Cargo.toml | 18 ++-- lib/clif-backend/src/code.rs | 13 ++- lib/clif-backend/src/lib.rs | 4 +- lib/clif-backend/src/relocation.rs | 5 ++ lib/clif-backend/src/resolver.rs | 13 ++- lib/clif-backend/src/trampoline.rs | 9 +- lib/llvm-backend/Cargo.toml | 2 +- lib/runtime-abi/Cargo.toml | 2 +- lib/runtime-core/Cargo.toml | 2 +- lib/runtime-core/src/codegen.rs | 1 - lib/runtime-core/src/lib.rs | 1 - lib/singlepass-backend/Cargo.toml | 2 +- 13 files changed, 116 insertions(+), 84 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3d8c85a48c9..3270ab2f7ea 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -247,47 +247,73 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "cranelift-bforest" -version = "0.31.0" -source = "registry+https://github.com/rust-lang/crates.io-index" +version = "0.43.1" +source = "git+https://github.com/wasmerio/cranelift?branch=feature/merge-cranelift-0-43-1#c5da7629c0dabcafb083efb5f9b8db39c20a4dc4" dependencies = [ - "cranelift-entity 0.31.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-entity 0.43.1 (git+https://github.com/wasmerio/cranelift?branch=feature/merge-cranelift-0-43-1)", ] [[package]] name = "cranelift-codegen" -version = "0.31.0" -source = "registry+https://github.com/rust-lang/crates.io-index" +version = "0.43.1" +source = "git+https://github.com/wasmerio/cranelift?branch=feature/merge-cranelift-0-43-1#c5da7629c0dabcafb083efb5f9b8db39c20a4dc4" dependencies = [ - "cranelift-bforest 0.31.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cranelift-codegen-meta 0.31.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cranelift-entity 0.31.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-bforest 0.43.1 (git+https://github.com/wasmerio/cranelift?branch=feature/merge-cranelift-0-43-1)", + "cranelift-codegen-meta 0.43.1 (git+https://github.com/wasmerio/cranelift?branch=feature/merge-cranelift-0-43-1)", + "cranelift-entity 0.43.1 (git+https://github.com/wasmerio/cranelift?branch=feature/merge-cranelift-0-43-1)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "target-lexicon 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "target-lexicon 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cranelift-codegen-meta" -version = "0.31.0" -source = "registry+https://github.com/rust-lang/crates.io-index" +version = "0.43.1" +source = "git+https://github.com/wasmerio/cranelift?branch=feature/merge-cranelift-0-43-1#c5da7629c0dabcafb083efb5f9b8db39c20a4dc4" dependencies = [ - "cranelift-entity 0.31.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-entity 0.43.1 (git+https://github.com/wasmerio/cranelift?branch=feature/merge-cranelift-0-43-1)", ] [[package]] name = "cranelift-entity" -version = "0.31.0" -source = "registry+https://github.com/rust-lang/crates.io-index" +version = "0.43.1" +source = "git+https://github.com/wasmerio/cranelift?branch=feature/merge-cranelift-0-43-1#c5da7629c0dabcafb083efb5f9b8db39c20a4dc4" + +[[package]] +name = "cranelift-frontend" +version = "0.43.1" +source = "git+https://github.com/wasmerio/cranelift?branch=feature/merge-cranelift-0-43-1#c5da7629c0dabcafb083efb5f9b8db39c20a4dc4" +dependencies = [ + "cranelift-codegen 0.43.1 (git+https://github.com/wasmerio/cranelift?branch=feature/merge-cranelift-0-43-1)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "target-lexicon 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "cranelift-native" -version = "0.31.0" -source = "registry+https://github.com/rust-lang/crates.io-index" +version = "0.43.1" +source = "git+https://github.com/wasmerio/cranelift?branch=feature/merge-cranelift-0-43-1#c5da7629c0dabcafb083efb5f9b8db39c20a4dc4" dependencies = [ - "cranelift-codegen 0.31.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-codegen 0.43.1 (git+https://github.com/wasmerio/cranelift?branch=feature/merge-cranelift-0-43-1)", "raw-cpuid 6.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "target-lexicon 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "target-lexicon 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "cranelift-wasm" +version = "0.43.1" +source = "git+https://github.com/wasmerio/cranelift?branch=feature/merge-cranelift-0-43-1#c5da7629c0dabcafb083efb5f9b8db39c20a4dc4" +dependencies = [ + "cranelift-codegen 0.43.1 (git+https://github.com/wasmerio/cranelift?branch=feature/merge-cranelift-0-43-1)", + "cranelift-entity 0.43.1 (git+https://github.com/wasmerio/cranelift?branch=feature/merge-cranelift-0-43-1)", + "cranelift-frontend 0.43.1 (git+https://github.com/wasmerio/cranelift?branch=feature/merge-cranelift-0-43-1)", + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "wasmparser 0.37.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1269,7 +1295,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "target-lexicon" -version = "0.4.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1484,9 +1510,11 @@ name = "wasmer-clif-backend" version = "0.7.0" dependencies = [ "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "cranelift-codegen 0.31.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cranelift-entity 0.31.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cranelift-native 0.31.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-codegen 0.43.1 (git+https://github.com/wasmerio/cranelift?branch=feature/merge-cranelift-0-43-1)", + "cranelift-entity 0.43.1 (git+https://github.com/wasmerio/cranelift?branch=feature/merge-cranelift-0-43-1)", + "cranelift-frontend 0.43.1 (git+https://github.com/wasmerio/cranelift?branch=feature/merge-cranelift-0-43-1)", + "cranelift-native 0.43.1 (git+https://github.com/wasmerio/cranelift?branch=feature/merge-cranelift-0-43-1)", + "cranelift-wasm 0.43.1 (git+https://github.com/wasmerio/cranelift?branch=feature/merge-cranelift-0-43-1)", "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "nix 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1494,39 +1522,13 @@ dependencies = [ "serde-bench 0.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "serde_bytes 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)", - "target-lexicon 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "wasmer-clif-fork-frontend 0.33.0 (registry+https://github.com/rust-lang/crates.io-index)", - "wasmer-clif-fork-wasm 0.33.0 (registry+https://github.com/rust-lang/crates.io-index)", + "target-lexicon 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "wasmer-runtime-core 0.7.0", "wasmer-win-exception-handler 0.7.0", - "wasmparser 0.35.3 (registry+https://github.com/rust-lang/crates.io-index)", + "wasmparser 0.37.2 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "wasmer-clif-fork-frontend" -version = "0.33.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cranelift-codegen 0.31.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "target-lexicon 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "wasmer-clif-fork-wasm" -version = "0.33.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cranelift-codegen 0.31.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cranelift-entity 0.31.0 (registry+https://github.com/rust-lang/crates.io-index)", - "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "wasmer-clif-fork-frontend 0.33.0 (registry+https://github.com/rust-lang/crates.io-index)", - "wasmparser 0.35.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "wasmer-dev-utils" version = "0.7.0" @@ -1586,7 +1588,7 @@ dependencies = [ "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", "wabt 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", "wasmer-runtime-core 0.7.0", - "wasmparser 0.35.3 (registry+https://github.com/rust-lang/crates.io-index)", + "wasmparser 0.37.2 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1658,7 +1660,7 @@ dependencies = [ "serde_bytes 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", - "wasmparser 0.35.3 (registry+https://github.com/rust-lang/crates.io-index)", + "wasmparser 0.37.2 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1674,7 +1676,7 @@ dependencies = [ "nix 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", "wasmer-runtime-core 0.7.0", - "wasmparser 0.35.3 (registry+https://github.com/rust-lang/crates.io-index)", + "wasmparser 0.37.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1734,7 +1736,7 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.35.3" +version = "0.37.2" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1821,11 +1823,13 @@ dependencies = [ "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" "checksum cmake 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "81fb25b677f8bf1eb325017cb6bb8452f87969db0fedb4f757b297bee78a7c62" "checksum constant_time_eq 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "995a44c877f9212528ccc74b21a232f66ad69001e40ede5bcee2ac9ef2657120" -"checksum cranelift-bforest 0.31.0 (registry+https://github.com/rust-lang/crates.io-index)" = "409f92af3dd276e112b72873a3ef02613e3c5f55b81d5d5d04f3157d4f8b8c54" -"checksum cranelift-codegen 0.31.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b303542a56fba4cbaeea099fb30ed078b50de0e765fd69f7f5f410adbe31d95b" -"checksum cranelift-codegen-meta 0.31.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0fee15ed430092a6d14b7c6d627540bef732509b8097ae31e4e35526edaa129c" -"checksum cranelift-entity 0.31.0 (registry+https://github.com/rust-lang/crates.io-index)" = "739222c3740e4a8d6f0375bd95caba9b6c11afcba9f0e1d4f944d6bd99f84600" -"checksum cranelift-native 0.31.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ce451162d18b7d82118e23ea7e12f7d8b98557549404bd71215548de79eb0736" +"checksum cranelift-bforest 0.43.1 (git+https://github.com/wasmerio/cranelift?branch=feature/merge-cranelift-0-43-1)" = "" +"checksum cranelift-codegen 0.43.1 (git+https://github.com/wasmerio/cranelift?branch=feature/merge-cranelift-0-43-1)" = "" +"checksum cranelift-codegen-meta 0.43.1 (git+https://github.com/wasmerio/cranelift?branch=feature/merge-cranelift-0-43-1)" = "" +"checksum cranelift-entity 0.43.1 (git+https://github.com/wasmerio/cranelift?branch=feature/merge-cranelift-0-43-1)" = "" +"checksum cranelift-frontend 0.43.1 (git+https://github.com/wasmerio/cranelift?branch=feature/merge-cranelift-0-43-1)" = "" +"checksum cranelift-native 0.43.1 (git+https://github.com/wasmerio/cranelift?branch=feature/merge-cranelift-0-43-1)" = "" +"checksum cranelift-wasm 0.43.1 (git+https://github.com/wasmerio/cranelift?branch=feature/merge-cranelift-0-43-1)" = "" "checksum criterion 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "0363053954f3e679645fc443321ca128b7b950a6fe288cf5f9335cc22ee58394" "checksum criterion-plot 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "76f9212ddf2f4a9eb2d401635190600656a1f88a932ef53d06e7fa4c7e02fb8e" "checksum crossbeam-deque 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b18cd2e169ad86297e6bc0ad9aa679aee9daa4f19e8163860faf7c164e4f5a71" @@ -1940,7 +1944,7 @@ dependencies = [ "checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" "checksum synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "02353edf96d6e4dc81aea2d8490a7e9db177bf8acb0e951c24940bf866cb313f" "checksum take_mut 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60" -"checksum target-lexicon 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1b0ab4982b8945c35cc1c46a83a9094c414f6828a099ce5dcaa8ee2b04642dcb" +"checksum target-lexicon 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7975cb2c6f37d77b190bc5004a2bb015971464756fde9514651a525ada2a741a" "checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" "checksum termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "96d6098003bde162e4277c70665bd87c326f5a0c3f3fbfb285787fa482d54e6e" "checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" @@ -1964,9 +1968,7 @@ dependencies = [ "checksum wabt-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "af5d153dc96aad7dc13ab90835b892c69867948112d95299e522d370c4e13a08" "checksum walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)" = "9658c94fa8b940eab2250bd5a457f9c48b748420d71293b165c8cdbe2f55f71e" "checksum wasi 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b89c3ce4ce14bdc6fb6beaf9ec7928ca331de5df7e5ea278375642a2f478570d" -"checksum wasmer-clif-fork-frontend 0.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3bd6bec1587a3b11222f4ff129fd119785713c41de413f54f99d3c03743812f4" -"checksum wasmer-clif-fork-wasm 0.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a8f323e612fe2549391255a09f89c927d7feb0ec4bf0c2cad9e3c089bdca42fc" -"checksum wasmparser 0.35.3 (registry+https://github.com/rust-lang/crates.io-index)" = "099aaf77635ffad3d9ab57253c29b16a46e93755c3e54cfe33fb8cf4b54f760b" +"checksum wasmparser 0.37.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f7387ba67c13dd9cd01d7d961e733375aee889f828564e190da85b5602eb5eeb" "checksum which 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b57acb10231b9493c8472b20cb57317d0679a49e0bdbee44b3b803a6473af164" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" "checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6" diff --git a/lib/clif-backend/Cargo.toml b/lib/clif-backend/Cargo.toml index 3b662358d87..901223de9ca 100644 --- a/lib/clif-backend/Cargo.toml +++ b/lib/clif-backend/Cargo.toml @@ -10,15 +10,15 @@ readme = "README.md" [dependencies] wasmer-runtime-core = { path = "../runtime-core", version = "0.7.0" } -cranelift-native = { version = "0.31" } -cranelift-codegen = { version = "0.31" } -cranelift-entity = { version = "0.31" } -cranelift-frontend = { package = "wasmer-clif-fork-frontend", version = "0.33" } -cranelift-wasm = { package = "wasmer-clif-fork-wasm", version = "0.33" } -target-lexicon = "0.4" -wasmparser = "0.35.1" -byteorder = "1.3" -nix = "0.15" +cranelift-native = { git = "https://github.com/wasmerio/cranelift", branch = "feature/merge-cranelift-0-43-1" } +cranelift-codegen = { git = "https://github.com/wasmerio/cranelift", branch = "feature/merge-cranelift-0-43-1" } +cranelift-entity = { git = "https://github.com/wasmerio/cranelift", branch = "feature/merge-cranelift-0-43-1" } +cranelift-frontend = { git = "https://github.com/wasmerio/cranelift", branch = "feature/merge-cranelift-0-43-1" } +cranelift-wasm = { git = "https://github.com/wasmerio/cranelift", branch = "feature/merge-cranelift-0-43-1" } +target-lexicon = "0.8.1" +wasmparser = { version = "0.37.0", default-features = false } +byteorder = "1.3.2" +nix = "0.15.0" libc = "0.2.60" rayon = "1.1" diff --git a/lib/clif-backend/src/code.rs b/lib/clif-backend/src/code.rs index f5e4b3b7a01..b2ccc66520a 100644 --- a/lib/clif-backend/src/code.rs +++ b/lib/clif-backend/src/code.rs @@ -1117,7 +1117,18 @@ impl FunctionCodeGenerator for CraneliftFunctionCodeGenerator { fn feed_local(&mut self, ty: WpType, n: usize) -> Result<(), CodegenError> { let mut next_local = self.next_local; - cranelift_wasm::declare_locals(&mut self.builder(), n as u32, ty, &mut next_local)?; + let mut builder = FunctionBuilder::new( + &mut self.func, + &mut self.func_translator.func_ctx, + &mut self.position, + ); + cranelift_wasm::declare_locals( + &mut builder, + n as u32, + ty, + &mut next_local, + &mut self.func_env, + )?; self.next_local = next_local; Ok(()) } diff --git a/lib/clif-backend/src/lib.rs b/lib/clif-backend/src/lib.rs index 60f19a877ed..ddecdbaf08a 100644 --- a/lib/clif-backend/src/lib.rs +++ b/lib/clif-backend/src/lib.rs @@ -34,7 +34,7 @@ extern crate serde; fn get_isa() -> Box { let flags = { let mut builder = settings::builder(); - builder.set("opt_level", "best").unwrap(); + builder.set("opt_level", "speed_and_size").unwrap(); builder.set("jump_tables_enabled", "false").unwrap(); if cfg!(not(test)) { @@ -42,7 +42,7 @@ fn get_isa() -> Box { } let flags = settings::Flags::new(builder); - debug_assert_eq!(flags.opt_level(), settings::OptLevel::Best); + debug_assert_eq!(flags.opt_level(), settings::OptLevel::SpeedAndSize); flags }; isa::lookup(Triple::host()).unwrap().finish(flags) diff --git a/lib/clif-backend/src/relocation.rs b/lib/clif-backend/src/relocation.rs index 50a032095ec..bb07c7c59b3 100644 --- a/lib/clif-backend/src/relocation.rs +++ b/lib/clif-backend/src/relocation.rs @@ -202,6 +202,11 @@ impl binemit::RelocSink for RelocSink { } } } + + fn reloc_constant(&mut self, _: u32, _: cranelift_codegen::binemit::Reloc, _: u32) { + unimplemented!() + } + fn reloc_jt( &mut self, _offset: binemit::CodeOffset, diff --git a/lib/clif-backend/src/resolver.rs b/lib/clif-backend/src/resolver.rs index 94e984fb6fe..7a868f35e46 100644 --- a/lib/clif-backend/src/resolver.rs +++ b/lib/clif-backend/src/resolver.rs @@ -10,7 +10,10 @@ use crate::{ use rayon::prelude::*; use byteorder::{ByteOrder, LittleEndian}; -use cranelift_codegen::{ir, isa, Context}; +use cranelift_codegen::{ + binemit::{Stackmap, StackmapSink}, + ir, isa, Context, +}; use std::{ mem, ptr::{write_unaligned, NonNull}, @@ -58,6 +61,11 @@ pub struct FuncResolverBuilder { import_len: usize, } +pub struct NoopStackmapSink {} +impl StackmapSink for NoopStackmapSink { + fn add_stackmap(&mut self, _: u32, _: Stackmap) {} +} + impl FuncResolverBuilder { pub fn new_from_backend_cache( backend_cache: BackendCache, @@ -109,12 +117,13 @@ impl FuncResolverBuilder { ctx.func = func.to_owned(); let mut reloc_sink = RelocSink::new(); let mut local_trap_sink = LocalTrapSink::new(); - + let mut stackmap_sink = NoopStackmapSink {}; ctx.compile_and_emit( isa, &mut code_buf, &mut reloc_sink, &mut local_trap_sink, + &mut stackmap_sink, ) .map_err(|e| CompileError::InternalError { msg: e.to_string() })?; ctx.clear(); diff --git a/lib/clif-backend/src/trampoline.rs b/lib/clif-backend/src/trampoline.rs index 7f22c62a5bd..a6fc6572bac 100644 --- a/lib/clif-backend/src/trampoline.rs +++ b/lib/clif-backend/src/trampoline.rs @@ -1,4 +1,5 @@ use crate::cache::TrampolineCache; +use crate::resolver::NoopStackmapSink; use cranelift_codegen::{ binemit::{NullTrapSink, Reloc, RelocSink}, cursor::{Cursor, FuncCursor}, @@ -19,6 +20,11 @@ struct NullRelocSink {} impl RelocSink for NullRelocSink { fn reloc_ebb(&mut self, _: u32, _: Reloc, _: u32) {} fn reloc_external(&mut self, _: u32, _: Reloc, _: &ir::ExternalName, _: i64) {} + + fn reloc_constant(&mut self, _: u32, _: Reloc, _: u32) { + unimplemented!() + } + fn reloc_jt(&mut self, _: u32, _: Reloc, _: ir::JumpTable) {} } @@ -89,12 +95,13 @@ impl Trampolines { ctx.func = trampoline_func; let mut code_buf = Vec::new(); - + let mut stackmap_sink = NoopStackmapSink {}; ctx.compile_and_emit( isa, &mut code_buf, &mut NullRelocSink {}, &mut NullTrapSink {}, + &mut stackmap_sink, ) .expect("unable to compile trampolines"); ctx.clear(); diff --git a/lib/llvm-backend/Cargo.toml b/lib/llvm-backend/Cargo.toml index 2e198a6c39f..bd97176f958 100644 --- a/lib/llvm-backend/Cargo.toml +++ b/lib/llvm-backend/Cargo.toml @@ -7,7 +7,7 @@ readme = "README.md" [dependencies] wasmer-runtime-core = { path = "../runtime-core", version = "0.7.0" } -wasmparser = "0.35.1" +wasmparser = { version = "0.37.0", default-features = false } smallvec = "0.6" goblin = "0.0.24" libc = "0.2.60" diff --git a/lib/runtime-abi/Cargo.toml b/lib/runtime-abi/Cargo.toml index 1840e65d904..d0cda4124c3 100644 --- a/lib/runtime-abi/Cargo.toml +++ b/lib/runtime-abi/Cargo.toml @@ -12,7 +12,7 @@ libc = "0.2.60" wasmer-runtime-core = { path = "../runtime-core" } failure = "0.1" tar = "0.4" -wasmparser = "0.35.1" +wasmparser = { version = "0.37.0", default-features = false } zstd = "0.4" # [target.'cfg(unix)'.dependencies.zbox] diff --git a/lib/runtime-core/Cargo.toml b/lib/runtime-core/Cargo.toml index f683a974eb5..02d5b62c3a2 100644 --- a/lib/runtime-core/Cargo.toml +++ b/lib/runtime-core/Cargo.toml @@ -10,7 +10,7 @@ edition = "2018" [dependencies] nix = "0.15" page_size = "0.4" -wasmparser = "0.35.1" +wasmparser = { version = "0.37.0", default-features = false } parking_lot = "0.9" lazy_static = "1.4" errno = "0.2" diff --git a/lib/runtime-core/src/codegen.rs b/lib/runtime-core/src/codegen.rs index e69b9637c6b..3db1b374368 100644 --- a/lib/runtime-core/src/codegen.rs +++ b/lib/runtime-core/src/codegen.rs @@ -146,7 +146,6 @@ pub fn validating_parser_config(features: &Features) -> wasmparser::ValidatingPa enable_bulk_memory: false, enable_multi_value: false, }, - mutable_global_imports: true, } } diff --git a/lib/runtime-core/src/lib.rs b/lib/runtime-core/src/lib.rs index fa4450693ee..26a76f7dbf6 100644 --- a/lib/runtime-core/src/lib.rs +++ b/lib/runtime-core/src/lib.rs @@ -146,7 +146,6 @@ pub fn validate_and_report_errors_with_features( enable_reference_types: false, enable_threads: features.threads, }, - mutable_global_imports: true, }; let mut parser = wasmparser::ValidatingParser::new(wasm, Some(config)); loop { diff --git a/lib/singlepass-backend/Cargo.toml b/lib/singlepass-backend/Cargo.toml index f90afad1278..573018e14b0 100644 --- a/lib/singlepass-backend/Cargo.toml +++ b/lib/singlepass-backend/Cargo.toml @@ -10,7 +10,7 @@ readme = "README.md" [dependencies] wasmer-runtime-core = { path = "../runtime-core", version = "0.7.0" } -wasmparser = "0.35.1" +wasmparser = { version = "0.37.0", default-features = false } dynasm = "0.3.2" dynasmrt = "0.3.1" lazy_static = "1.4"