Repository navigation
fix(build): stabilize wasm test flows - #2511
Conversation
There was a problem hiding this comment.
Review: hide clang's implicit wasm-opt for Asyncify wasm links
The core design is sound. When clang drives a wasm Asyncify link it can implicitly run any wasm-opt it finds on PATH, which would optimize the module before LLGo's deliberate Asyncify post-link pass. Filtering standalone wasm-opt directories out of the linker's PATH while leaving postLinkWasm's independent exec.LookPath untouched (wasm_postlink.go) is the right approach, and the feature is well-guarded (shouldHideClangImplicitWasmOpt: wasm + Asyncify + no explicit -extld) and unit-tested for the clang/emcc/non-wasm cases.
A few findings below. Security review found no issues (PATH is only filtered, never broadened; symlinks are canonicalized; the shell helper quotes all expansions and invokes tools as argv[0]). Performance is a non-concern — the scan runs once per produced executable, immediately before a far more expensive linker spawn.
Additional non-blocking notes:
- Several new helpers (
shouldHideClangImplicitWasmOpt,clangDriverMayRunWasmOpt,withoutClangImplicitWasmOpt,resolveToolDirInPath) lack doc comments, unlike the surrounding functions in this file. The why is load-bearing and currently only captured in test names — notably whyemccis deliberately excluded (it manages its own wasm-opt pipeline). A brief comment on each would help future maintainers. executableNames(build.go:1722) appends bothname+extandname+strings.ToLower(ext)for each PATHEXT entry, doublingos.Statcalls on a case-insensitive filesystem; the lower-cased duplicates can be dropped.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
LLGo WebAssembly build benchmarks
WebAssembly output sizes
LLGo WebAssembly build measurements
Compared with |
b3a87cd to
90192e1
Compare
|
Also addressed the non-blocking review notes in 283c2b2: documented the PATH-filtering helpers and why emcc is excluded, and removed redundant lowercase PATHEXT probes. LLVM 22 internal/build tests pass (309.071s), targeted review regressions pass, and the shell script passes syntax and ShellCheck validation. |
LLGo baseline benchmarks
Program measurements
Core language and compiler benchmarks
Timer runtime benchmarks
Compared with |
|
Follow-up after the review and size/coverage audit:
Full local single-worker integration and the focused Go package suite pass. Waiting for the refreshed CI, Codecov, and benchmark checks before treating the PR as complete. |
Summary
This starts R3 after the merged R2.1 lifecycle work and focuses on WebAssembly toolchain completeness.
llgo test -cthrough the non-executing emulator path after linking, instead of falling through to device flash or serial discovery.--no-wasm-optwhen LLGo owns the Asyncify pipeline.wasm-ld, then Asyncify/EH translation, then post-Asyncify optimization. This avoids environment-dependent double processing without increasing wasm output size.This PR intentionally contains no multi-worker runtime work. The fork-runner CI fallback used during development remains isolated in cpunion#236 and is not part of this upstream contribution.
Base
Rebased onto the current xgo-dev/main at
9317592bb, including the merged R2.1 and Windows/CI fixes.Validation
go test ./internal/build ./internal/crosscompile ./cmd/internal/test ./cmd/internal/flags -count=1bash -n dev/test_wasm_single_worker.shshellcheck dev/test_wasm_single_worker.shdev/test_wasm_single_worker.shrun withLLGO_BUILD_CACHE=offThe integration run passed scheduler, timer, GC, lifecycle, host-callback, expected deadlock/Goexit failures, public
llgo testexecution, andllgo test -cartifact validation across Emscripten wasm32, Emscripten Memory64, and WASI.