windows: integrate Windows into shared CI matrices (R8, depends on #2422) - #2425
windows: integrate Windows into shared CI matrices (R8, depends on #2422)#2425cpunion wants to merge 194 commits into
Conversation
LLGo baseline benchmarks
Program measurements
Core language and compiler benchmarks
Compared with |
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
|
@fennoai please review the completed R8 shared-CI integration. All Linux, macOS, and Windows jobs and the Codecov patch gate are passing. |
There was a problem hiding this comment.
Review: Windows R8-on-R7 integration
Reviewed the R8-only range (09a23ef..f293677, 84 files) — the actual scope of this PR per the description; the full base-diff also carries the stacked #2422 work, which is out of scope here.
This is a large, well-executed portability change: CI matrix consolidation (removing windows.yml), platform-split demos, portable LLDB tooling, and Windows PE metrics. Test coverage is strong — nearly every production change is paired with a test (TestAddPESections, TestWindowsTarXzTools, TestWindowsDebugPointerParameter, TestRunQuietIncludesCommandOutput, etc.). Comments explain the Windows-specific rationale well. No high-severity or blocking issues found; the notes below are refinements.
Cross-cutting notes (no reliable single inline location):
- Supply-chain —
github.com/cpunion/libreplacement. The rootgo.mod:30and all demo/toolgo.modfiles replacegithub.com/goplus/libwith a personal fork pinned tov0.0.0-20260822071805-ebe22363a225. The PR body already flags this as temporary, which is right — the important one is the rootgo.mod(the compiler build itself), not just the demos.go.sumhashes guard against tampered fetches, but this should revert to an upstream-owned tag before release. Tracking this is worthwhile. internal/crosscompile/fetch.go—.tar.xzextraction trust path. The Go-nativeextractTarGz/extractZippaths enforce a path-traversal (illegal file path) guard; the.tar.xzpath shells out to externaltar/bsdtar/MSYS2tarwith--force-localand relies on the tool's own protections. Combined with downloads still having no checksum/signature verification (downloadFile), a moved/altered release archive could write outsidedest. This is largely pre-existing (the PR only changed tool selection), but pinning checksums for the ESP/WASI archives would close the gap._demo/c/syncdebug/once_default.govsonce_windows.go. The two files implement the samellsync.Oncetest with gratuitously different structure (package-level vars + named funcs vs. locals + closures). If the closure form works on Windows it almost certainly works everywhere; a shared implementation (or a comment explaining why they must differ) would reduce drift risk.
Verified and dismissed: an internal reviewer flagged test_windows_runtime.ps1 referencing a missing check_windows_imports.ps1, but that file exists at .github/workflows/check_windows_imports.ps1 — not an issue.
|
FennoAI is processing your request, please wait a moment... |
|
Review follow-up:
|
This reverts commit 2910a58.
There was a problem hiding this comment.
Review: R8 shared-CI Windows integration
Reviewed the locked R8-only range e1791699...f2936775 (357 files, ~13.7k/-2.2k). Focus was the production runtime/codegen surface — Windows fault handling, SEH unwind, semaphores, threading, RNG, print, setjmp, and the CI matrix reshaping. Four review passes ran (quality, performance, security, docs).
Overall: high-quality, carefully engineered work. The _default/_windows/_windows_<arch> build-tag partitioning is, in nearly every family I checked (setjmp, fault, cpuprof, sema, foreign-thread, ffi-abi, gc-threads, llvm-config), provably complete and non-overlapping, and the native C/asm bridges (rand, fault handler, print, syscall, setjmp, thread/FLS) are bounds-checked with no memory-safety, injection, or weak-randomness issues found. CI trust boundaries are sound: pull_request (not pull_request_target), contents: read, secrets confined to appropriate steps, toolchain pins consistent (Go 1.26.7 / LLVM 19 / VS2022).
A few items worth a look, left as inline comments. None are blocking.
Notes (not inline):
- Supply-chain (Medium):
replace github.com/goplus/lib => github.com/cpunion/libis added to the root and every sub-modulego.mod(_xtool,doc/_readme,_demo/{c,go,py,embed}). Content is pinned +go.sum-verified, and the PR body flags it as temporary — recommend gating release on moving these commits to an org-owned/tagged upstream so a released version never depends on a personal fork. (Inline note on rootgo.mod.) - CI hardening (Low, pre-existing):
.github/workflows/benchmark.ymlinterpolates${{ github.event.pull_request.base.ref }}directly into arun:block. The line itself is pre-existing (this PR only addsshell: bashto that step), exploitability is low (base ref is an existing branch name,pull_requesttrigger,contents: read, no secrets), but normalizing to theenv:-indirection pattern already used elsewhere in the same file would be good hygiene.
Verification of the described validation matrix (287 packages, ./test/go, coverage %, LLDB suite, cross-target runtime builds) relies on the CI results reported as green; I reviewed the code and configuration, not the live job logs.
Additional findings
runtime/internal/lib/runtime/runtime_windows.go:1: [P2] Windows build-tag overlaps baremetal/wasm (duplicate LLGoFiles):runtime_windows.gois tagged//go:build windows, while siblingruntime_baremetal.gois//go:build baremetal || wasm. Awindows && (baremetal || wasm)build satisfies both, and both declareLLGoPackage/LLGoFilesconstants — that configuration would fail with duplicate declarations.runtime_default.goin the same package correctly excludes windows (!baremetal && !wasm && !windows), so this is the one file in the family whose tag isn't provably disjoint. Ifwindows && baremetal/windows && wasmis not a real target the impact is latent, but tightening to//go:build windows && !baremetal && !wasmremoves the ambiguity at zero cost.
|
|
||
| replace github.com/xgo-dev/llgo/runtime => ./runtime | ||
|
|
||
| replace github.com/goplus/lib => github.com/cpunion/lib v0.0.0-20260822071805-ebe22363a225 |
There was a problem hiding this comment.
[P2] Temporary personal-fork replace should not ship in a release
github.com/goplus/lib (compiled into every LLGo-built binary) is redirected to the personal fork github.com/cpunion/lib, and this replace is duplicated across _xtool/go.mod, doc/_readme/go.mod, and _demo/{c,go,py,embed}/go.mod. The pseudo-version is pinned and go.sum-verified, so content tampering is guarded, but a personal fork is a weaker trust/longevity anchor for a shared project. The PR body notes this is temporary — recommend gating merge/release on moving these commits into an org-owned repo (or a tagged upstream release of xgo-dev/lib) so no released version depends on a personal fork.
| } | ||
| } | ||
|
|
||
| func semaRelease(addr *uint32) { |
There was a problem hiding this comment.
[P2] semaRelease issues a wake syscall on every uncontended release
semaRelease calls psync.WakeUint32 (→ WakeByAddressSingle, a kernel transition) unconditionally on every release. This Windows path keeps no waiter count — semaAcquire is a bare CAS loop plus WaitUint32, with no waiters field — so the release side can never elide the wake when nobody is waiting. The unix design (sema_cond_llgo.go) only signals when waiters != 0. Since this backs sync_runtime_Semrelease/poll_runtime_Semrelease, high-frequency uncontended releases (waitgroup counter reaching zero, channel/select semaphores) pay a syscall per op that unix avoids. Not a correctness bug — spurious wakeups are handled by the acquire loop — but a per-op syscall on the fast path. A per-address waiter count maintained in the acquire loop would let release skip the wake.
|
CI follow-up: the attempted Reverted that change in b7fce75, documented the required platform distinction in 4b8549e, and locally verified the Unix fixture through LLGo. The two inline review fixes remain intact. |
|
Once ABI follow-up:
|
Depends on #2422. Part of the Windows support proposal in #2325.
Until #2422 merges, GitHub's full diff also contains the stacked R6/R7 work. The R8-only review range is
09a23ef5aa341f6d3c196ccca2785cc34fbed9cc..f29367759ec3fa39e7637121f187e0e4c8af4593.What this changes
windows.ymlworkflow and addswindows-2022to the existing Go, LLGo, GOROOT, standard-library coverage, docs-local, build-cache, and benchmark matrices.Once.Doaccepts the barevoid (*)(void)callback used bypthread_once, while the explicitOnce.DoFuncadapter retains a capturing Go closure above the C boundary and passes only a fixed callback plus opaque context to native code.Remote-install coverage is intentionally unchanged, as agreed in #2325. Removing the MSYS2 host-toolchain dependency is R9; clean release artifacts and broader debugger qualification remain R12.
The temporary
github.com/cpunion/libreplacements provide the Windows-capable bindings already exercised by the integration branch. Their upstream contribution is staged in goplus/lib#26; the replacements will be removed after an upstream-owned revision is available.Validation
windows/amd64qualification, cold LLGo cache:./test/gopassed in 641 seconds;clpassed with 96.6% statement coverage,ssawith 95.1%,internal/crosscompilewith 82.2%, andinternal/cabiwith 86.3%;python312.dll.DoFunccalls.git diff --check, YAML parsing, Bash syntax, PowerShell parsing, Python source compilation, and actionlint all pass.