Go 1.23
Timer rewrite with GC-able synchronous timer channels. Range-over-func ships. unique and internal weak pointers. Linkname lockdown. v1 tracer deleted. Profile stack depth 128. First spinbit attempt (reverted). Stack-slot merging. GOARM64/GORISCV64.
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: GC CPU pause accounting became exact. The pause update was factored out (
08a7ab97ba) and usesmaxprocsinstead ofstwprocs(ae0a08dee9). Pause time now starts when the world is actually stopped, removing overlap with idle time (d4395ebc0c), and the time Ps spend in_Pgcstopwhile stopping is added back individually (e995aa95cb). The limiter consumes these values. Left open: nothing noted. - Heap bitmap rewrite and allocation headers — Done: user-visible the experiment and old code were removed (
9f3f4c64db). Headers made large pointerful zeroing preemptible (de3a3c9ebc, publication thread). Left open: nothing noted. - Finalizers, runtime.AddCleanup and the cleanup queue — Done: user-visible doc note on method receivers in
SetFinalizer(f7c330eac7). Left open: nothing noted. - Weak pointers and the unique package — Done: user-visible
internal/weak(dfc86e922c) and theuniquepackage withMake/Handle(a088e230d4); string clone viastringslite(4dccb78582);HashTrieMapiteration (3a3837f422). Left open: the weak API was internal only. - Object pinning (runtime.Pinner) — Done:
runtime.debugPinnerV1, a self-pinning Pinner for debuggers usingdebugCall(7f9edb4225). Left open: nothing noted. - Mark worker scheduling and GC work queues — Done:
gcBgMarkStartWorkersuses channels instead of notes, sorunnextcan hand off directly (5dceddfe7c); data/bss root jobs computed in one loop (0b1b6c1589). Left open: nothing noted. - Allocation publication, zeroing and preemptibility — Done: preemptible zeroing of large pointerful objects (
de3a3c9ebc). Left open: nothing noted. - Sweeper termination and pacing — Done: large-object stats updated before
freeSpan, fixing/memory/classes/heap/unusedunderflow (36d32f68f4). Left open: nothing noted.
Other changes
- allocfreetrace replaced by traceallocfree user-visible —
GODEBUG=allocfreetraceremoved (11047345f5). Thetraceallocfreeexperiment records alloc/free events in execution traces, with a batch carrying heap base and alignment for ID compression (724bab1505,efe7a1f5d3,ca1d2ead5d). - time.Timer no longer embeds runtime timer state internal — touches the scavenger’s timer use (
bc20704c26).
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: Cox’s stacked refactor, deliberately in tiny steps: delete
addtimer/clearDeletedTimers(4a3c3ec996,77f0bd01fb), merge statuses (b2bd7ebafc,09bfea95cf,3be36e9b20,ed0ad591d3,db8c6c8c7a), introducetimer.lockand use it in deltimer/modtimer/cleantimers/runtimer/adjusttimers/moveTimers (51df232b12,2fb5ef889b,58911599e8,d1e8dc25ff,1df6db8e4f,c6888d9264) with a new lock rank (b5a99eaa94),status→stateand method-ification (a155a2f8a1,370c8e983b), per-Ptimersstruct (adc575e64c; the message doubts the pair of atomic int64 deadlines hide missed wakeups), then the state cleanup above (6135651867). user-visible GC of unstopped timers (508bb17edd) and synchronous Stop/Reset (966609ad9e). Follow-ups: use of per-M/P timers needsacquirembefore choosingts(lost-sleep flake2965dc9895), zombie count fixes (40cc3eb278,e38be310a4),timers.wakeTimerace (85bbb12141), Ticker.Reset spurious race (24fa7544b0),adjustfast path (1c864333ca), avoiding netpoll wakeups at timer creation (84b190ad3c),cleanHeadoptimisation (97f1b76b4b), restoring the older adjust call order because it measured faster (77d9cb8937), timer race (fae6eb5f2f), heap sift simplification (d0051be847), debug tracing (38723f2b38). Left open: Stop/Reset racing a running timer returned wrong results. - Runtime mutex: tri-state futex/sema locks → “spinbit” mutex — Done: first attempt at futex lock redesign for profiling blame: share the sema
lock2structure with futex locks and double-link the waiting-M list (be0b569caa,d881ed6384,dfb7073bb8), plus unlock-time contention profiling (ba1c5b2c45,8ab131fb12). All five commits reverted on 2024-05-29 (1be701a344,5dead59add,afbbc2894b,3f4be127bc,9114c51521) because the patch series reduced the maximum throughput of contendedruntime.mutexand regressed applications where that is the bottleneck. Left open: both a scalable lock and a correct blame-the-unlocker profile. - Contended runtime-lock profiling (mutex profile for runtime-internal locks) — Done:
acquireLockRankalways acquires the M som.locksis consistent when deciding whether profiling is safe (4bb67bc21e). Unlock-blame attempt reverted (see spinbit thread). Left open: blame semantics. - Scheduler core: spinning Ms, work conservation, stealing, STW interaction — Done: idle-P race in
injectglist(24070cf747);runnextdisabled on wasm (no sysmon to prevent runnext ping-pong starvation) — added and reverted (0c64be46ac,a6a5c30d2b,4afb155cdf); trace acquire/release across all P steals (c9d88ea2aa). Left open: nothing noted. - Coroutines (
iter.Pullruntime support) — Done: thread-lock state is bound to the coro at firstnewcoro; full lock state (counts and locked thread) must remain identical thereafter; simple nested/serialiter.Pullstays fast while exotic cases fail (dfe781e1eb); goexit propagation from iterator inPull(9d2aeae72d). Left open: restrictions “may consider lifting”. - sync package API evolution — Done: user-visible
Map.Clear(5b6cd3d0cb,3b0d39c5da). Left open: nothing noted. - sync/atomic and runtime atomics — Done: runtime atomics moved to
internal/runtime/atomic(4c2b1e0feb); user-visibleatomic.And/Or(192d65e46b). Left open: nothing noted. - Runtime lock ranking — Done:
acquireLockRankAndM(4bb67bc21e);lockWithRankMayAcquirenosplit (3959d54c0b); sched/allp < timers rule removed (854dea060e). Left open: nothing noted. - Netpoller — Done: Windows websocket handling moved out of the runtime (
d0dc93c8e1); netpoll event sources identifiable on Windows (1de46564a7). Left open: nothing noted.
Other changes
- Trace/GC CPU pause metrics internal —
d4395ebc0c,e995aa95cb; stack ownership check for traces (d6a3d093c3); frame pointer in syscalls (2b82a4f488,6737f4cee5, and later54fe0fd43f1.24). - Timer plumbing leftovers internal —
8a493a6672,3ad5cd4741,c961ab3fe9,3c39b2ed11,7381123235,b2e9221089; sync cleanups (5bce5362da,36cd880878). - Misc internal — pahole struct sizing (
552faa8927);profstackdepthGODEBUG (66cc2b7ca7); pc buffers to M (2141315251);kqparameter (1c924572d0); Windows netpollBreak identification (29746b4814); mips And/Or (9623a3586f), linknames (6ec291f495); exithook safe for concurrent os.Exit (f85c40438f);casgstatusthrows on systemstack (0304d035cd); crashFD init (3d20a327a1); dead code (be29a02161); legacy linkname documentation (1d3d6ae725,05cbbf985f,2a7ca156b8,9a3ef86173); atomic Or doc (201129414f).
Data structures and type metadata
From Runtime: maps, built-in data structures, hashing, randomness and type metadata (Go 1.18–1.28)
- Map hashing and hash functions (memhash, aeshash, fallback hash) — Done: the 64-bit fallback hash
mix()first argument was attacker controllable (xor of input with constants) so zeroing the multiplier produced many collisions; it is now xored with the process seed (ef2f3391da), then constants xors removed/odd-forcing dropped (c260de24b6,35c619398b).hashkeywas deterministic because it was initialised beforerandwas seeded; now usesbootstrapRand(1a3682b4c1).memhash{32,64}lost their external linkname (2e9ed44d391.24, landed in the 1.24 cycle). Left open: nothing noted. - Compiler-generated equality/hash functions and type descriptor emission (reflectdata) — Done: itabs generated via the
rttypemechanism (977803e796), compiler usesabi.MapMaxKeyBytesetc. (4605ce2d34),MaxPtrmaskBytesmerged intointernal/abi(ff4e45fbc2). Left open: nothing noted. - internal/abi type layout unification and type metadata (rtype → abi.Type) — Done:
abi.ITabin reflect (f2db96cd6c),EmptyInterface/TypeOf/NoEscape(4742c52e10),zeroValmoved to internal/abi and then reverted back to runtime (2f5b420fb5,4c589d93ad),ifaceIndirremoved then restored “for now” (55a06f7920,2064413b54). Left open: nothing noted. - Interface conversion: itabs, type switch and assertion caches — Done: compiler generates itabs with
rttype(977803e796),2589a89468. Left open: nothing noted. - reflect implementation: performance, allocation and escape behaviour — Done: user-visible
reflect.SliceAt(d08a957298),Type.OverflowInt/Uint/Float/Complex(33013e8ea8), iteration methodsValue.Seq/Seq2,Type.CanSeq/CanSeq2(524a774634,b44600f83f),TypeForfaster for concrete types (2413629aa8),Comparabletrue for nil interface (e41fabd688), String kind inPointer/UnsafePointer(3d61f24835),StructOfsetsTFlagRegularMemory(99e12bee44) with an array fix (3330c69476), anonymous field name omitted from type string (2ff89341f6). Left open: nothing noted. - memmove / memclr / memequal / internal/bytealg assembly optimisation — Done:
strings.Compareintrinsified throughbytealg.CompareString→runtime_cmpstring, ~28% faster, becauseslices.SortFuncneeds a three-way compare (fd999fda59); arm64memequalshort-circuits identical pointers (66b776b025: O(n)→O(1), geomean 43.5ns→2.4ns; all other arches already had it); wasm memchr result extension fix (90c6558b6a). Left open: nothing noted. - Slice growth, string building and allocation-free bytes/strings helpers — Done:
Builder.Growsize classes (968b71bce4). Left open: nothing noted. - Runtime randomness: fastrand, chacha8rand and math/rand/v2 — Done:
internal/byteorderuse (8623c0ba95). Left open: nothing noted. - iter.Pull and range-over-func iterator types — Done: user-visible types
Seq/Seq2exposed without experiment (5a181c5042), double next/yield rejection (ff743ce862), panic propagation (1471978bac), Goexit propagation (9d2aeae72d), stop-before-next (1634fde4f9), doc from proposal (fe36ce669c). Left open: nothing noted.
Other changes
- Legacy //go:linkname documentation internal — a set of commits listing linkname users by dependent count (
5fee159bc2,bde905af5b,5fc5555feb,ef225d1c57,4cac885741,9a8995b8b6). - Panic values framed in tracebacks internal —
69e75c8581.
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: v1 tracer removed and v2 becomes the only one (
2c5849dc40, −3415 lines; flag removed55e4097cba); old-format reader (6133c1e4e2) and PC-based stacks (d3d390984b);GoStatusStackevent gives stacks to goroutines blocked for a whole generation (5879bf7e38); coroutine eventsGoCreateBlocked,GoSwitch,GoSwitchDestroyforiter.Pull, trace version 1.23 (c9c88d73f5); rewritten scalabletraceMap(5bba5b256c); user-visible experimental-event mechanism andGODEBUG=traceallocfreewhich adds 9 expensive events for heap/span/stack alloc and free plus a type-table batch (724bab1505,197101a84a,efe7a1f5d3,b6fa505c4a);traceAdvancebefore exit (20f4b6d8f9); package moved tointernal/trace(5890b023a5,664088b898). Attempted push-down ofsystemstackrequirement reverted for breaking longtest (5ec7395afc,9f13665088). Left open: tracer not reentrant; alloc/free events are experimental. - Frame-pointer unwinding in tracing and profiling; profile stack depth — Done: FP unwinding for block and mutex profilers (
f4494522dc); user-visible profile stack depth raised 32 → 128 for alloc/mutex/block/threadcreate/goroutine profiles using newinternal/profilerecordtypes with unbounded stacks (1b9dc3e178),GODEBUG=profstackdepth(up to 1024, back to 32) (66cc2b7ca7), regression fix (47187a4f4f); frame pointer tracked while in syscall (2b82a4f488); mutex profile record dedup (183a40db6d, reverted6948b4df8c, relanded87abb4afb6after fixing a bounds error and inline expansion). Left open: CPU/heap profiles still use the old unwinder;MutexProfileroot-frame regression (fixed 1.24). - Mutex and block profiles, including runtime-internal lock contention — Done: reverts of in-flight work (
ca7d300509restoring the GODEBUG,e6b8b2f3e2); FP unwinding for the profiler (f4494522dc) and dedup fix (87abb4afb6). Left open: unlocker blame still missing. - CPU profiling, goroutine profiling, pprof labels and the protobuf writer — Done: legacy profile parser removed from
internal/profile(2f6a25f447); one fewer STW when reading goroutine profile config (f96d9a6432); linker no longer disables memory profiling when onlyWriteHeapProfileis reachable (82c14346d8); stack depth 128 (see FP thread). Left open: nothing noted. - runtime/metrics and MemStats — Done: GC pause CPU stats updated inside the STW to remove a race, tests tightened by 10x (
017478a963); usesmaxprocsnotstwprocs(ae0a08dee9); IncNonDefault coverage test (74726defe9,418e6d559e,20b79fd577). Left open: nothing noted. - Coverage redesign: runtime/coverage, internal/coverage, covdata — Done:
go:linknameuses removed (180ea45566,df4e49366c,cd41d71785);-coverpkgpercentage fix (a85b8810c4,7196db9e66). Left open: nothing noted. - Race detector, ASan, MSan and Valgrind integration — Done:
internal/asanandinternal/msanpackages for use from std (db99b9b17c,e1e466f80c,8f7df2256e); wakeableSleep modeled in the race detector (0b12e3d81c); arm64 racecall saved-FP clobber fixed (234390e741); user-visible publicsync/atomicAnd/Or with race instrumentation (192d65e46b). Left open: nothing noted. - Crash output, runtime/debug, BuildInfo and debuglog — Done: user-visible
SetCrashOutput(1bb947b2eb, examplef0a862ee4d, dup semanticsb27d02c07b,CrashOptionsparam3f7a030e02, variadic removeda22cb5cabe). Left open: “placeholder for future options (e.g. JSON)”.
Other changes
- Tracer v2 residue (1.23 log) internal — EvGoStop Gosched reason (
287f791845), syscalling M IDs (c46966653f), WindowsEvFrequency(707eba9b94),traceMapcleared without write barriers (829f2ce3ba), non-atomic enabled check (52b5f164ae),traceReadCPUoff the system stack (9fa153b729), parser spilled-batch recovery (4513f1a1c1), experimental data/arg fixes (81d424ee9a,1ed8166192), dead code (be29a02161),ordering.Advancesplit (c2b1463153),gotraceeventstatstool (c3bd543cc3). Theruntimecontentionstacksremoval (87e930f728) was reverted (ca7d300509) and finally redone in 1.25. - os.FindProcess via pidfd reverted (
cdf3249d74,c4e4afc90e) user-visible. - Exit hooks moved to
internal/runtime/exithook, safe for concurrentos.Exitinternal (ff2070d939,f85c40438f). - Memory profile/lock tests internal —
f9ba2cff22reverted bye6b8b2f3e2.
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:
freedefersimplified (5a61d8d36b); user-visible panic values printed so every newline is followed by a tab, so a crafted panic value cannot fake a goroutine stack in tracebacks (69e75c8581); rangefunc panic messages reworded (6dd79d02f8). “Preempt more aggressively when panicking” (13766fe7d8) was reverted (18840865d2). Left open: nothing noted. - Unwinder: gentraceback →
unwinderiterator, inline unwinder, pcvalue cache — Done: exported runtime methods printed in tracebacks (a0d477cb6d),mcallunwinding on Windows fixed (a8ba163695); an attempt to printpc=0x..for inline frames was reverted (643d816c8b,386dcf4c93). Left open: nothing noted. - Symbol tables,
runtime.CallerandCallersFrames— Done: user-visibleCallersFramesinput may omit virtual PCs for inline frames (22f5e33031) so a[]uintptrcaptured withskipworks without changing the textual traceback format. Left open: nothing noted. - Stack growth, stack bounds and the crash stack — Done: remaining arches: s390x, loong64, arm, 386, mips (
cad6629144,f719d5cffd,727e8d3863,c764d56ff1,ff0bc4669e). Left open: nothing noted. - C-to-Go callbacks: extra-M reuse, system-stack bounds, init gating — Done: stack bounds always updated at cgocallback (
1ffc296717), saved/restored (76a8409eb81.24),x_cgo_getstackboundpthread attr initialized (35ef4a9f33),runtime/cgostack-bounds note (e45c262fe5),fatalfmarked noreturn (0286a0822b). Left open: nothing noted. - Security hardening: AT_SECURE, std fds, AT_RANDOM, gated debug features — Done: user-visible
debug.SetCrashOutput(fd for fatal panics,1bb947b2eb, plus638b9023e3,3d20a327a1); traceback framing (69e75c8581); cheaper permission changes viamprotect(cb12198de5). Left open: nothing noted. - Signals and async-preemption machinery — Done: ignored signal not re-raised (
be003bd00b),debugPinnerV1(7f9edb4225). Left open: nothing noted. - Syscall layer:
AllThreadsSyscall,internal/runtime/syscall, libc and WindowsSyscallN— Done: internal/syscall → internal/runtime (05c0579621); eventfd for epoll wake (d068c2cb62); EVFILT_USER for kqueue (519f6a00e4); nolockOSThreadper Windows syscall (1f354a60ff). Left open: nothing noted. - Windows runtime port — Done: IOCP high-res timer (
cf52e70997),winmmavoided (558919b454), websocket handling out of runtime (d0dc93c8e1), long-path check removed (c098400548),RtlGetVersion(cff7267e0d), no per-syscallLockOSThread(1f354a60ff). Left open: nothing noted.
Other changes
- Misc internal —
throwworkaround pending issue 67274 and write-barrier-freeconvTstring(9eebdca8a9,bf0b605dfb), PPC64 asmcgocall stack usage (0c39dc1ff7),traceAdvancebefore exit (20f4b6d8f9), Windows SyscallX parameter counts and nosplit cleanup (35fa852d6d,dda4b17ee4), cgo warning flags (4a7f3ac8eb,0784fd1b2f,8705675614), loong64/s390x And/Or atomics (76ff0caa59,1a8ee033f8),testinguses QPC on Windows user-visible (1c4704991a). - kqueue/epoll wakeups internal — see syscall thread.
runtime/internal→internal/runtimeinternal — (05c0579621, laterfc5073bc151.24 in 1.24 forsys).- Linkname policy internal — document legacy
//go:linknamefor modules with ≥2,000 dependents (519b0116a1; later guidance8d0bef7ffe1.26 in 1.26).
Compiler frontend · types2
From Compiler frontend: the types2 type checker (Go 1.18–1.28)
- Instantiation, Named types, Context deduplication and lazy expansion — Done:
7020beeffdoptimizes Named method lookup;210f051d6bdocuments the deterministic method order. - Type inference and unification — Done:
e85968670ebetter error when inference fails in a call; alias handling in unification (ee29dbe43e,0d478d8e07). - Generic type aliases and
Aliastype nodes — Done:15cec430d7flips the default togotypesalias=1in types2 (go/types had its own flip earlier in the cycle), though “the compiler still uses the non-default setting due to a panic” (9101bf1916controls creation viatypes2.Config).1a6498e1cbinitial parameterized aliases,f294ddeb29instantiation,4ed358b57erepresentsanyusingAlias,d68d485405gates alias type parameters onGOEXPERIMENT=aliastypeparams,bf279b71e2addsAlias.{TypeParams, SetTypeParams, TypeArgs, Origin},9b9de261bdaddsAlias.Rhs,13c49096fdrejects uninstantiated signature aliases,f1039180bdenables aliases for TestStdlib. Left open:1a6498e1cblists “instantiation of alias types” and API additions as missing at that point; the dev experiment remained. - Type declaration cycles, valid-type detection and the object path — Done:
a66a3bf494tracing,9f9008ce66disable an incorrect optimization in validType,13e5fd95f5better position for infinite types,83b2b47b5d,d186dde818/a555ac6332alias cycles. - Per-file language versions and version gating — Done:
8121604559do not fail fast on version errors,133c8fc9bbno version checks for embedded types of imported interfaces,5e00352b9bsingular wording,502347f121duplicate-method error in go1.13. - Language features as seen by the type checker (by release) — Done: user-visible range over func:
e15cc7ab82iteration variables may be omitted,26ed0528c7error for floating-point iteration variable,4e77872d16,fd99157f9drefactor ofrangeStmtfor clarity; generic aliases (alias thread). - Error reporting: codes, messages, and sub-errors — Done:
96e9838f39,5e3c4016a4,dc6a5cfca1quote user-supplied names,f81e498673better errors for non-existing fields or methods. - Sharing code between go/types and types2 — Done: eight generated files.
Other changes
- Position/syntax helpers internal —
bdb0a1abfcname position in struct processing,67361bf868,7731fd9cd3,a56834922f,8e02e7b26a. - Typed-API additions user-visible —
01064622a2Func.Signature,9b9de261bdAlias.Rhs, (f176f5e1a31.28 is 1.28). - Switch/Type fixes internal —
69e7b2bcd6typecheck cases even if switch expression invalid,ad87d44047,814e72f2ef,2c6f24c825. - Small fixes, unifier/assignment refactors, message and tracing tweaks internal — 11 commits:
8435659a43,10a65649a3,720306359a,61a3ee5441,e8f5c04c1b,cfbe6cd9bb,c51f6c6257,e718aee5f5,799968dfc3,06478e4b46,2fe2e4d593
Compiler frontend · syntax, IR, generics
From Compiler frontend: syntax, IR, unified IR and the generics implementation (Go 1.18–1.28)
- Unified IR: one serialization for noding, stenciling, inlining and export — Done: alias uses preserved in export data (
f9c0423ec8, viapkgbits.TypeNamed), materialized aliases exported/imported (b24ec88bb9),1e4de0584edescribes the export data. - Old typechecker and IR node-model cleanup — Done:
OPARENskipping more selective (6af27c49bc),wrapNameremoved (334835e6b3), remaining constant bounds check removed from typecheck (5428cc4f14). - Static initialization and package init — Done: user-visible constants before variables in init order (
8f618c1f53, a types2 change affecting program behaviour); static-init safety fixes (973befe714ODEREF,5038ce82b6OASOP inmayModifyPkgVar); init fixesbe152920b9. - Compile-time performance, concurrency and the self-PGO’d compiler — Done: PGO profile refresh (
7c52c064df, Template -3.5%, Unicode -5.1%, GoTypes -3.9%);cmd/preprofiletool to pre-parse PGO profiles (b7ae16e04b,e069587c8d); eq/hash algorithm andptrBytescomputed once inCalcSize(fcfd824e31,b40dc30d24) rather than on demand; telemetry counters (483a913a55,acda0107ba). - Frontend support for new language features and spec changes — Done: user-visible range-over-func enabled for Go 1.23 files (
d278d5bbdd), generic alias types (477ad7dd51,31c8150082enables aliases in the type checker),len(ch)/cap(ch)viachanlen/chancap(b6753baaed,61d6817c83),-lang=go1accepted (08370dcd9a), linkname referring to instantiations disallowed (849770dec9), rangefunc robustness (5a9dabc2ba). - The syntax package (parser, scanner, tree) — Done: KeyValueExpr start position (
4256ec1661),Pos.FileBase(8b990f2592). - Types package internals: size, algorithm kind, TFlag, SIMD flags — Done: algorithm kinds simplified (
d255792933), computed inCalcSize(fcfd824e31),ptrBytescomputed duringCalcSize(b40dc30d24); “mark pointer to noalg type as noalg” (b8c76effd9); itabs generated using therttypemechanism (977803e796). - Method wrappers and promoted-method sharing — Done: method wrapper comments; wrapper handling for aliases.
Other changes
- Stack slot merging internal —
MergeLocals+AllocFrameoverlap disjoint-lifetime autos (>3*PtrSize, same size / GC shape): merged89f7805c2e, reverted0bf6071066, re-landed off by default875332b8a2, default-on inecfddf4841. - Telemetry internal — compiler counters (
483a913a55,d79c350916). - Rangefunc internal — see language features;
5f50b1e3bffixes miscompilation switching over channels. - Unified IR: noder/writer/reader refinements and pkgbits (1.23) 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 (532c6f1c8d) - Generics: dictionary/shape fixes in the stenciler (1.23) internal — fixes in dictionary passes for type assertions, comparisons, switches, nested instantiation packages, and recursive generic interface instantiation (
cda1e40b44,8b48290895) - Old typechecker and IR node-model cleanup (1.23) 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 (
dcf046f021,508e761978,bf91eb3a8b) - Syntax package: error messages and parser tolerance (1.23) internal — better syntax and go/parser error messages, accepted type-parameter lists, parser simplifications (
cc95d85fe4,71f9dbb1e4) - Housekeeping (1.23) internal — dead-code removal, ioutil/seek/slices/atomic-type replacements, README edits, debug-flag removal, assorted small bug fixes and doc comments (
109c7bbf8f,856355a913,b847d4cd2c,28e0052ee7,4d923e3f07,de487d5616,a245aced26,9a028e14a5,a49952445f,9702cd980f,3c72dd513c,b8a410c434,1cb13ac7f6,0b72631a82,b3b4556c24,ad77cefeb2)
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:
cmd/preprofilepre-parses profiles into a compact text format. The first versionb7ae16e04bwas reverted ina807295d43and reimplemented ine069587c8d.- The compiler checks the header without reading the whole file (
9819d8265f). - The shared parsing moved into
cmd/internal/pgo, with entries sorted by weight so deserialization needs no sort (63deaf00ea). The message reports PGO parsing falling from 13.7% to 1.3% of compile CPU. pgowas renamedpgoir(0c5612092d).- Call-site offsets are now assigned correctly (
185f31bf30). - Export-data lookup gained a debug log (
d037bba19b), method lookup bails on interface types (508e761978), and devirtualization gained a post-lookup cleanup hook (ca5ba146da).
- Inliner: budget, closures, and the interleaved inline/devirtualize driver — Done:
- Cost analysis was separated from applying inlining (
b158ca9ae3). - Runtime functions are not inlined under
-d=checkptr(f0de94ff12). - A fixpoint refactor (
a245aced26,28e0052ee7) was reverted in9159d71a37(#66261).
- Cost analysis was separated from applying inlining (
- Prove pass and bounds-check elimination: from poset relations to a dense limit table, topo-sorted walk, and division-aware proofs — Done: integer comparisons with numeric bounds improved (
bbd0bc22ea). Bug workarounds were removed from loop inversion (ff35c382eb). Left open: nothing noted. - Memory-op optimization: memcombine, dead stores, store-to-load forwarding, alias analysis, mem2reg — Done: bool constants are included in memcombine (
802473cfda). DSE treats equivalentLocalAddrs as equal (57026007c8). Left open:802473cfdapoints to “trickier cases … see TODO at memcombine.go:503”. - Lowering of builtins to memory ops: memmove/memclr/memequal inlining and generated equality — Done:
- Redundant
cmpstringcalls are CSE’d (1a0b86375f, rule fixed in9f9dd2bfd8). - Zeroing for
append(s, make([]T, n)...)avoids a past-the-end pointer (93e3696b5d).
1a0b86375fnotes a redundant</<=test remains “because the compiler doesn’t know that cmpstring only ever returns -1,0,1”. - Redundant
- Stack-slot merging (mergelocals) — Done:
- user-visible Initial merging (
89f7805c2e) was reverted (0bf6071066) and relanded default-off (875332b8a2). - Address-taken candidates were added (
82e929e4f8), and region formation was enhanced (e01b1eb289). - The flag was flipped on by default (
ecfddf4841).
89f7805c2enotes that the merge-locals liveness pass would ideally fold into the stack-map liveness pass, but “this may be difficult”. - user-visible Initial merging (
- Switch lowering: jump tables, type-switch caches, and switch lookup tables — Done: the jump table symbol is static (
2908352980). Left open: nothing noted. - Range-loop and range-over-func lowering in walk — Done: the closure pointer stays live for range-body closures (
44079f39eb). The body closure is named#yield%d(f27a40ce5f). Rangefunc constants are deduplicated intointernal/abi(997b6969fd). Left open:f27a40ce5fsays the name “may not actually be necessary”, pending confirmation with Delve. - SSA values for zero-sized and multi-field direct-interface types — Done: 0-sized value simplification in copyelim (
6f5d77454e).
Other changes
- Small internal — merge-locals trace tweak and stack var sort refactor (
26a1f4ae00,593daf785f), ppc64 rule fix (c6d142c4a7). - internal/abi constants internal — ITab offsets, map consts, trace consts, byteorder package (
b138b19d2f,4605ce2d34,7611d2e610,f3a743981d). - Combined passes and compile speed internal — phielim+copyelim merged (
69aa1974f3), rewrite-cycle detection delayed for huge functions (c686783cab),cap(ch)aschancapcall (61d6817c83), ARM64 LSE atomics without dynamic checks (0ae8468b20). - Fixes internal — zero-extension over signed values (
7f90b960a9), args not assumed zero-extended (6bf8b76b95), CAS atomics SSA bug (643865856c).
Backends and assemblers · architectures, ABI
From Compiler backend: architectures, register allocation, ABI and assemblers (Go 1.18–1.28)
- amd64 code generation and GOAMD64 microarchitecture levels — Done: user-visible
PCALIGNMAX align,amountdirective for fine-grained loop alignment (useful only on amd64 per measurements, none on Apple Silicon)18d0e6a14f. - arm64 code generation and assembler — Done: atomic And/Or intrinsics on arm64 (using register temp
v.RegTmp, results = old value)63c1e141bc; asm tests run for cross builds0def9d5c02;FMOVQlarge offsets (1.26)0c4444e13d1.26. - riscv64 compiler and assembler (RVA profiles, vector, compressed) — Done: user-visible rounding-mode suffixes on FP conversions (
FCVTLD.RNE, default RTZ)3580c212c2; hardware float min/max with qNaN pre-check09ed9a6585; Zba/Zbb/Zbs in the assemblerdb423dde85, native rotations for rva22u64 (significant SHA-512 gain)3659b8756a, rotation pseudo-instructions and canRotatedaa58db486,997636760e; rva22u64 MOV improvementsa6ecdf29e3. - loong64 backend and assembler — Done: atomic memory access instructions
504212bbd7; recheck jump offsets after loop alignmentf7f56ded01. - PPC64 / Power10 backend (GOPPC64, prefixed instructions, PC-relative code) — Done: float min/max
dfb17c126c; ADDZEc7065bb9db; CMP against $0408739fc96,cc673d2ec5; ADDconst/ANDconst reintroduceddca577d882; RLWINM combos (7994da4cc1,0222a028f1); 32-bit constant adds6e5398bad1. - Stack slot merging, liveness and stack maps — Done: intervals
7979c8f588, merging enhancements82e929e4f8,26a1f4ae00,e01b1eb289. - Prologue, frame pointer, stack split and function alignment (cmd/internal/obj) — Done:
PCALIGNMAX18d0e6a14f. - Atomics and memory-ordering code generation — Done: arm64 And/Or intrinsics (sync/atomic aliases)
63c1e141bc.
Other changes
- structs.HostLayout user-visible
22344e11f2. - Telemetry for cmd tools user-visible
eef288da1e,dbe03e4831. - linkname restrictions for new internal functions user-visible
4721f95058. - args_stackmap for ABI0 asm internal
0b72631a82. - 1 small obj/loong64 and loong64 asm commits internal — e.g. obj/loong64: improve the definition of plan9 assembly format. (
9ea4770e14) - 8 small obj/ppc64 and PPC64 rules commits internal — e.g. obj/ppc64: combine C_SBRA and C_LBRA optab classes; obj/ppc64: add new constant optab classifications; obj/ppc64: generate smaller machine code for OR/XOR of uint3. (
adbf71eb98,69f1290fcb,288615ddb5,d2eb72fcff,da732dd1c0,3aad2d0765,105ac94486,d5e5b14305) - 6 small ssa/regalloc/liveness/obj generic commits internal — e.g. cc: soften type matching when allocating stack slots; cc: fix sign/zero-extension removal; ssa: fix the description of auxCCop as auxInt. (
e930413331,a46ecdca36,734fd7a949,18dd682672,8056540772,a130fb6309) - 1 small obj/riscv and riscv64 rules commits internal — e.g. obj/riscv: check immediate for rotation instructions. (
20f052c83c) - 1 small obj/x86 and amd64/386 rules commits internal — e.g. obj/x86: make SEH symbols content-addressable. (
27603028eb) - 1 small obj/arm64 and arm64 rules commits internal — e.g. obj/arm64: fix return with register. (
b1fd047508)
Linker and object files
From Linker, object files and debug info (Go 1.18–1.28)
- Relocation-free pclntab and funcdata (offsets instead of relocations) — Done: pcbucketsize and minfunc constants merged into
internal/abi284e553035,40fab294de. Left open: nothing noted. - //go:linkname restrictions and the blocklist — Done: user-visible blocklist for newly added internal functions
4721f95058; pull-only linknames disallowed (-checklinkname, off)c4772d30bf; default on003683f41d; push linknames added for legacy pulls41aab30bd2; vdso linkname fix0bc684a994; flag documented148755a27b. Left open: only standard-library definitions enforced. - DWARF quality for debuggers (types, variables, trampolines) — Done:
DW_AT_go_runtime_typeforunsafe.Pointerb89ad46451; captured-variable DIEs carry a closure offset attribute (+0.06% size on a Delve sample)f048829d70; putvar/putAbstractVar refactored to a single abbrev table08029be9fc; range-over-func internal vars dropped82c371a307. Left open: nothing noted. - Dead code elimination and reflection-aware pruning — Done: deadcoded function symbols excluded in shared mode
98529a8e7c. Left open: nothing noted. - Linker performance and memory — Done:
-randlayout=seedrandomizes function order to test benchmark sensitivity5258d4ed60; profile files closed7b3c38045b,8bf9f4bb66; telemetry7fcf38d715. Left open: nothing noted. - Reproducible build IDs, buildinfo and symbol tables — Done: LC_UUID rewritten for external Darwin links
3bcefa5276. Left open: nothing noted. - ELF/relro/hardening and external-link policy — Done:
-bindnow88480fadcc;.dynamicand.gotinto relro2dddc7ef88(after revert of earlier attemptbe58fd0070); relro overlap fixa548dee75c; no-BTI marking on openbsd1e433915ce. Left open: nothing noted. - Per-platform object formats and internal linking (Mach-O, PE, XCOFF, wasm, ppc64, riscv64, loong64) — Done: loong64 reloc naming unified
0584574797; openbsd/arm64 PIE68d3a9e417; riscv64 local text symbolsb5a64ba62e; PE.relocalignmentf71c00b616. Left open: nothing noted.
Other changes
- Darwin and misc linker changes internal — unified OS/SDK versions and Mac Catalyst (
d90a57ffe8,cecbf4f28e), runtime.text.N symbols in dynlink (9a9dd72d5c), runtime.end placement (b589478af7), obj timestamp cleaning (3454ac0d63), host-obj capture/trace (a428387e97,ddc6e165fd), loadelf static calls (3b51581261), objIdx removal (c2c4a32f9e), abi map constants (b1a12dd2ed), loong64 musl path (128a99decd,7a072fc250), FromAssembly propagation (5c7d774538), ppc64 elf_* symbols (d2eb72fcff), dsymutil handling (5f319b7507), MinGW CRLF (e8ee1dc4f9),-c-archivear path (7bfc82429c). - GOROOT_FINAL removed user-visible (
507d1b22f4). - Runtime itab moved to internal/abi internal (
e0ee5b1afa).