Go 1.22
Per-iteration loop variables. Range over int. Range-over-func as an experiment with coroutines. Allocation headers. New execution tracer by default. ChaCha8 randomness. Type-switch and assertion caches. SCCP. loong64 register ABI.
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:
gcPaceScavenger’s memory-limit goal was corrected to(100−reduceExtraPercent)/100 × limit(729f214e3a). Left open: nothing noted. - Heap bitmap rewrite and allocation headers — Done: user-visible preparation (
7a606fef66,cdf1362179,25867485a7), theallocheadersimplementation (38ac7c41aa), and default enablement (e3585c6757). Benchmarks with footers: GoBuild −3–4%, tile38 −1.9% (1e250a2199). Headers were restored after a persistent dashboard regression (0ef169abb1). Follow-ups:typePointersOfTypefast path forbulkBarrierPreWrite, removing a p90 regression (d6ef98b8fa); memory-profile accounting using the fullelemsize(f67b2d8f0b,c418da34cd); arenalargeTypeclearing (052d402985); unrolled-bitmap flag (ee4b61a32e) and freeing leak (0f3876f8c1); smallermspan.freeindex/nelemsfields (340a4f55c4); test fixes (17eb0a2bac,b71d43296f1.21). Left open: objects may lose incidental 16-byte alignment; “A follow-up change will add a GODEBUG flag that ensures 16 byte alignment” (0ef169abb1). No such GODEBUG exists ininternal/godebugsat HEAD. - Scavenger redesign — Done: corrected memory-limit goal (
729f214e3a);sysGrowmin-index bug that remapped and zeroed live index data (c95fe91d07). Left open: nothing noted. - Transparent huge page management — Done: user-visible
MADV_COLLAPSEinstead ofMADV_HUGEPAGE(9f9bb26880), then “don’t eagerly collapse hugepages … Disable it until further notice” (595deec3dd), with dead code deleted (765dfb00b2). Metadata huge-page calls moved to the system stack to avoid a self-deadlock on stack growth (5f08b44799).GODEBUG=disablethpwas added, because 1.21.1+ stopped working around the kernel’s khugepaged behavior (c915215af6). Left open: the runtime no longer stops khugepaged from re-backing returned memory: “basically unavoidable without a new madvise flag” (9f9bb26880). - Object pinning (runtime.Pinner) — Done: user-visible
Pinsilently accepts non-Go pointers (bfa8a8586f), with reworded docs (451e4727ec). Left open: nothing noted. - Memory arenas experiment — Done: adapted to allocation headers (
cdf1362179); big-endian heap-bit byte order (f7c5cbb820); clearingmspan.largeTypewithout a write barrier (052d402985); test (90a73ec1f2). Left open: “Much of this can be avoided … if the compiler were to write out the pointer/scalar bits as an array of uintptr” (f7c5cbb820). - Mark worker scheduling and GC work queues — Done: all mark workers yield to
forEachP(needed by the new tracer,25895d1c99); per-worker-kindgcDrainwrappers so profiles show which kind is running (081d27a2e5). Left open: nothing noted. - Sweeper termination and pacing — Done:
GODEBUG=gcstoptheworld=2now flushes mcaches ingcSweep,_ConcurrentSweepremoved (4f4c23512e); write-only fields deleted (7241fee9b0). Left open: nothing noted.
Other changes
- writeBarrier.needed folded into enabled internal — (
72da49caee). - mheap.arenas false sharing internal — padding gave +17% on MinIO with GOGC=1000 on 112 cores (
b45b00162b). - sync.OnceFunc/OnceValue(s) drop the function after first call user-visible — stops it keeping its captured allocations alive (
4f55a5af5e). - work.pauseStart removed internal — (
7a6ddbb425). - Tracer API as a lock internal — GC/sweep tracing calls rewritten to the
traceAcquire/traceReleasepattern (f119abb65d), diag area.
Scheduler and concurrency
From Runtime: scheduler, timers, channels, locks and synchronization (Go 1.18–1.28)
- Contended runtime-lock profiling (mutex profile for runtime-internal locks) — Done: user-visible mutex profile counts every blocked goroutine (
1c00354013); runtime-internal lock contention profiled (0b31a46f1f, reverted468bc94188, relanded450ecbe905);GODEBUG=profileruntimelocksrenamedruntimecontentionstacksand sentinel_LostContendedRuntimeLock(98fd8f5768). Left open: attributes the waiter’s own wait time, not the delay the critical section caused; futex locks “too late in the cycle” to fix. - Scheduler core: spinning Ms, work conservation, stealing, STW interaction — Done:
goschedcallswakepafter pushing onto the global runq: without it, a spinning M that had just checked the global runq could park while the yielder’s G was stranded (loss of work conservation, with sysmon’s 10ms preemption the only backstop) (ad943066f6); global runq checked in the delicate dance (dd5db4df56);forEachPwrapper moves caller to_GwaitinglikestopTheWorldto avoid deadlocks with GC stack scanning (ff7cf2d4cd);m.locks-related andwirepthrows moved to systemstack (37aed23f51). Left open: sysmon still preempts regardless of idle Ps (#60693 referenced). - Coroutines (
iter.Pullruntime support) — Done:iter, runtime: add coroutine support, exported under GOEXPERIMENT=rangefunc (a9c9cc07ac). Left open: interaction with thread-locked goroutines. - sync package API evolution — Done: Once-wrapped functions are not kept alive after running (
4f55a5af5e);Poolpanics rather than throws on nil receiver (be0e0b06ac);Map.Rangeno longer always escapes (7015ed891c);Onceusesatomic.Uint32(be3d5fb6e6). Left open: nothing noted. - Runtime lock ranking — Done: wakeableSleep edges (
5a6f1b35d4,23c0d30244); rwmutex (9b4b3e5acc,dcbe772469). Left open: nothing noted. - Netpoller — Done:
netpollWaitersadjusted after goroutines ready and innetpollunblock(f51c55bfc3,eaa8419a72). Left open: nothing noted.
Other changes
- rangefunc runtime preparation internal —
_deferroom (390763aed8),deferreturnwithout unwinder (9869699c44), pruned_deferfields (0c2abb3233). - g0/crash stack and cgo internal — callback stack bounds update reverted (
a46b1ad357,ea8c05508b), stackguard1 on extra M (9af74e711a,c0c4a59816),dropmclears bounds (1af424c196), crash stack disabled on Windows (dc094f9c96),sched.lockovertraceThreadDestroy(cea35baf12), pcvalue cache to M reverted (d367ec6a0e,26e0660811). - g0/crash stack internal — larger g0 in non-cgo (
c6d550a668), crash stack via stackalloc (e293c4b509), reverted callback bounds/stackguard1/pcvalue variants (4f9fe6d509,2b462646ed,4a8373c553). - Misc internal —
wakeableSleepsend-on-closed fix (3073f3f941);debugcalllocks OS thread (d9a4b24a17); AIX noteclear (a762ea17ec);copyCheckerdoc (18b2c45b0a); atomic integer sweep (4988a65f2a); wine hacks removed (4beb33018b); arm64 saved fp zero (94d36fbc4a);memhash_varlendevirtualisation (3fd5c357a3); stack bound docs (a7c3de7052).
Data structures and type metadata
From Runtime: maps, built-in data structures, hashing, randomness and type metadata (Go 1.18–1.28)
- Compiler-generated equality/hash functions and type descriptor emission (reflectdata) — Done: reflectdata uses
internal/abitypes directly (7fcc626b57) and descriptor generation reorganised aroundrttype(2d9e8ded94). Left open: nothing noted. - internal/abi type layout unification and type metadata (rtype → abi.Type) — Done: compiler uses internal/abi types (
7fcc626b57), map layout read from abi (cc47df017duses real type size in map keys/values). Left open: nothing noted. - Interface conversion: itabs, type switch and assertion caches — Done: caches for interface type switches (
39263f34a3) and type asserts (cbcf8efa5f); itab init nil-check cleanup (e7d582b55d). Left open: nothing noted. - reflect implementation: performance, allocation and escape behaviour — Done: user-visible
reflect.TypeFor(42d2dfb430),PtrTodeprecated (93ec88160e),DeepEqualfor maps optimised (f024e390bb),IsZerofor arrays and structs (12051f7d95,ada5c2edb4,c700c23cef), panic on recv channel close (f2d709b769),StructOfembedded-interface support removed since it never worked (method wrappers need closure calling convention) (6d5c9f2f26), reflectliteValuestack-allocatable (d573a8a8e8). Left open: nothing noted. - memmove / memclr / memequal / internal/bytealg assembly optimisation — Done: amd64
Index/Count/IndexBytealigned hot loops with PCALIGN (dfc1437580,3393155abf,23711f8ef7,8b6e0e6e8e: two AVX2 lanes per Count loop, -5.4% geomean), arm64 Count (289b823ac9), Power10 compare/Count (b2e809bab5,756841bffa),memequalPCALIGN (11e9c8e6a1), genericLastIndexByte(890a62bf1b), Rabin-Karp helpers via generics (b46aec0765,68e52bc03c,a05a25cb19). Left open: nothing noted. - Slice growth, string building and allocation-free bytes/strings helpers — Done: growslice loop optimisation (
c56f463412),nextslicecap(1d84b02b22). Left open: nothing noted. - Runtime randomness: fastrand, chacha8rand and math/rand/v2 — Done: user-visible ChaCha8 (
6382893890, revert82fc03f9c9, replayd92434935f);fastrandback temporarily (dca2ef2361). Left open: riscv64 tests disabled because of compiler bug #64285. - iter.Pull and range-over-func iterator types — Done: race instrumentation fix for Pull2 (
f2d243db8f). Left open: behind GOEXPERIMENT=rangefunc. - Classic map maintenance and maps package helpers (pre-swiss) — Done:
25e48765a4,b303fb4855,16d3040a84,d32b4798f8,3bc28402fa(built-inclear). Left open: nothing noted.
Other changes
- Free unrolled GC bitmaps internal —
0f3876f8c1.
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 v2 tracer and parser added behind
GOEXPERIMENT=exectracer2(43ffe2a892); enabled by default (41f58b2295, Nov 2023);go tool tracere-implemented on the new parser:cmd/trace/v2with goroutine/task/region/MMU pages, pprof endpoints and thread/proc views (748952f494,48a6362dff,d1dcffdb4a,971f59399fand ~10 siblings); trace analyses ported (9d914015f8MutatorUtilizationV2,3b303fa981goroutine summaries,816ee0be38tasks); cgo-callback thread-ID reuse modelled correctly (6d7b3c8cd1);ProcStealfromentersyscall_gcwait(b6b72c775a); lock-hold fixes in stack table dump andreadTrace0(5249947f11,e4ea6283e4); CPU samples now written per generation using a second CPU-profile buffer chosen by the SIGPROF handler under the thread’s write flag, withtraceCPUFlushdraining the old one (f5e475edaf1.23, listed in 1.23 log). Left open: v1 still in tree; deadlock debugger disabled (74993bffe1); Windows tests disabled temporarily (505dff4fe2); goroutines blocked all generation have no stack (see 1.23). - Mutex and block profiles, including runtime-internal lock contention — Done: docs for block/mutex profiles and for runtime-internal locks in the metric (
e9eb2beeb2,3f2bf706f7); user-visible runtime-internal contention shown underGODEBUG=runtimecontentionstacks(introduced outside this bucket; testsd59bd25a30). Left open: attribution is to the waiter, not unlocker (#66999). - CPU profiling, goroutine profiling, pprof labels and the protobuf writer — Done: darwin memory mappings via
vmmap/Mach calls (b7c826d2c4; vmmap retry fix9312f47d0a1.23 landed in 1.23); labels for the goroutine requesting a goroutine profile (9cdcb01320); profile of empty-sample protos still fully decoded (e1c0349a7c); generics names and inlined generics locations (20a03fc713,d95e25e83c);ticksPerSecondneeds 5ms instead of a 100ms thread sleep and runs on a goroutine sleep (130baf3d42). Left open: Darwin profiling needed non-blocking reads (c6ee8e31e3). - runtime/metrics and MemStats — Done: user-visible
/sched/pauses/{stopping,total}/{gc,other}:seconds;/gc/pauses:secondsdeprecated as an alias for the new gc/total (6ef98ac87c);/gc/scan/*fixed (2186909d86);ReadMetricsSlowavoids stack movement (6a32ecc059); ReadMemStats debug assertions behind double-check (b2efd1de97). Left open: nothing noted. - Coverage redesign: runtime/coverage, internal/coverage, covdata — Done: user-visible
cmd/cover“emit meta file” mode and go command handling for packages without tests (e356aa656d,d1cb5c0605);covcmddefs moved tocmd(3fb1d95149,98bacdeafe); compilerFixupmerge (3378adc517). Left open: nothing noted. - Race detector, ASan, MSan and Valgrind integration — Done: ASan on linux/loong64 (
e9c14a7780); race syso with atomic And/Or (6b43a172d8); testing attributes races to subtests via monotonic counts (55b8e16b2e); asan asm fix on amd64 (d9f7e1dc73). Left open: nothing noted.
Other changes
- Trace parser and viewer hardening internal —
Event.Stackforwarded toStateTransition(539b4d8d5b,351d8520a6), batch-order and syscall parse ambiguity (e8298c09b1,c06beb9eff,aae7734658), malformed-trace panics and unknown goroutine states rejected (e58e813950,7abeefd2b1),NoTask/BackgroundTask(5dde69fd40), viewer factoring and task/goroutine filtered views (c785be4c6a,ff07b73fac,b83934830f,7e32d8d10b,71052169be,64c12bafea,90ba445253,4e3ac99a33); runtime P-status emission at safepoints (5a2161ce9e,cf3d253c1b);wakeableSleepchannel race (3073f3f941);internal/profilepostDecode errors (5fe2035927); Darwin struct alignment (a0c02df519). - Misc GODEBUG user-visible — GODEBUGs added by other areas (
162469b3cf,eb070d7483,b18b058816) were swept into this bucket; the pagetrace build fix (6db1102605).
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: shared defer state machine (
9eb1d5317b);deferreturnfast path and no-unwinder design (51cb12e83b,9869699c44); frame-pointer restoration on recover (b51a4dd6c4,f7a87e3299); runtime support for range-over-func defers (e82cb14255). Left open: the fast-path commit says the case “deferreturn in a function with linked defers but none pending” and recovery into open-coded frames still need the unwinder; more defer optimisation hoped for. - Unwinder: gentraceback →
unwinderiterator, inline unwinder, pcvalue cache — Done: pcvalue cache moved to M, with start PC stored in cache entries (6be2639aff,4a8373c553, after reverts),SPWriteignored on innermost frame (4c5130a96e) and “unexpected SPWRITE” no longer printed (15a274b621),readvarintUnsafesped up (67359829a2). Left open: nothing noted. - Symbol tables,
runtime.CallerandCallersFrames— Done: off-by-one intextOfffixed (5cc1e99f94). Left open: nothing noted. - Stack growth, stack bounds and the crash stack — Done: crash stack on amd64/arm64 (
0262ea1ff9), “print g pointer in crash stack” (3a9254636c), ppc64 (aa9dd50095), riscv64, mips64x, wasm;badmorestackg0fixed on wasm (4cd201b14b);TestG0StackOverflowunskipped (dfbf809f2a); thread that faults crashes the process (de5b418bea). Left open: gsignal / systemstack misuse not covered (TODO in0262ea1ff9); 386/arm/mips/s390x/loong64 not yet. - C-to-Go callbacks: extra-M reuse, system-stack bounds, init gating — Done:
a46b1ad357/4f9fe6d509allow stack-bound updates on callbacks from C threads (one revertedea8c05508b);cgocallbackg1unlocks OS thread (68a12a8023);runtime/cgoC files consolidated per OS andcrosscall1standardised (60506f4d7f,23e4a4b6e5,0ab0d4e33f,f2781229a9,7ce1dd9979,ac64a3628b,a91931d692),fatalfused on BSDs/Solaris;#cgo noescape/nocallback(24b9ef1a73, disabled until 1.23 by607e020150, enabled in 1.24 byff271cd3911.24);getstackboundfor set_stacklo (52e17c2e4d); debugger can see “pinned pointer” error clarity (eebeca803d);cgo.Handledoc example (d2f4c935f21.18). Left open:#cgo noescapegated. - Library entry points and runtime initialization — Done: Windows lib entry stack alignment (
5fe3f0a265). Left open: nothing noted. - Security hardening: AT_SECURE, std fds, AT_RANDOM, gated debug features — Done: user-visible standard fds forced open at init on Unix (
d4dd1de19f); ChaCha8 global rand (c29444ef39);RtlGenRandom→ProcessPrng(693def151a). Left open: nothing noted. - vDSO,
vgetrandomand fast clocks — Done: corrected linux-arm64 vDSO hash codes (dde20209b8). Left open: nothing noted. - Signals and async-preemption machinery — Done: fatal signal fault address (
c4af8abae1), debuglog dumped before crash (9ceba95008), debug calls on ppc64le (b0ae440bf0),SetUnhandledExceptionFilteron Windows (bc15070085), s390x SIGFPE for p256 (6fe976545d), darwin signal-stack sema guard (91bea5a21d). Left open: nothing noted. - Syscall layer:
AllThreadsSyscall,internal/runtime/syscall, libc and WindowsSyscallN— Done: ETIMEDOUT from kevent ignored (1f3f851a6e), Windowsusleep/osyieldin Go (b6ae112ff1,d73a33f1c3),AddVectoredContinueHandlerloaded unconditionally (a30967f4ce). Left open: nothing noted. - Windows runtime port — Done: profiler high-res timers (
a09ea59198),SetUnhandledExceptionFilter(bc15070085), Go-writtenusleep/osyield(b6ae112ff1,d73a33f1c3), wine hacks removed (4beb33018b),ProcessPrng(693def151a),QueryPerformanceCounter(ab2e3ce77c). Left open: nothing noted. - New, ported and removed platforms — Done: openbsd/riscv64 (
57c1dfd2ab), openbsd/ppc64 (c140105e1c), loong64 plugin, msan and regabi (d7fcb5cf80,fbbed139a1,f6f141ab80,4e6bbbe61f),GOWASIRUNTIMEdefault (3687f77069). Left open: nothing noted. - CPU feature detection, GOAMD64 checks and cpu GODEBUG options — Done: AVX512 detection (
8f262a2843); riscv64 cache line (5e31f78c8a); arm32 sync-instruction detection (66b8107a26). Left open: nothing noted.
Other changes
- Misc runtime/cgo and Windows internal —
stackguard1on extra M’s g0 (2b462646ed, revertedc0c4a59816), g0 bound from frame address (a3ced4a633), atomic init-done check inruntime/cgo(b104a0ef32),procidclearing inunminitexcept NetBSD (4be921d888,298e848864), libcall nil args on Windows (1d538f198d), rdx dumped on Windows crashes (af3bf866b1),miniterrnoon m0 for AIX/Solaris (737a5b0eaa), asmcgocall rework on ppc64x (b291538d33), OpenBSD map-stack version handling removed (4e896d179d),sigctxt.faultunified (a72d1e5bf4,7117819fdc), windows hosts-file name resolution user-visible (33d4a5105c). - MADV_HUGEPAGE avoided internal — use
MADV_COLLAPSE, stopMADV_NOHUGEPAGE(9f9bb26880), cross-area with GC. - ppc64 atomics internal —
lwsyncon failed CAS; fixesnotesleepvisibility on BSD (655155d0a7); mips CAS barrier (25ad137cf4). - And/Or atomics internal — all arches: generic (
237715cf7c), 386/amd64 (36f3ec5912), arm/arm64 (0ccbf6306c), ppc64x (6bcf176829), riscv64 (555af99bcc), wasm (6ecd5f7504), s390x/loong64 in 1.23. - Darwin mappings internal — memory mappings for pprof (
b7c826d2c4). - godebug race annotations internal — (
0b56804084,3313bbb405).
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:
27316739acfixes~[]Epassed to the unsafe builtins;6f87db509afixes a(*T)(nil)-to-interface conversion bug. Left open: nothing noted. - Instantiation, Named types, Context deduplication and lazy expansion — Done:
b6898dde3dinstantiated interfaces must be concurrency safe;d2ee7821d3no panic during interface completion. - Type inference and unification — Done:
1f8f2ab966removes order dependency with channels;f2f5979253correct parameter list in argument passing;51cb717d27no implicit modification of an argument function’s type;b34059032eno inference error for invalid arguments; error messages for reverse inference (2643a59172,0ac1e3b245). - Generic type aliases and
Aliastype nodes — Done:bea55136b2introduces unexported_Aliasand_Unaliasbehind_EnableAlias; tests run in both modes (4346ba34df).30de0b5ef4exportsAlias/Unalias(proposal #63223) gated byGODEBUG=gotypesalias=1, off by default;acc8cb6a5fmarks the setting undocumented;8e658eee9cmakes the compiler calltypes2.Unaliasto prepare for it. Left open: unset default still meant no alias nodes; no generic alias. - Per-file language versions and version gating — Done: user-visible
e59eaee2e3(Info.FileVersions),1fc45e9a2b,12f3d6858edocs,6146a73d27range-over-int errors for version < 1.22,11677d983eenables it without GOEXPERIMENT,008ab9adb8fixes allowVersion for invalid pos. - Language features as seen by the type checker (by release) — Done: user-visible range over int (
11677d983e,5f949c4f2fconstant range expressions,25a59decd5). - Error reporting: codes, messages, and sub-errors — Done:
58c28ba286avoid “have m(T), want m(T)”,0b3dd75f6cunexported missing method,25c5f6f159. - Checker performance, memory and API ergonomics — Done:
5fa4aac0ce,14a3ffc3d2,832212df9a(compiler usestypes2.InitOrder),294e1b260e.
Other changes
- API documentation and fixes user-visible —
8da6405e0dInfo.PkgNameOf,ede27fb4ac/8222423e03Selection docs,a27a525d1bcorrectVar.scopePosfor parameters,7b625d1f65. - Compiler-facing internal —
832212df9a,14a3ffc3d2. - Small fixes, unifier/assignment refactors, message and tracing tweaks internal — 8 commits:
8597d052b2,197522d3ae,c5569f09f2,2fa7129836,ffc4ccea07,5914f6a482,01987d3117,e62bf150cc
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: long
go.shapesymbol names hashed (8c1349baf7);mark instantiated runtime functions norace(5b2ddfadb2). - Unified IR: one serialization for noding, stenciling, inlining and export — Done: early deadcode moved into the unified writer (
59037ac93a), statically-knownifstatements elided in noder (f92741b1d8), “init” function created during noding (88cb17e106), inlining “properties” written to export data for the new inliner (323cf73091, +2-3% export data on kubelet),6dce882b3a1.21. - Old typechecker and IR node-model cleanup — Done: the biggest sweep:
OFUNCINST/InstExpr,ir.Ntype,AsNode,ODCLCONST/ODCLTYPE,OSIZEOFfamily (f9410990e6,09b03117b0,7af28fa90e,36fc721419,06138963a2),OrigNode/ir.Orig/SepCopy(d2eab5ff19,729e21b24c,e50bbae2de),ConstExprin favour ofBasicLit(7f1f4a1936), old variable-capture logic (22eba6a1f8),Func.ReflectMethod(a03f1aeb55),Inl.Body(08bf6d1405),typecheck.DeclContext(4089b6a5b1),NeedRuntimeType(7b2f81eb3b). Closures always constructed typechecked (5c6fbd2c3e),ORECOVERdesugared during typecheck (52c3e8c735), go/defer normalized early with wrappers (7e2e648a2d,2c51ea11b0). Nodes constructed typed:NewNameAt(typ)(e453971005),NewBasicLit(typ)(972fc055eb),NewZero(c8396b5188),Func.DeclareParams(d18e9407b0),ir.CallExpr.GoDefer(0709f1bb00), “never returns” func flag (3d62c76736). types API overhaul: no.Slice()/.FieldSlice()(14f5eb7f31),Funargremoved (98195ed057), separate struct vs tuple printing (6f7caf8894), signature representation simplified (4b9a70a3b7),Type.Registers(c80a9f172b). - Static initialization and package init — Done:
afa3f8e104staticopy safety;88cb17e106buildsinitduring noding (removingInitTodoFunc);079c0441d5/611c3af30daddrtaken/closure fixes. - Compile-time performance, concurrency and the self-PGO’d compiler — Done: profile refreshed (
1926a0b573, -3.1% Template); per-package memprofile/cpuprofile into directories (0ce94d79bc,2f5bd4e4f2). - Compiler debugging infrastructure: bisect/hash debugging, flags, dumps — Done:
-env key=value(c14655da98), pgohash (3fb86fb864),-d=rangefunccheck=0(d411b3197c), pgo devirtualization disable (1ab9df4849). - Frontend support for new language features and spec changes — Done: user-visible per-iteration loop variables for Go >= 1.22 modules (
fe1daf2e43), range-over-int (a94347a05c) and range-over-func (2fba42cb52, rewrite inrangefunc/rewrite.go) behindGOEXPERIMENT=range; laterb5e31780b6post-loop-exit check;fbfe62bc80/778880b008range-typecheck fixes; interface type-switch lowering with a single runtime call (28f4ea16a2,7499257016,b455e239ae,afd7c15c7f);//go:buildversion mismatch reporting (1f25f96463). - The syntax package (parser, scanner, tree) — Done:
Unparen,UnpackListExpr(d5c5808534, inlinable and stack-allocated result verified bytesting.AllocsPerRun), better type-parameter-list errors (b7a695bd68), dummy name for missing func name (b7a66be69c). - Package paths,
-p, and build-system contract — Done: fallback for missing-peliminated (cf338eb890), vestigial importpath symbol logic removed (52a5881bee),-+flag computed from package path (fbcf43c60b),PkgSpecialsunify NoInstrument/NoRace lists (56b3b244fd,83e0704c50). - Types package internals: size, algorithm kind, TFlag, SIMD flags — Done: struct size calculation refactor (
1f544ef0eb),Type.Registers(c80a9f172b). - ir.StaticValue, ReassignOracle and function-variable tracking — Done:
Reassignedexported and OASOP handled (7087b8ac4c, #61502),StaticCalleeNameextracted (3be2176d92),ReassignOracle(8be8bfeaa2).
Other changes
- Work-queue refactor of
gcinternal — package-level declarations, type descriptors and SSA compilation run in one loop (ca858a43f4reverted bye47fad515d, relanded ascf68384674). - Devirtualization from export data internal —
bfb8924653,42bd21be1clookup of functions in export data, used by PGO. - Type-descriptor generation reorganised internal —
2d9e8ded94. - ABI/register docs internal — loong64 registers (
945c2bc74e). - Interleaved devirtualization and inlining internal —
4a90cdb03d, mutual (opt area). - Shared
hmap/hitertypes internal —42f4ccb6f9. - zerocopy by default internal —
-d=zerocopyon (d63c88d695). - Compiler README tips internal —
bc1d71ff64. - Unified IR: noder/writer/reader refinements and pkgbits (1.22) 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 (1d04c42045,e4fdb437f6,f4e6815652,b036d7e17f,18c6ec1e4a,2e457b3868,a55ef98239) - Generics: dictionary/shape fixes in the stenciler (1.22) internal — fixes in dictionary passes for type assertions, comparisons, switches, nested instantiation packages, and recursive generic interface instantiation (
285ac5a11e,4bf1ca4b0c) - Old typechecker and IR node-model cleanup (1.22) 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 (
ade5a6232f,48e05ee749,89eb6b76ae,2a47bc9e4f,8789b5d72f,3761e3fbfd,3d15bfaa3e,21293b6b87,4f97a7e6ea,ae09ca6c0f,0a49d4a778,5eb382fc08,e3ce312621,3556d3b9bf,905b58b537,aa381c538a,008dabcd19,38db0316f4,884c93a6df,3290fb870c,4988a65f2a) - Syntax package: error messages and parser tolerance (1.22) internal — better syntax and go/parser error messages, accepted type-parameter lists, parser simplifications (
884aa71f51,96b6e78ea9) - Housekeeping (1.22) internal — dead-code removal, ioutil/seek/slices/atomic-type replacements, README edits, debug-flag removal, assorted small bug fixes and doc comments (
4550055149,7889ae3b12,3378adc517,f47cfd6cb5,5af4b34870,d1593b7a4a,596120fdc6,43e69b330a,99ea5b9765,ecfd2cab7b,ac2ec69e19,2399302a25,d2e2da83b1,11084a9a1e,3fb1d95149,53827ba49e,2744155d36,e7c142a19d,0c66ae5c27,5b6d3dea87,d1674cb4c6)
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: user-visible
- Indirect callees and functions can be looked up from export data (
bfb8924653,42bd21be1c). - Function-value devirtualization (
fb6ff1e4ca, #61577) can be disabled with a flag (1ab9df4849). hairyVisitorandmkinlcallnow share their inlinability logic, so the hot-budget decisions agree (b56645a87b).pgohashenables bisection (3fb86fb864).- The hottest edge is selected stably, breaking ties by name (
4b17b36b3f,2d428cfd85). runtime.memhash_varlenis never devirtualized (3fd5c357a3).- Devirtualization uses
CallExpr.GoDefer(ddb38c3f54). Readability refactors:14c347f5ce,da13da1fce. - Devirtualization and inlining are interleaved so devirtualized calls get inlined (
4a90cdb03d, #52193).
fb6ff1e4canotes that closures needing a context are not supported as targets. - Indirect callees and functions can be looked up from export data (
- Inliner: budget, closures, and the interleaved inline/devirtualize driver — Done:
checkptrarguments may be inlined (28a8896d57).- A small tweak for range-func panics (
2380862c7c). ir.CallExpr.GoDefermarksgo/defercalls, which are now normalized in typecheck (0709f1bb00).
- Escape analysis: call modelling, closures, func-variable callees, and solver speed — Done:
- Indirect closure calls are optimized, along with tracking of
*p=and mutating builtins (ff47dd1d66). blankLocbecame transient,transientwas flipped to!persists, and the attributes became a bitset (570763e0ec,4e336b8e1e,1038fc207b). Leftovergo/defernormalization code was removed (b805e18fbf).- user-visible Zero-copy string→[]byte conversion when the bytes are never mutated (
c8adb3004f) was reverted the next day (b75ac7a8d5), then restored behind the-d=zerocopydebug flag (925d2fb36c, #2205). ir.StaticValueimproved andir.StaticCalleeNamewas extracted (3be2176d92).ORECOVERis desugared in typecheck (52c3e8c735). Fixed escape analysis of stringmin/max(34416d7f6f).
- Indirect closure calls are optimized, along with tracking of
- New inliner heuristics (GOEXPERIMENT=newinliner,
inline/inlheur) — Done: [user-visible, experiment only]- The experiment was added (
fbf9076ee8). - Function properties and their framework (
03d457a221,b888ec4ac3), written to export data (323cf73091). - Analysis of “no return” (
e844d72421), results (3f0f76734e) and params (906a073b0b). - The call-site table (
19ca2337c5) and scoring (746f7e1744). The message says the adjustment values are arbitrary and “will almost certainly need tuning”. - Trace flags (
dab9c502c4,a9cfbec17b). Budget computation was refactored (6eb31c1a00), and the func-level never-returns flag is used (eac1f3e461). - Inlining is decided by score, with the relaxed
CanInlinebudget (0b07bbd2be). - Rescoring by result use (
00073c25f6), ConstExpr removal (0725410df5,4651c0c6d9,a86ef0409b), the “returns inlinable func” heuristic (f56c293319), and call-result scoring (9e90a15ba4). - Inlinability is revised by the largest possible score (
04d64a3b36). - The package-level table was removed, analysis was regionalized, and call sites exposed by inlines are scored (
74350dd603,993ca35bd4,a0df23888f). -d=inlscoreadj(8d41d053e0).- Analyzers,
ir.StaticValueuse,AnalyzeFuncand scoring were refactored (d21afcdf00,bbcd85528c,3f04f959d2,322cd4e807). - Fixes and speedups:
3255fca993,5239c91351,cfb281754e,15fa7a84b8,d3d5173759,9d3b3416a4. - Enablement is checked via
internal/buildcfg(5b6d3dea87).
746f7e1744says the score values need tuning; the experiment stayed off. - The experiment was added (
- Prove pass and bounds-check elimination: from poset relations to a dense limit table, topo-sorted walk, and division-aware proofs — Done: loops are rewritten to count down so only the iterator stays live. This covers
for i := 0; i < n; i++, index-freerangeover a slice, and range-over-int (bac4e2f241, #61629).findIndVarno longer matches disjoint loop headers (8b4e1259d0). Left open: nothing noted. - Memory-op optimization: memcombine, dead stores, store-to-load forwarding, alias analysis, mem2reg — Done:
- Memcombine of stores whose values come from consecutive loads (
e713d6f939). - memcombine state is reset between blocks (
08cdfd06ed), and big-endian multi-byte elements were fixed (bda1ef13f8). - DSE handles constant pointer offsets (
43b57b8516, #63657).
- Memcombine of stores whose values come from consecutive loads (
- Lowering of builtins to memory ops: memmove/memclr/memequal inlining and generated equality — Done:
s==sis folded to true for strings, which matters for NaN tests in generic code (d0964e172b, #60777). Left open: nothing noted. - Switch lowering: jump tables, type-switch caches, and switch lookup tables — Done:
- Jump tables for large type switches (
4711299661). - Interface type-switch improvements (
28f4ea16a2) and the type-switch cache (39263f34a3). - Caches in front of type assertions (
cbcf8efa5f) andconvI2I(afd7c15c7f). - The type hash comes from the itab field (
e0948d825d), using the new runtime type mechanism (9ab5121691). - SCCP propagation into jump tables was fixed (
788a227759), and so was constant-folding an out-of-range index (f6509cf5cd).
- Jump tables for large type switches (
- Loop variable per-iteration semantics (loopvar) — Done: user-visible the new semantics apply to files compiled at Go 1.22+, with version-dependent handling of the experiment and debug flags (
fe1daf2e43). Left open: nothing noted. - Range-loop and range-over-func lowering in walk — Done: user-visible range over integer, initially behind
GOEXPERIMENT=range(a94347a05c). Room for rangefunc defers (390763aed8). Left open: nothing noted. - Sparse conditional constant propagation (sccp) — Done: resubmission (
4ee1d542ed) after the first version broke a dominance relationship caught by ssacheck. Left open: nothing noted. - SSA values for zero-sized and multi-field direct-interface types — Done: zero-sized values dropped from call expansion (
1493dd3cfc); decompose shortcuts apply forPtrShaped(eb832afb23).
Other changes
- Compiler plumbing cleanups (~35 commits) internal — remove
ir.CurFuncuses, TempAt, NewFunc API, AllocFrame after Compile, instrumentation moved into ssagen (89eb6b76ae,78f90511ec,9c9fcabb02,5d6f835b3e,d2e2da83b1); staticcopy made safe (afa3f8e104); GOSSAFUNC ABI-aware dumps (a903639608); funcdata encoding for large frames (da7ac77380);mulUintptrremoved (53827ba49e); range-over-func defined iter type fix (881869dde0). - Open-coded defers optimized internal — defer closure slots contiguous so metadata holds one offset; active-count dropped in favor of top set bit of the bitmask;
_deferfields pruned (bb5974e0cb,0c2abb3233,8c5a54f698). - Inline heuristics prerequisites internal — flag calculation via export data and call-site flags (
d2024a091d,dc0548f92f); “New inliner heuristics” thread extension. - Stack layout internal — locals sorted by alignment, not size (
4198193035); reflect-method DCE:MethodByName(literal)keeps DCE (e802f211b0,07faf8fab5). - Walk/ssagen cleanups internal —
walkGrowslice(a2647f08f0), share hmap/hiter/_defer/scase types (42f4ccb6f9,e7240ed886,fecf51717f), copy SSA-able variables (00715d089d, fixed5a329c3bfb1.23), pointer arithmetic after nil check (962ccbef91), non-pointer writes inside write-barrier region (556e9c5f3e), expandCalls arg marshalling in call block (e72ecc6a6b).
Backends and assemblers · architectures, ABI
From Compiler backend: architectures, register allocation, ABI and assemblers (Go 1.18–1.28)
- Register-based calling convention (ABIInternal) ports beyond amd64 — Done: loong64 regabi: registers changed to avoid ABI arguments
070139a130, register infoebca52eeb7, spill supportbd224fa522, CALL ops6b77d1b736, obj prologuee58c9baa9f, enablede5615ad876; duff registers movedf43581131e.obj: unspill code in prologue marked preemptible2b3c1c5937. Left open: s390x. - Register allocator, scheduler and block-level backend passes — Done: scheduler special case for entry block removed
505e50b1e3; loong64 dynlink no-op in regalloc08b9640333; liveness stackmap excess bits removed05d4b57c9f. - amd64 code generation and GOAMD64 microarchitecture levels — Done: shorter MOVs for clears of 9–12 bytes and MOVQ+MOVL for 11-byte moves
3d4f41aea8,a65b4904fc; indexedSET*ops67983c0f78; direct memoryBTS, avoid BTS when OR works611706b171; hardware float min/max (amd64+arm64)319504ce43; PCALIGN accepted on 386/amd64f322d67ced; ANDL/TESTL if upper 32 bits zero (reverted0e02baa59a). - arm64 code generation and assembler — Done: large constants into vector registers via rodata
0a17b2c174; fewer literal-pool uses (208fc13245,19e2e3c291); InvertFlags absorption into Noov comparisonsfb5bdb4cc9,ace1494d92(saves an instruction: CSET,CSEL instead of CSET,CSET,BIC); top 32 bits kept zero for 32-bit opsa9bedc36a5; frame pointer restore in epilogue fixedc9888bdfe2. - riscv64 compiler and assembler (RVA profiles, vector, compressed) — Done: shift lowering for int32/uint32 (srlw/sraw/srliw/sraiw replace extend-then-shift)
561bf0457f,8fc043ccfa, correctness fix70c7fb75e9; FMA performance05f9511582,63ab68ddc5; atomics mapped per RISC-V spec (amo.aqrl; lr.aq/sc.rl) 890b96f7ab; call relocation reworkbda5e6c3d0; PCALIGN9840d38cdb; publicationBarrier intrinsicd98f74b31e. - loong64 backend and assembler — Done: regabi, Lowered{Move,Zero} improved
3754ca0af2, duff cleanup06f420fc19. - PPC64 / Power10 backend (GOPPC64, prefixed instructions, PC-relative code) — Done: 34b ADD/MOVD constants
e9379a8f8b,061d77cb70; masking codegen5cdb132228,c8caad423c,773039ed5c; avoid ANDCCconst80834af206,9341046302; RLWNM/RLDICR5f872db5fc,41c71d48a1; lwsync on failed CAS so notesleep/notetsleep see wakeups655155d0a7; mask/small-constant in-register generation (36ecff0893,dcd018b5c5); KDSA/KMA/KMCTR are s390x. - Late-lower pass, memory-op combining and arch-independent rule migration — Done: consecutive-load memcombine
e713d6f939. - Prologue, frame pointer, stack split and function alignment (cmd/internal/obj) — Done: PCALIGN on 386/amd64
f322d67ced. - Multi-word arithmetic, intrinsics and carry-chain support — Done: Add64/Sub64 on mips64
5f8a2fdf09,b1474672c6. - Atomics and memory-ordering code generation — Done: riscv64 atomics per spec
890b96f7ab; ppc64lwsyncon failed CAS655155d0a7. - s390x, MIPS, 386 and 32-bit ARM backends — Done: s390x KDSA/KMA/KMCTR crypto instructions
61719e18f7,ed8cbaf6ac,a40404da74,b06f59e75c.
Other changes
- Remove asm
-compiling-runtime;""package prefix internal72946ae867,22f9e0ef52,b3faace3f7,ad74bc4a92. - ARM floating point option user-visible
ee6b34797b. - ssa API cleanup simplified
NewFunc9c9fcabb02,Frontend.Autoreplaced byFunc.NewLocal5d9e0be159. - ID-to-PC translation semantic clarified
e6b154defb. - 8 small obj/riscv and riscv64 rules commits internal — e.g. cc: sign or zero extend for 32 bit equality on riscv64; cc: fold most repetitive operations to simplify riscv64 rule; obj/riscv: support subtraction with a constant. (
33da4ce457,ada5f8a46d,dc74a3dd4f,13d5ca42fd,216c512198,e816eb5014,f711892a8a,d33548d178) - 7 small obj/ppc64 and PPC64 rules commits internal — e.g. obj/ppc64: do not assemble non-constant rotate RLWMI; cc: add rules to avoid unnecessary MOVDaddr for PPC64; cc: update to rules on PPC64 folding bit reversal to load. (
d80f3966b8,b7e0dfc437,3550a84840,d580460f07,566d94fe69,3128aeec87,7e5ed466bb) - 9 small obj/arm64 and arm64 rules commits internal — e.g. obj/arm64: move register encoding into opxrrr; obj/arm64: factor out splitting of 24 bit unsigned scaled im; obj/arm64: improve splitting of 24 bit unsigned scaled immed. (
499a120099,af297c3555,6eaad824e5,3313b39bae,2a1ba6ebb1,8a1ff51827,02482a546f,91bb19a59a,78b42a5338) - 19 small ssa/regalloc/liveness/obj generic commits internal — e.g. obj: print relocation type by name in -S output; cmd: fix mismatched symbols; abi: stop using types.Func. (
5f9412911b,6d5ea923a2,d5cd55a289,b0a17c0489,c6dd97e533,0b47b94a62,c1dfbf72e1,50bd17205f,eaae2d45c7,c9bb7ce2d7,af8a2bde7b,c0e2a9dffd,dc0d126e37,36b14a78b5,a903639608,1493dd3cfc,eb832afb23,070c1fcbc5,cbc403af1d) - 5 small mips/s390x/arm/wasm commits internal — e.g. obj/mips: use obj.REG_NONE rather than 0; obj/mips: use more appropriate register types for OP_RRR; obj/mips: use more appropriate register types for OP_FRRR/OP. (
24af43fa66,f6966577a2,789980ec0e,b60bf8f8e1,f8170cc017) - 2 small obj/loong64 and loong64 asm commits internal — e.g. cc: fix If lowering on loong64; obj,cmd/link: access global data via GOT in -dynlink mode on. (
b3b442449b,346e06c46d)
Linker and object files
From Linker, object files and debug info (Go 1.18–1.28)
- DWARF quality for debuggers (types, variables, trampolines) — Done: user-visible
-sno longer disables DWARF on Mach-O; flags rationalized1d84c89bec,4d21b3ec2d,15eea6a193; fix of go-kind for synthetic ptr types37971b31df; DWARF off by default for c-shared on darwine924ea03cc;Sym.Lengthreplaced byContext.Size227ec02824. Left open: nothing noted. - Dead code elimination and reflection-aware pruning — Done: special cases for Method/MethodByName removed
6b52bfa393, test casesbb74a53c21; rename toR_USENAMEDMETHODb4c889b561; deadcode of global map vars avoided for plugins660620dd45. Left open: nothing noted. - Reproducible build IDs, buildinfo and symbol tables — Done: user-visible
-B gobuildid089cc68676. Left open: nothing noted. - Per-platform object formats and internal linking (Mach-O, PE, XCOFF, wasm, ppc64, riscv64, loong64) — Done: Mach-O symbol-targeted relocations always
be910bf2fd,bad9ca8a61,ac81156bce; no DYSYMTAB for external Mach-Of55e7e104b; riscv64 internal cgo linking and call relocse68c027204,bda5e6c3d0; openbsd/ppc647f92dcc88d; loong64 plugind7fcb5cf80; .pdata/.xdata merging from host objects3aa2823d8b; arm text split1e69040920; per-package text addresses landed then reverted7e1713e93c,7c446bab63. Left open: nothing noted.
Other changes
- Mach-O and PE details internal — symbol ordering and zero-sized local symbols for dynamic linking (
1c10d743ea,e417698e84), dsymutil/strip printed in-v(5bf8f533f0), ld-prime warnings (040dbf9c18), PE xdata/comdat fixes (17211b64b6,a95c5d37f2,d4430f6913),.shstrtabfix (3251006291), start address alignment (d66fc90a0d), loong64 relocs and paths (ed26e2fe34,39d3c4ad35,02d581ef53), riscv64 TLS and openbsd (9ff0116229,95ef1e7efc), runtime-package check generalized (88a6df72c9,fbcf43c60b), bisect flags (5abf00e4f0), string symbol names not mangled (b65e34f038),Headersize fix (f0b05092fd),PathToPrefixinverse (696fb5ead0). - Shared-mode package initialization internal (
fd54185a8d). -Rvalidation, flag order determinism internal (11b08a75cd,57e2eb64eb).