Skip to content

Commit 6ac02e1

Browse files
authored
Optimize MIRI execution time in CI (bytecodealliance#10038)
* Optimize MIRI execution time in CI * Disable Cranelift optimizations and use single_pass register allocation by default. * Ignore a number of tests that are compiling wasm which we generally don't want to do under MIRI. * Fix CI build
1 parent 146aa47 commit 6ac02e1

File tree

8 files changed

+18
-0
lines changed

8 files changed

+18
-0
lines changed

crates/wasmtime/src/config.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,14 @@ impl Config {
279279
{
280280
ret.cranelift_debug_verifier(false);
281281
ret.cranelift_opt_level(OptLevel::Speed);
282+
283+
// When running under MIRI try to optimize for compile time of wasm
284+
// code itself as much as possible. Disable optimizations by
285+
// default and use the fastest regalloc available to us.
286+
if cfg!(miri) {
287+
ret.cranelift_opt_level(OptLevel::None);
288+
ret.cranelift_regalloc_algorithm(RegallocAlgorithm::SinglePass);
289+
}
282290
}
283291

284292
ret.wasm_backtrace_details(WasmBacktraceDetails::Environment);

tests/all/component_model/instance.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use wasmtime::component::*;
33
use wasmtime::{Module, Store};
44

55
#[test]
6+
#[cfg_attr(miri, ignore)]
67
fn instance_exports() -> Result<()> {
78
let engine = super::engine();
89
let component = r#"
@@ -124,6 +125,7 @@ fn export_new_get_old() -> Result<()> {
124125
}
125126

126127
#[test]
128+
#[cfg_attr(miri, ignore)]
127129
fn export_missing_get_max() -> Result<()> {
128130
let engine = super::engine();
129131
let component = r#"

tests/all/component_model/linker.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ fn missing_import_selects_max() -> Result<()> {
106106
}
107107

108108
#[test]
109+
#[cfg_attr(miri, ignore)]
109110
fn linker_substituting_types_issue_8003() -> Result<()> {
110111
let engine = Engine::default();
111112
let linker = Linker::<()>::new(&engine);

tests/all/func.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,7 @@ fn dtor_runs() {
473473
}
474474

475475
#[test]
476+
#[cfg_attr(miri, ignore)]
476477
fn dtor_delayed() -> Result<()> {
477478
static HITS: AtomicUsize = AtomicUsize::new(0);
478479

tests/all/host_funcs.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ fn drop_func() -> Result<()> {
8383
}
8484

8585
#[test]
86+
#[cfg_attr(miri, ignore)]
8687
fn drop_delayed() -> Result<()> {
8788
static HITS: AtomicUsize = AtomicUsize::new(0);
8889

tests/all/instance.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use wasmtime::*;
22

33
#[test]
4+
#[cfg_attr(miri, ignore)]
45
fn wrong_import_numbers() -> Result<()> {
56
let mut store = Store::<()>::default();
67
let module = Module::new(store.engine(), r#"(module (import "" "" (func)))"#)?;

tests/all/linker.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use std::sync::Arc;
55
use wasmtime::*;
66

77
#[test]
8+
#[cfg_attr(miri, ignore)]
89
fn link_undefined() -> Result<()> {
910
let mut store = Store::<()>::default();
1011
let linker = Linker::new(store.engine());
@@ -269,6 +270,7 @@ fn no_leak_with_imports() -> Result<()> {
269270
}
270271

271272
#[test]
273+
#[cfg_attr(miri, ignore)]
272274
fn get_host_function() -> Result<()> {
273275
let engine = Engine::default();
274276
let module = Module::new(&engine, r#"(module (import "mod" "f1" (func)))"#)?;
@@ -331,6 +333,7 @@ fn alias_one() -> Result<()> {
331333
}
332334

333335
#[test]
336+
#[cfg_attr(miri, ignore)]
334337
fn instance_pre() -> Result<()> {
335338
let engine = Engine::default();
336339
let mut linker = Linker::new(&engine);

tests/all/module.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@ fn tail_call_defaults() -> Result<()> {
300300
}
301301

302302
#[test]
303+
#[cfg_attr(miri, ignore)]
303304
fn cross_engine_module_exports() -> Result<()> {
304305
let a_engine = Engine::default();
305306
let b_engine = Engine::default();

0 commit comments

Comments
 (0)