Precompute removes atomic.fence in shared-memory modules
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
Start by tracing how --precompute handles atomic.fence and how EffectAnalyzer marks shared-memory reads and writes; the issue does not name implementation files or tests. Reproduce with the provided C example and wasm-opt --precompute --enable-threads, then compare the output with --vacuum alone. Done when precompute preserves the fence in the shared-memory case.
由索引模型根据 Issue 内容生成。
描述
wasm-opt version 133 (version_133-96-ga631c1445), from emsdk.
--precompute (and so -O1 and above) replaces atomic.fence with nothing, even with --enable-threads and a shared memory. --vacuum alone keeps it. EffectAnalyzer marks the fence as reading/writing shared memory, so Precompute seems to skip that check.
Repro:
int x, y;
__attribute__((export_name("st"))) void st(int v) {
x = v; __atomic_thread_fence(__ATOMIC_SEQ_CST); y = 1;
}
clang --target=wasm32 -O2 -matomics -mbulk-memory -c f.c -o f.o
wasm-ld --no-entry --shared-memory --import-memory --max-memory=1048576 f.o -o f.wasm
wasm-opt --precompute --enable-threads f.wasm -o g.wasm
llvm-objdump -d f.wasm | grep -c atomic.fence # 1
llvm-objdump -d g.wasm | grep -c atomic.fence # 0
Same result with -O1, -O2, -O3, -Os and with --detect-features; -O0 keeps it.
Impact: in our emulator a guest FENCE is compiled to atomic.fence; after wasm-opt the engine had none, and a producer/consumer ring between threads read stale bytes (intermittent aborts on ARM64 Chrome). Using an atomic.rmw.or seq_cst on a dummy cell instead survives -O3.
- 主要语言
- WebAssembly
- 星标
- 8.7k
- 派生
- 905
- 平均合并
- 2 天 55 分钟
- 30 天内合并 PR
- 83
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
WebAssembly/binaryen 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 88/100
WebAssembly/binaryen#9135 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 半天 新手友好度 76/100
WebAssembly/binaryen#9018 · 3 条评论 ·
维护者通常 1 天内回复
-
RemoveUnusedModuleElements drops an active elem segment whose items are global.get, so call_indirect traps可能已有人在做 @tlively 今天认领。 未关闭
难度 3/5 1-2 天 新手友好度 68/100
WebAssembly/binaryen#9366 ·
维护者通常 1 天内回复
-
Binary reader rebuilds tag types from Signature, dropping rec group and supertype (follow-up to #7219)可能已有人在做 @tlively 于 1 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 68/100
WebAssembly/binaryen#9365 ·
维护者通常 1 天内回复
-
Add a pass to relax nullabilities of definitions可能已有人在做 @stevenfontanella 于 4 天前认领。 未关闭enhancement
WebAssembly/binaryen#9352 · 已指派 1 人 ·
维护者通常 1 天内回复
查看 WebAssembly/binaryen 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 76/100
Azure/azure-functions-nodejs-extensions#180 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 78/100
tidyverse/ellmer#1226 · 1 条评论 ·
维护者通常 3 天内回复
-
cli: `studio --request <missing file>` answers with a raw ENOENT/EISDIR instead of a clear error未关闭bug good first issue help wanted
难度 2/5 1-3 小时 新手友好度 88/100
laaielichter/Ai-edit-studio#81 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 77/100
jasonacox/pypowerwall#472 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
sebastienros/jint#4531 ·
维护者通常 1 天内回复