Go 1.25
Green Tea GC experiment. Container-aware GOMAXPROCS. Flight recorder. Spinbit everywhere. DWARF 5. Core types gone from the checker. Unlocker-blame runtime-lock profiling. Allocation-free interface conversions of constants and composite literals.
Each area lists the stage every thread reached in this release (with what was left open afterwards), then changes that are not part of a thread. Thread names link to the full thread on its topic page.
Memory management
From Runtime: memory allocator and garbage collector (Go 1.18–1.28)
- Soft memory limit and GC CPU limiter — Done:
sched.idleTimewas double-counted when the limiter forced an up-to-date flush; fixed (385000b004). Left open: nothing noted. - Green Tea: span-based marking with vector scan kernels — Done: user-visible the
greenteagcGOEXPERIMENT was added, off by default (f1ebad19bd). Size-class tables moved intointernal/runtime/gcso generators could share them (528bafa049,e90ba1d208). The core landed: scan bits, per-P span queue, global overflow list, and per-size-class stats underGODEBUG=gctrace=2(1b40dbce1a). Supporting work: a faster inner-loop bit clear (b30fa1bcc4); settingmspan.limitbefore publication so the conservative scanner cannot index pastallocBits(4c7567290c); allocation-time publication made safe against conservative scanning (24ea1aa25c, see the publication thread); per-P overhead cut from ~2.6 KiB to 536 bytes when the experiment is off (d4bf716793); an explicit nil check inspanInlineMarkBits.initto avoid read-faulting fresh pages to the zero page, which made hugo slower (f8ccda2e05); and word-at-a-time mark merging, ~33% faster, with clearing folded in and skipped for fresh spans (397d2117ec,0c6296ab12,6d4a91c7a5,75a19dbcd7). Left open: “A future extension … is to use SIMD-accelerated scanning kernels” (1b40dbce1a); experiment off by default. - mallocgc decomposition and size-specialized malloc — Done:
needzeroremoved from paths that must always zero (144d4e5d5f). Left open: nothing noted. - Finalizers, runtime.AddCleanup and the cleanup queue — Done: user-visible
checkfinalizer(3df078fc74,913c069819,eec8dd0836,c58f58b9f8,8b45a3f78b,5b0b4c01ba), with queue lengths printed each cycle (0d42cebacd); finalizer blocks cleaned up (57cd75a351); the multi-goroutine cleanup queue (e46c8e0558,1421b982dc); a missed-wakeup fix by re-checking the full list after marking asleep (b450b5409d); nil-P skip inprocresize(8dd7d2111b); race-detector annotations (3ea94ae446).sync,reflectanduniquemoved fromSetFinalizertoAddCleanup(954e2c0b06,b4e992b6e1,0028532118). Left open:c58f58b9f8flagged that a tiny-allocated cleanup arg “could end up co-located with the object”; fixed in 1.26 (1bb1f2bf0c1.26). - Weak pointers and the unique package — Done: user-visible
weak.Makeaccepts linker-allocated objects (6d7cb594b3);Pointerconversions between types are blocked (8163ea1458); equality semantics clarified (5ec76ae5aa); weak pointers work in sbrk mode (53b9eae387). The unique canon map withAddCleanuplanded (0028532118,e382bf5b32,2f036e1475,ca3b474702,644905891f). Compiler help forunique.Make: no copy forstring(b)(27ff0f249c) and modeled data flow of non-string pointers for escape analysis (5e6a868b28). Left open: “We still need some kind of back-pressure mechanism” for cleanups (0028532118). - Allocation publication, zeroing and preemptibility — Done: the fresh-from-OS zeroing skip restored plus atomic
largeType(df9888ea4e); thefreeIndexForScansnapshot (24ea1aa25c). Left open: nothing noted. - Sweeper termination and pacing — Done:
goschedIfBusyin bgsweep to avoid a livelock oncelockis inlined (e666f1dabf); gcpacertrace end-of-sweep condition (ad7a6f8159). Left open: nothing noted. - Stack and register root scanning — Done: GC STW now calls
casGToWaitingForSuspendG, avoiding mutual deadlock with the tracer’ssuspendG(c6ac736288). Left open: nothing noted. - Address-space layout, tagged pointers and the mem.go layer — Done: user-visible anonymous mappings named via
PR_SET_VMA_ANON_NAME(e.g.[anon: Go: page summary]), Linux 5.17+ (52eaed6633). 512-byte tag alignment (9d0320de25, aix fixes3009566a46,0c15d88974); freebsd/amd64 to 57 bits for LA57 (5bbac667c5). Left open: nothing noted. - Linear-memory heaps (Wasm and sbrk platforms) — Done: missing unlock in
sysReserveAlignedSbrk(456a90aa16). Left open: nothing noted.
Other changes
- GODEBUG=gccheckmark=1 repaired internal — had bit-rotted (root jobs not reset, noscan in workbufs, arenas, preemption); a dist smoke test was added (
b25b5f3ff4). - gQueue/gList carry their size internal — (
e0dba45c62). - plan9 heap sampling internal — the floating-point-free
nextSampleNoFPwas deleted now that Plan 9 can use floating point (40c953cd46).
Scheduler and concurrency
From Runtime: scheduler, timers, channels, locks and synchronization (Go 1.18–1.28)
- Timer rewrite: per-P timer heap, timer.lock, and GC-able synchronous timer channels — Done: bubbled timers behave like unbubbled ones: channel timers enter the bubble heap only when blocked on, and due timers run immediately rather than being queued, random order for same-instant timers (
3432c68467,3bd0eab96f); fake clock excludes monotonic time (5916bc5b57). Left open: nothing noted. - Runtime mutex: tri-state futex/sema locks → “spinbit” mutex — Done: committed to spinbit everywhere including emulated-
Xchg8platforms, tri-state implementations deleted; wasm excepted (single thread) (7a177114df). Left open: nothing noted. - Contended runtime-lock profiling (mutex profile for runtime-internal locks) — Done: unlocker blamed (
4d0f955a5e); fix for cputicks overflow causing zero-duration events (ac645eaa0e). Left open: nothing noted. - Scheduler core: spinning Ms, work conservation, stealing, STW interaction — Done: only one P at a time polls the network in
findRunnable(352dd2d932), reverted for a CockroachDB benchmark regression (489917fc40), reintroduced (1e436ba668); explicit exclusion of a theoreticalglobrunqget->runqput->runqputslowrecursion by refactoring runq/globrunq APIs (a42e337ede, +size field forgQueue/gListe0dba45c62);semreleaseno direct G handoff on systemstack (a189516d3a);allpSnapshotstashed on M (740857f529). Left open: nothing noted. - GOMAXPROCS container awareness and dynamic updates — Done: user-visible cgroup discovery and default-on behaviour (
f12c66fbed,e6dacf91ff); rename toupdateMaxProcsG(6160fa59b6);updatemaxprocsmetric only when disabled (3b77085b40); guarantee of no GOMAXPROCS-update syscalls after aGOMAXPROCScall by synchronising with sysmon (for sandboxing) (e481a08e0e); custom GOMAXPROCS noted even when the value is unchanged (f069a82998). Left open: parent limits, cgroup migration (“we can consider changing this in the future”). - testing/synctest bubbles — Done: fake clock stops advancing once the main goroutine exits (
d6c8bedc7b); no monotonic reading in bubbledtime.Time(5916bc5b57); race-detector happens-before for AfterFunc (c0392e7e49); “bubble” terminology (ef7724c432); closing bubbled chans from outside panics (d596bc0e81);hchan.bubblepointer (0afcf9192c); WaitGroup association (b170c7e94c); cond-misuse fatal (21b7e60c6b); distinct deadlock message once the main goroutine is done (049a5e6036); lock rank for weak pointers vs synctest (b78e38065e); clearer bubbled stack traces (848a768ba7); timers aligned with unbubbled (3432c68467,3bd0eab96f). Left open: some violations still recoverable panics. - Asynchronous preemption: extended register state — Done: arm64 resumes via return (
77343fa646);internal/runtimeexplicitly excluded from async preempt (92a63bdfee). Left open: nothing noted. - sync package API evolution — Done: user-visible
WaitGroup.Go(822031dffc), f must not panic (9921537a96); fewer allocations in OnceFunc family via single captured struct (c5ff26a7a0); funcs not kept alive after panic (ee0d03fab6);Once.doneasatomic.Bool(95611c0eb4). Left open: panic handling inWaitGroup.Go.
Other changes
- Panic printing internal —
478ad013f9. - Misc internal — schedtrace output (
ecda82012d,5295722238);mpadding for 64-bit (b199d9766a,3968a5bca4);isExtraInC(577bb3d0ce); linknames kept for sonic (279da96532); frame-pointer preamble (742fda9524); atomic types not to be copied (42d3cdc909);Map.Deletedoc (583d586ef9); synctest linker-alloc WG (4f86f22671); wording/cleanup (d365f2266d,c3a0859720,4ed9943b26).
Data structures and type metadata
From Runtime: maps, built-in data structures, hashing, randomness and type metadata (Go 1.18–1.28)
- Swiss-table maps (GOEXPERIMENT=swissmap → only implementation) — Done: clear also erases tombstones (
4e63ae46e0), prune tombstones before growing (05ed8a00e0, fixes #70886, pathological insert/delete workloads), faster small-map lookups (bfc209518e), empty/zero map lookups inline better (8a85a2e70a, -12.75% geomean), race PC fix (14b15a2bea), fastermaps.Clone(a645bc5eb9). Left open: thenoswissmapfallback still existed (“noswissmap is going away soon”,252c939445). - reflect implementation: performance, allocation and escape behaviour — Done: user-visible
reflect.TypeAssert[T](2541a68a70; zero-alloc for concrete T, allocates for methods or interface T fromElem()), later fixed for nil interface (f1e6ae2f6f); fasterTypeFor(679cd8e779),IsZeropointer check (a8e0641d5b),packEfaceleaks input to result rather than heap (ef20ccc10b),runtime.AddCleanupinstead of finalizers (b4e992b6e1),Seqfixes (d93f6df0cc,194696f1d1). Left open: nothing noted. - memmove / memclr / memequal / internal/bytealg assembly optimisation — Done: arm64 Count (
f2e9076764) and Index* (5b36f61356, ABIInternal), loong64 SIMD memmove/memclr/memequal/indexbyte/compare/Count (13b7c7d8d2,1763ee199d,ecdd429a3b,7bc714d601,a1c3e2f008,17b9c9f2ad), s390x memclr (a177448765), mips64x Count (1776255742), riscv64 simplified (ad39fd9486) and synthesised MIN/MAX (d88f93f720). Left open: nothing noted. - Runtime randomness: fastrand, chacha8rand and math/rand/v2 — Done: loong64 assembly
block(b8ed752d6f: 40-45% faster). Left open: nothing noted. - iter.Pull and range-over-func iterator types — Done: smaller Pull footprint (
ba7b8ca336). Left open: nothing noted.
Diagnostics and knobs
From Runtime: tracing, profiling, metrics and diagnostics (Go 1.18–1.28)
- The new execution tracer (trace v2): generations, per-M buffers, new parser — Done: user-visible
runtime/traceflight recorder (83df0afc4e, see thread below);tracev2package split out with spec validation tests and an experiments guide (0f62125487,34e8541d24,fadfe2fc80,b5f34aa4ab); trace v1 reader renamed (8028731648); sync batch withEvClockSnapshot(trace, mono and wall clock) at the start of each generation, format bumped to 1.25 (112c23612f,2d216141a1); stricter per-version event checks (715754ba86); sync event emitted even when the next generation is broken (283296195b,85f8e240fe);readTraceno longer spins on shutdown (816199e421). Left open: truncated-versus-broken traces cannot be told apart (fixed in 1.26). - Frame-pointer unwinding in tracing and profiling; profile stack depth — Done: account for missing frame pointer in function preamble (
742fda9524);traceStacktestable plus benchmark (75b43f9a97). Left open: nothing noted. - Mutex and block profiles, including runtime-internal lock contention — Done: verification test using
cputicksbounds comparing fast vs. slow critical sections (591c4b50c0); unlocker blame (4d0f955a5e);GODEBUG=runtimecontentionstacksremoved because the semantics now match (94c4cdc948); failing tests log the profile (35139d6e45). Left open: nothing noted. - Flight recorder and trace subscribers — Done: user-visible flight recorder (
83df0afc4e),TestSubscribersinfrastructure (f2d96272cb1.26 in 1.26 log). Left open: “Future optimizations are planned for” the multi-subscriber mechanism (commit message). - CPU profiling, goroutine profiling, pprof labels and the protobuf writer — Done: write errors from profile output propagated (
4aeb9ba0de); system goroutines join the goroutine profile state machine (281cfcfc1b);TestCgoCallbackPprofskipped where profiling is broken (7dd7d70c03). Left open: nothing noted. - runtime/metrics and MemStats — Done: ptr/scalar bitmap metric removed (
60d3bcdec3);HeapGoalreported 0 when GC disabled (1947c4233a). Left open: nothing noted. - Race detector, ASan, MSan and Valgrind integration — Done: race on loong64 (
bce8486ebe); gsignal checks inasancall/msancall/racecall(11c86ddcb8); user-visible ASan builds run__lsan_do_leak_checkat exit (645ea53019) and unregister root regions on free (56e5476e10); msan memmove through cgo (969a0da362); precise Go data/bss bounds for race (c1fc209c41); user-visible Valgrind instrumentation (40b19b56a9); GDB minimum version raised to 10 (8d767ff38d). Left open: Valgrind--leak-check=yesreports errors because “likely need more annotations”; async preemption and GC very slow under Valgrind (commit message). - Crash output, runtime/debug, BuildInfo and debuglog — Done:
DefaultGODEBUGdocumented as a build setting (c4136a433c);SetCrashOutputexample no longer passes parent env (3672a09a48). Left open: nothing noted.
Other changes
- Scheduler/other internal — m0 padding (
3968a5bca4), cleanup race hints (3ea94ae446).
OS layer, stacks and panics
From Runtime: OS and platform layer, stacks, panics and tracebacks (Go 1.18–1.28)
- Defer, panic and recover re-implementation — Done: panic transfers to the
deferreturnPC (c2ae5c7443); re-raised panic values no longer duplicated inprintpanics(478ad013f9); “raised” wording replaced by “panicked” (d365f2266d). Left open: nothing noted. - Frame pointers: explicit NOFRAME, FP maintenance and FP unwinding — Done: FP cleared in
mcallandmorestack(9c1d19a183,93fb2c9074). Left open: nothing noted. - C-to-Go callbacks: extra-M reuse, system-stack bounds, init gating — Done:
isExtraInCset only if no Go frames left (577bb3d0ce); WindowsCreateThreadinstead of_beginthread(00e793cfe3); TSAN lock wrappers around cgo symbolizer/traceback (d7abfe4f0d1.26), noting wide cleanup potential since mostruntime/cgofunctions carry manual TSAN instrumentation. Left open: “lots of room for future cleanup” of TSAN instrumentation. - vDSO,
vgetrandomand fast clocks — Done: vgetrandom M-exit cleanup and stress test (0b31e6d4cc,8969771cc3); s390xvdsoSPfix (6c3b5a2798). Left open: nothing noted. - Signals and async-preemption machinery — Done: async preempt resumes by return on arm64 (
77343fa646), Windows context-call injection deduped (3108366214). Left open: nothing noted. - New, ported and removed platforms — Done: 32-bit function index on Wasm (
9782dcfd16), loong64 cgo traceback (0694718389). Left open: nothing noted. - CPU feature detection, GOAMD64 checks and cpu GODEBUG options — Done: RISC-V runtime extension detection on Linux (
bcfa00cbd2), ARM64 SHA3 (e4216d54f5), LSE check relanded (81c66e71d4), Neoverse N3/V3 (adf21a9b56). Left open: nothing noted.
Other changes
- Misc internal — linknames restored for sonic (
279da96532),gobuf.retremoved (c594762ad5), no restore fromg0.schedin arm64systemstack(739fb752e3), loong64 SIMDmemclr/Countand libFuzzer tracing (1763ee199d,17b9c9f2ad,dc1e255104), loong64exitThreadbarrier (11c847e536),usleeps390x (ca4649747a), cgo docs and warning fixes (a8e532b0f2,76c7028253,2e71ae33ca,01ba8bfe86), HACKING.md update (8c6fec6d25). - Mapping decoration, cpu detection internal — RISC-V extensions on Linux (
bcfa00cbd2), Neoverse N3/V3 (adf21a9b56),HasSHA3(e4216d54f5),rva23u64(664aebab7d). - Cleanup goroutine race internal — re-check work list after marking asleep (
b450b5409d). - Synctest tracebacks internal — stack traces for bubbled goroutines (
86101b083a,b7382cc1f0,848a768ba7);runfinqalways shown (9c88db5f1e). - arm64 backoff internal — ISB/backoff for
lfstack.pop/spanSet.pop,procyieldvia counter-timer (Garbage −40%) (50586182ab1.26). - Plan 9 internal — monotonic time, randomness (
4c32b1cc75,9f55e7bc21,adb29670fc).
Compiler frontend · types2
From Compiler frontend: the types2 type checker (Go 1.18–1.28)
- Bringing up generics in types2 (type-parameter operands, core/structural types, tparam-as-interface) — Done: removal of the checker’s use of core types (see Design). Left open: nothing noted.
- Type sets, union terms, interfaces and constraint satisfaction — Done:
commonUnderreplacescoreType(see previous thread). - Type inference and unification — Done: nothing substantive besides core-type removal (previous thread).
- Type declaration cycles, valid-type detection and the object path — Done:
5e7f0b947cinfrastructure to record declaration positions for panics (off by default);608e9fac901.26 (“flip on position tracing”, 1.26 by log) enables it after compilebench showed no significant change (geomean −0.77%). - Language features as seen by the type checker (by release) — Done: user-visible core types removed from the language spec: checker side in “Bringing up generics”; Parser-detected invalid
...(ad7b46ee4a). - Error reporting: codes, messages, and sub-errors — Done: the rewrite listed above;
18ad74dd36dumps the position stack on non-bailout panics. - Sharing code between go/types and types2 — Done:
8a7742e78crange.go. - Checker performance, memory and API ergonomics — Done:
9189921e47andfe9b292b11(used maps allocated ininitFiles);4ac729283c/1cf6386b5e(interface methods not registered inInfo.Types, then reverted).
Other changes
- API additions user-visible —
932a4a4befVar.Kind()/VarKind(go/types),b3aff930cfLookupSelection,34b70684ba/34cf5f6205interface-method field type tests,34b70684baappend(bytes, y...)typing. - Small fixes, unifier/assignment refactors, message and tracing tweaks internal — 4 commits:
aa8d4df9d9,011b7ce8d1,3ada42ffed,bc5aa2f7d3
Compiler frontend · syntax, IR, generics
From Compiler frontend: syntax, IR, unified IR and the generics implementation (Go 1.18–1.28)
- Generics via GC-shape stenciling and runtime dictionaries — Done: shapify fixes: no shapify when reading a reshaping expression (
bfbf736564), relaxed reshaping (da0e8c4517). - Unified IR: one serialization for noding, stenciling, inlining and export — Done: formal documentation of UIR: grammar (
cad1fc5207,019d798726), sections renamed Reloc->Section (52624e533f), string/PosBase/Pkg/Name/Obj sections documented (a24f4db2a2,2ab210bc74,d93bea0e59,11660d537b,25ca686a0b), reference-table rationale (f14f3aae1c). - Compile-time performance, concurrency and the self-PGO’d compiler — Done:
fece9871bbprofile refresh. - Compiler debugging infrastructure: bisect/hash debugging, flags, dumps — Done:
2c9689ab0e(variablemakehash),e46d586edd(literalallochash) so allocation optimizations are bisectable. - Frontend support for new language features and spec changes — Done: label requirement after
goto(go/parser), scalar-allocation aggregation for heap escapes (5fc596ebe7), type-based alias analysis (11f7ea8ce0),bdef177831go/parser requires a label aftergoto.
Other changes
- Allocation optimizations internal — type-based alias analysis (
11f7ea8ce0),5fc596ebe7,8203265d5econcatbytes,f27d86c631shift tests. - Inline tail calls internal — enabled
6c70f2b960, reverted1aa3362093. - Error message user-visible — importing package
embed(5b748eed9c). - Unified IR: noder/writer/reader refinements and pkgbits (1.25) internal — RType/implicit-conversion wiring,
*Athelpers, optional expression handling, UIR documentation and grammar,pkgbits.Index/SectionKindrenames, synthetic closure positions, unsafe.Sizeof handling and related reader/writer fixes (68ca584ffa,30b2b767d6,6681ff9c9e,d73aa535de,195e64232d,fd6afa352d,96d2211c61,bfb8f13274,26e05b95c2,b6e251b264,cc119ee391,497cb7c0c3) - Generics: dictionary/shape fixes in the stenciler (1.25) internal — fixes in dictionary passes for type assertions, comparisons, switches, nested instantiation packages, and recursive generic interface instantiation (
b1f259b1b4) - Old typechecker and IR node-model cleanup (1.25) internal — removal of unused typecheck/ir/types code (Ntype, CurFunc uses, vargen, Resolve dependencies), more typed IR node construction, simplified DeclFunc/NewMethodExpr and constant handling (
67e0681aef) - Syntax package: error messages and parser tolerance (1.25) internal — better syntax and go/parser error messages, accepted type-parameter lists, parser simplifications (
c8664ced4e) - Housekeeping (1.25) internal — dead-code removal, ioutil/seek/slices/atomic-type replacements, README edits, debug-flag removal, assorted small bug fixes and doc comments (
586e205522,b38b0c0088,deb6790fcf,116b82354c,198c3cb785,3e82316a43,961818e013,bb917bb030)
Middle end and SSA optimizer
From Compiler: middle end and SSA optimization (Go 1.18–1.28)
- Profile-guided optimization (PGO): hot-call inlining, devirtualization, profile preprocessing — Done: a zero-weight edge is never chosen as the hottest callee (
13b1261175). Left open: nothing noted. - Inliner: budget, closures, and the interleaved inline/devirtualize driver — Done:
- Infinite recursion and out-of-memory when inlining closures were fixed (
34073a736a,4f45b2b7e0). - The recursion test is now based on inline positions (
cad4dca518), which made older checks unnecessary (1cf6b50263, +0.5% cmd/compile text). ir.ContainsClosurewas added (a08984bc8f), andCallExpr.NoInlinewas removed (3033ef0016).
- Infinite recursion and out-of-memory when inlining closures were fixed (
- Escape analysis: call modelling, closures, func-variable callees, and solver speed — Done:
- The solver speedups
04a9b16f3d,74304cda29andf506ad2644. - Escape uses an
ir.ReassignOracle(e89791983a). unique.Makemodels the data flow of non-string pointers (5e6a868b28), and SSA eliminates the string copy in calls tounique.Make(27ff0f249c).-m=2logs became more accessible (8bf816ae68,c1aad08901).- The literal and constant allocation avoidance described in the next thread.
- The solver speedups
- Allocation avoidance: stack-allocated slice backing stores and allocation-free literals — Done: user-visible fewer allocations.
- Constants are propagated into interface conversions (
ed24bb4e60,326e5e1b7a). Zero values use the globalzeroVal(c3bb27bbc7). Composite literals convert to interfaces without allocating (f4de2ecffb). - Follow-ups preserve side effects when rewriting with literals (
988a20c8c5), keep the optimization on under coverage (479b51ee1f), addliteralallochash(e46d586edd), and fix line numbering (66536242fc). - Variable-sized
makesliceis stack-allocated, pointer-free elements only (7a427143b6). Pointerful elements were then allowed (2d050e91a3), and static len/cap are resolved (ba3f568988). appendbacking stores are stack-allocated, cmd/go <0.1% bigger (ce88e341b9).variablemakehashand the threshold flag were added; they found the culprit in #73199 (2c9689ab0e). The optimization is off under-N(21acfdc4ef).- Stack buffers are over-aligned to match heap alignment (
c8bf388bad). - In a related backend change, scalar heap allocations are aggregated (
5fc596ebe7).
- Constants are propagated into interface conversions (
- Prove pass and bounds-check elimination: from poset relations to a dense limit table, topo-sorted walk, and division-aware proofs — Done:
isGenericIntConst(bdc2d856a8).- Bool-to-uint8 limits (
b7c9cdd53c). Duplicate unsat reports are suppressed (00635de759). - min/max inside
flowLimit(d2842229fc).OnesCountlimits (c00647b49b,99411d7847). - Bit size derived from type size (
644b984027). - Bounds on signed
x % 2^k(3baf53aec6).
- Memory-op optimization: memcombine, dead stores, store-to-load forwarding, alias analysis, mem2reg — Done:
OpLocalAddris not a load in DSE (0825475599).- Type-based alias analysis (
11f7ea8ce0, #70488). - memcombine handles different-size stores (
113b25774e), with an offset fix (d6c29c7156). - Store-to-load forwarding works with copy-compatible types (
16a6b71f18).
- Loop variable per-iteration semantics (loopvar) — Done: an ICE in the transformation was fixed (
a0dc7bf084). Left open: nothing noted. - testing.B.Loop support in the compiler (bloop) — Done: a stopped timer in
B.Loopis detected (5918101d67). TheB.Loopdocumentation was clarified per #73137 (ab2926291b). Left open:ab2926291bhints that “the exact approach might change in the future”. - Range-loop and range-over-func lowering in walk — Done: side effects of range over an array are not evaluated when there are none (
8af32240c6). A cast was added in the final-value computation (3452d80da3). Left open: nothing noted. - Constant-folding loads from type metadata and dictionaries — Done: load constants from itabs (
43e6525986); avoidifaceeqcall when the interface is known direct (072eea9b3b). - ARM64 load/store pairing (LDP/STP) — Done: pair loads and stores on arm64 (
20d7c57422); write-barrier code shaped for pairing (187fd2698d).
Other changes
- Cleanups internal —
linkedBlocksremoved (9dc572eab5), Sym/Aux replace interface{} (eec3745bd7),hv2 <= 127(ef7f09149b), intrinsic aliases for bits.Len/OnesCount (7e8ceadf85,03cb8d408e), PPC64 AND-shift merge fix (ee7bfbdbcc). - Escape/alloc-related lowering internal —
[]byte→string map-key lookup moved to SSA (89c2f282dc),concatbytesoptimized (8203265d5e), phiopt cases (c9d0fad5cb), shortcircuit patterns (4d6722a8fd), load-op merging in more situations (d681270714). - Constant folding internal — PopCount, bits.Add64, 128-bit multiplies (
3e033b7553,b60b9cf21f,7d0cb2a2ad), 8/16-bit multiplication distribution (f7dbbf2519),MakeTupleop (4ff70cf868). - Fixes internal — 32-bit alignment of values with 64-bit fields (
1647896aa2), side effects oflen()arg (336626bac4), closure LSym for type conversions (fc641e7fae).
Backends and assemblers · architectures, ABI
From Compiler backend: architectures, register allocation, ABI and assemblers (Go 1.18–1.28)
- Register allocator, scheduler and block-level backend passes — Done: handle desired registers of 2-output instructions
a0029e95e5;tightenregister-pressure heuristic relaxed1e756dc5f7; nilcheck ops not moved by tightena1ddbdd3ef; “don’t preload registers if destination already scheduled”524946d247; induction-variable increments scheduled late19f05770b0; temp register reuse fixedcc16fb52e6; GOSSAFUNC output now includes liveness7472b4c324; residual GC register map code removed3b25b3c195. - amd64 code generation and GOAMD64 microarchitecture levels — Done:
x < 128→x <= 127for imm8 (−3.15% archive/tar geomean)d524e1eccd;(x&1)==0via AND/XORe57769d5ad; shift-by-1 → ADDcd595be6d6; reuse flags rather thanTEST x x6729fbe93e;x*z+ylowers to FMA when enabled (v3)43b7e67040; multiplication strength reduction by automatic linear-combination search (amd64, arm64)12110c3f7e; PCMPEQB commutative8cb6d3b826; Plan 9 SSE/FMA special-cases removedc18ff21cc8,35cb497d6e,c9b07e8871. - arm64 code generation and assembler — Done: LDP/STP load/store combining variants
0b88a87879, sign-extension bug in paired 32-bit loads fixedbeac2f7d3b; BTI instruction9ce47e66e8; epilogue SP increment in one instructionf7cc61e7d7; register encoding moved intooprrr/opldrrhelpers (f90f3cfcf7,4f5863c2ce,fd0805b660); more conservative use of zero register16dbd2be39; constant-classification refactor (391dde29a3…06f82af183); OpMove used more than memmove calls11fa0de475; fold negation into add/subdfebef1c04. - riscv64 compiler and assembler (RVA profiles, vector, compressed) — Done: vector load/store, integer arithmetic, fixed-point, reductions, mask, FP and permutation instruction support, vsetvl configuration (
37e9c5eaba,535e0daefd,4c1b8ca98c,2e60916f6e,936ecc3e24,5a342266e6,1cc624fd62,c8545439b5); CSR map5a7db813a6; synthesized MIN/MAXd88f93f720; GORISCV64-gated intrinsics TrailingZeros (CTZ), Len (CLZ), OnesCount (CPOP, with Zbb check for rva20u64: +5 ns without Zbb vs up to −11 ns with), Bswap (REV8)6fb7bdc96d,b70244ff7a,4d10d4ad84,90e8b8cdae; constant constructiond37624881f; plugin build modecdc9560794;R_GOT_PCREL_ITYPE_RELOC371ee1469c; generic simplifications123141166b; fold zero register for*zeroinstructionse373771490. - loong64 backend and assembler — Done: ~25 vector assembler commits (e.g.
53d689ce99,b0e2f185c5,b10c35945d,47fd73a51c,d65c209b4b); immediate loading optimizedb9630c56db,f24d2e175e; shifts2a772a2fe7,b143c98169; unalignedOK for memcombine09d76e59d2; negation foldingc31a5c571f; prefetch intrinsicda9c5b142c. - Duff’s device replaced by generated loops; Zero/Move lowering — Done: nil check done before calling duff functions on arm64/amd64
dbaa2d3e65;noDuffDeviceflag removed26040b1dd7. - Late-lower pass, memory-op combining and arch-independent rule migration — Done: automated multiplication strength reduction
12110c3f7e; loong64 equivalente0716172221.26 (1.26); constant folding flagsaf278bfb1f. - Stack slot merging, liveness and stack maps — Done: residual register GC map code removed
3b25b3c195; stack object alignment 1.285d29d80b6c1.28. - WebAssembly backend — Done: indirect calls use 64-bit ops because >65536 functions overflowed the 16-bit shift of the PC
c876bf9346; large return address as i64d60a684c87. - s390x, MIPS, 386 and 32-bit ARM backends — Done: negation folding for mips64x/mipsx/s390x (
8097cf14d2,d52679006c,7589e96042); publicationBarrier on mips (94e3caeec1,3dbc775d60); s390x LCDBR4ae6ab2bdf.
Other changes
- panic transfer via deferreturn PC internal —
recoverfrom range-over-func defers uses the PC ofdeferreturnas target, removing the register-value handshake (go cmd −0.2%)c2ae5c7443,9ddeac30b5. - Signed loads from read-only memory
a7e331e671; preamble preemptible (reverted)3f3782feed,fa2bb342d7. - Generated-files up-to-date test internal
d4c6effaa7. - endbr64 and BTI (CET/BTI) user-visible
04de448c6d,9ce47e66e8. - 14 small obj/riscv and riscv64 rules commits internal — e.g. cc: combine negation and word sign extension on riscv64; obj/riscv: support MOVD with floating point constants; ssa: optimise more branches with zero on riscv64. (
21417518a9,d7c242a19a,e6c2e12c63,215de81513,7a2f757c52,24b395119b,1aee4f3464,c386ed107e,af133d86e4,10d070668c,d000963d04,5a1f47a7f7,0d7dc6842b,2363897932) - 4 small obj/arm64 and arm64 rules commits internal — e.g. ssa: correct MOVDnop handling for arm64; obj/arm64: replace range checks with isaddcon2; obj/arm64: simplify conclass. (
fba83cdfc6,dab10bca37,c524db9ca8,4464a7d94f) - 1 small obj/ppc64 and PPC64 rules commits internal — e.g. cmd/internal/sys: allow unaligned loads on big-endian ppc64. (
3981b446dd) - 16 small obj/loong64 and loong64 asm commits internal — e.g. obj/loong64: add {V,XV}NEG{B/H/W/V} instructions support; obj/loong64: add {V,XV}{FSQRT/FRECIP/FRSQRT}.{S/D} instructi; obj/loong64: add {V,XV}{ADD/SUB}.{B,H,W,D,Q} and {V,XV}{ADD/. (
f41fdd962d,80f068928f,39d7a49736,2ce1fb4220,e3ea8e68fb,ac8474c0a2,0095b5d098,005d7f29d1,fb2c88147d,3474c52e4b,b386b62852,d13da63929,f49ca5f525,c62099cfac,045b5c1bfb,d37a1bdd48) - 10 small ssa/regalloc/liveness/obj generic commits internal — e.g. cc: remove reduntant Zero rule; cmd: use cmd/internal/hash.New32 and Sum32 only; cc: simplify intrinsification of TrailingZeros16 and Trailin. (
46fd6b4e37,eab8e987c0,927fdb7843,1b1c6b838e,8b8bff7bb2,a20d583bb9,afe11db4a7,47ab9cbd82,8a8efafa88,4ce1c8e9e1) - 1 small obj/x86 and amd64/386 rules commits internal — e.g. cc: remove carriage returns from AMD64latelower.rules. (
a65078204c) - 1 small mips/s390x/arm/wasm commits internal — e.g. obj/s390x: fix potential recursive String call. (
9f3dd846e2)
Linker and object files
From Linker, object files and debug info (Go 1.18–1.28)
- //go:linkname restrictions and the blocklist — Done: user-visible more blocked
683810a368,47b941f445; linkname reference to a TEXT symbol allowed regardless of size70109eb326. Left open: nothing noted. - DWARF 5 migration — Done: dead
R_DWARFFILEREFremoved38825ef347;DW_LNCT/DW_UTconstants41a30dd192;R_DWTXTADDR_*relocations31b800abe6;SDWARFADDR282a14ec61; line tables767e7680ec;.debug_addrand v5.debug_infoe7cd4979be; rnglists4c0a47a8ff; loclistsbef2bb80a9; fix of wrong inlined-subroutine pc range (alwaysDW_AT_ranges)955cf0873f,bdfa604b2e; DWARF 5 enabled by defaultca19f987ca; loclist fix for heap return vars without optimizations71c2bf5513. Left open:e7cd4979besays DWARF stays damaged until the later patches landed; not enabled on macOS. - Linker performance and memory — Done:
-eunlimited errors76c18e2ed2;-funcalign=N9302a57134; size fixups after references load88cf0c5d55. Left open: nothing noted. - Per-platform object formats and internal linking (Mach-O, PE, XCOFF, wasm, ppc64, riscv64, loong64) — Done: loong64 internal linking
f212b6499a; Wasm method/func tables hold only function index so >65536 funcs fit9c507e7942; Mach-OX86_64_RELOC_SUBTRACTORfor race syso5fb9e5dc19;.gotin__DATA_CONST61641c1145; >4 GB base for 64-bit PE176a2154aa. Left open: nothing noted.
Other changes
- Misc linker internal —
__gotsection name (2298215f5b), loong64 PLT trampoline removed (6cb8c839f9),LookupPkgSpecial(pkg).Runtimeshared by go and linker (f3c69c2e78), riscv64 gcc-15 and mapping symbols (12e5efd710,a2fbb50322), macOS 12.0 versions (33d3f603c1), devel detection (214b208e24), mmap check (b338f6bfa6), pe64 bool (ba01453bbe). - Linker block of duplicate BSS internal — larger-size BSS wins (
8f6c083d7b,0f8ab2db17).