Allow embedders to exclude Cranelift's Pulley backends on hosts with a native backend

Aperta
#15,168 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
46/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
rust

Direzione di ricerca

Start with the pulley feature in crates/wasmtime/Cargo.toml and the existing #[cfg(feature = "pulley")] handling in wasmtime-cranelift; then inspect the relevant build.rs checks. Determine how to forward the feature while preserving Pulley support for hosts without a native backend. Done means embedders can disable Pulley on supported hosts and receive a clear build error when it is required.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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).

Lingua principale
Rust
Stelle
18.8k
Fork
1.9k
Merge medio
1g 3h
PR unite (30g)
382

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di bytecodealliance/wasmtime

Tutte le issue di bytecodealliance/wasmtime

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.