From 286037166a6f0e0b8c4ab8c351476381702ac927 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20du=20Garreau?= Date: Sat, 10 Jul 2021 15:02:20 +0200 Subject: [PATCH] Update wasmer --- Cargo.lock | 250 +++++++++++++++++++----------- common/state/Cargo.toml | 2 +- common/state/src/plugin/module.rs | 4 +- 3 files changed, 161 insertions(+), 95 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 90d9acf175..1b9abbaf38 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -24,7 +24,7 @@ version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e7a2e47a1fbe209ee101dd6d61285226744c6c8d3c21c8dc878ba6cb9f467f3a" dependencies = [ - "gimli 0.24.0", + "gimli", ] [[package]] @@ -329,7 +329,7 @@ dependencies = [ "cfg-if 1.0.0", "libc", "miniz_oxide 0.4.4", - "object 0.25.3", + "object", "rustc-demangle", ] @@ -940,37 +940,35 @@ dependencies = [ [[package]] name = "cranelift-bforest" -version = "0.68.0" +version = "0.74.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9221545c0507dc08a62b2d8b5ffe8e17ac580b0a74d1813b496b8d70b070fbd0" +checksum = "c8ca3560686e7c9c7ed7e0fe77469f2410ba5d7781b1acaa9adc8d8deea28e3e" dependencies = [ "cranelift-entity", ] [[package]] name = "cranelift-codegen" -version = "0.68.0" +version = "0.74.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e9936ea608b6cd176f107037f6adbb4deac933466fc7231154f96598b2d3ab1" +checksum = "baf9bf1ffffb6ce3d2e5ebc83549bd2436426c99b31cc550d521364cbe35d276" dependencies = [ - "byteorder", "cranelift-bforest", "cranelift-codegen-meta", "cranelift-codegen-shared", "cranelift-entity", - "gimli 0.22.0", + "gimli", "log", "regalloc", "smallvec", "target-lexicon", - "thiserror", ] [[package]] name = "cranelift-codegen-meta" -version = "0.68.0" +version = "0.74.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ef2b2768568306540f4c8db3acce9105534d34c4a1e440529c1e702d7f8c8d7" +checksum = "4cc21936a5a6d07e23849ffe83e5c1f6f50305c074f4b2970ca50c13bf55b821" dependencies = [ "cranelift-codegen-shared", "cranelift-entity", @@ -978,24 +976,21 @@ dependencies = [ [[package]] name = "cranelift-codegen-shared" -version = "0.68.0" +version = "0.74.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6759012d6d19c4caec95793f052613e9d4113e925e7f14154defbac0f1d4c938" +checksum = "ca5b6ffaa87560bebe69a5446449da18090b126037920b0c1c6d5945f72faf6b" [[package]] name = "cranelift-entity" -version = "0.68.0" +version = "0.74.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86badbce14e15f52a45b666b38abe47b204969dd7f8fb7488cb55dd46b361fa6" -dependencies = [ - "serde", -] +checksum = "7d6b4a8bef04f82e4296782646f733c641d09497df2fabf791323fefaa44c64c" [[package]] name = "cranelift-frontend" -version = "0.68.0" +version = "0.74.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b608bb7656c554d0a4cf8f50c7a10b857e80306f6ff829ad6d468a7e2323c8d8" +checksum = "c31b783b351f966fce33e3c03498cb116d16d97a8f9978164a60920bd0d3a99c" dependencies = [ "cranelift-codegen", "log", @@ -2131,21 +2126,15 @@ dependencies = [ [[package]] name = "gimli" -version = "0.22.0" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aaf91faf136cb47367fa430cd46e37a788775e7fa104f8b4bcb3861dc389b724" +checksum = "0e4075386626662786ddb0ec9081e7c7eeb1ba31951f447ca780ef9f5d568189" dependencies = [ "fallible-iterator", "indexmap", "stable_deref_trait", ] -[[package]] -name = "gimli" -version = "0.24.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e4075386626662786ddb0ec9081e7c7eeb1ba31951f447ca780ef9f5d568189" - [[package]] name = "git2" version = "0.13.20" @@ -2910,6 +2899,27 @@ dependencies = [ "cfg-if 1.0.0", ] +[[package]] +name = "loupe" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b6a72dfa44fe15b5e76b94307eeb2ff995a8c5b283b55008940c02e0c5b634d" +dependencies = [ + "indexmap", + "loupe-derive", + "rustversion", +] + +[[package]] +name = "loupe-derive" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0fbfc88337168279f2e9ae06e157cfed4efd3316e14dc96ed074d4f2e6c5952" +dependencies = [ + "quote 1.0.9", + "syn 1.0.73", +] + [[package]] name = "lz-fear" version = "0.1.1" @@ -3590,22 +3600,14 @@ dependencies = [ "objc", ] -[[package]] -name = "object" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d3b63360ec3cb337817c2dbd47ab4a0f170d285d8e5a2064600f3def1402397" -dependencies = [ - "crc32fast", - "indexmap", -] - [[package]] name = "object" version = "0.25.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a38f2be3697a57b4060074ff41b44c16870d916ad7877c17696e063257482bc7" dependencies = [ + "crc32fast", + "indexmap", "memchr", ] @@ -4025,6 +4027,26 @@ dependencies = [ "tracing", ] +[[package]] +name = "ptr_meta" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0738ccf7ea06b608c10564b31debd4f5bc5e197fc8bfe088f68ae5ce81e7a4f1" +dependencies = [ + "ptr_meta_derive", +] + +[[package]] +name = "ptr_meta_derive" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16b845dbfca988fa33db069c0e230574d15a3088f147a87b64c7589eb662c9ac" +dependencies = [ + "proc-macro2 1.0.27", + "quote 1.0.9", + "syn 1.0.73", +] + [[package]] name = "quinn" version = "0.7.2" @@ -4394,6 +4416,29 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "rkyv" +version = "0.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb135b3e5e3311f0a254bfb00333f4bac9ef1d89888b84242a89eb8722b09a07" +dependencies = [ + "memoffset 0.6.4", + "ptr_meta", + "rkyv_derive", + "seahash", +] + +[[package]] +name = "rkyv_derive" +version = "0.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba8f489f6b6d8551bb15904293c1ad58a6abafa7d8390d15f7ed05a2afcd87d5" +dependencies = [ + "proc-macro2 1.0.27", + "quote 1.0.9", + "syn 1.0.73", +] + [[package]] name = "rodio" version = "0.14.0" @@ -4559,6 +4604,12 @@ dependencies = [ "owned_ttf_parser 0.6.0", ] +[[package]] +name = "rustversion" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61b3909d758bb75c79f23d4736fac9433868679d3ad2ea7a61e3c25cfda9a088" + [[package]] name = "rusty-xinput" version = "1.2.0" @@ -4678,6 +4729,12 @@ dependencies = [ "version-compare", ] +[[package]] +name = "seahash" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" + [[package]] name = "security-framework" version = "2.3.1" @@ -5313,9 +5370,9 @@ dependencies = [ [[package]] name = "target-lexicon" -version = "0.11.2" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "422045212ea98508ae3d28025bc5aaa2bd4a9cdaecd442a08da2ee620ee9ea95" +checksum = "64ae3b39281e4b14b8123bdbaddd472b7dfe215e444181f2f9d2443c2444f834" [[package]] name = "tempfile" @@ -6420,12 +6477,13 @@ checksum = "d7cff876b8f18eed75a66cf49b65e7f967cb354a7aa16003fb55dbfd25b44b4f" [[package]] name = "wasmer" -version = "1.0.2" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a70cfae554988d904d64ca17ab0e7cd652ee5c8a0807094819c1ea93eb9d6866" +checksum = "7f52e455a01d0fac439cd7a96ba9b519bdc84e923a5b96034054697ebb17cd75" dependencies = [ - "cfg-if 0.1.10", + "cfg-if 1.0.0", "indexmap", + "loupe", "more-asserts", "target-lexicon", "thiserror", @@ -6433,8 +6491,8 @@ dependencies = [ "wasmer-compiler-cranelift", "wasmer-derive", "wasmer-engine", - "wasmer-engine-jit", - "wasmer-engine-native", + "wasmer-engine-dylib", + "wasmer-engine-universal", "wasmer-types", "wasmer-vm", "wat", @@ -6443,11 +6501,13 @@ dependencies = [ [[package]] name = "wasmer-compiler" -version = "1.0.2" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b7732a9cab472bd921d5a0c422f45b3d03f62fa2c40a89e0770cef6d47e383e" +checksum = "cc86dda6f715f03104800be575a38382b35c3962953af9e9d8722dcf0bd2458f" dependencies = [ "enumset", + "loupe", + "rkyv", "serde", "serde_bytes", "smallvec", @@ -6460,16 +6520,17 @@ dependencies = [ [[package]] name = "wasmer-compiler-cranelift" -version = "1.0.2" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48cb9395f094e1d81534f4c5e330ed4cdb424e8df870d29ad585620284f5fddb" +checksum = "1a570746cbec434179e2d53357973a34dfdb208043104e8fac3b7b0023015cf6" dependencies = [ "cranelift-codegen", + "cranelift-entity", "cranelift-frontend", - "gimli 0.22.0", + "gimli", + "loupe", "more-asserts", "rayon", - "serde", "smallvec", "tracing", "wasmer-compiler", @@ -6479,9 +6540,9 @@ dependencies = [ [[package]] name = "wasmer-derive" -version = "1.0.2" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8b86dcd2c3efdb8390728a2b56f762db07789aaa5aa872a9dc776ba3a7912ed" +checksum = "1ee7b351bcc1e782997c72dc0b5b328f3ddcad4813b8ce3cac3f25ae5a4ab56b" dependencies = [ "proc-macro-error", "proc-macro2 1.0.27", @@ -6491,13 +6552,13 @@ dependencies = [ [[package]] name = "wasmer-engine" -version = "1.0.2" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efe4667d6bd888f26ae8062a63a9379fa697415b4b4e380f33832e8418fd71b5" +checksum = "8454ead320a4017ba36ddd9ab4fbf7776fceea6ab0b79b5e53664a1682569fc3" dependencies = [ "backtrace", - "bincode", "lazy_static", + "loupe", "memmap2 0.2.3", "more-asserts", "rustc-demangle", @@ -6511,33 +6572,16 @@ dependencies = [ ] [[package]] -name = "wasmer-engine-jit" -version = "1.0.2" +name = "wasmer-engine-dylib" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26770be802888011b4a3072f2a282fc2faa68aa48c71b3db6252a3937a85f3da" +checksum = "6aa390d123ebe23d5315c39f6063fcc18319661d03c8000f23d0fe1c011e8135" dependencies = [ - "bincode", - "cfg-if 0.1.10", - "region", - "serde", - "serde_bytes", - "wasmer-compiler", - "wasmer-engine", - "wasmer-types", - "wasmer-vm", - "winapi 0.3.9", -] - -[[package]] -name = "wasmer-engine-native" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bb4083a6c69f2cd4b000b82a80717f37c6cc2e536aee3a8ffe9af3edc276a8b" -dependencies = [ - "bincode", - "cfg-if 0.1.10", + "cfg-if 1.0.0", "leb128", - "libloading 0.6.7", + "libloading 0.7.0", + "loupe", + "rkyv", "serde", "tempfile", "tracing", @@ -6550,12 +6594,30 @@ dependencies = [ ] [[package]] -name = "wasmer-object" -version = "1.0.2" +name = "wasmer-engine-universal" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abf8e0c12b82ff81ebecd30d7e118be5fec871d6de885a90eeb105df0a769a7b" +checksum = "0dffe8015f08915eb4939ebc8e521cde8246f272f5197ea60d46214ac5aef285" dependencies = [ - "object 0.22.0", + "cfg-if 1.0.0", + "leb128", + "loupe", + "region", + "rkyv", + "wasmer-compiler", + "wasmer-engine", + "wasmer-types", + "wasmer-vm", + "winapi 0.3.9", +] + +[[package]] +name = "wasmer-object" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c541c985799fc1444702501c15d41becfb066c92d9673defc1c7417fd8739e15" +dependencies = [ + "object", "thiserror", "wasmer-compiler", "wasmer-types", @@ -6563,29 +6625,33 @@ dependencies = [ [[package]] name = "wasmer-types" -version = "1.0.2" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7f4ac28c2951cd792c18332f03da523ed06b170f5cf6bb5b1bdd7e36c2a8218" +checksum = "c91f75d3c31f8b1f8d818ff49624fc974220243cbc07a2252f408192e97c6b51" dependencies = [ - "cranelift-entity", + "indexmap", + "loupe", + "rkyv", "serde", "thiserror", ] [[package]] name = "wasmer-vm" -version = "1.0.2" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7635ba0b6d2fd325f588d69a950ad9fa04dddbf6ad08b6b2a183146319bf6ae" +checksum = "469a12346a4831e7dac639b9646d8c9b24c7d2cf0cf458b77f489edb35060c1f" dependencies = [ "backtrace", "cc", - "cfg-if 0.1.10", + "cfg-if 1.0.0", "indexmap", "libc", + "loupe", "memoffset 0.6.4", "more-asserts", "region", + "rkyv", "serde", "thiserror", "wasmer-types", @@ -6594,9 +6660,9 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.65.0" +version = "0.78.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc2fe6350834b4e528ba0901e7aa405d78b89dc1fa3145359eb4de0e323fcf" +checksum = "52144d4c78e5cf8b055ceab8e5fa22814ce4315d6002ad32cfd914f37c12fd65" [[package]] name = "wast" diff --git a/common/state/Cargo.toml b/common/state/Cargo.toml index de24d09f7a..dae2aebdcd 100644 --- a/common/state/Cargo.toml +++ b/common/state/Cargo.toml @@ -32,7 +32,7 @@ scopeguard = "1.1.0" serde = { version = "1.0.110", features = ["derive"], optional = true } toml = { version = "0.5.7", optional = true } tar = { version = "0.4.30", optional = true } -wasmer = { version = "1.0.0", optional = true, default-features = false, features = ["wat", "default-cranelift", "default-jit"] } +wasmer = { version = "2.0.0", optional = true, default-features = false, features = ["wat", "default-cranelift", "default-universal"] } bincode = { version = "1.3.1", optional = true } plugin-api = { package = "veloren-plugin-api", path = "../../plugin/api", optional = true } diff --git a/common/state/src/plugin/module.rs b/common/state/src/plugin/module.rs index 4adba15e63..933de37a18 100644 --- a/common/state/src/plugin/module.rs +++ b/common/state/src/plugin/module.rs @@ -6,7 +6,7 @@ use std::{ }; use specs::saveload::MarkerAllocator; -use wasmer::{imports, Cranelift, Function, Instance, Memory, Module, Store, Value, JIT}; +use wasmer::{imports, Cranelift, Function, Instance, Memory, Module, Store, Universal, Value}; use super::{ errors::{PluginError, PluginModuleError}, @@ -32,7 +32,7 @@ impl PluginModule { /// This function takes bytes from a WASM File and compile them pub fn new(name: String, wasm_data: &[u8]) -> Result { // This is creating the engine is this case a JIT based on Cranelift - let engine = JIT::new(Cranelift::default()).engine(); + let engine = Universal::new(Cranelift::default()).engine(); // We are creating an enironnement let store = Store::new(&engine); // We are compiling the WASM file in the previously generated environement