Created
January 13, 2025 22:44
-
-
Save alexcrichton/5e83b134fc094dd525facc8e57992e10 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/vms/wasmtime.rs b/src/vms/wasmtime.rs | |
index 115f93d..befdc3d 100644 | |
--- a/src/vms/wasmtime.rs | |
+++ b/src/vms/wasmtime.rs | |
@@ -3,7 +3,13 @@ use crate::utils::{CompileTestFilter, ExecuteTestFilter, TestFilter}; | |
use wasmi_new::ModuleImportsIter; | |
pub struct Wasmtime { | |
- pub strategy: wasmtime::Strategy, | |
+ pub strategy: Strategy, | |
+} | |
+ | |
+pub enum Strategy { | |
+ Cranelift, | |
+ Pulley, | |
+ Winch, | |
} | |
struct WasmtimeRuntime { | |
@@ -15,15 +21,15 @@ struct WasmtimeRuntime { | |
impl BenchVm for Wasmtime { | |
fn name(&self) -> &'static str { | |
match self.strategy { | |
- wasmtime::Strategy::Cranelift | wasmtime::Strategy::Auto => "wasmtime.cranelift", | |
- wasmtime::Strategy::Winch => "wasmtime.winch", | |
- _ => panic!("unknown Wasmtime strategy"), | |
+ Strategy::Cranelift => "wasmtime.cranelift", | |
+ Strategy::Winch => "wasmtime.winch", | |
+ Strategy::Pulley => "wasmtime.pulley", | |
} | |
} | |
fn test_filter(&self) -> TestFilter { | |
match self.strategy { | |
- wasmtime::Strategy::Auto | wasmtime::Strategy::Cranelift => { | |
+ Strategy::Cranelift | Strategy::Pulley => { | |
TestFilter { | |
compile: CompileTestFilter { | |
ffmpeg: false, // takes too long to compile | |
@@ -32,7 +38,7 @@ impl BenchVm for Wasmtime { | |
..Default::default() | |
} | |
} | |
- wasmtime::Strategy::Winch => { | |
+ Strategy::Winch => { | |
let winch_works = cfg!(target_arch = "x86_64"); | |
TestFilter { | |
execute: ExecuteTestFilter { | |
@@ -48,7 +54,6 @@ impl BenchVm for Wasmtime { | |
}, | |
} | |
} | |
- unknown => panic!("unknown Wasmtime strategy: {unknown:?}"), | |
} | |
} | |
@@ -94,13 +99,15 @@ impl BenchVm for Wasmtime { | |
impl Wasmtime { | |
fn store(&self) -> wasmtime::Store<()> { | |
let mut config = wasmtime::Config::default(); | |
- if matches!( | |
- self.strategy, | |
- wasmtime::Strategy::Auto | wasmtime::Strategy::Cranelift | |
- ) { | |
- config.wasm_tail_call(true); | |
+ match self.strategy { | |
+ Strategy::Cranelift => {} | |
+ Strategy::Pulley => { | |
+ config.target("pulley64").unwrap(); | |
+ } | |
+ Strategy::Winch => { | |
+ config.strategy(wasmtime::Strategy::Winch); | |
+ } | |
} | |
- config.strategy(self.strategy); | |
let engine = wasmtime::Engine::new(&config).unwrap(); | |
<wasmtime::Store<()>>::new(&engine, ()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment