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

オープン
#15,168 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
46/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
rust

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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

主要言語
Rust
スター
18.8k
フォーク
1.9k
平均マージ
1日 3時間
マージ済み PR(30日)
384

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

bytecodealliance/wasmtime のほかの issue

bytecodealliance/wasmtime の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。