Upgrade to wasmer 2.2 (#11168)

This commit is contained in:
Alexander Theißen
2022-04-05 19:01:45 +02:00
committed by GitHub
parent 7a4d5b5ec6
commit 14333e3074
6 changed files with 282 additions and 148 deletions
+1 -4
View File
@@ -24,13 +24,10 @@ sp-maybe-compressed-blob = { version = "4.1.0-dev", path = "../../../primitives/
sp-serializer = { version = "4.0.0-dev", path = "../../../primitives/serializer" }
thiserror = "1.0.30"
environmental = "1.1.3"
wasmer = { version = "1.0", optional = true }
wasmer-compiler-singlepass = { version = "1.0", optional = true }
wasmer = { version = "2.2", optional = true, features = ["singlepass"] }
[features]
default = []
wasmer-sandbox = [
"wasmer",
"wasmer-compiler-singlepass",
]
@@ -251,6 +251,8 @@ pub enum InstantiationError {
/// Module is well-formed, instantiated and linked, but while executing the start function
/// a trap was generated.
StartTrapped,
/// The code was compiled with a CPU feature not available on the host.
CpuFeature,
}
fn decode_environment_definition(
@@ -43,9 +43,8 @@ pub struct Backend {
impl Backend {
pub fn new() -> Self {
let compiler = wasmer_compiler_singlepass::Singlepass::default();
Backend { store: wasmer::Store::new(&wasmer::JIT::new(compiler).engine()) }
let compiler = wasmer::Singlepass::default();
Backend { store: wasmer::Store::new(&wasmer::Universal::new(compiler).engine()) }
}
}
@@ -191,6 +190,7 @@ pub fn instantiate(
wasmer::InstantiationError::Start(_) => InstantiationError::StartTrapped,
wasmer::InstantiationError::HostEnvInitialization(_) =>
InstantiationError::EnvironmentDefinitionCorrupted,
wasmer::InstantiationError::CpuFeature(_) => InstantiationError::CpuFeature,
})
})?;