Go 1.9
Type aliases. sync.Map. math/bits intrinsics. Inline-aware tracebacks and CallersFrames. Stack barriers removed. Concurrent runtime.GC(). Profile labels. Write-barrier insertion moved into SSA. Devirtualization. Groundwork for the concurrent backend. Monotonic time.
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)
Noscan spans and spanClass, concurrent runtime.GC, treap for large spans, rationalised trigger, workbufs as manual spans.
- Concurrent sweep and proportional sweep — Done:
heap_live-driven proportional sweep (a5eb3dceaf,9d36163c0b),sweeponetracking (44ed88a5a7), sweep allocation counting simplified (b50b728587), trace events cover the whole sweep loop (79c56addb6). Left open: nothing noted. - Decentralized GC state machine and mark termination simplification — Done: user-visible
runtime.GC()anddebug.FreeOSMemorynow trigger a concurrent cycle (9ffbdabdb0,786eb5b754,3d58498fdb,29fdbcfea3) instead of STW, with forced GCs tracked independently ofgcMode; heap profile snapshotted in mark termination (eee85fc5a1,1be3e76e76); finalizer queue not rescanned (f1ba75f8c5). Left open: STW GC mode remained as a separate code path. - GC pacer: trigger controller, assists and background utilisation — Done: trigger generalised and recomputed consistently (
29be3f1999,49a412a5b7,ee175afac2,1c4f3c5ea0,a5eb3dceaf), no GC on SetGCPercent (227fff2ea4). Left open: soft/hard limit separation next release. - Stack scanning: conservative, precise by frames, stack barriers, hybrid barrier, async safe points — Done: rescan list removed (
c5ebcd2c8a). Left open:g.gcscanvalidkept. - Hybrid write barrier and buffered write barrier — Done: write barriers eliminated from allocation/mark bitmaps (
42c1214762),wbufptrremoved (98da2d1f91), comment on compiler knowledge ofwriteBarrier(7e1832d06c). Left open: barrier still a normal call. - Precise heap scanning: type information, the heap bitmap and GC programs — Done: noscan spans (
1a033b1a70,c44d031bf0,8e25d4ccef). Left open: nothing noted. - Allocating from mark bits: allocBits, freeindex and ctz — Done: lock-free fast path for mark-bit allocation (
2ef88f7fcf), simplified sweep allocation counting (b50b728587),markBits.clearMarkedNonAtomicremoved (6aee6b895c), mcentral cache-line alignment (259d60995d), division avoided in gc (a4ee95c805). Left open: nothing noted. - Size classes, tiny allocator and mcache/mcentral — Done:
spanClass, noscan segregation,sizeToClassremoval (1a033b1a70,295d160e01,7ee43faf78). Left open: nothing noted. - Span lifecycle in mheap: free lists, treaps, first-fit and the page reclaimer — Done: treap for large spans (
6e9ec14186); manual spans for workbufs (9cc883a466,051809e352,dc0f0ab70f,9741f0275c). Left open: nothing noted. - Heap address space: contiguous arena to sparse arenas — Done: arena bound fixes (
4af6b81d41,e5a5c03f5b,13ae3b3a8d,780249eed4,623e2c4603,6c6f455f88). Left open: contiguous arena. - Mark work distribution: parfor, work buffers, gcWork and root jobs — Done: manually managed workbuf spans (
9cc883a466,051809e352), lfstack type (13ae271d5d),489620d878(drain local runq when a dedicated worker runs). Left open: nothing noted. - Runtime allocators for runtime metadata and the port to Go — Done: manually managed spans for workbufs and stacks (
9cc883a466,9741f0275c,dc0f0ab70f), malloc forbidden in scavenge (df6025bc0d). Left open: nothing noted. - Memory statistics and accounting — Done: user-visible
ReadMemStatsSTW under 25 µs (4a7cf960c3). Left open: nothing noted.
Other changes
- Misc internal — profile buffer with label pointers (
b788fd80e6),wakepdeadlock avoided inenlistWorker(1f77db94f8), Solaris EAGAIN on mmap (13cdd814ea),VirtualAllocOOM message (fa3c5173a5), double wakeup (3b5637ff2b). - Misc internal — documentation and tracing (
77f64c50db,b992c2649e,ecb7b63820,29e88d5130,73d0273573,ffd5687a82,ff7994ac10). - Simplify mallocinit internal — Simplified and cleaned up mallocinit. (
1cc24690b8)
Scheduler and concurrency
From Scheduler and concurrency runtime (Go 1.0–1.17)
Fairer Mutex, sync.Map, semaphore treap, runtime rwmutex, os poller and internal/poll; threads: Mutex, semaphores, Map, netpoll.
- The G-M-P scheduler: from global-lock M:N to per-P run queues, spinning Ms and work stealing — Done: MaxGomaxprocs raised to 1024
fcb45b9c61; extra M’s G marked dead when unused4e7067cde4. - Network poller: from the netFD select loop to the runtime-integrated epoll/kqueue/IOCP poller — Done:
internal/pollrefactor3792db5183and os file I/O through the pollerc05b06a12d(1.9); netpoll panic messages91c9b0d568. - Timers: timerproc goroutine → per-bucket heaps → timers on Ps — Done:
time.Sleepno longer allocatesa1261b8b0a; “use next timer to decide whether to relax”093adeef40. - Channels and select — Done:
selectgojoinedd50f892abc. - Semaphores, runtime locks and Notes — Done: semaRoot two-level list
45c6f59e1f, balanced tree990124da2a; runtime rwmutex09ebbf4085,80832974ac,9745e88b22,f3b5a2bc19. - sync.Mutex, RWMutex, WaitGroup, Cond, Once — Done: user-visible fairer Mutex with starvation mode
0556e26273. - sync.Pool — Done: faster
indexLocal(−47%)af5c95117b,poolLocalaligned to cache line8aa31d5dae. - sync.Map, atomic.Value and sync/atomic — Done: user-visible
sync.Map959025c0ac; alignment docfea7c43ea2. - Goroutine and M lifecycle: caches, ids, LockOSThread, Goexit, cgo extra Ms, deadlock detection — Done: extra M’s G dead when unused
4e7067cde4; stackAlloc removed0993b2fd06. - Stop-the-world, safe points and GC–scheduler interaction — Done: rescan list removed
c5ebcd2c8a. - Scheduler diagnostics: schedtrace, GODEBUG, execution tracer, block/mutex profiles — Done:
runtime/pproflabels definitions62956897c1. - Fast random numbers for the scheduler — Done: 32-bit values
663226d8e1; fasterfastrand()%n46a75870ad.
Other changes
- Signals, TSAN and exec internal —
29edf0f9fe,87ad863f35,e57350f4c0,3a1ce1085a,91139b87f7,28f650a2f7,835dfef939. - os poller and timing user-visible —
c05b06a12d,3792db5183,e4371fb179(time.Now 19.6 → 9.7ns on darwin),01cd22c687. - Misc internal —
640cd3b322,caa7dacfd2,f2e87158f0,2d86f49428,91a80cc174,f4f018518d. - sync documentation and mipsx atomics user-visible —
766e1ae362,e2160cc571(RWMutex double RLock rules),4b4bb53bf3(WaitGroup.Done),00e2524d8a.
Data structures and type metadata
From Runtime data structures and type metadata (Go 1.0–1.17)
sync.Map-backed reflect caches, hmap.extra and overflow preallocation, MakeMapWithSize, the compiler's dxxx-to-LSym refactoring and deterministic signature ordering, C99 complex division.
- Hash map core: from the first hashmap.c to the 8-entry bucket design — Done:
hmap.extra,newoverflow,bmap.setoverflow, preallocated overflow buckets (a41b1d5052,619af17205,17d497feaa,94e44a9c8e), 64-bitoverLoadFactor(b666f2860b), bad size hint no longer panics (f9531448b8),reflect.MakeMapWithSize(6c5a819a5e),mapassign_*usetypedmemmovefor keys (579120323f), marking “writing” delayed until after the first alg call (04fc887761). - Map growth, iteration order, overflow buckets and GC interaction — Done:
hmap.extra,newoverflow, preallocation, consistent evacuation, size-hint fixes (a41b1d5052,619af17205,94e44a9c8e,064e44f218,f9531448b8). Left open: commit message notes follow-ups such as reusing freed overflow buckets (issue 19992) and size-hint-based estimates (19931). - Compiler-generated equality and hash functions — Done: cheaper small array compare (
3bdc2f3abf). - Runtime type descriptors: layout, shrinking and name encoding — Done: dxxx functions converted to
obj.LSym(4d600b8e5f,bea8ffdbb1,b065c95551,08db34927d,2f4ce69ddd,0d1e903c8a,1dc3b60bd6,3cf72322dc),dumptypestructssplit (976a5ce1a8,92607fdd30),signatlistmap with deterministic sorting (91433eb577reverted by re-roll6d9c77f5dd,6f2ee0f3df,e577a55b78,25fc842f17),ptrdatadocumented (2ef340f271), plugin recursive types (e49627d355), exported flag in namedata (ee392ac10c). - reflect dynamic types: ArrayOf, ChanOf, MapOf, SliceOf, FuncOf, StructOf — Done:
MakeMapWithSize(6c5a819a5e),StructOfmethod checks (87d5f6b9f6,2ddc3e940e). - reflect.Call, MakeFunc, method values and argument-frame GC precision — Done: out-of-bounds pointer fix for no-result method calls (
627798db4e). - reflect performance, caches and API additions — Done:
sync.Mapcaches (33b92cd6ce),MakeMapWithSize(6c5a819a5e),bucketOffix (b5e5194306), clearptrToThis(066ac428cd). - Strings: concatenation, conversion and printing helpers — Done:
slicebytetostringspeedup (23be728950), numeric panic output (0d33dc3105). - Soft-float, 64-bit division and complex arithmetic helpers — Done: C99 complex division (
16200c7333), ARM div/mod stubs (79d05e75ca).
Other changes
- Compiler type-symbol refactoring internal — embedded
byte/runefield names (9bbb07ddec),haspointersmoved (944d56d763),newnamelintypenamesym(8ab71304d4),Nopkg/Sym.LSymunexported andLinksymbubbling (62a2bee7a5,0d50a49f5c,2fe43cec8b),itabEntry.symremoved (07d09003f1). - Misc internal — dead assignment (
19b05acd13), banner for generated code (6914b0e3e3), docs onNumMethodandDeepEqualcycles (7e4d1a05e5,a279b53a18). - Softfloat and type-name cleanups internal — Cleaned up softfloat code, alg.go and type names in comments, and updated dalgsym to use obj.LSym. (
0e497971bb)
Diagnostics and knobs
From Diagnostics and knobs (Go 1.0–1.17)
Streaming protobuf writer, profile labels, inlining-aware tracebacks/Callers, concurrent runtime.GC(), heap-profile snapshot at mark termination.
- Execution tracer (trace v1): events, per-goroutine sequencing, annotations — Done: mark assists recorded (
2a74b9e814);runtime/traceiterates over frames rather than PCs after inlining (3249cb0ab4); swept/reclaimed bytes recorded in sweep events (22000f5407). Left open: nothing noted. - CPU profiler and runtime/pprof writers (legacy format to compressed protobuf) — Done: streaming encoder with one copy in memory (
cbab65fdfa); new profile buffer for CPU (1a680a902a); hash table for staging (1564817d8c); symbolized proto profiles (cbef450df7) with inlined frames expanded (9e83c11fca); GNU build IDs in mappings (c797256a8f) and a dummy huge page mapping ignored (3ddf65015a); period information fixed (0c0c94a9dc);Profile.Addrace fixed (9b15c13dc5); empty stacks handled (c7894924c7); mips SIGPROF deadlock prevented (835dfef939); newly addedMemStatsfields printed (8833af3f4b). Left open: “get back down to storing it zero times (streaming it to the underlying io.Writer)” (cbab65fdfa). - Profile labels — Done: user-visible label types (
91ad2a2194),SetGoroutineLabelsandDowith runtime support (62956897c1), labels propagated into the profile proto (f105c91757), race-detector annotations (c82efb1fa3). Left open: nothing noted. - Heap profile accounting and MemStats — Done: user-visible
runtime.GC()triggers a concurrent GC that still completes a full cycle and publishes the heap profile (9ffbdabdb0); heap profile cycle type and snapshot at mark termination (3ebe7d7d11,eee85fc5a1); manually-managed spans not counted inheap_inuse/sys(dc0f0ab70f); atomic loads ofheap_live(9d36163c0b). Left open: nothing noted. - GODEBUG, runtime/debug, debug log and traceback knobs — Done:
SetGCPercentno longer triggers a GC when negative or otherwise (9f75ecd5e1,227fff2ea4); inlined frames in tracebacks andruntime.Callers(781fd3998e,ee97216a17,7bf0adc6ad); endless-recursion tracebacks print the top and bottom 50 frames (3a813386221.16, listed under 1.16 in the log). Left open: nothing noted. - Traceback correctness and inlining (diagnostic output) — Done: accurate inlined tracebacks and
Callers(781fd3998e,ee97216a17,7bf0adc6ad,e4f73769bc). Left open: mid-stack inlining not yet enabled.
Other changes
- Misc internal —
protopprofmerged intopprof(9a7544395a), triggerRatio rationalised (49a412a5b7),profilepackage moves (0b8c983ece), tag parameter and docs (5ed952368e,6cf7918e73,38cb9d28a9),0location in count profiles (c34add780b), gdb command (2465971781,a7d7d7aec2), pc printed with fp/sp (27f88731eb). - runtime.Caller skips logical frames user-visible — runtime.Caller now skips logical frames. (
0ea120a70c)
OS layer, stacks and panics
From OS interface, stacks and panics (Go 1.5–1.17)
inline-aware tracebacks/Callers/CallersFrames, stack barriers removed, monotonic time.Now, internal/cpu created, 2 MB Windows stacks, allocManual.
- Goroutine stack growth, shrinking, GC stack barriers and stack objects — Done: stack barriers removed (
d089a6c718), faster stack copy (aafd96408f),allocManual/freeManualgeneralization of stack span allocation (407c56ae9f,9741f0275c),stackFromSystemandstackCache=0fixes (8a1c5b2e48,475425201a), 2 MB stacks on 64-bit Windows (c2c07c7989). - Tracebacks, symbol tables and
runtime.Callers/CallersFrames— Done: inlined frames in tracebacks,CallersandCallersFrames(781fd3998e,ee97216a17,7bf0adc6ad,7f32d41e5d,38521004ed,390fdead0b), user stack of other threads printed inGOTRACEBACK=crash(4b8f41daa6,f2e87158f0),FuncForPCdocs (d58125ecd2,58ae050055), nilFunc.Name(a776087ee3),findmoduledatapcall reduction (0efc8b2188). - Signals: masks, forwarding, sigaltstack and the unified Unix signal layer — Done:
SIGPROFenabled/disabled with profiling (e24228af25), SIGPIPE refinement (78074f6850), signals under TSAN polled via libc (29edf0f9fe,a8dd20d389), atomicfwdSig(87ad863f35), signal stack on main thread cleared (5dc14af682), reset handlers to default in forked child (df0892cbf8,28f650a2f7),sigactionsa_flagsfix (4210930a28). - cgo runtime support: pointer checks, callbacks, extra Ms, C-to-Go call path — Done:
GOTRACEBACK=crashpromptly in cgo binaries (f2e87158f0), Android TLS slot search (0476c7a7b5), openbsd PT_TLS (9417c022c6), CFRelease (2b4274d667). - Shared-library and buildmode entry points (c-archive, c-shared, plugin, shared) — Done: ppc64le c-archive init fixed (
daa0ddde93), CR saved/restored on ppc64le (b1af5393d9). - vDSO, time sources and process-wide randomness — Done:
mach_absolute_time(e546b295b8), monotonictime.Now(0e3355903d), fasterNowon Darwin and Windows (e4371fb179), Wine time (9f98e49825),internal/cpupackage arrives (69972aea74). - Windows runtime — Done: reduced timer resolution when idle (
11eaf42886), 2 MB stacks (c2c07c7989),syscall.Exitusesruntime.exit(cfae35efa5), time on Wine (9f98e49825). - CPU feature detection (
internal/cpu), auxv parsing andGODEBUG=cpu.*— Done:internal/cpucreated (69972aea74), crc32 on arm64 (ab636b899c). - Assembly-level runtime entry points: memequal/cmp/IndexByte, hashing, atomics and ABI wrappers — Done: fastrand in Go (
d03c124860),IndexByteon ppc64x (d60166d5ee), hardware divide (69261ecad6),countByte/Count (01cd22c687,d206af1e6c),nosplitfixes,procyieldYIELD on ARM (bdc64183c8),IndexByte/Equalon arm64, rwmutex on Ms (80832974ac). - Thread lifecycle, physical page size and scheduler-facing OS hooks — Done:
NumCPUviacpuset_getaffinityon FreeBSD (e19f184b8f), arena placement viasbrk(0)(bb6309cd63),CLONE_SYSVSEM(2673f9ed23).
Other changes
- Darwin/iOS internal — user-visible runtime: darwin/amd64, don’t depend on outarg slots being unmodified (
69e1634985) - Linux, vDSO, time and auxv internal — user-visible runtime: fix some assembly offset names (
ef30a1c8aa); user-visible runtime: use standard linux/mipsx clone variable names (4208fcdcd4); user-visible cmd/compile, runtime: simplify multiway select implementation (c310c688ff); runtime/internal/atomic: Remove unnecessary checks for GOARCH_ppc64 (189053aee2); user-visible runtime: clean redundant call of environ function (0dd7b8f879); user-visible runtime: use pselect6 for usleep on linux/amd64 and linux/arm (4dcba023c6); user-visible runtime: use pselect6 for usleep on linux/386 (e26b51b0d5); user-visible runtime: intercept munmap as we do mmap (f425f54957); user-visible runtime: delay before osRelaxing (7a8f39fa14); user-visible runtime: fix duplicate “the”s (f062955ea7) - stacks, defer and unwinding internal — user-visible runtime: improve systemstack-on-Go stack message (
4234d1decd) - BSD, Solaris, AIX, Plan 9, NaCl internal — user-visible runtime: prevent TLS fetching instructions from being assembled on NaCl/ARM (
0020b8a257); user-visible runtime: work around NetBSD bug in thread creation (c6e7cb4a37); user-visible runtime, syscall: in Plan 9 ARM asm, replace “SWI 0” with “SWI $0” (3b263e43a9) - cgo and C interop internal — runtime/cgo: actually remove gcc_libinit_openbsd.c (
092405a9af) - signals and crashes internal — user-visible os/signal: avoid race between Stop and receiving on channel (
8ec7a39fec) - funcdata comments internal — Updated funcdata comments in cmd/internal/obj and runtime. (
bab191042b)
Compiler frontend
From Compiler frontend (Go 1.1–1.9)
Type aliases implemented, syntax.Pos position redesign with columns in errors, parse-time label/goto checking, concurrent parsing and initial backend concurrency (-c), cmd/compile/internal/types split, -importcfg, export-data version 5 with inlined-body positions.
- The
syntaxpackage, position representation and parse-time checks — Done: Pos redesign (8d20b25779,32bf2829a1,e97c8a592f,3d5df64b3f,4b8895e2dd,24597c080b,4808fc4443,f3b56de4d2,2d429f01bd), principled node positions (5267ac2732), columns in errors (2a5cf48f91), concurrent parsing (ec63158d71), parse-time branch checking (912a638b0c), brace positions (e0329248d5);d10b50dc34print positions in tree dump. Left open: the-Cflag is expected to be removed eventually (2a5cf48f91); the gcNodetree still exists as a second representation (“Phase 3 is planned for eventual removal”,756b9ce3a5). - Binary export data and the object-file split — Done:
e3efdffacd,9fd359a29a,49de5f0351,ee272bbf36,a6b16e0024(v5),ad8c17b703,2123a6c644,a680a85ea7simplify export info,ff0748670c. Left open: the format is still a sequential stream;ebcdda4732andeb86abaa36improve importer failure modes only. - Inlining — Done:
566e72d0ce,dffe5ac9f2,83843b1610,9fd359a29a. Left open: the “unexported funcs are never inlinable across -l=4 with linknames” issue fixed bye3efdffacd; inlining remains leaf-only (calls block inlining). - Escape analysis and stack allocation — Done:
61336b78c1,ecc6a81617(walkexpr must not modify ONAME/OLITERAL/OTYPE nodes, for concurrency). - Closures, method values and variable capture — Done:
61336b78c1. - Language changes and rules as implemented in the compiler — Done: user-visible
660200528a,829adf5047,c9446398e8,422c7fea70,10a200e560,5f5d882f5c, type aliases (see next thread). - Type aliases (the
=>experiment andtype A = B) — Done: user-visible3e11940437,49de5f0351,f011e0c6c3,b2386dffa1,5c160b28ba,de2e5459ae,9ecc3ee252,5d92916770. Left open:b2386dffa1lists “needs many more tests”, undetected duplicate methods and byte/rune alias setup. - Static initialization, composite literals and
init— Done:160914e33c,50688fcb6e,d1b544c7eb,a73a330cdf(count init functions from 0),49a533e212,6ee8c6a7ce,095a62c349,3237af2da8. - Walk-level lowering and runtime-call optimisations — Done:
504bc3ed24,e67d881bc3,ec091b6af2,5d6b7fcaa1,d71f36b5aa,2c91bb4c8a,807c80fce3,62947bedd2,febafe60d4,dbd51ce99c(intrinsify math.Sqrt),a0d6d3855f(typename in walk),d8899acaf8. - Write barriers, precise stacks and liveness (compiler side) — Done:
bdb9b945b9OASWB eliminated,d71f36b5aa,c96e94e69d1.8 etc. (see other). - Compiler data structures:
Node,Nodes,Type, and thetypespackage — Done:f68f292820(types package),fd44d872de,24c52ee570,ed70f37e73,386765afdfand the Node flags series,166b1219b8,a5a1fd4bc9,b2c391b70c,236ef852be(split SetInterface from SetFields),07de3465be(recursive interfaces),b1b4f67169/8ee2d5bc00(SetFields/Width safety),944d56d763,e82c925f5e,efc47819c0/371aa23d10(noTrecur),0b6a10ef24,ecc6a81617,3a89065c6c,3c0072e056,97b89dc055,fdef951116,00f4cacb49. Left open:Nodestill carries every node kind (the commit message of756b9ce3a5says Phase 3 is “planned for eventual removal”). - Compiler performance, formatting and concurrency — Done:
723ba180b3,756b9ce3a5,f9fb4579e1,b87fcc6e06,6d9c77f5dd,794d29a46f,61336b78c1,302474c61c,da67c23fbb,f5c878e030,22f1b56dab,98b3e3a064(match tool versions),f8b0231639. Left open: “Concurrent backend compilation still defaults to off”; “In future work, cmd/go will automatically set -c”; order and walk remain serial; some mutexes “may still be eliminable”. - Pragmas, directives and compiler flags — Done: user-visible
4d6b08de70,005c77dde8,22f1b56dab,2a5cf48f91’s-C,f9be63b9ba,da67c23fbb,98b3e3a064,3c1914fc46(distinguish.aand.oby content).
Other changes
- Misc 1.9 frontend internal —
dba0d38298,ad784caa74,9f26b9b93e,84b9329bd9(Type.LongString/ShortString),0fd6df3522,8ee37c6a66,7a9aa06902;d8a0f74801,03e2a4d1f1,5d0c20efc7,5a75d6a08e(optimize non-empty-interface conversions),c1363b2d91,b761b07bf9,a27b78141b,50520f1543,710f4d3e7e,0cfb23135c,e0a5e69be2,758b5b3284,c5fed5bb24,19d2061d50,249aca5dee,ee2f5fafd8,2770c507a5,c61cf5e6b7,b6c600fc9a(separate builtin and real runtime packages),542a60fbde,e8475c94b8,0dafb7d962,3b68a64769,d55f528826,8e36575ebe,9330ef869c,25a1d5d0f4,39e22f0423,f498929cdb(importpkg global removed),3f4f119b5e,3431d9113c,ca33e10971,3751513562,eba396f596,5101231425,c87520c598,96af817497/7e068895c3(block and mutex profiling support in the compiler),ca33e10971,0e4824aacc,245ef3a157,c8b889cc48(DWARF lexical blocks),da67c23fbb; ,ebcdda4732,6c2458e72d(Unicode spaces in package paths),47e659b01f,6d594342c6,e5e0e5fc3e,eb86abaa36,f0cf740733;85d6a29ae6,92363d52c0,dfeecda91d,dccc653aeb,5e157db37a,e41fb5591f,f2c5f57a87,53e62aba2f,2d1829b539,899532487f,b1b4f67169; . - types-package follow-ups and lookups internal —
07af21308c,80c4b53e1e(Type.Posremoved),2c50bffee1,f7027b4b2d,ac99ade5a0,bc972e8ef8(lookup helpers removed),3d90378df5,64f00fb150,52d8d7b93a,2e1b42a814,385c13cf18,25fc842f17,dc243f257b,f96abb40b6,b2a363b7ea,7189a02ca5(haslabelgotoremoved after parse-time branch checks),0d50a49f5c,d40bb738ff; syntax fixesf8ae30c4a2,783f166e65,e956dcbdb5,2923b14a7b(continue in switch). - Export and typealias cleanups internal — Simplified field and method export and made minor cleanups on dev.typealias. (
ac8421f9a5) - Skip convT2E for empty structs user-visible — The compiler skips convT2E conversions for empty structs. (
8958d8ce37) - Skip reexporting types internal — Skipped reexporting types in reexportdep. (
edad59cfae) - Runtime interface updates internal — Updated memclr signatures and the builtin writeBarrier to match the runtime. (
f6fc0dd620,db6e27c38d) - Init and generated file cleanups internal — Minor init handling cleanup, standard DO NOT EDIT comments in generated files, and moving mkpkg to types.NewPkg. (
eca90561c3,9e28ea0c08,ec241db2fd)
Middle end and SSA optimizer
From Middle end and SSA optimizer (Go 1.0–1.9)
Write barrier insertion fully moved to SSA, de-virtualization, loop rotation, constant-to-interface without allocation, concurrent-backend preparation, inlining dead-code awareness (threads: write barriers, devirtualization, backend concurrency prep, inlining, rewrite rules, order/walk).
- SSA backend arrival (dev.ssa): bring-up, coverage, default-on — Done: the old-backend leftovers are shrinking:
46085c4b36culls deadobjcode;5c90e1cf8adropsFunc.StaticData; positions becomesrc.XPos(fc456c7f7b,eaca0e0529);a5e3cac895splits state amongssa.Func/Cache/Config. See the concurrency-preparation thread for the rest. Left open: nothing noted. - Generic rewrite rules and rulegen — Done:
walkmulremoved in favour of generic rules (47d2a4dafa), reassociating constant folding (379567aad1), shift-pair-to-extension (72a071c1da), float strength reduction (63a72fd447),ZeroExt(Const)(12c58bbf81),Neg(Const)(417f49a363), store elimination (4fc498d89a), BCE rules for AND-bounded indexes (4fc45ae879), boolean rules (6a24b2d0c1,9aeced650f), bit-twiddling (00db0cbf86), 32-bitAddPtr(Const)(4b3a55ec02),IsNonNil(ConstNil)(6ad2d6aa92), fixes togeneric.rules(457ac38e7a). Left open: nothing noted. - Common subexpression elimination (cse) and its scalability — Done: constant-string CSE (
e22ba7f0fb), commutative-op fix (6317f92f6e), fewer allocations (f791b288d1: Aux map populated once across the two CSE runs and skipped for non-CSE-able ops), tuple-select ignoring types (08dca4c649),OffPtr SPin the constant cache (3dcfce8d19). Left open: nothing noted. - Nil check elimination and the redesign of nil checks — Done: same-block elimination back (
98061fa5f3),IsNonNil(ConstNil)(6ad2d6aa92), more Phi non-nil (c694f6f3a8). Left open: nothing noted. - Prove pass and bounds-check elimination — Done:
73f92f9b04,4fc45ae879(AND-bounded indexes),7439ba32ff,0b6fbaae6e(loop rotate/guard made conditional because it “degraded bounds check removal” in preemptible-loop mode). Left open: the preemptible-loops experiment still trades off BCE. - Escape analysis (esc.c → esc.go) — Done:
1e29cd8c2b,a69754e30c,24e94766c0,fcee3777fd,6f83b75be2(lexical scope of escaped variables). Left open: nothing noted. - Inlining (inl.c → inl.go) — Done:
8a9dc05312,566e72d0ce,e52d317d24,2397cd0fbf,a246f61637,1c6ef9aeed,b928e2faa8,619e37bdcc. Left open: ishairy visitor: “will make it easy to add more state” — later budget/mid-stack work. - Write-barrier insertion: from gc to the SSA writebarrier pass — Done:
c4ef597c47,9ebf3d5100,211c8c9f1a,5bfd1ef036,794f1ebff7,0ee9c46cb1,e5c9358fe2,94a017f3f5,85b2940f5c. Left open: nothing noted. - Interface conversions, type assertions and devirtualization — Done:
4e0c7c3f61,295307ae78,c682d3239e,0358367576,d9270ecb3a. Left open: only direct itab-known calls are handled. - Phi construction and the SSA builder’s scalability — Done:
61fb2f6d63,4e428907c5,e00e57d67c,5272a2cdc5,9664bc1d1f,a027466e4b. Left open: nothing noted. - Dominators, loops, CFG editing and block-level passes — Done:
39ce5907ca,638ebb04f2,abdb2c35b6,073297ff68,b3e577b9e7,16e430e1ef,0b6fbaae6e,9664bc1d1f. Left open: rotation conditional on GOEXPERIMENT (BCE regressions). - Compile-time performance and determinism of the SSA package — Done:
a5e3cac895,f791b288d1,4ee934ad27(export data -10%),ccaa8e3c6f. Left open: nothing noted. - Preparing the backend for concurrent compilation (Go 1.9) — Done: all of the above. Left open: nothing noted.
- Lowering of copies, strings and slices; intrinsics — Done:
a833485828,c8eaeb8cba,a51e4cc9ce,ee69c21747,3bdc2f3abf,e4a500ce14,dbd51ce99c,d5dc490519,dd9892e31b,42e97468a1,ec091b6af2,5d6b7fcaa1. Left open: nothing noted.
Other changes
- Source-position work internal —
27da3ba5af,165a96e281,0b4e8d00fe. - Compile-time/refactors internal —
7cd6310014,a6bd42f263(emitOffPtrfor first field so dse removes stores),c4b8dadb40,10d718b983,678f35b676,945180fe2a,67d69f899c. - Dead code internal —
dffe5ac9f2eliminates deadifbranches after typechecking (instead of separately in inlining, escape and export; labels/goto block it). - Compiler fixes and refactors (33 commits) internal — small fixes, line-number repairs, node-API tidy-ups and diagnostics in
gcand thessapackage that do not carry separate design (34b563f447,8179b9b462,6ee8c6a7ce,8cf1766930,35a95df571,a146dd3a2f,78200799a2,862fde81fc,c61cf5e6b7,a9292b833b,fdef951116,f7f3514bd8,8eb14e9de5,9b480521d8,ccae744f80,8a4cee67af,7202341de9,26be4b9113,0b647ffb98,95bfd927f5,8caf21da47,44a0681ae4,ebcb9cdf67,4c1622082e,700574e791,716219ffd9,495f55d27d,26e126d6e6,cee5cd5a02,e5bb5e397d,978af9c2db,cfae61b65a,cabf622da8) - SSA and inlining cleanups internal — Some SSA cleanup, fixed misaligned comments, removed unused code and simplified inlnode. (
0df81e8887)
Backends and assemblers
From Backends and assemblers (Go 1.7–1.11)
Cleanup and speed: liveness ported to SSA, math/bits and rotate intrinsics, automatic commutative rule generation, chunked rewrite functions, types.Type in SSA, XPos/src.Pos, inlining PC tables, Follow removal, concurrent-safe assemblers and Prog allocation for the concurrent backend, ARM/ARM64 assembler hardening, load+op fusion on amd64.
- Register allocation, flag allocation and stack slots — Done: better spill placement (
886e9e6065), no spill of rematerializable values at merge edges (8a44c8efae), startRegs fix (8a5175df35), preemptible-loop phi fix (9664bc1d1f), rewrite of rematerializable/flag interplay discussed in2cb61aa3f71.10’s predecessor work. Left open: ADDQconst could not be marked rematerializable because it clobbers flags (documented in2cb61aa3f71.10 the next cycle). - Scheduling, tighten, block layout and CFG passes — Done: exit blocks last (
4b0d74f89d), contiguous looprotate (638ebb04f2), storeOrder fix (a355639c60,978af9c2db), boolean simplification rules (6a24b2d0c1),27bc723b51loop depth init,1213776650/6664ccb453concurrency tuning (see obj thread). Left open: nothing noted. - Rewrite-rule machinery and compile-time performance of the SSA compiler — Done: automatic commutation (
041ecb697fthen relanded53f8a6aeb0), chunked rewrite functions (fc7b83d192), no successor variables (eaa198f3d1), lazy config (193510f2f6), cheaper CSE (f791b288d1), Func/Config/Cache roles (43afcb5c96,a5e3cac895),*types.Typein SSA (46b88c9fbc),d11a2184fbearlier GC of freed constants,3dcfce8d19. Left open: rules for different operand widths still repetitive. - Multi-architecture SSA ports: ARM, 386, ARM64 (dev.ssa) — Done: ARM64 address folding refactor
4eb48a336e,b53f0f8c96,6464e5dc4bnot folding offsets for args because args are not 8-byte aligned to SP;fb0ccc5d0aadds assembler support for large/unaligned loads and stores so folding can resume;38fbada557more ARM constant folding;01b1a34aacrework of udiv on ARM;a041806335,14f3ca56ed,6897030fe3assembler constant-pool avoidance. Left open: ARM64 assembler still rejects many forms (see assembler thread). - Multi-architecture SSA ports: PPC64, MIPS64, MIPS32, s390x — Done: PPC64 rotates (
9248ff46a8,01c8719f8bmoves rotate generation to SSA), ANDN (95f3e474561.8,695f12c21a), fused multiply-add (17570a9afb), LoweredZero/LoweredMove (23bd919136,a8b2e4a630,b8d327a438), register-based int/float conversion (44053de365, requiring Power8),13c35a1b20no scratch stack location,c644a76e1fremoving OldArch checks,4dbcb53d0b,ddf807fce8,f75b5e99eds390x rule fixes,93b7eb973f. - Removal of the legacy backend and decoupling gc from the code generators — Done:
Thearchplumbing (3e2f980e27,3e63cdf850),Curfnremoval (ef1ab0f0f4,6652572b75,1911087dee), Prog globals gone (c3a50ad3c7),0a94daa378SSAGenState,263ba3ac7bdefframe,174b858f78frame size passed to defframe. Left open: nothing noted. - Liveness, stack maps, safepoints and write barriers — Done: SSA liveness (
325904fe6a,2d78538c12,ea8c7dae4f),1cdf4bf33f/691755304cSymEffects,b612ab3acb,38dee12dea,7b8f51188bbitmap generation refactor,8179b9b462output params live with defer,7cd6310014. Left open: nothing noted. - DWARF variable locations, statement positions and inline info from the backend — Done: XPos and src.Pos plumbing (
82d0caea2c,ad4efedc6c,4808fc4443,472c792e0a), inline PC-value tables (699175a11a,0824ae6dc1), dwarf.Var generation moved into the compiler (68177d9ec0),1a7582f5e9,00263a8968line-number churn reduction. Left open: variables always described as being on the stack. - Intrinsics for atomics, math/bits, math and runtime helpers — Done: math/bits (
495b167919,5cadc91b3c,42e97468a1,8304d10763), rotates (7e07e635f3,fa3fe2e3c61.10), ppc64x atomics (95c9583a18), fused multiply-add (bd8a39b67a,17570a9afb). Left open: Len8 is disabled (495b167919). - Memory-op combining, byte-order idioms and load/store folding — Done:
bd91e3569a,4477fd097f,21c71d7788,0fe58bf650,86dc86b4f9,b548eee3d9/074b73b1b2fixes,f9bec9eb42(MOVL for small constants: 1657 MOVQ replaced, binary 4KB smaller). - amd64 and 386 instruction selection — Done:
f9bec9eb42,9d5987d79f,0fe58bf650,a4e1a72f0a1.10 (actually 1.10),3e63cdf850. - ARM and ARM64 instruction selection and fused operations — Done:
8577f81a10,257b01f8f4,4eb48a336e,fb0ccc5d0a,38fbada557. - Memory clearing and copying: Zero, Move and Duff’s device — Done:
23bd919136,a8b2e4a630,b8d327a438,fddc004537no nil check for Zero/Move on 386, AMD64 and S390X. - cmd/internal/obj: Prog/LSym refactoring, concurrent backend and object-writing — Done: Follow removal (
bed8129ee6), FuncInfo (9cb2ee0ff2), concurrency-safety (see Design),7a98bdf1c2removes AUSEFIELD pseudo-op,ac7761e1a4removes Link.Plists,3394633db0eliminates AMODE,8ada52228cremoves ProgInfo tables,cce4c319d6drops AVARFOO ops,7bb5b2d33aremoves Addr.Node and Prog.Opt,d0ff9ece2b. Left open: nothing noted. - x86 assembler: AVX, AVX2, AVX-512 and the instruction table — Done:
7f9832254c,92d918da03,a2da2108ee,1f85d3ad09,88f423edacprologue branch layout (wrapper case moved to end),2ebe1bdd89. - ARM64 assembler — Done:
579297e1e1,d039d01fe9,0bae9b083b,2b6c58f6d5,990dac2723,b5931020b7,2122fc6358. - 32-bit ARM, MIPS and PPC64 assemblers — Done: ARM and PPC64 items above (
85ecc51c48,7d4cca07d2,09b71d563a,6910e1085b,c5ddc558ba,a041806335,14f3ca56ed,6897030fe3,dcf643f1fd),b53acd89db,c12cd31a33RLDIMI fix,555d1e36f9MOVFL fix,604e4841d6stackbarrier removed. - Prologues, frame pointers, NOFRAME and tail calls — Done:
41fd8d6401,88f423edac,a143f5d646,450472989b,13c35a1b20.
Other changes
- Concurrent backend user-visible — the compiler can run SSA/assembly of functions concurrently (
-c); function queue is a buffered channel (1213776650), complex functions first (6664ccb453), enabled by obj changes above. - Fused multiply-add user-visible — emitted on s390x (
bd8a39b67a) and ppc64x (17570a9afb); explicit float/complex conversions now block fusion and are kept as rounding OCONV operations. - SSA type change internal —
ssa.Typeto*types.Type(46b88c9fbc),MustSize/MustAlignment(94d540a4b6),872db79989. - Compiler struct packing internal — bools to bitsets (
ed70f37e73, up to 4% memory). - Pointer-clobber experiment internal —
1e72bf6218experiment that clobbers all dead pointer fields. - Op metadata internal —
hasSideEffects(11b283092a),UsesScratch(c28f55c5021.8, 1.8),SymEffect(1cdf4bf33f). - Removed instructions internal — emulated float instructions removed from s390x (
a524616860), Hmul8/16 (02e36f8c87), BTQconst, TESTB op on s390x (45b26a93f31.8, 1.8). - Misc rules internal —
3d5eb4a6bebetter Slicemask,3e63cdf850shift with different-typed counter,9d5987d79f,02e36f8c87,6a29440dcc/87c475c227backend usesobj.LSym,c8f38b3398store size from type information in Aux. - Misc fixes internal —
c920fa537famd64p32 slice-in-bound check,7a98bdf1c2,e471ad9189duplicated outgoing-arg zeroing removed,a51e4cc9cezero return parameters earlier (before move-to-heap, since allocation points expose uninitialised slots to the GC). - Backend/gc decoupling cleanups internal —
57107f300a,5f5d882f5c,dc4434a0c0,0dafb7d962,89840e4ac9,10fdf769f0,ee80afe326,22ea7fc1a9,e95989c1c1,34975095d0,beb833f124,7efb0779be,0323895cc0,3d90378df5,3751513562,877574725b,42426ed411,5aebeaaca2,30940e2cc2,a495fe2775,804784c8ba,fcee3777fd,26e126d6e6,33fd319cbc,3692925c5e,c239fbb893,118b3fe7bb,08d8d5c986(replaces Go/Defer calls with StaticCall). - obj cleanups internal —
7bad00366b,301149b9e4,1874d4a883,b1a4424a52,a955ece6cd,42a915c933,88d4ab82d5,6f4a4585f2,214be5b302,c06679f7b5,4909ecc462,1acba7d4fa,aca58647b7,bfd8093c96,92cffa1391,c311488283,99683483d6,7165bcc6ba,e367ba9eae,eacfa59220,30ddffadd5,f30de83d79,49f4b5a4f5,c18fd09840,4e4e51c5c5,7b5f94e76c,9d4a84677b,aecf73fc31,bb215de8a6,89a355c930,6b0bd51c1c,d2a9545178,f20944de78,4927b9a9ff. - Rules and SSA fixes internal —
57546d67ec,5c90e1cf8a,5f374ea8fb,8cf1766930,a16e631e74,708ba22a0c(constant-divide strength reduction moved from the front end to SSA rules),094992e22a,3557d54609,6fd5e2549a,793e4ec3dd,604455a46c,86dc86b4f9,24dc8c6cb5,ff80d8ba4b,cb83924d5b,256210c719(better single-live-memory check),35cf3843a4,7b0b52ef2b,cc71aa9ac4,ff262913fe,baa0fdd093. - Assembler fixes internal —
d039d01fe9,fd118b69fa,eed6938cbb,db6f3bbc9a,4b2f7b4b51,c7cae34b19,5e79787935,ef26021d30,1eed80f09a. - 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). (
c10499b539,78f6622b81,399086f2db,b3fb6b00ae,4e5593ddaa)
Linker and object files
From Linker and object files (Go 1.0–1.9)
PIE linked externally by default, Windows external linking and DWARF fixes, Mach-O DWARF for dsymutil, -importcfg, object magic go19ld, objabi split and symbol-kind trimming.
- Go symbol table, pc/line table and function metadata (gosymtab, pclntab, findfunc) — Done:
runtime.epclntabforced into.textfor the PE symbol table (99e1e4f657,b5e964cc1c). - Stack splitting and the linker’s nosplit overflow check — Done: 64-bit Windows always reserves 2MB stacks, independent of cgo (
c2c07c7989). - DWARF generation in the linker — Done: see Design; also
.debug_gdb_scriptson windows (1d44c4e378),go.dwarflinkage unification viadwarf.Varslices (1a7582f5e9). Left open: nothing noted. - External (host) linking and cgo — Done: PIE external by default (
ab067cde34), always show external linker output (4d7a5edb7e), PE adjustments for external linker (e31144f128,a7e2556255,6db4d92e4c,e94b9d4143),-snot passed to host linker on macOS (371c83b594),-no-piefallback to-nopie(9e859d5e9c), ppc64le trampolines with external linking (738739f565). - Build modes: -shared, c-archive, c-shared, shared, PIE, plugin — Done: user-visible PIE external by default (
ab067cde34), plugins on s390x (a6b480bc07). Left open: internal PIE remains disabled. - liblink, the object file format and the move into the compilers — Done: magic bump (
7c84dc79fd), objabi extraction (1e3570ac86), symbol kinds trimmed (be2ee2a4b4,d2a9545178,4aca8b00ff,b2363ee9f6) and attribute bits (a69222d949,f72534ab6a),Setuintxx/WriteIntunified (89a355c930),dxxxtodxxxLSymrefactors (4d600b8e5f,bea8ffdbb1,c2b4fb5a3b,976a5ce1a8,92607fdd30). - From C to Go: cmd/link — Done: quadratic library loading fixed (
51711d1429),-importcfg(4f2269edbd),Segment.Sectionslinked list to slice (743fe0697d),markextraeliminated (d343478295), goto removed in ldelf (d728be70f4). - Linker speed and memory (Go 1.7 focus) — Done: quadratic library loading fixed (
51711d1429);cmd/internal/srcfilename cache (57e038615d, compile-side); DWARFencbufremoval (f978301144, enabling a concurrent backend, withPutFuncbuffer reuse and 7-bit fast path). - Runtime type data, GC metadata and sections laid out by the linker — Done:
runtime._typevariants exported to debug_info (073247f11f). - Container writers: Windows PE, Mach-O and Plan 9 — Done: the PE and Mach-O items above, including
c7a7c5a9b4/e94b9d4143(windows/386 cgo underscore prefix) and4e3a1e409a,361af94d5d(windowsgui as a linker variable rather than a header type). - Architecture and OS ports in the linker (arm, power64, arm64, mips, s390x, nacl, BSDs, Solaris) and trampolines — Done: ppc64le external trampolines (
738739f565), alignment 16 (09b71d563a), mips64 CPIC (39c07ce9e5), plugin on s390x (a6b480bc07), PT_TLS on OpenBSD (9417c022c6), canonicalized package of dupok text symbols (a1cedf0842). - Build IDs, ABI hashes, flags and determinism — Done: user-visible
-importcfg(4f2269edbd); ABI hash limited (533ed967c6).
Other changes
- Misc internal —
99df7c9caaappend loops,f978301144(above),57e038615d,752d7bad4f,dc444418d9,201fd16568Fieldtrack SDATA,4c86f7bd49,27a10f7da7,f0cf740733omit framepointer from compile version,45d42fdceano-no_pieon darwin/arm64,361af94d5d,e29ea14100,adc80c0665.