Add volatile flag to MemFlags
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
MemFlags が定義されており、既存の flag ヘルパーを確認できる codegen/ir/memflags.rs から始めます。enum のケース Volatile と要求された 3 つのメソッドを追加し、説明どおりに volatile の状態を作成、照会、更新できることを確認します。issue の mem2reg の例が想定されるユースケースを示しています。
索引モデルが issue の本文から書いたものです。
説明
Add Volatile flag to MemFlags.
Benefit
When some optimization pass knows about load/store type (is it volatile or not?) then it's possible to do a lot of optimizations. One of it is memory to register promotion. I tried to implement mem2reg pass there cranelift-mem2reg and this pass works but in some cases it fails e.g this simple C code:
// compiled with rcc
typedef struct Foo {
int x;
int y;
} Foo;
int main() {
Foo foo;
foo.y = 42;
}
Message: definition error: Compilation error: Verifier errors
note: while compiling function u0:0() -> i32 system_v {
ss0 = explicit_slot 8
block0:
v1 = iconst.i64 4
v2 = iadd.i64 v0, v1
v3 = iconst.i32 42
store v3, v2
v4 = iconst.i32 0
return v4
}
All loads and stores might be marked as volatile and mem2reg will not optimize struct Foo into registers.
Volatile flag also can help in SRoA when it's possible to replace allocation on stack with single 32 or 64 bit register.
Implementation
Just add additional enum case in codegen/ir/memflags.rs and add 3 simple functions to MemFlags: volatile() -> Self,is_volatile() -> bool, set_volatile(&mut self).
Alternatives
I do not see any alternatives.
UPD: This might be useful for this issue: Support volatile store/loads
- 主要言語
- Rust
- スター
- 18.7k
- フォーク
- 1.8k
- 平均マージ
- 1日 9時間
- マージ済み PR(30日)
- 140
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
bytecodealliance/wasmtime のほかの issue
-
cranelift cranelift:documentation
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
bytecodealliance/wasmtime#14433 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
cranelift
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
bytecodealliance/wasmtime#14200 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
bug wasm-proposal:exceptions wasmtime:debugging
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
bytecodealliance/wasmtime#14102 ·
メンテナーはふだん 1 日以内に返信
-
wasm-proposal:gc
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
bytecodealliance/wasmtime#13808 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 62/100
bytecodealliance/wasmtime#14451 ·
メンテナーはふだん 1 日以内に返信
bytecodealliance/wasmtime の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
trezor/trezor-firmware#7997 ·
メンテナーはふだん 2 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
oxidecomputer/management-gateway-service#506 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
scylladb/nodejs-rs-driver#566 ·
メンテナーはふだん 1 日以内に返信
-
A-ABI needs-triage relnotes relnotes-needs-review relnotes-tracking-issue T-lang T-libs T-opsem
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信