[wasm-opt] `--minify-imports-and-exports-and-modules` does not report module renames.
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 48/100
調査の方向性
提供された test.wat、wat2wasm コマンド、--minify-imports-and-exports-and-modules フラグを使い、まず wasm-opt バージョン 123 で問題を再現します。フラグのマッピング出力を調べ、wasm2wat の出力と比較します。stdout にモジュールと関数の両方の名前変更が、統合されたモジュール名も含めて報告されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
When using wasm-opt with the --minify-imports-and-exports-and-modules flag, the tool correctly minifies both the import module names and the import function names. It often merges multiple import modules into a single new minified name.
However, the mapping printed to stdout is incomplete. It includes the remapping for the function names but completely omits the remapping for the module names. This makes it impossible for tools that rely on this map to correctly patch the host JavaScript environment, breaking the application.
Environment
wasm-optVersion:wasm-opt version 123
Minimal Reproducible Example (MRE)
1. Input .wat file (test.wat):
This file defines a module that imports two functions from two different, uniquely named modules.
(module
(type (;0;) (func))
(import "long_module_name_a" "long_function_name_foo" (func (;0;) (type 0)))
(import "long_module_name_b" "long_function_name_bar" (func (;1;) (type 0)))
)
2. Assemble to .wasm:
wat2wasm test.wat -o test.wasm
3. Run wasm-opt:
wasm-opt test.wasm -o output.wasm --minify-imports-and-exports-and-modules
Results
Actual stdout Output:
The tool only prints the mapping for the function names:
long_function_name_foo => a
long_function_name_bar => b
Actual Contents of output.wasm (decompiled with wasm2wat):
The output Wasm shows that the module names were also minified and merged into "a":
(module
(type (;0;) (func))
(import "a" "a" (func (;0;) (type 0)))
(import "a" "b" (func (;1;) (type 0)))
)
Expected Behavior
The stdout mapping should be complete and reflect all minification operations performed on the import/export interface. A correct and unambiguous output would look something like this:
long_module_name_a => a
long_module_name_b => a
long_function_name_foo => a
long_function_name_bar => b
This would provide all the necessary information for a host environment to correctly wire up the minified module.
- 主要言語
- WebAssembly
- スター
- 8.6k
- フォーク
- 885
- 平均マージ
- 2日 4時間
- マージ済み PR(30日)
- 77
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
WebAssembly/binaryen のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
WebAssembly/binaryen#9135 · コメント 1 件 ·
-
難易度 2/5 半日 初心者へのやさしさ 76/100
WebAssembly/binaryen#9018 · コメント 3 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
WebAssembly/binaryen#9133 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 52/100
WebAssembly/binaryen#9123 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
WebAssembly/binaryen#9122 ·
WebAssembly/binaryen の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
nightscout/nocturne#1424 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
paritytech/zombienet-sdk#591 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
mruangutai/harness#1897 ·
-
os:linux
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
mpv-player/mpv#18510 · コメント 2 件 ·