Go 1.19
Soft memory limit (GOMEMLIMIT) and GC CPU limiter. Scavenger index redesign. Jump tables for switches. riscv64 register ABI. linux/loong64 port. Unified IR gains full generics support.
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)
- GC pacer redesign — Done: user-visible the old pacer and the experiment were deleted (
3334afd760). To support the memory limit, the goal and trigger are now computed on demand from current inputs, with a newtriggeredfield recording where a cycle actually started (129dcb7226). The maximum-trigger computation was rewritten to match its intent (473c99643f), and trigger math moved to integer shifts (973dcbb87c). gctrace now prints the correct goal (a6c75aa5c3). A late regression came from making alloc counts truly monotonic (79db59ded9), which also madeheapLivemonotonic and caused small-heap memory growth; it was partially reverted to a “non-monotonic overestimate” (1ebc983000), and the pacer went back to the precomputed trigger (85a482fc24). Left open: “in the future we should consider moving away from such a history-sensitive smoothing function” (85a482fc24). - Soft memory limit and GC CPU limiter — Done: user-visible the limiter was added and turned on unconditionally, along with a feature flag for memory-limit code (
01359b4681). Then came, in order: limit plumbing (986a31053d),mappedReady(4649a43903),sys*wrappers (f990b0f1e8), alloc/free counts (85d466493d),heapFree(d36d5bd3c1), stats moved intogcController(375d696ddf), the dynamic goal (129dcb7226), the limit-derived goal (7e4bc74119), allocator and scavenger enforcement (b4d81147d8), the exportedruntime/debug.SetMemoryLimit(f01c20bf2b), and theGOMEMLIMITparser accepting B/KiB/MiB/GiB/TiB (0feebe6eb5). Limiter refinements: a private assist-time pool (2eb8b6eec6), idle-mark and total-idle accounting (08d6c4c2b9,54bd44e573), cancelling assists (1f0ef6bec7), windowed accounting (d7941030c9), and a/gc/limiter/last-enabledmetric (cfccb5cb7c). Left open: the 61-bit timestamp can produce “hiccups” when the top bits change (d7941030c9). Thrashing with idle mark workers disabled (periodic GC) is not handled (08d6c4c2b9). The fixed 1 MiB headroom later caused eager scavenging (#57069). - Scavenger redesign — Done: scavenger refactored into a testable
scavengerState(d29f5247b8); chunk-index redesign (91f863013e,ccb798741b); memory-limit goal and allocation-time scavenge assist (b4d81147d8); physical-page-aligned allocations restructured so scavenged-bit accounting stays exact (b58067013e). Left open: finding work can mean iterating “across the whole heap”, giving “worse overheads for memory limit scavenging” (91f863013e). - Finalizers, runtime.AddCleanup and the cleanup queue — Done: the finalizer
reflectcallframe did not include the register-ABI spill slot and could clobber the caller; fixed (58804ea67a). Left open: nothing noted. - Mark worker scheduling and GC work queues — Done: periodic-GC idle-worker cap (
e1b5f347e7); idle workers disabled when a dedicated worker exists (d8cf2243e0); merged wbuf checks intryGetFast/putFast(86c8075675). Left open: idle workers are still “necessary for GC progress” when only fractional workers exist (e1b5f347e7). - Address-space layout, tagged pointers and the mem.go layer — Done:
sys*wrappers and consolidated docs (f990b0f1e8). Left open: nothing noted.
Other changes
- BoringCrypto GC-aware cache internal —
boring.Cache, a fixed-size concurrent map from unsafe.Pointer to unsafe.Pointer cleared every GC, replacing a hidden struct field; later factored intocrypto/internal/boring/bcache(a840bf871e,e845f572ec,8f9bfa9b7b). - 64-bit atomic field alignment test internal — (
6b6813fdb7).
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:
timerModifiedEarliestcleared when the last timer is deleted (c006b7ac27). Left open: nothing noted. - Scheduler core: spinning Ms, work conservation, stealing, STW interaction — Done: work-stealing order randomness fixed: with GOMAXPROCS=12 only 4 coprime strides existed so position and stride were correlated; now chosen independently (
510ad4561f). Scheduling decisions fromschedulemoved intofindrunnableso any M infindrunnablecan become a GC worker or trace reader andhandoffpsees all work sources (fixes #44313, #39004) (13b18ec947).runqgrabyields instead of sleeping on OpenBSD/NetBSD (226346bb76,b93ceefa7b). Goroutine-profile STW reduced to fixed bookkeeping with a barrier in the scheduler (52bd1c4d6c). Left open: lost-wakeup race when a non-spinning M drops its P. - Asynchronous preemption: extended register state — Done: loong64
asyncPreempt(740b0ebb76); arm64 uses stp/ldp (2e9facbdd4). Left open: nothing noted. - sync package API evolution — Done: happens-before documented for sync, atomic, finalizers (
a71ca3dfbd); Cond guidance (d42a48828f); semaphore-treap scalability tests (7bad61554e). Left open: nothing noted. - sync/atomic and runtime atomics — Done: user-visible typed atomics (
ffe48e00ad). Left open: runtime still uses old API. - Runtime lock ranking — Done: partial order edge for trace/wbufSpans/mheap (
482669db62). Left open: nothing noted. - Fast random numbers for the scheduler — Done:
fastrand64(ebe1435fbb). Left open: nothing noted.
Other changes
- Regabi condition cleanup internal —
d8bee94be2. - Closed channel receive fast path internal —
ca7c6ef33d. - Goroutine profile with barrier internal — race annotations (
209942fa88), STW reduction (52bd1c4d6c). - Syscall via RawSyscall on Linux internal — landed and reverted (
64e69d3925,bb004a179a,aac1d3a1b1). - Misc internal —
Pool.Putredundancy removed (507a44dc22);fastrand64use in net (a4bbcd4b1f); faketime jump usespidleget(13f6be2833); atomic alignment docs (0eb7051aad,69bb7c6ef5);m.procidalignment on 32-bit (ea7e3e3c0f); execution-trace profile prefers curg (7b1f8b62be).
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: array-equal loop unrolling (
1a955bcdb7), instantiating types excluded from type hash (d3672054fb),dupokadjustments for shape/non-generic types (884530b374,909a7a3213), incomplete itab always writesfun[0](6f5590edf6), struct comparison unification (3c29aca436), embedded bit moved from field offset to name bytes, leaving a full uintptr for offsets (e1e66a03a6), sort named types before unnamed for plugin signature (5b4fafd5db). Left open: nothing noted. - Interface conversion: itabs, type switch and assertion caches — Done: incomplete itab always writes
fun[0](6f5590edf6). Left open: nothing noted. - reflect implementation: performance, allocation and escape behaviour — Done: inlineable
Value.Type,MapRange,Bool,String,Bytes,Len,Cap(e948c3394e,c5edd5f616,67d6be139c,01837ca7eb);Value.Byteson addressable arrays (a5b8b56d1d);Len/Capon pointer-to-array (892cd0b636);SliceHeader/StringHeaderdeprecation added then reverted (bc2e961cf4,e6d8b05a61); map key type check inMapIndex/SetMapIndex(11a650bb4a);StructOfoverflow panics (c22a6c3b90). Left open: nothing noted. - Register ABI completion for reflect, memmove/memclr and bytealg across architectures — Done: register ABI always on for ARM64 (
8ff42d1bb1, fallback deleted9f252a0462) and PPC64 (b810a74da3,0a69c98214);RegabiArgsconditions dropped in reflect/runtime (d8bee94be2); riscv64 runtime/reflect/bytealg/memmove (8fefeabb35,b55a2fb3b0,0652274c10,be1d7388b3; reflect support reverted oncead646b33c9, re-added56400fc706/bb2b73635f1.23, float3293218ea1a7); loong64 support (2a5114f49a,96a10b9c84,d28bf6c9a2). Left open: riscv64 still gated. - memmove / memclr / memequal / internal/bytealg assembly optimisation — Done: amd64 memclr uses ERMS
REP STOSBfor 2KB..32MB (dcfe57b8c2, -8.43% geomean; 2KB threshold from Intel’s guide), AVX2-less memclr removed for GOAMD64>=3 (12acf9b0f0), pointer-size word stores in memclr (e0f99775f2), ppc64x memmove/memclr/equal/compare/index/indexbyte (9ccf5b8e86,91b9915d3f,8375b54d44,78fb1d03d3,7ca1e2aa56,5c707f5f3a), riscv64 memequal/compare (3c42ebf3e2,291bda80e5), dead code for GOAMD64 levels removed (330cffb8691.20 in 1.20 cycle, -14.86%). Left open: nothing noted. - Runtime randomness: fastrand, chacha8rand and math/rand/v2 — Done:
fastrand64inmapiterinit(01b8f5e882). Left open: nothing noted. - Classic map maintenance and maps package helpers (pre-swiss) — Done:
29bbca5c2c. Left open: nothing noted.
Other changes
- GOMEMLIMIT byte count parser internal —
0feebe6eb5. - Remove boringcrypto compiler kludge internal —
cdcb4b6ef3. - Skip exporting generic functions for plugin builds internal —
b79c135f37. - reflect and ppc64 fixes internal —
Valuepanic messages (8b389eb2be), receiver stored in pointer slot for reflect call (74f0ccb68b),Kind.Stringnegative kinds (0d71234ee4), ppc64x backward copy (d82c294da7).
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 CPU profile samples are emitted into the execution trace when both profilers are on, rendered as instant events in
go tool trace; samples from threads known to the runtime, including g0 and no-P contexts (2c0a9884e0);internal/tracegets Go 1.19 test data (bd4753905d). Left open: samples are best-effort (see 1.22 fix). - CPU profiling, goroutine profiling, pprof labels and the protobuf writer — Done: user-visible MaxRSS reported on all unix platforms (
c1f22134f2); inlining correctness in the proto builder: PC reuse by inline NOPs (bd77d6e240),allFramescache bug producing wrongC<-B<-A,Alocations (ba8310cf29),pcDeckindexing (0d33a99675); finalizer G handling and race annotations in the concurrent goroutine profile (8fdd277fe6,209942fa88);profBufread-before-advance fix (1926fa5f84). Left open: nothing noted. - runtime/metrics and MemStats — Done: user-visible
/sched/gomaxprocs:threads(ece6ac4d4d),/cgo/go-to-c-calls:calls(9bd6e2776f), last GC cycle with limiter enabled (cfccb5cb7c); total allocation stats stored as uint64 (7c404d59db); user-visibledebug.SetMemoryLimitexported (f01c20bf2b, GC area). Left open: nothing noted. - Race detector, ASan, MSan and Valgrind integration — Done: user-visible new TSAN runtime v3: 2x smaller shadow memory, vectorized race detection, fixed 512-byte vector clocks, unlimited goroutines; e.g. encoding/json CodeDecoder −56%, net/http ClientServerParallel4 −92%,
syncshort tests −82% (d6a1ffd624, syso995a604591); race on s390x (87cf92e7d5, syso7c680974c6), PPC64LE C ABI (c8110c3df6); ASan on riscv64 (9956996f6e); ASan global checks attempted and reverted twice (1e5987635c,507b70d1e8,265b5fd2f1); amd64 syso avoids SSE4 (846490110a). Left open: ASan instrumentation of globals (reverted for breaking cmd/go tests). - Crash output, runtime/debug, BuildInfo and debuglog — Done: debuglog avoids string allocation (
73587b71a6). Left open: nothing noted.
Other changes
- Race/ASan loose ends internal — darwin syso rebuilt for macOS 12 (
5f6552018d1.18), PPC64LE v3 syso (6f1dce0fcb),racereadrangeABIInternal (f566fe3910),metricsSemarace annotations (d6481d5b96), further ASan-globals attempts (f52b4ec63d,1b0f9fbb67), RUSAGE_SELF (3c2e73c8c3);internal/traceignores regions on system goroutines (123a6328b7). - Heap goal and trigger computed dynamically internal — needed for the memory limit;
triggeredfield added (129dcb7226, GC area). - Scheduling decisions moved into findrunnable internal (
13b18ec947, scheduler area).
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: don’t discard the value when panicking while panicking (
5a4f0b6f1e); panic helpers markedgo:yeswritebarrierrec(81d567146e,568590b085); user throws simplified, runtime throws expanded (4289bd365c). Left open: nothing noted. - C-to-Go callbacks: extra-M reuse, system-stack bounds, init gating — Done: cgo traceback on arm64 (
81767e23c2), unified C→Go ABI transitions on arm64 (eee6f9f825,2e9facbdd4); C-librarysigactionracing:_cgo_sys_thread_startmemset removed on linux/freebsd arm (7f71e1fc28,adfee1e1e7); g0 stack bound from frame address (3e97294663). Left open: nothing noted. - Library entry points and runtime initialization — Done: musl static/dynamic start-up detection on ppc64le (
946167906e). Left open: nothing noted. - vDSO,
vgetrandomand fast clocks — Done: s390x vDSO (636c5f0208), loong64 vDSO (8542bd8938,3fa5ab0d83). Left open: nothing noted. - Signals and async-preemption machinery — Done: preemption signal unblocked in new Ms (
e3982660a7), sigtrampTOPFRAMEon unix (4bb45f7549,cb8219a0711.28), debug calls on arm64 (9717e8f80f), TSAN delayed-signal fix (d29d0314c1). Left open: nothing noted. - Syscall layer:
AllThreadsSyscall,internal/runtime/syscall, libc and WindowsSyscallN— Done:RawSyscall6in runtime (15602e8865), ppc64 r2 fixed (78070ec3d4),pipe2/accept4on solaris (c3c74777bc,3e00bd0ae4). Left open: nothing noted. - Windows runtime port — Done: Breakpoint on windows/arm64 (
9fcc8b2c1e),_beginthreadretry (c7ccabf3fe), cgo thread-start bodies merged on Windows (91019cc13d). Left open: nothing noted. - New, ported and removed platforms — Done: linux/loong64 port (
2a5ceaaa78,c8de7628cb,0084706528,8542bd8938,a7cc865edb,34507e879d), riscv64 regabi reflect reverted (ad646b33c9), Goarch loong64 constants (30b17b6f60). Left open: cgo-traceback, plugin, msan for loong64. - CPU feature detection, GOAMD64 checks and cpu GODEBUG options — Done: required options can’t be disabled (
5ccd8e5133); PPC64IsPOWER8and CPU report (d9d55724bd,51859ec229); loong64 cache line (ec9258029e); AVX2-less memclr removed for GOAMD64>=3 (12acf9b0f0). Left open: nothing noted.
Other changes
- Sigtramp/ABI details internal —
ABIInternalfor mostsigtrampgocalls (ba7f3d98d4),TOPFRAMEon the rest of Unix (cb6fc99b32), loong64 flags (61fc5df689), PPC64 register save/restore stubs from the linker (9c9090eb1d),save_gnot NOFRAME on ARM (aeaf4b0e5b), 64-bit atomic alignment (0f715f1ac9),pipe2fallback removed (9d34fc5108), JS/Plan 9 write-barrier avoidance (364ced6255), Plan 9exitsstring (3cf79d9610), stack split during fuzzing (386245b68e), nosplit guidance in HACKING (c29be2d41c). - Boringcrypto/libFuzzer hooks internal — dev.boringcrypto merges (
6e70f88f84,3ed08db261), libFuzzer value profiling and string compare intercept (c1d197a96e,2b0e457b42,1821639b57). unixbuild tag internal — the newunixconstraint used across std/runtime (a2baae6851).- GOAMD64 internal/cpu internal — disallow disabling required options (
5ccd8e5133), IsPOWER8 (d9d55724bd), loong64 HWCAP etc.
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: field access through type parameters disabled (
b8248fab89), because it was not part of the accepted semantics. Inference disabled for type instances (28fab5ef21). Fixes for composite-literal key duplicates with a generic key type (2138124143: numeric key values are mapped to the smallest numeric type that represents them, so0and0.0collide). Thecomparableoperand check, pointer base types and alias-to-constraint handling were adjusted (3a5e3d8173,3ebb1720d9). Left open: nothing noted beyond the follow-on threads. - Type sets, union terms, interfaces and constraint satisfaction — Done:
0807986fe6and7dc6c5ec34(comparable in type-set intersection),35fb79be6a(overlap test for term lists),41fe746857(underlying type used in union computation),d4fb93be87(print|rather than a union symbol),269bf7e855and3507805bcd(better type-not-in-type-set / constraint-misuse messages),2ea9376266(split the “term cannot be a type parameter” message),86fa2551fb(parentheses around types in interfaces). - Instantiation, Named types, Context deduplication and lazy expansion — Done: a type-lookup-by-identity fix for method sets (
f088f4962e),OriginforVar/Func(1170771074), expansion no longer infinite (47e34ca533,70668a4144), Named state simplified (846f971daa,1323b0e8f0,02e69cfa96,d5ae7a6487),1a2ca95ad2(instance context only set if packages match),43b09c096a(record all instances even duplicates). - Type inference and unification — Done:
0807986fe6correct tilde handling in CTI (an imprecise~core type cannot determine an unknown type argument, but a known one must be unified against the underlying type; the whole loop is iterated untilunknownsstops decreasing).b004c739b5makes inference independent of parameter order. - Type declaration cycles, valid-type detection and the object path — Done:
07eca49055,fc97075949(simplify),7751883379,114d5deac2,70668a4144. - Method receiver checking — Done:
9b90838712preserve parent scope when substituting receivers. - Error reporting: codes, messages, and sub-errors — Done:
d4fb93be87,73475ef035qualified names in cycle errors,f9747b7f73, test tweaks.
Other changes
- Test infrastructure internal — flag mechanism for test files (
3395f74d86),.go2/.src→.gorenames (82b810f79c,4dc5553930), predeclared test functions separated (29866aa2b6),6be52abfa1removes unified-build exclusion. - Platform sizes internal —
8140a605feadds loong64 togcArchSizes;2aa473cc54alignment ofatomic.Int64. - Misc fixes internal —
d3fe4e193escoping of range-clause iteration variables,302f5ed21doverflow-check crash,104742fddaiota value,b75e492b35delayed field-name conflict check,0a6ddcc4f0(no unused-import error for unimported packages),9038c24498,f71daa6fe6,7cb1ae3e8e,2da1e47fb0. - Small fixes, unifier/assignment refactors, message and tracing tweaks internal — 10 commits:
20dd9a42fb,914195c132,efbff6e43b,5df3f491ac,4a46e6e44c,83327b4ae4,c05c0ca8cf,0a6ddcc4f0,3e58ef6cc7,c847a2c9f0
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: Unified IR gets full generic support with the same dictionary model (
0e2f1abf5bDynamicType for derived types,ac3ba97907itabs in dictionaries,7fc38802e1/f326964824method expression closures for bound calls,64b6e44ad7,fcf6afb82d).d3672054fbstops including instantiating type args in type hashes. Left open: unified IR still generated static*runtime._types from shape types at some sites (see RTTI thread). - Unified IR: one serialization for noding, stenciling, inlining and export — Done: quirks mode removed (
4f04e1d99f); sync markers simplified (6d881da9c8); coding-level logic extracted tointernal/pkgbits(7c151f3280); reader for types2 moved intoimporter(44e92e11c7), lazier import (258fc75505);-Gflag and dead old-typechecker noder code removed (302af4be8e,ad52356536,0fcb94895f,d6d2ebb7b8); pkgbits version number (d40e7bb174); fingerprints in the export format (42ca44494c) so iexport data is no longer needed for package fingerprints;9a9bd10290+e146d3eafaswitch to the final unified export format and drop backwards-compatible iexport output (GOEXPERIMENT=unified go teston generic code works without-vet=off); union types for the backend (efbe17d6f1). Reentrancy fix for function body reading (7c292ddf1f); implicit interfaces (21998413ad). Left open:e146d3eafa: importer sets the receiver type to the underlying interface “until we make a decision on #49906”. - Old typechecker and IR node-model cleanup — Done: removal of the old checker’s tail:
typecheckdef/Name.Walkdef(1cfe1007cd),OIOTA(d661bdeabf),Broke/Diag/SetBrokenmachinery (da9649e6d9,7ca6902c17,515135f4c3,c10fb50894,2792a414c6,0eb2c77124),AllowsGoVersionchecks (810868c9f6),typecheck.FuncBody(489e4882ef),NewClosureExpr(f25631b490). Then a sweep removing syntactic type nodes:Field.Ntype,Name.Ntype,Name.TypeDefn,CompLitExpr.Ntype,TypeAssertExpr.Ntype,ir.FuncType/OTFUNC(73fb829f59,14fed2c8f1,a6a49d128b,e94fe09c33,3ffc230a9f,27b844f767,025a9c3438,983906fa6d),cf66a82b0bprunes remaining Ntype nodes.Type.OrigSym->OrigType(adae6ec542: “first law of frontend development: thou shalt not rely on types.Sym”),Sym.Block/Lastlinenoremoved (79103faf2d). - Compile-time performance, concurrency and the self-PGO’d compiler — Done: fixed a compiler deadlock on syntax errors from the open-file semaphore (
5a90270d7f,370cadd0e4), 128-bit hashes for content IDs (485a572243). - Frontend support for new language features and spec changes — Done: user-visible
//go:uintptrkeepalive(342b495301),sync/atomictyped values alignment (0f715f1ac9), unsafe.Slice open-coded (579902d0b1), constant-fold switch early (01b9ae22ed, better codegen74b52d95191.21). - The syntax package (parser, scanner, tree) — Done: generic-specific parse modes removed (
bf408e741c),~xas unary expression (09ada1af8f), CheckBranches checksfallthrough(6b309be7ab, one-time branch/label checks666d736ecb), no parse ofGOROOT/.git. - Package paths,
-p, and build-system contract — Done: user-visible-prequired (a987aaf5f7), default-p=mainfor main (20ba3f5de5),LocalPkg.Pathset (ab8d7dd75e) after removing""assumptions in unified IR, iexport, staticdata embed symbols,ir.PkgFuncNameandCtxt.Pkgpathfallbacks (1973be519a,e3661d5f08,499e334a28,4170084ad1,2540f4e49d),-importmapremoved (1355ea3045),-installsuffixkept after revert, command-line flags parsed earlier (b6c5a5baa7),#ifdef-style ABI notes for riscv64 (1045faa38c).
Other changes
- Content hash width internal — 128-bit base64 hashes for content IDs (
485a572243). -L/doc fixes internal —9058080319.- Asan checks user-visible — unsafe.Pointer conversions escaping under
-asan(c379c3d58d), globals instrumented (1b0f9fbb67after two reverts). - Abort on stack-ful ABI internal — 128-bit values can be spilled (
c2d373d5d1). - Unified IR: noder/writer/reader refinements and pkgbits (1.19) 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 (82a6529905,7900576bac,a1bf50eefe,8c5917cd76,6382c39e15,4e4db1e257) - Generics: dictionary/shape fixes in the stenciler (1.19) internal — fixes in dictionary passes for type assertions, comparisons, switches, nested instantiation packages, and recursive generic interface instantiation (
8cf11694ab,2e46a0a997,8419ec295c,fa8efc1347,fd1b5904ae,c90a19a760,920b9ab57d,e99275241c,dbf5220475,085529bd5f,7eeec1f6e4,4045b1bc3f,ff17b7d0d4,34f3ac5f16,14abe8aa73,923740a8cc,27038b70f8) - Old typechecker and IR node-model cleanup (1.19) 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 (
dcb6547b76,947bf333fc,b10164b292,f5a42cd4b4,15381040fa,96a1ad298a,53647a1994,115c3bfad5,3abe8fe00b,5073c1c740,a7ab208cbb,72d1cb092e,6399b24539,1284cc2495,80f3e3deba,2a6e13843d,a8facc456f,a900a176bf,ccf84a9750) - Syntax package: error messages and parser tolerance (1.19) internal — better syntax and go/parser error messages, accepted type-parameter lists, parser simplifications (
a7e76b8e80,0775730180,e49b80a754,ea6c828455) - Housekeeping (1.19) internal — dead-code removal, ioutil/seek/slices/atomic-type replacements, README edits, debug-flag removal, assorted small bug fixes and doc comments (
d81464e1eb,9743e9b6d8,5fd0ed7aaf,1024503f84,e5e638e512,129a2fcf6c,63ea27e9e0,7e0a1d340f,3fd8b8627f,3dac99ad4c,b1e83c0513,3df9df8d6a,1e5987635c,12763d141d,c15d0a93c7,d4bfc87218,f52b4ec63d,ffe48e00ad,ac39dbdf58,3391517c0e,17dc7b487f,7b314d27ce,b89a194889,fd17a4dc09,d602380f58,1243ec9c17,558785a0a9,8e1e64c16a)
Middle end and SSA optimizer
From Compiler: middle end and SSA optimization (Go 1.18–1.28)
- Inliner: budget, closures, and the interleaved inline/devirtualize driver — Done:
- user-visible
selectbecame inlinable (80a7504a13). - The shape-argument restrictions were refined (
cb458c05a8,19156a5474,f2b1cde544).
- user-visible
- Escape analysis: call modelling, closures, func-variable callees, and solver speed — Done: values with alignment greater than
PtrSizeare forced to the heap (162b88265e). Under-asan, making conversions tounsafe.Pointerescape (5fd0ed7aaf,c379c3d58d) was reverted in599d5395eb. Left open: nothing noted. - Prove pass and bounds-check elimination: from poset relations to a dense limit table, topo-sorted walk, and division-aware proofs — Done:
- Results of
math/bitsoperations are known nonnegative (3bd8c78575). - Constants discovered by prove are folded: about 70k hits building
go, binary 0.04% smaller (e1e056fa6a). And(1efe38750a). Upper bounds<= maxintfixed (31b8c23c57).- The induction variable detector was reworked for correct overflow handling (
2acd3646fc, #53653, #53663).
2acd3646fcsays induction variable detection “is still not quite right”. - Results of
- Lowering of builtins to memory ops: memmove/memclr/memequal inlining and generated equality — Done:
memmovewith a known size is inlined on loong64 (a6c95e75d9). Left open: nothing noted. - Switch lowering: jump tables, type-switch caches, and switch lookup tables — Done:
- Jump tables (
1ba96d8c09); arm64 support (540f8c2b50). - String switches use a jump table on lengths (
3d8cb26504), with prove changes so the length test is not repeated. - Jump tables are off under
-N(78bea702cd). The table symbol is local (c5da4fb7ac).
go119UseJumpTableskill switch remained until 1.21. - Jump tables (
Other changes
- Fixes and cleanups (~35 commits) internal — walk litas removal, appendWalkStmt (
b922055572,ed462a66a5), static-init fixes (0bd7408f90,1c77137d4f), intrinsify mulWW on mips64/riscv64 (4d350710a2), ORN on PPC64 (c570f0eda2), rewrite-loop detector off for deadcode-only changes (15728ce950), regabi magic names removed (3f8a694155). - loong64 SSA bring-up internal — rules/ops and intrinsics (
ec5bdefd0a,900ae5b35a). - Open-coded
unsafe.Sliceinternal — avoids runtime call and lets bounds checks optimize (579902d0b1);arrayClearfor array pointers (0668e3cb1a); BSRQ with nonzero input (7d3b64a2e3). - Boolean lowering fixes on arm64/ppc64/riscv64 internal (
9ae7dc3040,90a11e921b,7a574ff23f,d6e6140c98); PPC64 FPR/XER regalloc changes (e84a37068b,33987b408c); Add64/Sub64 lowered in SSA on PPC64 (0c43878baa); more negation rules (e858c14f91). - Walk/select/map tweaks internal — no unreachable branch for select cases (
d9fd9201ad), map-literal hint counts all entries (aaa3d39f27), field tracking of unexported fields (7fd9564fcd).
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: user-visible riscv64 moves to register ABI: context register moved from X20 to X26
9faef5a654, duff device registers X10/X11→X24/X2529b968e766, ABI register infocaf5cd9da8, initial spill4d2da99498, CALL ops849e42f028, morestack/prologue6c17529af7, enabledd3362fc124.sys.Archgains LR and fixed frame size, replacingCtxt.FixedFrameSize8af7fac5a1,5f625de4d0.loopreschedchecksrepaired for regabi3b01a80319. Left open: loong64 and s390x still stack-based. - Register allocator, scheduler and block-level backend passes — Done: XER made allocatable on PPC64
a4a0f9b148(FPR31 reallocated33987b408c, F0/F27-31 allocatablee84a37068b); better propagation of desired registersbdd0f0f780;merge(stack merging helper) uses applicative balanced trees to cut sets sharing (heap −95% on the pathological test)857cda4625; carry chain scheduled disjointlyc386269ed8(1.7–2.4× on PPC64 crypto/elliptic multiplication). - amd64 code generation and GOAMD64 microarchitecture levels — Done: LZCNT (avoids BSR zero special-case)
a92ca51507, SHLX/SHRX/SARX incl. load forms and constant-shift folding (7fbabe8d57,d6320f1a58,517781b391,66f03f79da,cb702a2a56), MOVBE index/store32de2b0d1c,ba6df85c7c, false dependency removed for TZCNT96081f8545, BSRQ with nonzero input7d3b64a2e3, v3 bit-length intrinsic fix for 16/8 bits5a103ca5e9. - arm64 code generation and assembler — Done: jump tables on ARM64
540f8c2b50(following the amd64 jump-table CL); prologue/epilogue with STP/LDPc6d9b38dd8and small-frame prologue changed to save LR+decrement SP in one instruction because glibc cannot block SIGSETXID and a signal on the old stack would clobber below SP (frame 0x1f0→0xf0)64ef16e777;stacksplitoptimized31be6285a8; ANDconst+UBFX merge8ab42a945a; TLBI, DC, TRN1/2 instructions; fix ADR/ADRP/BITCON/SYS encodings. - riscv64 compiler and assembler (RVA profiles, vector, compressed) — Done: register ABI (see ABI thread); boolean comparison fix
d6e6140c98; two-operand forms94727bed02. - loong64 backend and assembler — Done: arch bring-up (above), SPWRITE FuncInfo
654b03167f, division-constant folding fixa2bca290e7. - PPC64 / Power10 backend (GOPPC64, prefixed instructions, PC-relative code) — Done: Add64/Sub64 lowered into SSA with XER CA elision and spill support, carry-chain scheduling disjoint
0c43878baa,3d7ca9f7c0,c386269ed8(1.7–2.4× on native crypto/elliptic multiplication); ORNc570f0eda2; BI argument of BC fix4a5711c3cf;bdnzmnemonics7b1ba972dc; publicationBarrierc9f67c289f; preferred nop86371b0360; ISEL CR bit arg2f23364340. - Prologue, frame pointer, stack split and function alignment (cmd/internal/obj) — Done: arm64
c6d9b38dd8,64ef16e777,31be6285a8;3562977b6f(mips, s390x, riscv). - Jump tables for switch statements on more architectures — Done: arm64
540f8c2b50. - Multi-word arithmetic, intrinsics and carry-chain support — Done: Add64/Sub64 in SSA for PPC64
0c43878baa.
Other changes
- Boringcrypto-related build fixes internal
16215e5340,e5407501cb. - -p flag required by cmd/asm user-visible
6e03de7b83;-d=pctabflagdb3045b4be. - obj sorting of relocations / flag to omit referenced symbol names internal
1a9972ec87,b89a194889. - BlockKind widened internal
83ee6c1d16. - 10 small obj/arm64 and arm64 rules commits internal — e.g. cmd/asm: refactor some operands that are not special registe; cmd/asm: add TLBI instruction on arm64; cmd/asm: add DC instruction on arm64. (
f5290ef947,26ab215969,62d4c32b7e,44a0da4ff1,49f16625c8,ecee4a3291,9ae7dc3040,90a11e921b,e6b5949a75,160414ca6a) - 1 small obj/x86 and amd64/386 rules commits internal — e.g. cc: use opregreg for x86.AXOR* ops. (
a4ffeb9edd) - 2 small obj/ppc64 and PPC64 rules commits internal — e.g. cc: fix PrefetchStreamed builtin implementation on PPC64; cc: fix boolean comparison on PPC64. (
7b15e297a2,7a574ff23f) - 2 small obj/riscv and riscv64 rules commits internal — e.g. obj/riscv: fix illegal form of MOV instructions; cc: cast riscv64 rewrite shifts to unsigned int. (
5dbfa6e61a,95547aee8c) - 1 small cmd/asm commits internal — e.g. cmd/asm: fix MOVK when constant has high bit set. (
a6f6932b3e) - 1 small ssa/regalloc/liveness/obj generic commits internal — e.g. cc: fix the missing size for FuncInfoSym. (
e845750744)
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: stop sorting pclntab entries (the sort was a no-op because all values were 0)
1f97f960e7. Left open: nothing noted. - DWARF quality for debuggers (types, variables, trampolines) — Done: no typedef DIE for
noalg.struct{...}f79a983891; no label symbols for DWARF on Windows/ARM64cccfb8ffdb. Left open: nothing noted. - Nosplit stack checking and stack constants — Done: new algorithm: Dostkcheck 7.9 ms to 1.8 ms (−77%), total link −1.6% on cmd/go, at +430% pass memory (40 KiB to 212 KiB)
e25f46e596; AIX output fix5834024057. Left open: nothing noted. - ELF/relro/hardening and external-link policy — Done: ELF compression default
d34287a4f6; DT_NEEDED for all 64-bita8f019e956; unlinkable object when compiled without-pe853464055; visibility-hidden fixes2049649e8b;-Wl,-zarguments38607c5538. Left open: nothing noted. - Per-platform object formats and internal linking (Mach-O, PE, XCOFF, wasm, ppc64, riscv64, loong64) — Done: loong64 linker
cc4957a5f6; PE COMDAT support and crt2.o1edc2769ca,a9d13a9c23; ppc64 TOC trampolinescaa46312ee, register save/restore9c9090eb1d. Left open: nothing noted.
Other changes
- PE internal linking and cgo plumbing internal — loadpe
__imp_*/COMDAT/ctor-list handling and ASLR recipe (0a5bbba366,821420d6bb,cdee8004ab,cc3a3519af,2fa45a4fcd), libsynchronization for-raceand PIE disabled there (c3bea70d9b,0c7fcf6bd1). - Symbol handling internal — ABI-mangling for linker-generated symbols (
9c7f0b1ccd), attributes preserved on cloning to external (df08c9a821), name expansion removed (e3f7816f0e),.TOC.relocations resolved (12420f9c01), carrier symbol alignment (c2c76c6f19,1d9d99b7ce), plugin unexported methods marked (91631bc7e0), GOROOT stamping (9ac75d3951,9a932c5712,2c92b2349a), fuzz counters (3f571d1dea), loong64 relocs (af99c2092a), FuncID fix (7c45dafdb2), LR/frame size in sys.Arch (8af7fac5a1). - boringcrypto linking internal — internal linking allowed for crypto/internal/boring, R_X86_64_PC64 (
d1351fbc31,19b89a22df). - Fuzzing counters internal — libFuzzer 8-bit counters (
7ec6ef432a).