lifthrasiir opened issue #15168:
Feature
wasmtimecurrently unconditionally enables thepulleyfeature ofwasmtime-cranelift, which turns oncranelift-codegen/pulley. As a result every embedder using thecraneliftfeature links thepulley32andpulley64backends even withdefault-features = false, even when nothing ever targets Pulley.Benefit
wasmtime 49.0.4, rustc 1.99.1, aarch64-apple-darwin, release profile with
strip = true:[dependencies] wasmtime = { version = "=49.0.4", default-features = false, features = ["cranelift", "runtime", "std"] }fn main() -> wasmtime::Result<()> { let engine = wasmtime::Engine::default(); let module = wasmtime::Module::new(&engine, b"\0asm\x01\0\0\0")?; wasmtime::Instance::new(&mut wasmtime::Store::new(&engine, ()), &module, &[])?; Ok(()) }
file __textas published 7,896,992 5,996,012 features = ["pulley"]removed via[patch]6,121,152 4,522,352 delta -1,775,840 (-22.5%) -1,473,660 (-24.6%) The patched build compiles and runs unchanged;
wasmtime-craneliftalready handles the feature's absence (#[cfg(feature = "pulley")]).In the case of a large application like Aqueous, symbol attribution gives 1.54 MiB to the Pulley backends against 0.55 MiB for the aarch64 backend actually used.
Implementation
Ideally the feature has to be forwarded instead:
pulley = ["wasmtime-cranelift?/pulley"]withpulleyadded todefault. For hosts without a native backend,build.rscould then fail with a message asking for thepulleyfeature (whencraneliftis on andpulleyis off), rather than silently enabling it.Alternatives
Alternatively keep the current behaviour and let
build.rsaccept an opt-out, e.g. a--cfg wasmtime_no_pulley_compiler(only allowed on hosts with a native backend).
alexcrichton commented on issue #15168:
There's a bit more background on the current state of affairs here, but the size wins here are quite large so I think it'd be reasonable to try to fix this.
Given that a feature-based solution unfortunately won't work, perhaps cranelift-codegen could grow a Cargo feature for "enable pulley if there's no other backend" and Wasmtime would unconditionally enable that? That plus the conditional
pulleyfeature propagation as you mention I think would achieve the same results -- native wouldn't compile-in pulley, unsupported architectures would pull in pulley, and native could opt-in to pulling in pulley.
lifthrasiir commented on issue #15168:
Thanks, that works for me. cranelift-codegen's build.rs already does a similar thing for
host-arch(code), so it should be viable. The fallback condition would have to match Wasmtime'shas_host_compiler_backend(and miri) rather thanisa_from_arch, which also accepts i686.However, there remains a question of cross-compilation (my coding agent thankfully pointed it out): a user on a native host precompiling Pulley bytecode, without running it there, would have to turn on an additional feature. There are several options: require the feature in that case, add
pulleyto Wasmtime's defaults at the expense of default overhead, or create a new feature that only turns on the Pulley compiler. Any of them equally works for me, so it's your call.
alexcrichton commented on issue #15168:
Personally I think it's a reasonable tradeoff to require the
pulleyfeature for cross-compilation in that case, yeah.
alexcrichton closed issue #15168:
Feature
wasmtimecurrently unconditionally enables thepulleyfeature ofwasmtime-cranelift, which turns oncranelift-codegen/pulley. As a result every embedder using thecraneliftfeature links thepulley32andpulley64backends even withdefault-features = false, even when nothing ever targets Pulley.Benefit
wasmtime 49.0.4, rustc 1.99.1, aarch64-apple-darwin, release profile with
strip = true:[dependencies] wasmtime = { version = "=49.0.4", default-features = false, features = ["cranelift", "runtime", "std"] }fn main() -> wasmtime::Result<()> { let engine = wasmtime::Engine::default(); let module = wasmtime::Module::new(&engine, b"\0asm\x01\0\0\0")?; wasmtime::Instance::new(&mut wasmtime::Store::new(&engine, ()), &module, &[])?; Ok(()) }
file __textas published 7,896,992 5,996,012 features = ["pulley"]removed via[patch]6,121,152 4,522,352 delta -1,775,840 (-22.5%) -1,473,660 (-24.6%) The patched build compiles and runs unchanged;
wasmtime-craneliftalready handles the feature's absence (#[cfg(feature = "pulley")]).In the case of a large application like Aqueous, symbol attribution gives 1.54 MiB to the Pulley backends against 0.55 MiB for the aarch64 backend actually used.
Implementation
Ideally the feature has to be forwarded instead:
pulley = ["wasmtime-cranelift?/pulley"]withpulleyadded todefault. For hosts without a native backend,build.rscould then fail with a message asking for thepulleyfeature (whencraneliftis on andpulleyis off), rather than silently enabling it.Alternatives
Alternatively keep the current behaviour and let
build.rsaccept an opt-out, e.g. a--cfg wasmtime_no_pulley_compiler(only allowed on hosts with a native backend).
Last updated: Nov 19 2026 at 20:05 UTC