Stream: git-wasmtime

Topic: wasmtime / issue #15168 Allow embedders to exclude Cranel...


view this post on Zulip Wasmtime GitHub notifications bot (Nov 05 2026 at 18:44):

lifthrasiir opened issue #15168:

Feature

wasmtime currently unconditionally enables the pulley feature of wasmtime-cranelift, which turns on cranelift-codegen/pulley. As a result every embedder using the cranelift feature links the pulley32 and pulley64 backends even with default-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 __text
as 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-cranelift already 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"] with pulley added to default. For hosts without a native backend, build.rs could then fail with a message asking for the pulley feature (when cranelift is on and pulley is off), rather than silently enabling it.

Alternatives

Alternatively keep the current behaviour and let build.rs accept an opt-out, e.g. a --cfg wasmtime_no_pulley_compiler (only allowed on hosts with a native backend).

view this post on Zulip Wasmtime GitHub notifications bot (Nov 05 2026 at 20:11):

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 pulley feature 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.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2026 at 02:11):

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's has_host_compiler_backend (and miri) rather than isa_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 pulley to 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.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 09 2026 at 13:51):

alexcrichton commented on issue #15168:

Personally I think it's a reasonable tradeoff to require the pulley feature for cross-compilation in that case, yeah.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 11 2026 at 19:41):

alexcrichton closed issue #15168:

Feature

wasmtime currently unconditionally enables the pulley feature of wasmtime-cranelift, which turns on cranelift-codegen/pulley. As a result every embedder using the cranelift feature links the pulley32 and pulley64 backends even with default-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 __text
as 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-cranelift already 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"] with pulley added to default. For hosts without a native backend, build.rs could then fail with a message asking for the pulley feature (when cranelift is on and pulley is off), rather than silently enabling it.

Alternatives

Alternatively keep the current behaviour and let build.rs accept 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