$ the-wire · showcase
Compiler speedups land as prove's jump-table scan goes
By RepoJournal · Filed · About Go · Composed from the cited sources · methodology
Four cmd/compile changes today trim work the compiler does not need to do, from a prove-pass branch scan measured at 46.231 ms down to 0.742 ms on an 8,000-case stress test, to wasm min/max calls that become single instructions.
cmd/compile: remove the fallback jump-table branch scan golang/go
The successor scan left after the direct jump-table lookup is gone: since prove calls getBranch with p equal to b's immediate dominator, no other successor of p could dominate b anyway. On the 8,000-case stress test the prove pass dropped from 46.231 to 0.742 ms, with CartoGopher builds showing no measurable change.
cmd/compile: lower floating-point min/max to wasm instructions golang/go
Min32F, Max32F, Min64F and Max64F now lower to F32Min, F32Max, F64Min and F64Max on wasm instead of calling runtime helpers, removing those calls on both js/wasm and wasip1/wasm. The commit adds assembly checks for all four instructions and extends the runtime min/max tests to float32.
cmd/compile: break false destination dependencies for BSF and BSR golang/go
BSF and BSR read the destination register's previous value, so the compiler now clears it with XORL when it differs from the source, matching the existing treatment of POPCNT, TZCNT and LZCNT. Coverage spans amd64 BSF/BSR and 386 BSFL/BSRL, self-input scans are left alone, and Ctz64 and BitLen64 on GOAMD64 below v3 pre-initialize their BSFQ/BSRQ destinations.
cmd/compile: save and restore base.Pos in noder.reader's assign handling golang/go
A reworked CL that once broke the chan/element_type_too_large test now sets and restores base.Pos for the duration of the stmtAssign case, taking the last identifier's position from writer.declStmt for multi-line var declarations, and does the same for forStmt and ifStmt. The original failure came from base.Pos being set only in the inner assign call reached through assignList.
cmd/go: fix GoFiles data race on cgo outputs golang/go
GoFiles for "p" and "p [x1.test]" share a backing array, and buildExport's append of cgo-generated files raced when that array had spare capacity, surfacing as a reproducibility failure where -trimpath missed the path and nm showed an untrimmed _cgo_gotypes.go.
gopls/internal/analysis/fillswitch: avoid panic golang/tools
Elsewhere, gopls' fillswitch analysis now skips switches with missing or synthetic braces, and refactor.AddImport handles positions at fileScope.End(); the panic came from a closing brace synthesized at FileEnd landing outside the half-open types.Scope and making fileScope.Innermost return nil. In golang/tools, unitchecker drops its x/sync dependency for a sync.WaitGroup and a deps_test.go rule...