Go 1.11
Sparse heap arenas and no heap-size limit. Indexed export format. Concurrent compilation of all functions. Safepoints almost everywhere, with register liveness maps. Prove pass reworked. WebAssembly port. Darwin syscalls through libc. Trace user annotations. DWARF compression. internal/bytealg. Debugger call injection.
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 Memory management: GC and allocator (Go 1.0–1.17)
Sparse heap: arena index, sparse bitmap and span map, no heap size limit.
- Hybrid write barrier and buffered write barrier — Done:
writebarrierptrcalls eliminated (245310883d), simplifiedbulkBarrierPreWrite(3e214e5693), short-circuit typedmemmove/typedslicecopy for dst==src (486caa26d7,3658299f44). Left open: nothing noted. - Precise heap scanning: type information, the heap bitmap and GC programs — Done: sparse bitmap (
c0392d2e7f,29e9c4d4a4,f61057c497),findObjectsplit (41e6abdc61,058bb7ea27). Left open: nothing noted. - Heap address space: contiguous arena to sparse arenas — Done: sparse arenas (
c0392d2e7f,d6e8218581,2b415549b8,ed1959c6e6,ec25210564,788464724c,45ffeab549,51ae88ee2f,e9db7b9dd1), TSAN heap hints (2d4c1ff739), Plan 9 hints (b1dbce31d7,c2cdfbd1a7), race-mode hint exhaustion (4946d9e87b). Left open: nothing noted.
Other changes
- Misc internal —
unsafe_Newcall chain shortened (8999b1d6c9),lfnodevalidation (b1d94c118f), assumption about wbBufFlush arguments (b800f202dc), scanblock avoidance (d91e9705f8), locals/args maps unified (3080b7d0af), mark-phase waiting factored (fcb7488add). - Address space comments internal — Moved the address space size comment to malloc.go and clarified the address space limit constants and comments. (
90666b8a3d,ea8d7a370d)
Scheduler and concurrency
From Scheduler and concurrency runtime (Go 1.0–1.17)
atomic redirected to runtime, RWMutex profiling, ancestor tracebacks, js/wasm callbacks; threads: atomics, diagnostics.
- Channels and select — Done: debugSelect toggle
dbd66fd3d0. - Semaphores, runtime locks and Notes — Done: semaphore waits distinguished from
sync.Cond.Waitin goroutine statuse13a213c7f. - sync.Mutex, RWMutex, WaitGroup, Cond, Once — Done: RWMutex in the mutex profile
88ba645827; WaitGroup space9ff7df003d; RWMutex race annotationf451a318bb. - sync.Map, atomic.Value and sync/atomic — Done: atomics redirected to runtime/internal
1b6fec862c,0a4b962c17. - Goroutine and M lifecycle: caches, ids, LockOSThread, Goexit, cgo extra Ms, deadlock detection — Done:
tracebackancestorsd9b006a705; waitreason as uint84eea887fd4,4d7cf3fedb. - Scheduler diagnostics: schedtrace, GODEBUG, execution tracer, block/mutex profiles — Done:
tracebackancestorsd9b006a705; RWMutex profiling88ba645827.
Other changes
- js/wasm callbacks internal —
ef9217e7bd,e083dc6307,acebfba755,6c6e22e5a9,91d326e734,4902778607,eb4f33243e,5d22cebb12,b03f1d1a7e,d6c3b0a56d,bb0fae603b,afae876b31,469ada6ed9.
Data structures and type metadata
From Runtime data structures and type metadata (Go 1.0–1.17)
internal/bytealg created, arm64 aeshash/memmove/Compare/Index, map fast routines in type-specific files, old ARM softfloat deleted, method-set sorting in the compiler.
- Hash map core: from the first hashmap.c to the 8-entry bucket design — Done: fast routines moved to type-specific files (
d58593d8aa),hmapfield removed from map types (4ebc67d334),new(hmap)in makemap (bf9f1c1503), map delete always clears the value because compound-assignment optimizations rely on it, at +12–17% onMapDeletefor non-reference types (b080abf656), literal-key string allocation avoided form[T{string(b)}](a0f57c3fd01.12). - Map fast paths and compiler/runtime specialization — Done: type-specific files (
d58593d8aa). - Hash functions and algorithm tables: memhash, AES hash, fallback hash — Done: arm64 aeshash (
73e0c302b2). - Compiler-generated equality and hash functions — Done: alg functions always generated when called (
c801232525). - Runtime type descriptors: layout, shrinking and name encoding — Done: method sets sorted earlier and by package height (
91bbe5388d,49ed4cbe85,86a338960d), unusedSig.offsetremoved (fd9d2898bd), deterministic anonymous-interface output (876c6d1f27). - Interface values, itabs and type assertions — Done: better assertion panic messages for identical-looking types (
75c1aed345,cda1947fd1),printanyno longer checks String/Error (804e3e565e). - reflect performance, caches and API additions — Done: avoiding
commonwhen type is*rtype(1dbe4c50f2), terminology defined/embedded (47be3d49c7), DeepEqual map reuse (c4f9fa1f8e), exported methods sorted first (86a338960d). - memmove, memclr, duff routines and pointer-write atomicity — Done: amd64 3/4-byte moves simplified (
910d232a28), arm64 memmove (213a75171d), jump-table TODOs removed after measurement (f864d89ef7). - internal/bytealg and string/byte comparison primitives — Done:
internal/bytealgcreated and populated (403ab0f221,1dfa380e3d,45964e4f9c,f6332bb84a,ee58eccc56,b382fe28a7,63bcabed49,f8b28e28f8), arm64 Compare/Index (bfa8b6f8ff,d31ee64186,d4e936cfd6,f8ef6ed24a),be9c994609, s390x comparison fix (a5f8128e39),findnullvia IndexByte (91102bf723; first attempt7365fac2dbcrossed page boundaries; GoString -28%). - Slices and append: growslice, makeslice and string/slice conversions — Done: power-of-two special case and PtrSize (
e53cc7ae93,37dd7cd040),gobyteswithout clearing (dfb0e4f6c7),_MaxMem→maxAlloc(d7691d055a). - Strings: concatenation, conversion and printing helpers — Done: length-1 string and
intstringstatics (9372e3f5ef,2f2e8f9c81),findnull(91102bf723). - Soft-float, 64-bit division and complex arithmetic helpers — Done: old ARM softfloat removed (
f83e421268), nacl/arm udiv (5a43a271e8).
Other changes
- Compiler/runtime small fixes internal —
functype(c26fac88d4), method expressions with anonymous receivers (950a56899a), Plan 9findnull(523f2ea77b), reflect docs and struct-tag stripping for unexported types (377567edd0,997d7a1893). - Comment and signature fixes for map and memmove internal — Corrected map code path names in comments and used Go signatures for memclr and memmove comments. (
48bfc8db51,f2cde55cd6)
Diagnostics and knobs
From Diagnostics and knobs (Go 1.0–1.17)
Trace user annotations (Task/Span/Log), allocs profile, race on ppc64le, pprof mapping flags.
- Execution tracer (trace v1): events, per-goroutine sequencing, annotations — Done: user-visible annotation API proposal that bumps the trace version to 1.11 (
32d1cd33c7) and its implementation: Task/Span/Log eventsEvUserTaskCreate,EvUserTaskEnd,EvUserSpan,EvUserLog, string table guarded bytrace.stringsLock(6977a3b257);internal/tracelinks span/task start and end, with a revert and reland of removing backlinks (1ae22d8cfe,16398894dc,d3562c9db9,d3946f75d3), computes span stats (68a1c9c400,ad638fbfb5,61f92ee56a) and sorts events deterministically (1764609b8b); benchmarks, and Region creation avoided when tracing is off, so pre-existing regions are no longer traced (3bf1644428); old functions deleted (c1492b6bd0,c7519f0dae); package summary reworded (444e7ddb27). Left open: “we can add the feature [tracing pre-existing regions] in the future” (3bf1644428). - Race detector integration — Done: user-visible ppc64le support with
race_ppc64le.sandracefuncenterfp(9e9ff565cd, 1.11). - CPU profiler and runtime/pprof writers (legacy format to compressed protobuf) — Done: user-visible
allocsprofile (cd037bce09); mappings setHasFunctions(7b2f55d89f) with a fake mapping when/proc/self/mapsis unavailable (ba02264446);SetMutexProfileFractionnegative values specified (3d8940a9ee). Left open: nothing noted. - MSan and sanitizer integration — Done: NetBSD thread sanitizer support in
runtime/cgo(f5921d48f1). Left open: nothing noted. - GDB runtime support — Done: sp set before pc (
cbc26869b71.7), goroutine N for running goroutines and tab fixes (24659717811.9,a7d7d7aec21.9), atomicstatus-based state and constants from the runtime (dc3bef3635,ef175731ff,ef400ed20a), sp switching (048988a0f11.12),goroutine all(8c1f78524e1.13). Left open: nothing noted.
Other changes
- Racewalk and compiler cleanups internal —
63f4ab98eb,b0d437f866,bbfae469a1,8da180f6ca; cgo traceback callback timing documented (0e0cd70ecf).
OS layer, stacks and panics
From OS interface, stacks and panics (Go 1.5–1.17)
Darwin/iOS syscalls through libc, js/wasm, debugger call injection, VDSO traceback, vDSO on arm/arm64, internal/bytealg, GODEBUGCPU experiment, graceful g0 overflow handling.
- New and ported OS/arch targets, 1.5–1.17 — Done: js/wasm (
80e69220c8,35ea62468b): no threads, hence no preemption and no sysmon at first; RISC-V names reserved (9446eaa944); freebsd c-shared (88129f0cb2). - Goroutine stack growth, shrinking, GC stack barriers and stack objects — Done: faster/inlinable stack copy (
605c9feeb1,5af0b28a73,31cfa7f2f2,2e7e57770c), entry stack map (0fd427fda7), g0 stack overflow handled gracefully on Windows (78561c4ae9), g0 stack bounds on Windows (52e782a2d6,99e9be8043,d6b56bb301), goid in split-stack throw (183fd6f19b). - Tracebacks, symbol tables and
runtime.Callers/CallersFrames— Done:ddb503be96(always treat the signal PC assigpanic’s caller), traceback from VDSO code (419c06455a) and outermost libc call (fe68ab3bcd), C backtrace from signal handler on darwin/amd64 (5929ead6fb),getcallerspdummy arg removed (22f4280b9a). - Defer, panic, recover and Goexit (runtime side) — Done: abort path unification (
c950a90d72,60a9e5d613), unrecoverable panic handling moves to the system stack (9d59234cbe), crash outside systemstack (b1d1ec9183), recursive panic on bad lock count avoided (4991bc6257). - Signals: masks, forwarding, sigaltstack and the unified Unix signal layer — Done: libc signals on Darwin/iOS (
ec989337c5,021c39d7a3,467e15accc,c2fdb42b16),rt_sigactiontosigactionrename (c2f28de732), SIGRTMAX/32/33 errors ignored (2aef675000,c0e5485bd5),os/signal.Ignored(dfb1b69665), abort handling on arm64/Windows (0def0f2e99,7001ac5394). - cgo runtime support: pointer checks, callbacks, extra Ms, C-to-Go call path — Done: C backtrace from signal handler on darwin/amd64 (
5929ead6fb), NetBSD TSAN (f5921d48f1), memory sanitizer on arm64 (e8d417d272), iOS SIGINT handshake removed (144fae8ed5). - Shared-library and buildmode entry points (c-archive, c-shared, plugin, shared) — Done: freebsd/amd64 c-shared and c-archive (
88129f0cb2). - vDSO, time sources and process-wide randomness — Done: vDSO traceback (
419c06455a), simplified linux 386/amd64 walltime (5b21bf6f81), linux/arm and arm64 vDSO (51b027116c,ea59ebd338), vDSO stack-switch check (9745397e1d), FreeBSD fast clock (744ccbb852,58c231f244,a9fc375258), libc time on Darwin (cc09212f59,6c6e22e5a9), auxv for FreeBSD/NetBSD/DragonFly/Solaris (2e84dc2596,4ff4e50725,9364c13d09,01237b1362,6f47fa2d6c,51e19d6032). - Darwin and OpenBSD move to libc; Solaris and AIX libcall; syscall wrapper layer — Done: Darwin/iOS libc migration (
b7f1777a70,21656d09b7,ce5c3871a4,16d1a8e6e3,c2fdb42b16,cc09212f59,c8d07295c5,c1a068012c,ec989337c5,467e15accc,ef53de8ba4,6c6e22e5a9,021c39d7a3,f027d1a878,72c29fc8cd,c824f540d9,5b5473c6bf,cdffe9b1e3,6fdbed0543,76e92d1c9e,b3a854c733,e86c26789d). Left open: syscall package itself still raw syscalls. - Windows runtime — Done: abort handling (
7001ac5394), g0 stack bounds (52e782a2d6,99e9be8043,d6b56bb301,78561c4ae9),profileloopraces ( in 1.12). - CPU feature detection (
internal/cpu), auxv parsing andGODEBUG=cpu.*— Done: GODEBUGCPU experiment (f045ddc624), naming cleanups (57020705f3,7289607b1b,d46980995b), runtime usesinternal/cpu(954f651ccc,6b5236ae53,e0ac5f540b,d0712096b3,ace5fa1a60,91d326e734), crypto/tls use common detection (3f2039e28d,7ba0c6235f). - Assembly-level runtime entry points: memequal/cmp/IndexByte, hashing, atomics and ABI wrappers — Done:
internal/bytealgcreated (403ab0f221,1dfa380e3d,f6332bb84a), ARMv7 native CAS (150b728675,14f929af91,633b38c5d2), improved amd64/386systemstack(c5d6c42d35), BYTE encodings replaced by instructions (ff5cf43df5),procyieldon ppc64x (1caa06299c), r2 on ppc64x gogo (30a63ecee3), asm frame sizes (8a064c6008,a046caa1e8,beeabbcb25,dfbf568c9f), futex private (07751f4b58),nanosleepusleep (665b9b3476), Android O syscalls (04e6ae6bc3,5fcfe6b6ae,0e1bcfc638), ELF structs in own files (afb9fc1de9). - Debugger function calls and conservative preemption frames — Done: debug call injection (
c5ed10f3be). Left open: register maps cost ~5% of binary. - Thread lifecycle, physical page size and scheduler-facing OS hooks — Done: private futexes (
07751f4b58), arena order (9680980efe).
Other changes
- Linux, vDSO, time and auxv internal — user-visible runtime: consolidate mheap.lookup* and spanOf* (
a90f9a00ca); user-visible runtime: fix amd64p32 indexbytes in presence of overflow (aa9c1a8f80); user-visible runtime: add missing build constraints to os_linux_{be64,noauxv,novdso,ppc64x}.go files (083f3957b8); user-visible runtime: adjust GOARM floating point compatibility error message (786899a72a); user-visible runtime: make Playground timestamps change when the stream fd changes (8e43c37229); user-visible runtime: document philosophy behind runtime atomic usage (9300d223a3); user-visible runtime: fix syscall error returns on mips/mips64/ppc64 (acd30e9a82) - signals and crashes internal — user-visible runtime: fix errno sign for epollctl on mips, mips64 and ppc64 (
cc8809238b); user-visible runtime: use systemstack around throw in sysSigaction (3d69ef37b8); user-visible runtime: load errno as signed 32-bit (a68b713ef6) - assembly, atomics and architecture internal — user-visible os: add js/wasm architecture (
063f97a611); cmd/compile: add softfloat support to mips64{,le} (2959128dc5); internal/cpu: convert CRLF to LF line ending, and some superfulous space (581ed192e5) - cgo and C interop internal — runtime/cgo: make sure nil is undefined before defining it (
7a2a96d6ad); runtime/cgo: use size_t in sizeof result comparison (4102e6ff56) - Darwin/iOS internal — user-visible runtime: fix newosproc darwin+arm/arm64 (
eef27a8fa2) - stacks, defer and unwinding internal — user-visible runtime: remap stack spans with MAP_STACK on OpenBSD (
955cc07dde); user-visible runtime: correct new thread stack for openbsd MAP_STACK (8ec35ab66a) - BSD, Solaris, AIX, Plan 9, NaCl internal — user-visible runtime: tidy OpenBSD sysctl code (
9daa35edf0) - arm64 CPU features internal — Updated internal/cpu arm64 feature detection. (
8a525b8e7f)
Compiler frontend
From Compiler frontend (Go 1.10–1.17)
Indexed export format added and made default, syntax package made independent with column-aware line directives, concurrent compilation of all functions, method-set sorting O(N+M).
- dev.regabi: from
*Nodestruct to their.Nodeinterface and concrete node types — Done:Node.copy(19ee2ef950) and removal of manual copies (60fee0153f); constant-node constructors centralised (fdf33730e1); inline fields moved to a separateInlinestruct (562a199961);Field.Nname.Posreplaced byField.Posto stop allocating an ONAME per struct field (7759b32a62). Left open:Nodestill a single struct. - Indexed export format and the export-data lifecycle — Done:
ca2f85fd3fadds the indexed format (flag-iexport),a3c75d9b31makes it the default,eec8fb5ef3forbids mixing-iexportvalues,ce1252a610collapsesExport/Package/ExportedSym flags to oneOnExportList,07029254a0/49ed4cbe85add package height,bcc8edfd8asimplifies reexport, and fixesf125052ad5(exportingforloops),011ea87921(recursive inimport),cc422e64d0(missing inline body),8d5fd871d7(width not calculated). Left open: the binary format was still retained as fallback and (perfa913a36a21.12) inlining of autogenerated wrappers had to be disabled with iexport. - The syntax package: parser, scanner, source reader, positions and error recovery — Done: independence from
cmd/internal/src(5c08b9e8bd),ParseBytesremoval (e87f2a1b70), line directives with columns (ac45cb9aa0,6fa6bde924,0c884d0810), stringer tokens (c879153831), error-recovery and message improvements,~no longer assumed to mean^(33eb0633e1), naming conventions (f04eebfdf5). Left open: nothing noted. - Constants: Go 2 number literals, evconst, untyped conversion and go/constant — Done: constant constructors and rewriting refactored (
fdf33730e1,0250ef910f); constant pointer comparison fix (fe77a5413e); untyped boolean typechecking (d3f6d11d84,e057680542). Left open: nothing noted. - Concurrent compilation and frontend performance — Done:
fa3e9d27f3concurrent for all;91bbe5388d;3fca7306f4. Left open: nothing noted. - Directives and pragmas in the frontend (
//go:handling) — Done:8f6ae33796,41d3d153eb. Left open: nothing noted. - Inlining-related frontend work: export of bodies, type switches, closures, devirtualization — Done:
562a199961,80bbad015d. Left open: autogenerated wrapper inlining unsafe with iexport. - The legacy typechecker: error quality, alias/recursive-type handling and type checking order — Done:
48987baa09,d159d6108c,c65a2781be,7b177b1a03,950a56899a,b3f00c6985,3d501df441,1e308fbc1a. Left open: nothing noted. - Lowering in order/walk and the shape of runtime calls emitted by the frontend — Done:
004260afde,837ed98d63,aee71dd70b,22ff9521da,26708439ec,dcaf3fb134,2dbf15e88e. Left open: nothing noted. - Types package internals and type printing — Done:
2083b5d673,7500b29993,03f546eb60,6e9960ea631.10. Left open: nothing noted.
Other changes
- DWARF scopes and location lists internal —
7d7af6106f,3fca7306f4,b30bf958da,1c24ffbf93(location lists default),87736fc450,f45c07e84a. - Runtime/compiler select and write barrier internal —
2010189407removes legacy eager write barrier;a7f73c436d,f7404974da(preemptible loops experiment repaired). - Misc internal —
fcfea24742and1de0dcfc7b(README wording). - README for cmd/compile internal —
a835c7396d,7145f1c7c7. - Always write pack files internal —
ea668e18a6. - Declaration and function-generation consistency internal —
25824c96dcmakes eq/hash, method-expression/promoted wrappers and defer/go print/delete wrappers all usedclfunc/funcbody;45ce10fa3a,29517daff9(shared funcDecl/funcLit noding),6703addeee(drop legacy iface-wrapper code),d7eb4901f1(funcdepth removed),6a5cfa8b63(out-of-phase walk calls),02798ed936,c3473c4f10,24d5c871aa. - Escape-analysis tagging and frame checks internal —
88466e93a4anonymous receivers non-escaping,e3127f023ffused param-tagging loops,06b326054dcallee-args in frame-too-large check,568d6f9831Haspointer for SSA types,581331e75brace fix in SSA construction. - Error-message and ICE fixes internal —
b9c8e870d1,4a2bec9726,7bc99ffa05(package-aware case-insensitive suggestions),c3e8da67dd,409a943f69,f422bea498(lazily resolved shadowed types),b410ce750e,ba6974fdc3,535ad8efb8,b47806d1b5,bf10166264(empty package name for runtime/race, msan),d3ff5090dd. - Cleanups after the binary exporter internal —
545ef11037,8c67ca1a99,fac7d5dd95,27493187ed(cmplx ops asMpcplxmethods),2b2348ab14,c15b7b2a54. - Scanner comment reporting internal — The syntax scanner can now report comments. (
b890688986) - Unused parameter removal internal — Removed unused parameters in the compiler. (
ca9abbb731)
Middle end and SSA optimizer
From Middle end and SSA optimizer (Go 1.10–1.17)
The prove pass was reworked (unsatisfiability, poset, loop BCE folded in, loopbce deleted), range loops stopped producing past-the-end pointers, location lists were redesigned, is_stmt statement boundaries and stack maps at nearly every instruction landed, and mid-stack inlining prerequisites (variadics, panic, thresholds) arrived; arm64 got CondSelect (threads: Prove, Statement boundaries, DWARF, Inlining, CFG passes, Range loops).
- Prove pass: unsatisfiability, partial-order facts, loop bounds-check elimination — Done: unsatisfiability design (
669db2cef5), simpler limit logic and unsigned limits derived from signed (2e9cf5f66e,941fc129e2), fence-post implications (6436270dad), fail fast on unsat and short-circuit self-facts (385d936fb2,d54902ece9), relations between constants (8d8f620f68), len/cap relations infactsTable.update(4816eface1), OFORUNTIL inductive facts (b812eec928, needed by the new range lowering), loop BCE inside prove and removal of loopbce (7ec25d0acf,f49369b67c), fullOpIsInBounds/OpIsSliceInBoundssupport (ac43de3ae5), unsigned relations while branching (29162ec9a7), poset transitive closure (5c40210987), negative-increment loops (6d379add0f),len(s)-delta(e0d37a33ab), shift simplification (9eb4590ad2). Left open: poset only used for relations, not limits; fence-post for the unsigned domain was wrong (fixed in 1.12). - Escape analysis: the esc.go fixes, the escape.go rewrite, and the move to package escape — Done:
go:uintptrescapesfor unnamed parameters (beeab6ac02), loop depth to field (5a91c83ce8), element type forOINDof slices (3042463d61), explanation of escape reasons (a12c1f26e4,360c19157a), anonymous receivers non-escaping (88466e93a4). Left open: nothing noted. - Inlining: budget, mid-stack inlining, closures, and what became inlinable — Done: variadic functions (
09d4455f45), parameter refactor +panicinlinable (87a18c6109), larger-function threshold (5fc70b6fac), constantif(d7cd61ceaa),go:norace(c6e455bb11), struct == cost (b638760dad). Left open:-l=4“not the default” because it makes the compiler itself bigger and slower, and is untested with the debugger/DWARF. - Statement boundaries (is_stmt) and source positions through the optimizer — Done:
IsStmtin lico (619679a397); stmt boundary pass (c2c1822b12); position adjustments (b9a365681f,eda22a06fb). Left open: Delve could not yet use the marks (“worsens optimized-debugging experience”). - DWARF location lists from SSA — Done: reimplementation (
2075a9323d), memory use (39eea62340), dead locals in inline DWARF (1ba26a33ce). Left open: macOS base-address entries (commit says “TBD”). - Switch lowering, select, and type switches in walk — Done: open-coded select send/recv/default (
004260afde); untyped bool conversion in walkCases (a375a6b363); avoid runtime call forswitch string(byteslice)(566e3e074c). Left open: nothing noted. - Range loops, append and map idioms in walk — Done: no past-the-end pointer (
837ed98d63), map-clear idiom (aee71dd70b), memclr refactor (500d79c410), slice extension (a8a60ac2a7), mapassign-append (c12b185a6e),m[k] op= r(7395083136), preemptibleloops typechecking (48f990b4a5). Left open: preemptibleloops “doesn’t quite” work. - Rewrite-rule generator, typed Aux/AuxInt, and rule syntax — Done:
|operator (b657c00243), rulegen diagnostic (31ef3846a7),useAvg/useHmulSSA config options (a9ba3e30ac),Op{SP,SB}checks (cb44c8debb). Left open: whitespace alignment cleanups (stated inb657c00243). - Memory-op optimizations: memmove, Move/Zero, dead stores, nil checks — Done: arm64 memmove (
0e8b7110f6), disjoint memmove -> Move (6d00e8c478), composite optimizations (f31a18ded4), address-reaches-phi autos (adfa8b8691,1546ab5a39), Zero-to-Load fix (fbfbf03b28). Left open: “return value unnecessarily cleared” needed dead store analysis (f31a18ded4). - Arithmetic strength reduction, divisibility and intrinsics — Done: Sqrt 386,
4a1baf8bd1,098208a0d9, Ctz/Len ops,a9ba3e30acconfig options, math/bits usage (5654114d04,7ac756f74b). Left open: Ctz/Len only on amd64. - CFG and control-flow passes: branchelim, fuse, shortcircuit, phiopt — Done: arm64 CondSelect (
2d0172c3a7), amd64 cost model (25813f9f91), tighten after lowering (3a9e4440fd), branch likeliness reset (4313d7767d,81786649c5), common fuse code (cfbf375a81). Left open: cmov cost on amd64 handled heuristically. - Compiler front of walk/order: ordering fixes and the dev.regabi IR refactor (package walk) — Done: order.go refactored into methods (
26708439ec),defer deletefix (2c0c68d621), finishcompare series (30673769ed,5b071bfa88). Left open: nothing noted. - Diagnostics for the optimizer: ssa.html, GOSSAFUNC and optimizer logging — Done: README, columns, colors. Left open: nothing noted.
Other changes
- Stack maps at (almost) every instruction internal —
issafepointnow reports nearly every op as a safe point except runtime/nosplit code, instructions between the write-barrier flag load and the write, and those before a uintptr→unsafe.Pointer conversion (a367f44c18); interface first word marked uintptr (2413b54888);LivenessMap/LivenessIndexintroduced (d7d9df8a5b); liveness structures reused throughssa.Cache(f11e9aac4f). This is why range loops stopped producing past-the-end pointers. - Race/msan instrumentation moved into SSA construction internal — instrumentation inserted while building SSA, and
reorder1uses temporaries for all arguments when instrumenting; multi-field structs not SSAable while instrumenting, later relaxed (17df5ed910,736390c2bd,c0841ecd87,581331e75b). - Compiler memory/speed work internal — sparse maps cached across passes (
cd2cb6e3f5), worklists stack-allocated (4ed94ef1a8,9357bb9eba,b63b0f2b75),valueToProgreuse (b8644e3243), math/bits for register sets (7ac756f74b,5654114d04), prove poset reuse (3c8545c5f6). - Comparison and rule additions internal — comparisons via load merging (
b65122f99a), constantNeqPtr/EqPtr/IsNonNil(58cdecb9c8), symbol address comparisons (625f2dccd4),!truefolding (8f9cf5525e), Rsh64Ux64 non-negativity (548e1f8936),-Nruns generic deadcode (3f54e8537a), no past-the-end/len([]rune(s))/""<sfixes (b9a59d9f2e,c1ed1f3c80). - Walk/typecheck fixes internal — finishcompare series (
21343e07d6,b75e8a2a3b), untyped types kept out of walk (a3b3284ddc), type switch with guard and no cases rejected (e601c07908), orderexprlistinplace (a90fc6d2d4,3d4c9cecc8), double-walk of ORETURN (c359d759a7), defined string to []rune conversion (bcb563f4db), wasm closure nil check (81555cb4f3), swt duplicates (463fe95bdd), SSA of 1-element arrays (d21bdf125c), loopbce increment 0 fixes (7e9d55eeeb,58d287e5e8), prove tidy-ups (44e20b64ef,321bd8c93b,b846edfd59,980fdb8dd5) and small refactors (da022da900,284a4a7346,ed8b7a7785,8b766e5d09,c74aa39f47,6428c892c0,50921bfa2e,3afd2d7fc8,2d8181e7b5,64bf90576e,533fdfd00e,24d5c871aa,e10ee798c4,337cc29156,a8a050819b,6b0941a1bf,6495bf1710,bdaadeb387,707ca18d97,c2ccc48165,4f5389c321,f4d9c30901). - Regalloc loops update internal — Updated register allocation in loops. (
983dcf70ba) - Unused params and SSA TODO internal — Removed unused parameters and updated the SSA TODO file. (
14393c5cd4,ae26d57f96)
Backends and assemblers
From Backends and assemblers (Go 1.7–1.11)
Safepoints almost everywhere with register liveness maps, buffered write barrier on all runtime architectures, location-list redesign and statement boundaries, branchelim/CMOV on amd64 and CSEL on arm64, ARM64 fused operations and bitfield patterns, AVX-512 in the assembler, | rule alternation, and the new wasm architecture.
- Register allocation, flag allocation and stack slots — Done: preferring rematerialization (
dafca7de0f,014a9048d4), LEA of SP instead of ADDQconst (9916feeddf), dense GP register numbering (840f25bedd), g-register guard (31e1c30f55), allocation reductions (2ba98f1ae9,377a2cb2d2,cd2cb6e3f5caching sparse maps),3a9e4440fdmoving tighten after lowering so that rematerializable/flag-generating decisions benefit from lowered CSE. Left open: nothing noted. - Scheduling, tighten, block layout and CFG passes — Done: CondSelect/CMOV (
2d0172c3a7,080187f4f7,a35ec9a59e), likely-first layout (ab48574bab), decoupled emission order (c18ff18465), tighten after lowering (3a9e4440fd),f7404974dafinishing GOEXPERIMENT=preemptibleloops (likely bit bug),d9a50a6531and9eb4590ad2use prove-pass facts for CtzNonZero and bounded shifts,bff29f2d17/caa1b4afbd/9dc351bebahandling zero-width ops. Left open: nothing noted. - Rewrite-rule machinery and compile-time performance of the SSA compiler — Done:
|alternation across 386, ARM, MIPS, MIPS64, PPC64, s390x and AMD64 rule files (ec62ee7f6d,cab7ba0b28,3553262248,8993e16932,ebeea20a49,1e05924cf5,af11038428),4f5389c321moves SSA local type definitions to one location,aad71d3163rewrites ssa/README.md,398a8ed653removes broken rules,0029cd479eaddsLocalAddr(SP,mem operands). Left open: nothing noted. - Multi-architecture SSA ports: PPC64, MIPS64, MIPS32, s390x — Done:
ec62ee7f6d-style rule compaction,aff222cd18smaller PPC64 rewrite,8af0c77df3,331c187b17,8afa8a3374s390x simplifications,ae10914e67LAA/LAAG clobber flags,de186c63cecalls clobber g on s390x,ebb67d993aRound intrinsic on ppc64x,6aeddb1b57Sqrt on mips64,30311e8860loads without DS relocation for go.string on ppc64le,1566bf9025. Left open: nothing noted. - WebAssembly backend — Done: user-visible new architecture in the compiler (
3b137dd2df), stack optimization (482d241936), rule file name fix (cc0aaff40e), assembler offset fix (bf23a4e61d), write-barrier control (8aa57f1e9d), negative OffPtr (88dc4aee7c), address offset folding (1d303a0086). Left open: the linker half is separate (“A later commit will contain the corresponding linker changes”,3b137dd2df). - Liveness, stack maps, safepoints and write barriers — Done: buffered write barrier on all remaining runtime architectures (
252f1170e5,24dd83d7eb,1de1f316df,79594ee95a,a39de96438,313a4b2b7f,ae7d5f84f8,2ae1e1ae2f), safepoints almost everywhere (a367f44c18), register liveness maps (61158c162f,9f95c9db23,ed7a0682e2), memory optimization (d7d9df8a5b,75dadbec1e,3c36b8be66,f11e9aac4f,1e27e4807b,bdb65da049),d15d055054/06b326054dreject huge argument areas,85cfa4d55edegenerate write barrier case. Left open: optimized in later CLs (61158c162f: “We’ll optimize this in later CLs”). - DWARF variable locations, statement positions and inline info from the backend — Done: location-list redesign (
2075a9323d), memory reductions (39eea62340,a306341db7,9c854d65a3,108efc79c7,ac81c5c402), stack-only vars (44e65f2c94), statement boundaries (c2c1822b12,b9a365681f,dead03b794), line directives with columns (515fa58ac9,b3cb740be5),eca41af012base address selectors for dsymutil. Left open: nothing noted. - Intrinsics for atomics, math/bits, math and runtime helpers — Done: the 1.11 items above (
0a7ac93c27,fcba05148f,07f0f09563,ebb67d993a,6aeddb1b57,54dbab5221,1d321ada73,d9a50a6531,d7c7d88b2c,bd8a88729c,20102594a0,44b826bb28(AtomicAnd8/Or8 register fix on ARM64)). Left open: nothing noted. - Memory-op combining, byte-order idioms and load/store folding — Done:
0f2ef0ad44,77ba071ec6,39fefa0709,ecd9e8a2fezero stores combined on arm64,34f5f8a580/aaf73c6d1eregister-indexed and shifted-register-indexed ARM64 loads/stores,4b00d3f4a2,20cf5c4962,098ca846c7,29fcd57a9f,983fca55c0. Left open: nothing noted. - amd64 and 386 instruction selection — Done: the 1.11 items above, plus
0cacc4d0e2,22115859a5,b1df8d6ffa,c284171bbb,8bf4b7e673,29e5a81e28BS{F,R}L clobber flags,b71ea0b7ddCMOVLEQF clobbers AX. - ARM and ARM64 instruction selection and fused operations — Done: ARM64 fused ops and CSEL (
2d0172c3a7,cdd961630c,ebb77aa867,3c8b824453,f4c3072cf5,e244a7a7d3,1057624985,f524268c40,34f5f8a580,aaf73c6d1e,ecd9e8a2fe,77ba071ec6,39fefa0709),f6ce1e2aa5/78a579316bbugfixes,b08a9b7eccsoftfloat on ARM. - Memory clearing and copying: Zero, Move and Duff’s device — Done:
4f7b774822,094258408d,ecd9e8a2fe,8916773a3d,b46d398887. Left open: Duff’s device still used for mid-size blocks (later replaced). - cmd/internal/obj: Prog/LSym refactoring, concurrent backend and object-writing — Done:
a76249c38dlarger initial LSym.R,c9c73978e2slice-extension idiom inLSym.Grow,02495da6b6consolidated entry stack map,9f95c9db23,62adf6fc2dASCII cleanup,6d0f757bb9arch package definition. Left open: nothing noted. - x86 assembler: AVX, AVX2, AVX-512 and the instruction table — Done: AVX-512 (
5437cde96c,67fe8b5677), legacy completeness (b80b4a23d1), cleanups and speedups (8e3dd8ab88,3db3826a57,d487488135,58b18cfda5). Left open: nothing noted. - ARM64 assembler — Done: Design list;
3d6e4ec0a8two assembler fixes;95b4498ac0trailing NOP crash;911839c1f4;4d59b14400negative LDP/STP offsets. Left open: nothing noted. - 32-bit ARM, MIPS and PPC64 assemblers — Done:
9a9a8c0165,6633bb2aa7,e1f8fe8dff,5b14c7b324,4c15fdb32b,99e37e98b4,e940358fc9,0a5be12f5c,1b44167d05. - Prologues, frame pointers, NOFRAME and tail calls — Done:
99e37e98b4,75b56a0895,e940358fc9,a7f73c436d,495174302f,9b331189c1. Left open: nothing noted.
Other changes
- Inlining knobs user-visible — inline panic and
-l=4expressed as cost changes (87a18c6109),4f70a2a6991.10 in 1.10. - Softfloat on ARM user-visible — GOARM=5 uses the compiler’s portable softfloat (
b08a9b7ecc). - GOEXPERIMENT=preemptibleloops internal — repaired (
f7404974da), parallel compilation restriction removed. - s390x internal —
9fa988547aloop iteration limit raised,3c65bb5b90VMSLG. - 386/amd64 fixes internal —
29e5a81e28,b71ea0b7dd,f5d4863130,599f56dc05zero extend after float->int. - DWARF register mappings internal — arm64 (
9b95611e38,0eacf8cbdf). - Assembler fixes (ARM64/ARM/x86/MIPS) internal —
8c3c8332cd,8c8bb96b92,ce5fa6d5e9,2baed3856d,fdf5aaf555,7673e30503,9c312245ac,bec2f51b07,4dc25ceda4,eef42f928d,58e3f2ac87,67cc1af133. - SSA correctness fixes internal —
9c4fd4626c(pass LocalSlot values, not pointers),5a43a271e8,755b36aa53,3c16934f16,8871c930be(don’t lower OpConvert),3d6647d6f8,fb017c60bc,dffc915b2d,e4172e5f5e,3797f88f24,4f765b18f8,65c365bf0f,7951d90bc6,0c471dfae2,9ecf899b29. - Renames and comments internal — Renamed line to pos in ssa, Rconv to rconv, and added or relocated comments (s390x SB addressing, plive, doasm, liveness, double spaces). (
a5b80d469a) - Rewrite rule comments and cleanups internal — Normalized spaces in rewrite rule comments, removed unused parameters and made code cleanups. (
70fd25e4e1,2722650415,e8aa9a533d,284c53498f)
Linker and object files
From Linker and object files (Go 1.10–1.17)
DWARF compression (ELF, then Windows and Darwin) and separation of VA from file layout, is_stmt line tables, dsymutil workarounds, DWARF on darwin/arm, WebAssembly port, GOROOT default at link time, JSON-encoded cgo directives.
- Linker performance and memory engineering — Done:
bd83774593/8998c55ec0separate virtual-address layout from file layout (needed for compression); DWARF compression switched to BestSpeed because it was ~30% of linker time (12ed0ddec1: cmd/go link overhead of DWARF 75% to 37%); fieldtrack pass skipped when not enabled (8bb391312c, ~1% on hello-net/http), duplicate error suppression (2c01b7d632,289ab30457). Left open: DWARF still the dominant cost. - DWARF generation in the linker — Done: is_stmt (
dead03b794); location-list/range workarounds for dsymutil (230b0bad1f, revertedf8973fcafb; re-landed aseca41af012removing base-address selectors only when the external linker on macOS will run);393f84a125runtime-type attribute; DWARF on darwin/arm and arm64 (5f5168e004);402dd10a99.debug_line back to DWARF version 2 (dsymutil/LLDB); prologue-end plumbing (7bac2a95f6,836fe697c4). Left open: is_stmt only in internal-linker tables. - DWARF compression and Mach-O dsymutil combining — Done:
594eae5ad0,b397f633ca,83515df3f3,726a2d04ea,12ed0ddec1. Left open: compression was sequential (30% of link time before BestSpeed). - Mach-O and Darwin support — Done:
4af08e7a13sets S_ATTR_PURE_INSTRUCTIONS on text,5f5168e004DWARF on darwin/arm/arm64,1a92cdbfc1handles all load commands,3363e98371removes arm64 R_ADDR workaround. Left open: nothing noted. - PE / Windows — Done:
d67db88146splits .text and .rdata,83515df3f3DWARF compression on Windows. Left open: nothing noted. - WebAssembly — Done: wasm architecture added to the linker (
f41dc711d8); name-section fix (4eb1c84752), build ID in modules (3b0b3a0223), Go version custom section (8589f46fe0). Left open: nothing noted. - Build modes: PIE, plugin, c-shared, c-archive, shared libraries — Done:
2d26a65f8fno-no-piewith-linkshared,ceda47d08aplugin on linux/arm64. Left open: nothing noted. - Host object loading and external linking — Done:
8f6ae33796cgo directives encoded as JSON (+82/-163 lines; JSON escapes newlines so the object-file$$delimiter stays safe),f861f66d1dtreat cgo exported symbols as C symbols,ad4e6370fedrop-rdynamicwith-staticin cgo LDFLAGS,506d6a32ceerror for ext linking on ppc64,17fbb83693response files for long argument lists on Windows,b2d3d6e6761.10/d1be0fd9101.10 loader fixes. Left open: nothing noted. - Linker restructuring (1.10 code health and error reporting) — Done:
2c01b7d632and289ab30457report undefined relocation targets once (and a better message whenmain.mainis missing),6f7fa68b91regenerate SymKind String. Left open: nothing noted.
Other changes
- Duplicate commit of the dsymutil location-list fix internal —
f1fc9da316(same change as230b0bad1f, before its revert). - Build ID hashing internal —
946af1b658hash__.PKGDEFin genhash;ea668e18a6always write pack files;2dfb423e6e/fa3e9d27f3compile autogenerated functions concurrently (compiler). - Special function flag internal —
9d4215311bmarks goexit/mcall by funcID flag (plugins can have duplicates). - darwin runtime.framepointer_enabled in DATA internal —
08304e8867. - Closed go.o internal —
1174ad3a8f. - Dynimp split internal —
f00bfb385b. - Documented -X limitation user-visible —
6dd789fdea. - Compiler usage internal —
7ddd467ef3,c15b7b2a54,f356e83e2e,8fc25b531b(cosmetic). - Never coalesce type descriptors when dynamically linking internal —
d6a27e8edc;ec88f781c2abstract fn PathToPrefix;204c618f0adrops unused DWARF attributes;8bb391312cfieldtrack skipping. - Linker cleanups internal — Various tool-driven and simple cleanups, and macho_combine_dwarf.go code cleanup. (
a6b183fabd) - Skip PKGDEF and iOS DWARF internal — Linker skips __.PKGDEF in archives and DWARF combining for iOS binaries. (
699b0d4e52,bcdbd58ce4)