Go 1.8
SSA is the only backend on every architecture, and the legacy backend is deleted. Hybrid write barrier, so no more STW stack rescans. New syntax package and noder. Plugins. Cheaper defers and cgo calls. pprof protobuf output. Mutex profile. Same-size map growth.
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)
Hybrid write barrier ends STW stack rescans; bigger static size classes; sweep and root marking proportional to in-use spans; NextGC redefined.
- Concurrent sweep and proportional sweep — Done: sweep and
markrootSpansproportional to in-use spans (f9497a6747,c95a8e458f,575b1dda4e);mSpanList/go:notinheapclean-ups (991a85c889,1bc6be6423). Left open: nothing noted. - GC pacer: trigger controller, assists and background utilisation — Done: user-visible
MemStats.NextGCis now the goal heap (ec9c84c884),heap_reachableremoved (2098e5d39a); assist fixes (984753b665,81c431a537,f9e1adb713,d35dfd405e);NumForcedGCuser-visible (01c6a19e04). Left open: assists still assume entire heap live. - Stack scanning: conservative, precise by frames, stack barriers, hybrid barrier, async safe points — Done: rescan disabled by default (
bd640c882a), mark worker stacks scanned normally (d6625caf53), consistency checks for rescan position (ab59235729). Left open:gcrescanstacksfallback kept for one release. - Hybrid write barrier and buffered write barrier — Done: hybrid barrier (
5380b22991), pre-write ordering (8f81dfe8b4), 32-bit barrier flag load (fdc4a964d2,8107b0012f1.7), idle-worker and assist improvements (see pacer). Left open: the barrier is unconditional “for now” because channel operations would need both stacks’ state (5380b22991). - Precise heap scanning: type information, the heap bitmap and GC programs — Done: scanobject load/shift reduced (
0e7e43688d), atomics dropped fromheapBitsSetType(c03925edd3). Left open: nothing noted. - Size classes, tiny allocator and mcache/mcentral — Done: bigger size classes, static class tables (
14e5951166,7ba36f4adb), tiny blocks marked at GC start (85c22bc3a5). Left open: nothing noted. - Span lifecycle in mheap: free lists, treaps, first-fit and the page reclaimer — Done: span map and state cleanups (
6b0f668044,5915ce6674,6879dbde4e,f4dcc9b29b,3cbfcaa4baisFree). Left open: nothing noted. - Finalizers and span specials — Done: zero-initialised finalizer frames (
d3836aba31,db56a63547), weakerSetFinalizerpanic claim (99339dd445). Left open: nothing noted. - Mark work distribution: parfor, work buffers, gcWork and root jobs — Done: bounded
scanobject(cf4f1d07a1), assists perform root jobs (d35dfd405e), idle worker exit and wakeup (49ea9207b6,0bae74e8c9,dd500193d3,d70b0fe6c4),getfullavoided (ee3d20129a), STW mcache flush parallelised (a475a38a3d). Left open: nothing noted. - Runtime allocators for runtime metadata and the port to Go — Done: fixalloc zeroing (
ae3bb4a537),go:notinheaptypes (1bc6be6423,991a85c889). Left open: nothing noted. - Memory statistics and accounting — Done: user-visible
NumForcedGC(01c6a19e04). Left open: nothing noted. - Allocation-site profiling and GC debugging modes — Done: freed-object marking check (
d1cc83472d), improved scan diagnostics (05dc6b26ca,38f1df66ff). Left open: nothing noted.
Other changes
- Misc internal — missing race/msan checks in reflect (
dc9755c2a2), vacuous page rounding (336dad2a07,3de7dbb191),bbe96f5673,7aab88a31e,6b795e77df. - Misc internal —
SetFinalizerexpression (66121ce8a9), mark termination flush removal (9429aab999), pacer underflow debugging (2817e77024), worker/root-check ordering (c1730ae424). - Comment updates for GC and size classes internal — Updated the big mgc.go comment and added a size class table in a comment. (
618c291544,ffedff7e50)
Scheduler and concurrency
From Scheduler and concurrency runtime (Go 1.0–1.17)
Mutex profile, atomic intrinsics, select/stack-growth race fix; threads: diagnostics, channels, atomics.
- The G-M-P scheduler: from global-lock M:N to per-P run queues, spinning Ms and work stealing — Done: first-class
Gscan/state docsb1a6e079191.7. - Channels and select — Done: select/stack growth corruption fix
b902a63ade; write barriers on direct receivef2d05389da. - sync.Mutex, RWMutex, WaitGroup, Cond, Once — Done: unlock of unlocked mutex throws, not panics
40d81cf061(alsof72196647e1.10 for 1.10). - sync.Pool — Done: Pool enabled under race
ba048f7ce4. - sync.Map, atomic.Value and sync/atomic — Done: mips
9788e3d4d7; amd64 intrinsicsd6098e4277. - Stop-the-world, safe points and GC–scheduler interaction — Done: write barrier before pointer write
8f81dfe8b4, no barriers indropg/save8044b77a57,c3163d23f0, stack-to-stack copy shadingee785f03a2; spare Gs2be3ab4415. - Scheduler diagnostics: schedtrace, GODEBUG, execution tracer, block/mutex profiles — Done: user-visible mutex profile
ca922b6d36.
Other changes
- Misc runtime internal —
ab150e1ac9,8607bed744,aa581f5157,a73d68e75e,d7b34d5f29,e6da64b6c0.
Data structures and type metadata
From Runtime data structures and type metadata (Go 1.0–1.17)
Same-size map growth to bound overflow buckets, duplicate-itab handling across shared libraries, typemap/typelinks work, reflect.Swapper, decoderune.
- Hash map core: from the first hashmap.c to the 8-entry bucket design — Done: overflow-bucket limit (see growth thread,
9980b70cb4), iterator concurrent-map check fix (e492d9f018),bmap.tophashdocumented (bf776a988b). - Map growth, iteration order, overflow buckets and GC interaction — Done: same-size grow to bound overflow buckets (
9980b70cb4). Left open: counter is approximate for large maps by design. - Runtime type descriptors: layout, shrinking and name encoding — Done: typemap/typelinks work (
bee4206764,f4c7a12c2c,34c480afa8), qualification of unexported fields of unnamed types (14efaa0dc3), field pkgPath (011cb64231,8d0c105407), Noalg types no longer break user types (3797446150), main-symbol type table (5923df1af9). - Interface values, itabs and type assertions — Done: duplicate itab handling (
8b07ec20f7,1ec64e9b63), static iface init (dfc56a4cd3). - reflect.Call, MakeFunc, method values and argument-frame GC precision — Done:
getArgInfofor deferred reflection calls (d5bd797ee5),makeFuncImplkept live across stub (22689c4450). - reflect performance, caches and API additions — Done:
Swapper(ca04091f5b), zeroing avoided (adb1e67f02), struct tags ignored in struct conversion (ddb77100a6), DeepEqual cycles (19adf8aeaa). - memmove, memclr, duff routines and pointer-write atomicity — Done:
3107c91e2d,a96e117a58. - Slices and append: growslice, makeslice and string/slice conversions — Done: append clears only uncopied memory (
c1e267cc73). - Strings: concatenation, conversion and printing helpers — Done:
decoderuneand string/rune optimizations (d295174030,880c967ccd),maxstringremoved (252093f120).
Other changes
- Reflect and compiler internal — tflag cleared for new types (
56752eb2b8), Type equality documented (ec75230b55), mips port (1a07257777), docs (4c1995f95b,398e861d97), StructOf trailing zero-sized field (50c4dbced9), compiler allocations cut back viatconv(37d452c3e9), s390x R0 (f1515a01fd), pre-panic logs in core dumps (e0aedfb496).
Diagnostics and knobs
From Diagnostics and knobs (Go 1.0–1.17)
pprof protobuf output for CPU, heap, goroutine and counted profiles; GC events in traces; MemStats documented and NextGC made the real heap goal.
- Execution tracer (trace v1): events, per-goroutine sequencing, annotations — Done: user-visible GC shown in
cmd/traceon its own row, mark termination labelled (eed309f5fb,94589054d3), mark worker types annotated (6834839427), goroutines blocked on GC assists tracked (6da83c6fc0);StartTraceemits one stack id for all existing goroutines’EvGoCreateinstead of unwinding each (747a158ef3: 10K blocked goroutines 20ms → 4ms); runnable-count andEvGoWaiting/EvGoInSyscallanalysis fixes (c24cc40075,a50f9859bd); global buffer reset inStopTrace(cd285f1c6f);*greplaced byguintptrin the tracer (c242517866); a script to collect canned traces (e14b021977). Left open: nothing noted. - Race detector integration — Done: copy/append not instrumented inside the runtime (
9d8522fdc7); no crash on invalid PCs (38765eba73); code duplication in instrumentation (8b3194ac8f). Left open: nothing noted. - CPU profiler and runtime/pprof writers (legacy format to compressed protobuf) — Done: user-visible profile protobuf format:
protopprofconversion (f72a629dbd,7d14401bcb,b33030a727,21a1fe4ddf,eafe48781aremoves the gzip0 package), CPU (76f12cdaa2), counts (ccd69d0582), heap (86ab09eed5), goroutine locations (c6228ef7e2); heap profile reports GCSys/OtherSys (39ce6eb9ec). Left open:f72a629dbd/76f12cdaa2read and convert the whole profile in memory, “should be possible to convert each chunk in a stream”. - Heap profile accounting and MemStats — Done:
MemStatsdocumented (f67c9de656,a3f4cc0669);next_gcdisentangled from the trigger soNextGCis the heap goal andgc_triggeris unexported (ec9c84c884),heap_reachableremoved (2098e5d39a),next_gcis ^0 when GC is off (fa9b57bb1d), 8-byte alignment ofheap_live(d3a3b74aa1); user-visible number of forced GCs added (01c6a19e04). Left open: nothing noted. - GODEBUG, runtime/debug, debug log and traceback knobs — Done: runtime panic frame elided at top of user stack (
f9feaffdf5). Left open: nothing noted. - MSan and sanitizer integration — Done: msan calls before traceback functions (
d00890b5f3); nil g/m check inmsanread(ea7d9e6a52). Left open: nothing noted.
Other changes
- Misc internal — pprof slice prealloc (
456b7f5a97), pprof URL (c2322b7ea6), negative elapsed cycles (a1b6e1692b),sort.Sliceadoption (ad26bb5e30).
OS layer, stacks and panics
From OS interface, stacks and panics (Go 1.5–1.17)
cheaper defer (-42%) and defer-free cgo calls, mips/mipsle, plugin runtime support, unified Unix signal code, libc sigaction under cgo, physical page size query, SIGPIPE in libraries.
- New and ported OS/arch targets, 1.5–1.17 — Done: linux/mips and mipsle (
fa77001648,b241a06479,272032d0b2,b909d01152,3444e5b355,526b2f85ce,155d314e50), s390x vector facility and HWCAP (d38d59ffb5,f1515a01fd,f1ad4863aa,62dafbb4c6), ppc64x HWCAP (40aaf28312),pluginsupport in the runtime (0cbb12f0bb,b4c9829c22,f4c7a12c2c,54ec7b072e,b531eb3062,81a61a96c9). Left open: nothing noted. - Goroutine stack growth, shrinking, GC stack barriers and stack objects — Done: stackmaps no longer padded to 4 bytes (
303b69feb7),rewindmorestackremoved (4c9a372946), clearermorestack(bf9c71cb43,687d9d5d78), bad stack pointer message (3df926d52a), barrier slice nil with 0 barriers (3193c71c5b). Left open: barriers still present, removed in 1.9. - Tracebacks, symbol tables and
runtime.Callers/CallersFrames— Done:getcallerspin Go (d211c2d377),sigcodeprinted on signal crash (09692182fa), bad ftab index handled (b2d34fa51b), non-looping panic printing (7faf702396). - Defer, panic, recover and Goexit (runtime side) — Done: optimized defer (
f8b2314c56),getcallerspin Go (d211c2d377),call*signatures and zero-sizedeferArgsfixed (a73d68e75e), reflectcall write barriers simplified for the hybrid barrier (79561a84ce), cgo call without defer (441502154f). Left open: defer still costs ~28 ns over no-defer (f8b2314c56); “a future Go release will drop the cost of defer to nothing” (441502154f). - Signals: masks, forwarding, sigaltstack and the unified Unix signal layer — Done: unification listed above,
SIGSTOPon Solaris (84803f3da1),sigtrampcallee-saved registers (29cb72154d,fdde7ba2a2), nocgocallbackfrom signal handler (6c13a1db2e), crash if signal arrives on g0 stack (fded5dbb2f), sleeping to let bad signals deliver (75055de84a), SIGPROF PC on non-Go thread (d03e8b226c), SIGPIPE in libraries (d24b57a6a1),sigseton ppc64 BE (15937ccb89),sigfwdalignment (8380de416b), dragonfly signal-stack revert (5db80c30e6,a0d330f1dd). - cgo runtime support: pointer checks, callbacks, extra Ms, C-to-Go call path — Done: no defer in standard cgo call (
441502154f), pointer-check function literal (a16954b8a7), undead arguments (f6bff1d587),pthread_createretry on EAGAIN (7cba779cea,80acfe950f), tsan aroundsetenv(2d85e87f08), big-endian mips64 callback (14ff7cc94c), s390x FP register saves (06fcc32d14). - Shared-library and buildmode entry points (c-archive, c-shared, plugin, shared) — Done: plugin package and runtime checks (
0cbb12f0bb,b4c9829c22,f4c7a12c2c,54ec7b072e,81a61a96c9,b531eb3062), Android libs read/proc/self/auxv(6f287fa2bb). - vDSO, time sources and process-wide randomness — Done:
clock_gettimeon ppc64x/s390x/arm64/mips64x (0df5ab7e65,61d5daea0a,5594074dcd), Linux auxv extracted (d39b7b5347). - Windows runtime — Done:
RtlGenRandom(db82cf4e50), semaphore error checks (1a3b739b26), XMM float syscall args (9c02c75639), msvcrt/math/threads libs not linked by default (dd307da10c,9ac60181e2,f595848e9a),CreateThreadpanic on exit (f24384f686). - Assembly-level runtime entry points: memequal/cmp/IndexByte, hashing, atomics and ABI wrappers — Done: amd64
memmoveAVX (3607c5f4f1,d7507e9d11), AVX2Index(0cff219c12,44f1854c9d), s390x vector (47c58b4667,3436f0776f), call* signature fixes (a73d68e75e), unaligned atomic crashes on 386/ARM/MIPS (01b4ddb377,526b2f85ce),FPrather thanSPfor assembly parameters (9828b7c468), s390x frame sizes (62dafbb4c6), ppc64 HW caps. - Thread lifecycle, physical page size and scheduler-facing OS hooks — Done: physical page size from OS (
d7de8b6d23,276a52de55,6dda7b2f5f,1b9499b069,a0667be8ef,6a1cac2700), sched_getaffinity check. - Plan 9 and NaCl ports — Done: async I/O (
adb384ad2c), NaCl asm (e2103adb6c),brk_(5abfc97e84).
Other changes
- Darwin/iOS internal — user-visible runtime: os.Executable runtime support for Darwin (
2058511e4e) - Linux, vDSO, time and auxv internal — user-visible runtime: cull dead code (
7c5f33b173); user-visible runtime: insufficient padding in thepstructure (aaa6b53524); user-visible runtime: remove unnecessary calls to memclr (fa897643a1); user-visible runtime: simplify getargp (07bcc16547); user-visible runtime: make mspan.isFree do what’s on the tin (3cbfcaa4ba); user-visible runtime: consolidate h_allspans and mheap_.allspans (4d6207790b); user-visible runtime: eliminate mheap.nspan and use range loops (66e849b168); user-visible runtime: document rules about unmanaged memory (c5e7006540); user-visible runtime: add deletion barriers on gobuf.ctxt (70c107c68d); user-visible runtime: accept timeout from non-timeout semaphore wait on OS X (71cf409dbd); user-visible runtime: fix SP adjustment on amd64p32 (1bd39e79db); user-visible runtime: expand HACKING.md (5dd978a283) - BSD, Solaris, AIX, Plan 9, NaCl internal — user-visible runtime: ignore closeonexec ret val on openbsd/arm (
e80376ca6b); user-visible runtime: sleep on CLOCK_MONOTONIC in futexsleep1 on freebsd (360f2e43b7); runtime, cmd/link: fix netbsd/arm EABI support (8419c85eaa); user-visible runtime, syscall: update openbsd for changes to syskill (f91ddaabe6) - cgo and C interop internal — runtime/cgo: correct type declaration for Windows (
4141054d19) - stacks, defer and unwinding internal — user-visible runtime: on stack copy, adjust BP (
1ea60c136a) - other runtime/OS plumbing internal — crypto: detect BMI usability on AMD64 for sha1 and sha256 (
a2b615d527)
Compiler frontend
From Compiler frontend (Go 1.1–1.9)
New syntax package and noder replace the gc lexer/parser, textual export format removed, printer vs fmt.Formatter formatting rewrite, go:notinheap/yeswritebarrierrec, mapassign returns a slot pointer, first (reverted) alias implementation.
- Parser: from yacc to a hand-written recursive-descent parser — Done:
2ff463948c+adda7ad295noder on by default;57df2f802fold lexer/parser removed;2d4d22af7eparser.go remnants moved into noder.go;ee161e8591pragmas handled immediately;70544c91ff“match old parser errors and line numbers”;117793624bsyntax exposes extra info for gc;2d136ae82e//line filename:linewith ‘:’ in file name;7a26d9fced,322436b78c,60a9bf9f95Read/Parse error handling. - The
syntaxpackage, position representation and parse-time checks — Done:c8683ff797package added; used bynoderfrom2ff463948c(defaultadda7ad295);32db3f2756support for alias declarations in the syntax package (see alias thread);cfc0d6d884. Left open: positions still based on the gc LineHist/linenomodel. - Binary export data and the object-file split — Done:
b4e9f70412textual removed;c85b77c22b/5a6f973565version handling;b11c79fd07;03d81b5ed9alias import/export;bcc0247331avoid double export of aliased objects;6394eb378eblank struct fields’ package;14efaa0dc3qualify unexported fields of unnamed types;9aea69d6dc;595cebb055;c7b9bd7456self-recursive interfaces;f50ced6d73. - Inlining — Done:
e4cae432d6,376d9665a8;c7b9bd7456. - Language changes and rules as implemented in the compiler — Done: user-visible
39055700b1,8895a99c9f,7f1bc53379,936ae27b9c. - Type aliases (the
=>experiment andtype A = B) — Done:32db3f2756,1b0cf430dd,c0e2318f7c,89632aa183,50f66fbb66,03d81b5ed9,bcc0247331,8e970536df(revert of user-visible parts). Left open: “Leaving import/export related code in place for now”. - Static initialization, composite literals and
init— Done:49cce1a62e,cd2d5ee048,7b5df0c195,db9796dac5,dfc56a4cd3,d98de0c3d0,1faea596e4,add3ff549a,bba1ac4fd9,64214792e2,749720a036,41d2278eef,df2b63f09b. - Walk-level lowering and runtime-call optimisations — Done:
6286188986,8c85e23087,615a52b95b,9d2b988e4a,9d4623fe43,e26499153e,e6f9f39ce5,0dae9dfb08,6129f37367,395d36a67d,442de98c14,cf28e5cc9d,3f2cb493e5,ca5cea9dca,27eebbabc2(remove throwreturn). - Write barriers, precise stacks and liveness (compiler side) — Done:
a9e6cebde2,77527a316b. - Compiler data structures:
Node,Nodes,Type, and thetypespackage — Done:78a267e379,add3ff549a,dc46b882d5,d553c29dc1,bba1ac4fd9,2b687a7df8(interface methods not treated like functions),d89b70d433,70d685dc72;1fcad29341(OREGISTER),a7c84668c8(Label type removed),dc53ea7772(IsHiddenClosure),dc5f9311be,f8a3444388(EscScope),3be166dc70,d58219e50b,2b49d129c4,41fa42b447,82703f84e4/d7012ca282/584978f4b5/073d248bf5/fc47ee2332(unexport helpers and globals),42b37819a1(mkbuiltin generates code),3f2cb493e5. - Compiler performance, formatting and concurrency — Done:
f542576b9e,6e759ad2e2,adcd34c732and the Formatter series,37d452c3e9,0cd3ecb016,2b5c18c99e,09686a5873;37d452c3e9. - Pragmas, directives and compiler flags — Done:
a9e6cebde2,77527a316b,832082b44e,49b2dd583b(remove legacy debug flags).
Other changes
- Hygiene and unexport series internal —
4739dcf7fb,a9ed47735f,41943d9639,ee333b4b74,133d231a89,d3134b6450,e90ae90b7a,0d23c28526,809bb3a71c,549ca046ff,3a59b5626d,29f18d7983,06eeea210b,6537e18f02(%S/%Lverbs),cfc0d6d884,2e4dc86bfb,6758eedf89,1ee5446414,429eb3c696,e518962a27,88d2f9112a,6c43c0c2fd,03a1dc3522,4eb2fa1765,d57a4a656a,74a00b249b,0017438139(only generate ·f symbols when necessary),2827923800,ca4431a384,ec5b6406b7,20edeabc0f,833f57ed50,9a8bf2d67d,f46239b85c,4de3df8c95,655a4e1284,8fa0d85b38,c96e94e69d(frame pointers for otherwise frameless functions),c676b0f9cf,f412bd31ce,b03dce927b,f65abf6ddc,e8d5989ed1,f54c0db859(align complex64/128 like GCC, user-visible for cgo),b679665a18,d6dbf3a0d3,5b147122d6(GOARCH=mips),15040c11b9(bootstrap copies std packages),f444b8a80e1.7,a190f3c8a3(flag-specified dump of a phase+function). - Printer experiment steps internal —
73be5d82d4,62a296cd54,87061054e7,71d2b42bf6,8fb0893307,0a7c73b5db(use of the transientprinter),ebdc8faf04,0510f0dfe7,daf6179733(fmt.State),58de26810c; misc1fe4c81282,032e2bd1eb,cf09920c0f(OIDATA next to OITAB),f444b48fe4(encoding/json, not compiler). - Export and typealias cleanups internal — Simplified field and method export and made minor cleanups on dev.typealias. (
a8eb6d51bb)
Middle end and SSA optimizer
From Middle end and SSA optimizer (Go 1.0–1.9)
SSA becomes default on ARM, arm64, mips, mips64, s390x, ppc64; nil checks redone; writebarrier pass in SSA; Sreedhar-Gao phis; O(n log n) CSE; type-assert/switch inlining; preemptible-loop experiment (threads: SSA arrival, nilcheck, write barriers, CSE, phis, interface conversions, switch lowering).
- SSA backend arrival (dev.ssa): bring-up, coverage, default-on — Done: ARM default-on (
42181ad852), ARM Defer/RetJmp (d108bc0e73), 64-bit integer decomposition on ARM (8756d9253f), ARM floating point (59e11d7827), ARM symbolic constants (e1a2ea88d0),SSAReg(d0fa6c2f9e), default types for extension ops (68dc102ed1), stability of generated code (95427d2549), ppc64 BE (eed061f89c), mips (7f033933ce), tuple-select CSE (3d5cf72ca9),GOSSAFUNCrepaired (3eb16c059d),GOSSAHASHto set aDebugTestflag onssa.Configfor bisecting miscompiles (897c0ebf61), CFG-dependent caches (75ce89c20d). Left open:882dd1c3ba“enable rewritings that are blocked by old backends”, i.e. rules still gated by the legacy backends on the remaining arches. - Generic rewrite rules and rulegen — Done: rulegen refactor (
6a1153acb4), more constant folds (f0bab31660), Trunc-of-Ext (5c3edc46a6), extension after shift (ac74225dcc), negation into comparison (00459f05e0), constant square roots (8e24a98abe),Zeroafternewobjectremoved (b2e0e9688a), unblocking rules (882dd1c3ba), better tuple CSE (3d5cf72ca9). Left open: nothing noted. - Common subexpression elimination (cse) and its scalability — Done: O(n log n) refinement (
30088ac9a3), reduced comparison depth (e6051de035), tuple selector CSE (3d5cf72ca9), allowing new SSA values to appear during CSE (a34fddf46c). Left open: nothing noted. - Nil check elimination and the redesign of nil checks — Done: redo (
3134ab3c2d),newobjectremovalb2e0e9688a/4d07d3e29cre-enabled, dominator tree (f4e37c8ec5),256a605faa, PAUTOHEAP (4c4ca83120). Left open:256a605faaexplicitly loses intra-block elimination. - Prove pass and bounds-check elimination — Done:
0f29942489(sliceopt test and rule),93bca632d9(preserve type ininrange),6eede325ab(duplicate-case detection for integer ranges, front-end). Left open: nothing noted. - Escape analysis (esc.c → esc.go) — Done:
f1eed92fd0,bea5252a13,f8a3444388,923a74ce77,83c73a85db. Left open: nothing noted. - Inlining (inl.c → inl.go) — Done:
e4cae432d6,a3765723c6,5d1b53a944,9fbfe7cca0,0bc94a8864(inlined==compares elements, not addresses),dc5f9311be(Name.Inlvar removed). Left open: nothing noted. - Write-barrier insertion: from gc to the SSA writebarrier pass — Done:
f6aec889e1,c39918a049,d0e92f61e5/68331750da(removed unnecessary barriers for APPEND/stack writes),75d367e34b,ed0b232cdc,92ecd78933,fdc4a964d2. Left open: optimisations disabled by the hybrid barrier. - Switch, type-switch and select lowering — Done:
726190daf3,bd2838be77,b046786528,b7ac426ee3,e26499153e,a9266eef93,643b9ec07c,6eede325ab. Left open: nothing noted. - Interface conversions, type assertions and devirtualization — Done:
562d06fc23,1a7fc7b3a7,688995d1e9,672e579444. Left open: nothing noted. - Phi construction and the SSA builder’s scalability — Done:
5a6e511c61,433be563b6,1cbc5aa5291.9. Left open: “we might end up introducing a bunch of dead phis”; TODO to place phis only where reads may use them. - Dominators, loops, CFG editing and block-level passes — Done:
dd24b1098a,be302e6d43,7f1ff65c39,75ce89c20d,e85265e8c2,62ba15a492(more non-returning runtime calls). Left open: bool2int forif b {return 1}; return 0(“left for future work”, message ofe85265e8c2). - Compile-time performance and determinism of the SSA package — Done:
e6051de035,30088ac9a3,fe27291c00. Left open: nothing noted. - Lowering of copies, strings and slices; intrinsics — Done:
c9fd997524,150de948ee,58e2edafb7,8a7f0ad0b5,8e24a98abe,8aadcc551e,2756d56c89,964639cc33,644c16c76c,9a243303b8(omit temporary panicdivide calls). Left open: nothing noted.
Other changes
- Printing and naming internal —
adcd34c732(fmt.Formatterfor*Node),d817c4ec6d,33bb597d85,9c066bab64(AutoTemp flag),761443edd5(KeepAlive keeps whole variable). - Literal/static-init cleanups internal —
cd2d5ee048,7b5df0c195,db9796dac5,741445068f([0]T and [1]T SSA-able),cf28e5cc9d(evaluate panicking args before storing call arguments). - Misc internal —
26c7b4fb1e,3797446150,0bc94a8864,88d2f9112a,9d8522fdc7,7aefdfded0(4K as the boundary of legal pointers),5b708a6b6a. - dev.ssa per-construct implementation, debugging aids and small SSA fixes (2 commits) internal — the long tail of the SSA bring-up: implementing individual node kinds (
OSLICESTR,OCOMPLEX,OFALL,OCFUNC,ORETJMP,OGETG,OSPTR,PPARAMREF,len/capof maps and channels), floating-point and complex comparison fixes, defer/return handling,-Nfixes, logging and HTML printer tweaks, TODO updates (e3a6d00876,6adb97bde7) - Compiler fixes and refactors (17 commits) internal — small fixes, line-number repairs, node-API tidy-ups and diagnostics in
gcand thessapackage that do not carry separate design (3c55ee6420,375092bdcb,a301b329e5,cf20525bf4,46ba59025f,e6f1a886bc,a7277e5494,6a393dc64f,fb273fc3a3,70fd814f53,83676b93fb,4b8a1611b5,a06e931abe,f239196b9e,c5368123fe,032e2bd1eb,0d176621d9) - SSA and inlining cleanups internal — Some SSA cleanup, fixed misaligned comments, removed unused code and simplified inlnode. (
590f3f0c9d,26069e1981)
Backends and assemblers
From Backends and assemblers (Go 1.7–1.11)
SSA becomes the only backend for every architecture: ARM, 386, ARM64, PPC64/le, MIPS64, s390x and the new MIPS32 port, with the legacy cgen/gins code deleted (167e381f40, e7cc9c4f4d); new passes (writebarrier, nil-check redo, stack layout in SSA), atomic intrinsics, link register allocation, and PPC64/s390x assembler growth.
- Register allocation, flag allocation and stack slots — Done: copy-before-evict (
f876fb9bae), Phi-input copies (348275cda6), LR as allocatable register on s390x/ARM64/MIPS64/ARM (15817e409b,5c59cb4aa3,4f6d479186,f9238a76ff), flags removed from register masks (0484052358), SSA register numbering (833ed7c431), do not sink spills used for merge edges (7bd88a651d),d0fa6c2f9eaddingSSAReg,a2beee000bspecial-register checks, regalloc checks only when enabled (93d5f43a29), PPCCheckLoweredPhi(4c8baa0ad0). Left open: nothing noted beyond later spill placement. - Scheduling, tighten, block layout and CFG passes — Done: tuple scheduling fixes (
225ef76c25,1c53a1b197), aggressive tighten for booleans (fe5619b479),c345a3913fremoves BlockCall, reverse of nil-check blocks (see nil check thread),8c24bff52bstack layout in SSA. Left open: nothing noted. - Rewrite-rule machinery and compile-time performance of the SSA compiler — Done:
parseValuerefactor (6a1153acb4), rulegen/gen directory split from main build (7208a2cd781.7, 1.7),ad8b8f644edead-rule removal. Left open: rule duplication for commutative ops. - Multi-architecture SSA ports: ARM, 386, ARM64 (dev.ssa) — Done: ARM (series above,
d8181d5d75simplify MOVWreg,7b9873b9b9NEGF/NEGD), 386 (14cf6e2083..df2f813bd2,c069bc4996,2cbdd55d64), ARM64 (ae9570a5b9..d99cee79b9,ed1ad8f56c,b662e524e4CBZ/CBNZ,4d5bb76279), amd64p32 (69a755b602), many intrinsics. Left open: ARM64’sDuffdevice disabled on darwin (1e94d79f9d); ARM and ARM64 offset folding limits (see 1.9). - Multi-architecture SSA ports: PPC64, MIPS64, MIPS32, s390x — Done: PPC64 and PPC64le SSA, MIPS64 SSA (
7f27f1dfdd), s390x SSA (6ec993adc3), MIPS32 new port (66fdf433b0..f4c997578a), SSA unconditional (167e381f40). Left open: PPC64 load/store merging and several float conversions still go through memory (44053de3651.9 and40e25895e31.10 fix this in 1.9/1.10). - Removal of the legacy backend and decoupling gc from the code generators — Done: unconditional SSA (
167e381f40), legacy-backend deletion (e7cc9c4f4d,f03855f40e,838eaa738f,ad7732a9ac,1f2930cb5c,544010a05a,ae7e0ad7b8,24965bc96c),d6194c1fd1changesgoarch.Mainintogoarch.Init,08feadbd6eremovesArch.REGCTXT,dd748cf314/bb2bbfa086/79db1625b9simplify address generation,8c24bff52bstack layout in SSA,c345a3913fremoves BlockCall. Left open: the front end still reaches backend through globalCurfn,Thearch. - Liveness, stack maps, safepoints and write barriers — Done: writebarrier phase (
f6aec889e1), nil-check redo (3134ab3c2d:BlockCheckremoved, multipleNilCheckops per block, arch-specific elimination moved into a pass using new opcode flags), stack frame layout during SSA (8c24bff52b),943f5afe22stackmap dumping refactor,ca4089ad62. Left open: nothing noted. - Intrinsics for atomics, math/bits, math and runtime helpers — Done: amd64 atomics (
320ddcf834,84aac622a4), ARM64/ARM/s390x intrinsics (4354ffd38b,8ff4260777,38d35e714a,e94c52933b,517a44d57e), big arithmetic helpers (2756d56c89),10f757486ebswap for big-endian reads. Left open: nothing noted. - Memory-op combining, byte-order idioms and load/store folding — Done: bswap idioms (
10f757486e),33b71dfa1c/f357091a6dcombine extensions with loads, s390x merging (962dc4b44d,1cfb5c3fd5),deb4177cf0masks instead of branches for slicing (Slicemask better in3d5eb4a6be1.9, 1.9). Left open: nothing noted. - amd64 and 386 instruction selection — Done:
8589049d5c,cc0248aea5,c53879512f,10f757486e,d251030fa6. - ARM and ARM64 instruction selection and fused operations — Done: initial ARM (
8cc3f4a17e) and ARM64 (d99cee79b9,ed1ad8f56c,659dd4f1d7) optimizations. Left open: assembler restrictions on offsets. - Memory clearing and copying: Zero, Move and Duff’s device — Done:
9d4b40f55d,1e94d79f9d,114c05962c,c69dd3f054,dede2061f3(PPC zeroing and moves). - cmd/internal/obj: Prog/LSym refactoring, concurrent backend and object-writing — Done: the items listed above (
d391dc260a,6fe1febc86,246074d043,9b88fac00c,0cd8faf744,e6134702bb,4c9a372946,1bd91d4ccc,7124056f7e,e518962a27simplify Plists,e9fddf8f86darwin dynlink,d61c07ffd8). Left open: nothing noted. - x86 assembler: AVX, AVX2, AVX-512 and the instruction table — Done:
5ce715fdfe,13c829e5f6,4e24e1d999,04ade8e428,64e152910e,b92d39ef69removes some function prologues (those with no frame whose only call was in a sort Swap style wrapper…),9741d83ceaassembles files once per package (10% offgo build -a math). - ARM64 assembler — Done:
748aa84424,a866df2671,1e3c57c2cc,698bfa17a8(LR saved in leaf functions with a non-empty frame),ae9570a5b9. - 32-bit ARM, MIPS and PPC64 assemblers — Done: PPC64 vector and VSX (
f1973fca71,0acefdbea0), MIPS32 (5d28bc58b6,f58ce7fe79), MIPS prologue fix (b55cee1893),fedb0b3018ARM MOVW $-off(R),b6946fb120. - Prologues, frame pointers, NOFRAME and tail calls — Done:
c96e94e69d,b92d39ef69,698bfa17a8,430b82009c,4c9a372946(rewindmorestack removed).
Other changes
- cmd/asm called once per package user-visible —
go buildinvokes asm once for all .s files, cutting ~10% ofgo build -a mathwall time (9741d83cea). - math/big and bytes assembly for ppc64 user-visible — arith (
4955147291),bytes.Compare(1e28dce80a), floor/ceil/trunc (3311275ce8), arm64 math (ba94dd3438). - Softfloat / FP details internal — constant FP registers removed (
f9dafc742d),0acefdbea0. - s390x assembler internal — atomics (
266b349b2d), FIDBR/FIEBR (d2dd0dfda8), SSA instructions (43bdfa9337), BLTU/BLEU (a30b5a3d19), VLE/VSTE parsing (413f1ef4de,beec631c4c), VFMA encoding (930ab0afd7), ANDW/ORW/XORW (dd1dcf9496), removal of 3-operand logical immediates (3ef07c412f),f13372c9f7. - Slicing without branches internal —
deb4177cf0uses masks (Slicemask) rather than branches forx[i:]since a new pointer could otherwise point past the backing array. - Printing/formatting internal —
8d0bbe2b48/ff046d2e28fmt.Formatter for Type and Node;6537e18f02. - Compile-time bit fixes internal —
d251030fa6,26a6131bac. - dev.ssa ARM/PPC/386 stabilization internal —
e2848de9ef,fa54bf16e0,c40dcff2f2,8eadb89266(tuple selectors moved to generator’s block in CSE),22d1318e7b,8086ce44c4,95427d2549,41a7dca272,f0bab31660,7bca2c599d,1b0404c4ca,4a33af6bb6,38cd79889e,5ae8230769;b2e0e9688aremoves Zero and NilCheck for newobject. - Flag-clobber and nil-check fixes internal —
f1ef5a06d2,6ca7c2055b,120e9ff34f,1906d93bfd,98938189a1(duplicate nilchecks removed),6300161d40,a6edffb286. - PPC64 and s390x rules internal —
c87528d776,2679282da4,3390294308,6dd38ebae1,2f0b8f88df,96ea0918e6,b10b2f8d40(shift opcodes with shift operands),17a8ec2c4f,91706c04b9,807a7ebd51,7e0218cdb2,4cce27a3fa,2f679d74e6,9fe2291efd. - Housekeeping internal —
ab019da727documents Prog,c88e868030/e6e26eeb29generated stringers,791f71d192,897c0ebf61,2e2db7a170,41e1c42028(KeepAlive),dce0df29dd,c5368123fe,d80e8de54e,23d762c129,79d2115ec9,3be166dc70,9f5673d930,00efa446e1,33bb597d85,0c6c3d1de7,56b746974c,7c04633e0c. - ISEL on ppc64 internal — Used ISEL on ppc64 and cleaned up zero and extension use. (
cddddbc623)
Linker and object files
From Linker and object files (Go 1.0–1.9)
Plugins and plugin versioning, rel.ro segment and internal PIE groundwork, DWARF for functions generated in the compiler, ARM/ppc64x trampolines, mips, global state removed from cmd/link.
- Go symbol table, pc/line table and function metadata (gosymtab, pclntab, findfunc) — Done: number-of-files entry in gopclntab fixed (
bb12894d2b), stackmaps no longer padded to 4 bytes (303b69feb7), funcsym symbols hidden (7c3fc4b8e4). - Dead code and data elimination — Done: weak ptrTo relocation (
6f31abd23a), mark DWARF functions reachable (aad06da2b9), plugin tables only reachable in plugins (67b2927990). - DWARF generation in the linker — Done: functions’ DWARF generated in the compiler (
795ad07b3b), compact line encoding (8f65379f94), ptab types in debug_info (9f5673d930). - External (host) linking and cgo — Done:
-no-piefor exe (53aec79ce0), delay mingwex/mingw32 (dfbbe06a20), mips (a3b670e333), ARM external trampolines (c7e855658d), plugins force external (413afcafbf), hide ppc64le trampolines when external (ec77b8e09c), STT_COMMON (45f759500e). - Build modes: -shared, c-archive, c-shared, shared, PIE, plugin — Done: user-visible
-buildmode=pluginon linux and darwin/amd64, plugin versioning, internal PIE groundwork then disabled (commits above);cmd/distand plugin forcing external linking (413afcafbf); darwin dynlink support (e9fddf8f86,ab5a2173f9). - liblink, the object file format and the move into the compilers — Done: objdump of
.o(a99f812cba), weak relocation (6f31abd23a),SymKindtype (3877f820a6). - From C to Go: cmd/link — Done: globals removal and flag conversions as above. Left open: nothing noted.
- Runtime type data, GC metadata and sections laid out by the linker — Done:
d8d445280a,6f31abd23a,5923df1af9. - Container writers: Windows PE, Mach-O and Plan 9 — Done:
debug/pereader (d08c3d1329,237d7e34bc,02c1d8a158). - Architecture and OS ports in the linker (arm, power64, arm64, mips, s390x, nacl, BSDs, Solaris) and trampolines — Done: mips/mipsle (
585a0b03b2,76d8e60451,5b147122d6,a3b670e333), ARM trampolines (7c431cb7f9,c7e855658d), ppc64x trampolines (d26b0661c2), text splitting (b4efd09d18,6623988eb7), NetBSD EABI (8419c85eaa). - Build IDs, ABI hashes, flags and determinism — Done:
-sharedflag removed (361d2738d5), time stamp in-vhostlink output (404ae84aa2),-Xpath help (4284edb999,f78cd569f5).
Other changes
- Misc internal —
85072d5f75removeSymbol.Next,f373bf1eb9Solaris non-exec stack,93b753f525/d9504d4623cgo_dynamic_interpreter,24158644ddcamelCase,3167ff7ca9,5f94ff4c87,8f3c8a33fa,82c1e22e13,7c04633e0c,0e435347b1,791f71d192,6007c8c76b,8f9671d11a,83676b93fb,b87d7a5cf6RelocVariant type,f323a7c6d2,2266047556,dcb954c3f7,9d36ab222d,e32ac7978d,348a7c5397hash packages after loading,130ad87ab7ELF reloc sections,9cf06ed6cdC-only symbols on darwin,61db2e4efa,dfbbe06a20,550b7ccf771.6. - Remaining 1.8 linker cleanups internal —
b5e43e669ashort symbol names not mangled when dynlinking,550caa1c87,6383709272,836a3ae663,96414ca39fplugin C symbols not exported. - Linker allocation and main internal — Skipped allocation reading symbol names, skipped arch-specific main, and removed unnecessary comments. (
28ed2b0cd9,99b7984de7)