Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Wasmi to v0.32.0-beta.2 #83

Merged
merged 3 commits into from
Dec 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 21 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tools/benchtool/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ libc = { workspace = true }
libloading = { version = "0.8.1", optional = true }
log = { workspace = true }
object = { version = "0.32.1", default-features = false, features = ["std", "elf"], optional = true }
wasmi = { git = "https://github.com/paritytech/wasmi.git", rev = "ea3a29ce66ca116489b7bbcec520c5415ace17b2", optional = true }
wasmi = { version = "0.32.0-beta.2", optional = true }

[target.'cfg(target_arch = "x86_64")'.dependencies]
ckb-vm = { version = "0.24.6", features = ["asm"], optional = true }
Expand Down
8 changes: 4 additions & 4 deletions tools/benchtool/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,9 @@ define_backends! {
Wasm3 => backend_wasm3::Wasm3(),

#[cfg(feature = "wasmi")]
Wasmi_StackMachine => backend_wasmi::Wasmi(wasmi::EngineBackend::StackMachine),
Wasmi_Eager => backend_wasmi::Wasmi(wasmi::CompilationMode::Eager),
#[cfg(feature = "wasmi")]
Wasmi_RegisterMachine => backend_wasmi::Wasmi(wasmi::EngineBackend::RegisterMachine),
Wasmi_Lazy => backend_wasmi::Wasmi(wasmi::CompilationMode::Lazy),

#[cfg(feature = "native")]
Native => backend_native::Native()
Expand All @@ -297,8 +297,8 @@ impl BenchmarkKind {
BenchmarkKind::WebAssembly => {
#[cfg(feature = "wasmi")]
{
output.push(BackendKind::Wasmi_StackMachine);
output.push(BackendKind::Wasmi_RegisterMachine);
output.push(BackendKind::Wasmi_Eager);
output.push(BackendKind::Wasmi_Lazy);
}

#[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))]
Expand Down
9 changes: 5 additions & 4 deletions tools/benchtool/src/backend/backend_wasmi.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use super::backend_prelude::*;

#[derive(Copy, Clone)]
pub struct Wasmi(pub wasmi::EngineBackend);
pub struct Wasmi(pub wasmi::CompilationMode);

pub struct WasmiInstance {
store: wasmi::Store<()>,
Expand All @@ -17,14 +17,15 @@ impl Backend for Wasmi {

fn name(&self) -> &'static str {
match self.0 {
wasmi::EngineBackend::StackMachine => "wasmi_stack",
wasmi::EngineBackend::RegisterMachine => "wasmi_register",
wasmi::CompilationMode::Eager => "wasmi_eager",
wasmi::CompilationMode::LazyTranslation => "wasmi_lazy_translation",
wasmi::CompilationMode::Lazy => "wasmi_lazy",
}
}

fn create(&self) -> Self::Engine {
let mut config = wasmi::Config::default();
config.set_engine_backend(self.0);
config.compilation_mode(self.0);
wasmi::Engine::new(&config)
}

Expand Down