Go 1.1
Per-P scheduler with local run queues. Runtime-integrated network poller. Parallel GC and the first precise heap scanning. 8-entry-bucket hashmap with incremental growth, plus AES hash. Race detector. External (host) linking. int is 64 bits on amd64. Method values.
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)
Parallel GC with parfor and per-thread work buffers, and the first precise heap scanning from type information; "Stop-the-world mark-sweep…", "Precise heap scanning", "Mark work distribution".
- Stop-the-world mark-sweep, then the parallel collector — Done:
parfor-based parallel GC (d839a809b2,342658bbb6,95643647ae,b0702bd0db,d4c80d19a8,2924638d26replaces a lock withcasp); sweep batch free (4945fc8e40); zeroing moved out of the heap mutex and skipped for huge blocks (c1c851bbe8); GC stats (cea46387b9) and the stop-the-world time shown separately in GOGCTRACE (fd32ac4bae); user-visibleruntime/debugGC controls (472354f81e). Left open: marking depends on conservative scanning of stacks and untyped blocks (see precise-GC thread). - Precise heap scanning: type information, the heap bitmap and GC programs — Done: precise heap scanning from types (
9204eb4d3c,059fed3dfb,92c153d5f4,6e69df6102,21ea5103a41.2 in 1.2), unions→structs (cfe336770b,60682c4f59),709e03f43ddisable hook, type-info checker (bd1cd1ddea). Left open: stack scanning and parts ofruntimedata stayed conservative. - Size classes, tiny allocator and mcache/mcentral — Done: zero-size coalescing (
ec59b840f9), faster mcentral (d8626ef128), earlier detection of unused spans (09ea3b518e), scavenged spans needing zeroing (9ad236ab72), distinct pattern marking free blocks needing zeroing (c80f5b9bf7). Left open: nothing noted. - Scavenger: returning memory to the OS — Done: scavenged spans marked as needing zeroing (
9ad236ab72). Left open: nothing noted. - Heap address space: contiguous arena to sparse arenas — Done: run-time metadata allocation (
8a6ff3ab34), 128 GB (9799a5a4fd), noPROT_EXECon heap mmaps (5a8b7dc6d0),runtime.memlimitignored when allocating heap (515353a290). Left open: nothing noted. - Finalizers and span specials — Done: special bit not unset after finalization (
348087877c), finalizer root address preserved (e5dae3baaa),runfinqframe hidden from GC (e9bbe3a8da). Left open: nothing noted. - Mark work distribution: parfor, work buffers, gcWork and root jobs — Done: parfor and per-thread work buffers (
95643647ae,d4c80d19a8),addrootoptimisation (ab08eac5b7), strings marked without a buffer (ec8caf696a). Left open: nothing noted. - Memory statistics and accounting — Done: per-M GC stats (
d839a809b2),cea46387b9, uintptr malloc stats (0b09425b5c,09f48db3e1),memorydump()(e0c9d04aec). Left open: nothing noted.
Other changes
- GC robustness II internal — potential GC deadlock (
902911bcff), parfor stats reset (d151fb9e20), free-object counting (773685b4a3), workaround for a 5c compiler bug in GC code (6e981c181c), stack code split intostack.cfor the scheduler change (691455f780), parallel-GC preparation refactor (9903d6870f,a28a10e1a2). - Heap dump and debugging internal —
memorydump()(e0c9d04aec), GC trace stop-the-world accounting (fd32ac4bae),cgo/gccgofriendly globals (4019d0e424), executable heap removed on Unix (5a8b7dc6d0). - GC robustness internal — prevent GC during hashmap insertion (
54dffda2b6,2001f0c28e),settype_flushnot memprofiled (76959e2cc6), panic possible before malloc is ready (f84d5dd475), integer overflow fix at end=0 (45636db01b), and misaligned 64-bit atomic (433824d808), earlySysAllocchecks (94955f9b40,28f65bf4a2,3b9702c9c8,e786829e83),freemcache(ed516df4e4), spans typed (f8c58373e5,5d05c7800e),mgc0.ccode clean-ups (013fa63c90,89ec208ee8,ee3c88482b),GC_CALLas a 32-bit relative address and more preciseGC_REGIONin the linker (56a06db360,01ab9a012a).
Scheduler and concurrency
From Scheduler and concurrency runtime (Go 1.0–1.17)
The per-P scheduler (779c45a507) with local run queues, and the runtime-integrated network poller; threads: G-M-P scheduler, network poller, goroutine lifecycle.
- The G-M-P scheduler: from global-lock M:N to per-P run queues, spinning Ms and work stealing — Done: user-visible the per-P scheduler
779c45a507with the preparatory commits above; local queues353ce60f6e;runtime.Goschedforward progress for locked goroutinesf87b7f67b2/a92e11a256; deadlock-detector false negatives06a488fa97,6ee739d7e9; clear locked bit on goroutine exit1a4599b41a; integrated poller wiringc211884731. Left open: no preemption (long-running loops starve others); global queue can be starved (fixed in 1.2). - Preemption: cooperative stack-check preemption (1.2) to signal-based asynchronous preemption (1.14) — Done: nothing yet;
Goschedremained the only yield (f87b7f67b2). Left open: issue 543, tight loops starve the scheduler and GC. - Network poller: from the netFD select loop to the runtime-integrated epoll/kqueue/IOCP poller — Done: user-visible scheduler hooks
c211884731,d0c11d20b8(timer prototypes),add3349867(xchg64), integrated poller for darwin0bee99ab3b(TCP4Persistent 67786 → 33175 ns vs old poller), Linux/ARM1d64d04da5, explicit removal of fds from the epoll set before close (#5061)44840786ae, deadlock fix0b5d55984f; Windows band-aid giving a blocking hint to GetQueuedCompletionStatusea15104110. Left open: Windows and Solaris not integrated. - Channels and select — Done: precise GC of channels
a656f82071; heapsort select lock ordercb32ea9c19. - Semaphores, runtime locks and Notes — Done: lock-free stack
a5dc7793c0, semaphore table hidden from GC35724c1aa5, double-wakeup diagnosis4380fa6d99; unions → structs for Lock and Noted617454379,58030c541b. - sync.Mutex, RWMutex, WaitGroup, Cond, Once — Done: race instrumentation for sync
53390c8fc7,5bb3a66a97. - sync.Map, atomic.Value and sync/atomic — Done: Linux/ARM 64-bit atomics
090f9fc3ef, unaligned detection14a295c817,94b7853924; FreeBSD/NetBSD ARMace9ff4578,4d8b1feb79; race instrumentation59b8745328,27087022ce,f3c1070fa41.2. - Goroutine and M lifecycle: caches, ids, LockOSThread, Goexit, cgo extra Ms, deadlock detection — Done: 64-bit goids
320df44f04; Gosched for locked Gsf87b7f67b2; checkdead false negative06a488fa97; locked bit cleared1a4599b41a; park refactorf20fd87384. - Stop-the-world, safe points and GC–scheduler interaction — Done: helpgc refactor
01826280eb, parallel for95643647ae, per-thread work buffersd4c80d19a8. - Scheduler diagnostics: schedtrace, GODEBUG, execution tracer, block/mutex profiles — Done: user-visible blocking profile
4cc7bf326a; fatal-throw full stack dump81221f512d.
Other changes
- Garbage collector participation internal — per-M GC stats
d839a809b2, lock-free stacka5dc7793c0, parallel for95643647ae, helpgc01826280eb, per-thread work buffersd4c80d19a8, precise channelsa656f82071. - vdso and profiling internal —
5287175ad9(vdso on linux/amd64),1e957b6245,4da6b36fbf. - Race detector hooks for sync/atomic internal —
53390c8fc7,59b8745328,5bb3a66a97. - Union to struct internal —
60682c4f59,d617454379,58030c541b(precise-GC preparation). - Stack segment caching and scheduler-adjacent fixes internal —
f82db7d9e4(global stack-segment cache, limit per-thread cache, reduces StackSys on thread-heavy workloads),7847f328cd(BenchmarkStackGrowth −17%),1d7faf91df,3611553c3b,94fab3cad3,c8214c78bd(return from main waits for active panic),1b8f51c917,5b79aa82ff,77354c39f9,54340bf56f,6732ad94c7. - Plumbing and docs internal —
6dbaa206fb,a54f920bfe,55ff3f7076,02e05817ad(WaitGroup.Add caution),8572950383,5c1422afab,aa3d05acc9,51b8edcb37,4019d0e424,7f9c02a10d. - Refactor proc.c internal — Renamed local g and m variables to gp and mp in proc.c. (
a0c688331f)
Data structures and type metadata
From Runtime data structures and type metadata (Go 1.0–1.17)
The 8-slot bucket hashmap with incremental growth and fast-path routines, AES hash, reflect.MakeFunc/Select/Convert/Of and method values, the removal of run-time code generation, ARM softfloat conditional execution and faster ARM division.
- Hash map core: from the first hashmap.c to the 8-entry bucket design — Done: user-visible 8-slot bucket hashmap with incremental growth (
00224a356a), lazy first bucket (5b3ff61be6), string-length shortcut (45b54ee7fb), map reads made multithread-safe by doing grow work only on insert/delete (0e7144a875; an earlier “grow work during reads”07b6add0ca1.2 was reverted in 1.2 by7f0ee023ba1.2), atomic flag updates (b6bfc92df3), seed always mixed at the start of hashing (63bee953a2), delete on nil map is a no-op (28a50c7f51), precise GC of hashmaps throughhash_gciter(1e01fba2fc), collision detection debug (bca01cd0bf). Left open: GC treatment of map internals was bespoke and later removed. - Map growth, iteration order, overflow buckets and GC interaction — Done: incremental growth with 8-slot buckets (
00224a356a), no grow work in reads (0e7144a875), GC held off during insertion (54dffda2b6), maps freed more aggressively (bcb39a778c), precise GC (1e01fba2fc). Left open: evacuated bit in pointer’s low bit. - Map fast paths and compiler/runtime specialization — Done: fast access for common key types (
00224a356a), string-map small-table shortcuts (45b54ee7fb). - Hash functions and algorithm tables: memhash, AES hash, fallback hash — Done: hash continuity (
51fe5444fa), always-first seed (63bee953a2), AES hash for compound objects (6b57329268), faster string equality in the runtime (77f3e189d2, identical-pointer case 51→7 ns;3d5daa2319, 4K equal 2187→120 ns on amd64). - Runtime type descriptors: layout, shrinking and name encoding — Done:
gcfield (65e61d5770), array/chan/map/slice type list and header removal (1120982590), types of allocated objects stored (4a191c2c1b),Itabmoved toruntime.h(5c1422afab), GC info for reflect-made types (3660b532ac). Left open: GC info onArrayOf(issue 4375). - Interface values, itabs and type assertions — Done:
Itabin header (5c1422afab), types of allocated objects (4a191c2c1b). - reflect redesign: from string parsing to Type/Value structs — Done: user-visible
Select(370ae05545),Convert/ConvertibleTo(46f379cc2c),MakeFunc(ba4625c66f),ArrayOf/ChanOf/MapOf/SliceOf(1120982590), method values (3be703665e), fasterFieldByNamevia BFS (5e3224ce79,FieldByName38.2 ms → 42 µs;aa38801788multiplicity fix),Index/Sliceon strings (772decbc80),Zeronot addressable (6044dbdf1b), no run-time code generation (b1b67a36ac). - reflect dynamic types: ArrayOf, ChanOf, MapOf, SliceOf, FuncOf, StructOf — Done: user-visible
ArrayOf(unexported),ChanOf,MapOf,SliceOf(1120982590), GC info for synthesized types (3660b532ac). Left open: GC and algs forArrayOf(issue 4375). - reflect.Call, MakeFunc, method values and argument-frame GC precision — Done: user-visible
MakeFunc(ba4625c66f), method values (3be703665e), run-time code generation removed (b1b67a36ac). - memmove, memclr, duff routines and pointer-write atomicity — Done: shim removed, overflow fix (
3a50bc1a24,1b8f51c917), ARM memmove register avoidance (e34079bb59). - internal/bytealg and string/byte comparison primitives — Done: amd64/386 faster string and byte equality (
3d5daa2319,77f3e189d2). - Slices and append: growslice, makeslice and string/slice conversions — Done: small appends, zero-width growth, race instrumentation (
8cfed59941,782464aea5,3f7f030c59). - Strings: concatenation, conversion and printing helpers — Done:
"" + x + ""(8744d35dd3,71643b2fdb),slicebytetostringrace instrumentation (4a524311f4). - Soft-float, 64-bit division and complex arithmetic helpers — Done: conditional soft-float (
fb3a1b6821), ARM div/mod (3e3fa7b5f1), complex division speedups (0157c72d13), NaN choice (6e9506a7b4),intgo(0b08c9483f),
Other changes
- Reflect fixes and docs internal —
PkgPathof byte/rune (a96c2b8c1a),[]unsafe.Pointerrepresentations (384af66984,90f9beca15,487721fd0d,092c481c1b),MaxFloat32overflow (38070a72c5), error message and doc clarifications (8696b08446,74a7cc9bf2,ded94b7222,11d16dc535,b396d1143b,a6db2a8517). - Compiler and runtime small items internal —
typenameoutput marked type-checked (8022a1a588), initialization-order fix involving method calls (6cbf35c172), return-address rounding inruntime.equal(e07958f7df,41645847b4), surrogate halves illegal (c48b77b1b5), printf%c(7f9c02a10d), optional hashmap allocation checking (bf1f46180e), cleanup (a29304bfb8,e8265f18e6). - Unrolled small arrays and GC info internal —
175c401523,13cbf41a7f. - Race detector for slices/strings internal —
3f7f030c59,4a524311f4.
Diagnostics and knobs
From Diagnostics and knobs (Go 1.0–1.17)
Race detector added (compiler racewalk, TSan runtime, Windows port, lazy shadow); runtime/debug GC controls; heap profile overhead cut from 64kB to 2kB per MB.
- Race detector integration — Done: user-visible race detector for linux/darwin/freebsd amd64 and Windows, runtime hooks (
2f6cbc74f1); lazily allocated shadow memory, necessary on Windows and removing a 16TB virtual size (1a19f01a68,1ebf2d85ba); data/bss shadow mapping alignment (12b7db3d57);racewalkrewrite: block instrumentation (c46f1f40da), init lists (b11f85a8aa), refactor to a generic walk (703043c8dc), no double evaluation of function calls (abb313f8c8), params returned from heap (a3a7244779), structs and itabs (96833d3a25,89bfddbf67,db8d7a292d), more node kinds and&&/||/HMUL/append/type switch (656bc3eb96,c0b3c17184,eb7c51c148,5f9a9433ea,7c79910cb9,ecbf99ad97,ca4b868e9a); direct PC toracefuncenter(ce287933d6) andruntime·callerswhen the PC is on the heap (f59a605645);racefuncenterregister/arg fixes (ec892be1af,e2f9e816b7); nosplit callbacks (0ead18c59e); handling of stackalloc (27e93fbd00); finalizer-aware detection (063c13a34c);RaceRead/RaceWriteAPI in the runtime (51e89f59b2) and range access functions (ccc61eadd5); better stack traces: runtime frame on top (0ce96f9ef4) and sync/atomic frames (c3c107f67c). Left open: the race runtime depends on cgo (removed in 1.3 via thunks). - CPU profiler and runtime/pprof writers (legacy format to compressed protobuf) — Done: heap profile lowers memory overhead from 64kB to 2kB per MB of address space by using a 4096-byte interval (
baf91c313f); total-allocation profile corrected by including zero-in-use buckets (c4a814f2da); end-of-log marker in CPU profile (b2458ff75c); line numbers adjusted to call sites (318309a51f); memory profiles allowed with GOGC=off (0c3b17a55a). Left open: nothing noted. - GODEBUG, runtime/debug, debug log and traceback knobs — Done: user-visible
runtime/debugGC controls:SetGCPercent,FreeOSMemory,ReadGCStats(472354f81e);debug.Stackdeprecated in favour ofruntime.Stack(e49a183b76). Left open: nothing noted. - Traceback correctness and inlining (diagnostic output) — Done: LR saved on panic for leaf functions (
7de3d71797, 1.1). - GDB runtime support — Done:
parse_and_evalfor goroutine id (ca8aac698f).
Other changes
- Racewalk crash fixes internal — nil init and instrumentation of function entry (
21b2ce724a,de10a23db1). - Lock-free stack internal —
lfstackfactored out of the parallel GC work (a5dc7793c0,e65c0a82ceCNT_MASK); later changes: simplification after undiagnosed corruption (62a4359e2e1.5, 1.5), top-half amd64 and Power64 address bits (5fce15a2a31.5,b76e8360421.5, 1.5), merged 64-bit implementations (5c7ae10f661.7,3b02c5b1b61.7,720c4c016c1.7, 1.7), expanded address-space assumptions and node validation (981d0495b71.11,b1d94c118f1.11, 1.11). - 64-bit goroutine ids internal — goid width raised (
320df44f04). - Stack root scan restricted to locals and arguments internal —
db018bf77c,c676b8b27b; frame pointer printed on throw (6c1539bb01); arm unwind forward progress (8480e6f476); union in MHeap replaced by struct for precise GC (cfe336770b); closure code deleted (a48ed66447).
OS layer, stacks and panics
From OS interface, stacks and panics (Go 1.0–1.4)
Non-Go threads can call Go (6c976393ae), fast time sources, integrated netpoll, NetBSD and FreeBSD/ARM ports, new symbol table encoding, GOTRACEBACK=crash.
- Segmented stacks to contiguous (copied) stacks — Done: nothing structural;
1a4599b41aclears the locked bit when a goroutine exits. Left open: nothing noted. - Panic, defer, recover and Goexit — Done: defer pooling
0de71619ce;a22389ec38prints “fatal error” instead of “throw”;f84d5dd475panics possible before malloc is ready;c74f3c4576panic/recover in the Plan 9 note handler;7de3d71797saves LR on panic for ARM leaf-function tracebacks;5146a93e72GOTRACEBACK=crash. Left open: nothing noted. - Tracebacks, crash output and GOTRACEBACK — Done: GOTRACEBACK=crash
5146a93e72; ARM LR7de3d71797. Left open: nothing noted. - Symbol tables, pclntab and runtime.Caller/FuncForPC — Done: new encoding
c8dcaeb25d; hidden from GC46d7d5fcf5. Left open: “required step” for host-linker (external link) work. - Signals: handling, os/signal, foreign threads — Done:
cb4428e555,532dee3842,e49f945603,b9e051e82d,ecb2a0a9e5,d3d89ae7d2(check rt_sigaction results),91484c6c48,4eb7ba743d,fb7f217fe7,f322c78692; Plan 9 signal handling in Goccdca2cd6band note-handler panicsc74f3c4576; NetBSD signal ABI v279473d6b1c. Left open: foreign-thread signals other than SIGPROF. - Threads, locks and the OS scheduler interface — Done:
e6a3e22c75,a0955a2aa2,4f308edc86,86d509b463,1a4599b41a,c5f694a5c9(fix new scheduler on freebsd, windows). Left open: nothing noted. - cgo runtime support and non-Go threads — Done:
86d509b463,6c976393ae,3d2dfc5a7b,e9a3087e29,e49f945603; cgo on Linux/ARM5cffce611a, on NetBSD5131deeeb2,2fdd60b9b6, on OpenBSD708db79011;4eb7ba743d;6a70f9d073passessetmgtocgo_init;9de38d6788exports symbols in both link modes;d17506e52dmakes crosscall2 assembly. Left open: nothing noted. - TLS, g/m registers and shared-library linking — Done:
36b414f639,dfc22e29ecstartup convention;6a70f9d073;b42ebb6fbfNetBSD TLS. Left open: nothing noted. - Clocks, vDSO and timers — Done:
c7be4defe3,3a66bc415e,024a92c1da,4022fc4e21,2637777527,7777bac6e4. Left open: nothing noted. - Windows runtime port — Done:
afe0e97aa6handles exceptions even in cgo programs;6ec551887acallbacks match new func value representation;8aafb44b0b. Left open: nothing noted. - Platform ports: OS and architecture matrix — Done: NetBSD
5a043de746,fb32d60cd1,37aba1aa77,2fdd60b9b6,79473d6b1c; FreeBSD/ARM366268aa79,c2d2bfcc49,092b7cfb08; Plan 9/amd64a72bebf6e1,e42788628a; ARM hw float requirement212ce41d00; Linux/ARM cgo5cffce611a;e9d62a6d81. Left open: nothing noted. - Integrated network poller: OS back-ends — Done: user-visible integrated pollers Darwin
0bee99ab3b, Linux49e0300854, ARM1d64d04da5, Windows hintea15104110. Left open: BSDs and Windows use the old external pollster; slower at 16–32 threads. - Startup, auxv, randomness and security-adjacent runtime details — Done:
a642ca4930,d1e06dab7c,44fd1d1a6a,a5d4024139. Left open: HWCAP/PLATFORM unused (“future CLs will make use of the others”).
Other changes
- NetBSD bring-up internal — sigaction/syscalls/defs/signal/getcontext fixes and 386/amd64 support (
38445ca089,5374ded1f3,8a9edcf790,4a5a5b20a5,0b7bcb84e3,efa67b2c55,deb93b0f7b,2cb7498455,1b6557a0cf,b4402a49b6). - Misc 1.1 runtime internal —
fd04f05f2f(MOV $0 instead of XOR), ARM Breakpoint (0f80050542), Linux/386 Sigaction from kernel headers (a033e36766), ARM memset without r9/r10 and shim removal (07826038c3,3a50bc1a24), cgo on Windows/amd64 frame (7f075ece42),cc8bd8969f,b0a29f393b,a9824f178d,556dd0bfbd, new closure representation with DX context (6066fdcf38,a48ed66447), cgo symbol/crosscall2 housekeeping (f8d49b509b,5bffa3b88e,83c5d07c0e,776b51850b,960d7082ee,4cb921bbf1), Plan 9 aes hash (66e346433e), reorg build fixes (cf46e561b2,45ebc06484,a98bec4554,214c178493,eb80431b61,e67f198516,efd3d1ffe9,d0d7416d3f,e5ea2d5335,56a0bafdb6,f54d61061c). - Append / string fast paths internal — crossover tuning for append of strings (
f235d5d8d7,d09f34cc55), faster string equal (3d5daa2319). - Plan 9 fixes internal — Plan 9 getenv, semasleep, errstr, floating point (
432f18221f,f5752848fd,ef7705f6dd,7056ec6bfd,23599ca2f6,d2326febd5,a566deace1). - Memory SysUnused on BSDs internal — FreeBSD, OpenBSD, NetBSD (
314fd62434,c6afb781e2,4047f300c9,1fbe3090d8,295a4d8e64). - Misc safety internal — 64-bit negative error code
e3c7a9db83, tv_sec overflowsba50e4f120,51f14a9fe2,7f50c23e2d, cgo warnings as errors4758f89ddb,70e967b7bcrename locals mp/gp, zero defer free field403f012534,f3407f445dnohup, delete mkasmhcb807e7b4a. - OpenBSD runtime updates internal — Updated OpenBSD thread syscalls, defs and the new tfork syscall. (
8cea1bf102,99fc281743,cd37fecffb) - Field types prepared for GC changes internal — Updated runtime field types in preparation for GC changes. (
334bf95f9e)
Compiler frontend
From Compiler frontend (Go 1.1–1.9)
C cmd/gc maintenance: method values, new return rules and shift/const rules; first escape-analysis flow tracking and inlining with locals; first race-detector instrumentation (041fc8bf96); mostly error-message and robustness fixes.
- Parser: from yacc to a hand-written recursive-descent parser — Done: yacc era maintenance:
6ce4930365accepts an initial BOM,8f3b703323complains about invalid whitespace chars,ffc742b658accepts new conversion syntax,27d17255db1.2 inserts\nat end of every input file,6592456feb. Left open: grammar tied to Bison. - Binary export data and the object-file split — Done: inlining makes export data carry bodies, with a stream of bug fixes (
8d95245d0d,761830f481,fc7b75f216,9e66ee4562,b0bb6f8cee,a9f1569e7bBOM escaping,a45777fe99don’t export embedded builtins,561edbd63cno useless private symbols,8fff2525cb,fbaf59bf1e). Left open: export is source text. - Inlining — Done:
530147e870,cb856adea9,dfdfba14b9,ae5e791ed21.2 (1.2), fixesb6ea905ed9,a4682348c2,319131f295,9aef20e823;8d95245d0dexport data for inlined local variables. Left open: inlined bodies that contain calls are refused soruntime.Callercannot observe inlining. - Escape analysis and stack allocation — Done:
976ca1a47d,75692424d2,507fcf37d2,572d984eaa,71282131a1,9fe60801ae,38e9b0773d,fd178d6a7e,2af3cbe308. Left open: only a single bit of flow info per param. - Closures, method values and variable capture — Done: user-visible
d3c758d7d2method values (also20e05303fevariadic flag,38e9b0773descape,a9e119ac701.2 unnamed interface receiver in 1.2),25922c0658,9fe60801ae,ba0dd1f139missing-return line in closures. Left open: all captures by reference. - Language changes and rules as implemented in the compiler — Done: user-visible
d3c758d7d2method values;ecab408c42return requirements;465ff4cfc0,1947960a6f,88b98ff791,5188c0b59c,861aa4698a,401e0fea3a(rejectcomplexcalls with mismatched args),f02067a99a,ba05a43608,ced8004a00,c956dcdc54,ffc742b658(new conversion syntax),04098d88fa(forward declaration in pure Go package is an error),3aed92f811(var/type/const named init),87c35d8df1(qualified names as literal keys),6cbf35c172(init order with method calls),85ce3c7241. Left open: nothing noted. - Constant arithmetic,
Mpint/Mpfltand floating-point constants — Done:8931306389reject non-Go constants,0184081eb9small TPTR64 as integer constants,a85fce282esimplify defaultlit,bf59aafddc,08918ba438. - Static initialization, composite literals and
init— Done:6592456feb,2af3cbe308,0b2ca9e62f. - Walk-level lowering and runtime-call optimisations — Done:
18e86644a3,8fd65b0e1d,d098bffd84(avoid copy on type assertion),77f3e189d2faster string equality,1d6eb2e9fa/2ad57b4583(hash/eq ignore padding and blank fields),c0b3c17184. - Pragmas, directives and compiler flags — Done: user-visible
fd178d6a7enoescape;041fc8bf96race instrumentation-b;80dbe74360go.weaksymbol prefix. - Race detector and sanitizer instrumentation in the frontend — Done: user-visible
041fc8bf96,ce287933d6,c0b3c17184. - Diagnostics and error messages — Done:
892fa3ae6c,6363fc5aa6,d06dcd4595,1c2021ca14,a7a3fe7238(oversized arrays),c208a3a263,bd0bb2bc39,79a3b561b51.6… see other items.
Other changes
- Escape-aware
&T{}and small fixes internal —2af3cbe308(allocate&T{}on stack if possible);a732cbb593(OCOM in defaultlit),656b192c16reject...with multi-valued expressions,51072eb1fbparallel assignment in range,744b23fe48/c208a3a263/caff439820/51e8fe5b1brobustness for broken structs,d09afc2efbgc: generate garbage collection info for types(reflect.c, 178 new lines). - Typecheck/error polish user-visible —
8a686792e0,42aa9abae9,fcc1f2ac55,dd166b9437,b04c890a89,1c2021ca14,d7a3407e3d,7c295f3f0c,f607c479ea,79a16a3b70,e2711cb202,119189c459,b2e0c34cf3,38244018ce,ae2131ab3b,4b6ca21271,20c76f7f3f,615f289209(unique param names),fba96e915d(uintptr(nil)),2d3216f4a8(Offsetof),94acfde22e,6138e368f8,561edbd63c,10d14b63c2,0d22573f6e,0dd0e1ad0c,fc6b530f0f,64eb7749bc,f18ced3fc9,1c675ac89d,10da526069,c0d9bf5650,ce99bb2caf,5da5e8e02f,ba0dd1f139,5188c0b59c,a9f1569e7b,11999306df(don’t import same package multiple times),9224b4c873(Windows output filename),c29f4e00a1. - Build/platform internal —
b29ed23ab5,c2e06e0188,d795f07718(GO386=sse→sse2),d127ed5378(large stacks),389093feec,e7ef3b6daf. - Late 1.1 additions internal —
54191126e4(crash in %N print),922c0b4755(rebuild builtin.c),e7f89fcb1cstrict tree property for OAS2RECV,48af64b295mark builtin function uses as calls.
Middle end and SSA optimizer
From Middle end and SSA optimizer (Go 1.0–1.9)
Escape analysis restructured (call-graph SCC order, in→out parameter tags), inliner made practical (variadic, wrappers, escape-info stealing), rotate recognition (threads: escape analysis, inlining, order/walk).
- Escape analysis (esc.c → esc.go) — Done:
9fe424737b(call-graph SCC order),75692424d2/507fcf37d2(in→out tags),5583060c4c(addresses escaping through closures called in place),2667dcd113, bug fixesba97d52b85,54af752865,71282131a1,572d984eaa,20c7e41555,1dcf658f6d. Left open: tags record only whether content flows to results. - Inlining (inl.c → inl.go) — Done:
73b83a228e,dfdfba14b9,a72f9f46a2,2eafbb8878,09a17ca1f1,386ad0ab90,2667dcd113,7b8e08617e,ee5f59ab4f,76500b14a1,bcea0dd1d0. Left open: method values uninlined. - Order, walk and temporary lifetimes (order.c, walk.c) — Done: parallel assignment in range (
51072eb1fb), second value in range skipped when blank (7936ab58f7),x*8→x<<3(31072e41f4), rotate recognition for^(947a3ddf87) anda.b[0]<<1|a.b[0]>>31(4de6687554: asm shrinks to a singleROLL), struct padding not hashed or compared (2ad57b4583), map-index eval order in multiple assignment (5ea52a4d91), interface-comparison double evaluation (804a43ca76), eval order in select (1b3244e0db). Left open: nothing noted.
Other changes
- Inlining and escape fix-ups internal —
ee5f59ab4f,76500b14a1,bcea0dd1d0,20c7e41555,1dcf658f6d. - Switch/select/misc compiler fixes internal —
f4f1ba2b1e(switch on comparable arrays),551e263823,71b3b46073,f6a952599e(fallthrough in last case),08918ba438,2355409988,e7f89fcb1c,399dcc75a8,c44768cb1c,1ca7bc268b,e4cef96be6,df9f4f14b9. - Compiler fixes and refactors (2 commits) internal — small fixes, line-number repairs, node-API tidy-ups and diagnostics in
gcand thessapackage that do not carry separate design (78ba449a3c,407d0c5ab7)
Backends and assemblers
From Backends and assemblers (Go 1.0–1.6)
int becomes 64 bits on amd64; a long series of 6g/8g/5g code-quality changes (out-of-line panicindex, componentgen, rotates, SSE register use, GO386), the first GOEXPERIMENT, and explicit type information for locals. Threads: expression codegen, register allocator, C compilers.
- Per-architecture compilers 6g/8g/5g/9g and the shared gc code generator — Done: user-visible
intbecomes 64-bit on amd64: the compiler first learns len/cap areint(650160e36a), then flips (10ea6519e4, assembly offsets converted mechanically). 6g may use R14/R15 (8f8640a057) and all 16 SSE registers (57ad05db15); 8g importscomponentgen(ae0862c1ec; LEAL count for cmd/go 89774 → 47548), igen cases (f4e76d5e02), no address-of-slice for&s[i](2de064b63c,acbe6c94d7for 6g); panicindex out of line (fefae6eed1); contiguous loop layout (001b75c942); 5g backports of 6g constant-operand code (7b36acc4ac,ed0c5dd11f,bbccfddb84,01ddc8bd9a,905e8dfa27,d8008a9eef,3dcc63f750,5bdf40dcca,bdd9f29780); user-visibleGO386=387|sseselects FPU flavour, default 387 (9afb34b42e); method values (d3c758d7d2); closures without runtime code generation (9f647288ef) after the indirect func-value representation (1903ad7189); explicit TYPE pseudo-instructions for locals (1d5dc4fd48). Left open: no auto-detection of SSE2 (commit: “no auto-detection is performed”). - Register allocation and the peephole optimizer (reg.c, peep.c) — Done: 5c
regoptre-enabled (70db440885); 6g peephole (3d3b4906f9: shifts do not stop subprop, redundant MOVLQZX removed, early loads);fixjmpfor 6c/8c (5cb1ed2189); ONAME nodes recycled to denote registers (45fe306ac8); return registers optimizable (b73a1a8e32,bdd9f29780); 8g drops redundant temporaries before regopt (fa316ba4d8,14f3276c9d, extended to SSE2cf77dd37e7: Erf frame 220 → 84 bytes, Lgamma 948 → 44); 5g peephole reactivation incl. EOR → MVN and MOVB elimination (542dd8b9fb,3f26c5e124); short-integer arithmetic eliminated where possible (8f3c2055bd);componentgenfor 5g and for small arrays/structs on 6g (ee3e2ac1a6,16072c7497,022b361ae2: the 64-bitinthad made it ineffective); 6c rotate/shift peephole (41ec481a53,bb192d1399:(x<<a)|(x>>b)becomes a rotate). - Expression and statement code quality in 6g/8g/5g (division, bounds checks, loops, slices, interfaces) — Done: out-of-line panicindex (
fefae6eed1), contiguous loops (001b75c942), rotate code (c6ce44822c, later partly rolled back for 8g251199c430), float->uint64 truncation fix (e80f6a4de1), inline slice[arr,str] (40af78c19e),convT2E(8f84328fdc), nil-comparison without extraagen(ff642e290f), no LEA of interfaces on method calls (b45b6fd1c7),6gfloat move without MOVSD between registers (a768de8347),sbopswap logic (de96df1b02), simplified integer division (a617d06252), zerostack experiment: user-visibleGOEXPERIMENT=zerostackclears the stack on function entry to avoid GC false positives (b7603cfc2c);cmd/gc: avoid duplicate allocation during inlining(a72f9f46a2); large-model flag for 6c/6g (fe14ee52cc); more nil-pointer-to-large-struct checks (578dc3a96c). Left open: zerostack was expensive (the commit says so) and opt-in. - Stack frame layout, prologues, stack split and frame pointers — Done: 6c/8c stack frames cut by about half (
139448fe95),clearstkdeleted (96b0594833), fix for large stacks (d127ed5378). - The Plan 9 C compilers (cc, 5c/6c/8c) in the Go toolchain — Done:
GOROOT_FINAL(bcdafaa582), 6c rotates (bb192d1399,41ec481a53),MOVQLfor explicit truncation (e530d6a1e0), 5cregoptre-enabled (70db440885), R12 and F8–F15 usable on ARM (d87bc2f0c0),uintright-shift constant eval (34ad3995e0), large model flag (fe14ee52cc), dynamic-linker autodetection (dac4c3eee9), struct literal side effects (c13866db7f). - Assemblers: 5a/6a/8a/9a and the Go cmd/asm — Done: PLD (
2031252fb8), MULW (a0084b3494), SSE2 and XMM (5da37c0901,755e13877f), AES (297bb12809),GOROOT_FINAL(6af069f3e1), delete dead code (6a22e2fb3f).
Other changes
- PREFETCH builtin internal —
cmd/ccbuiltin like SET/USED (d42495aa80, ARM278d4a583d), disabled for GO386=387 (594360cb1b). - Contiguous loops and aligned entries internal —
001b75c942. - GOEXPERIMENT=zerostack user-visible — clears the stack on function entry to rule out GC false positives, opt-in (
b7603cfc2c); dead debugging code removed in 1.6 (397b4f6cbf1.6). - Compiler speed internal — Prog/Addr size reduced in 5g/6g/8g (
b2797f2ae0), regopt Reg flags documented (5e3fb887a3). - Compiler/runtime interplay internal — return parameters flushed on panic (
f1e4ee3f49), fixes for large stacks (d127ed5378), more precise hardware faults for nil pointer to large struct (578dc3a96c). - Plan 9 native tools internal —
-Wstrict-prototypes(255fb521da), 5g/5l tweaks (62dfa9c47d), dwarf type info for linux/arm (8cdee79063), new cgo object section (7556ccc7b1). - ARM DWARF and small ISA support internal —
8cdee79063,d2d990cc0a,072e36d5ef. - MOVBS-style short moves internal — see register allocator thread.
- Remaining small code-generation, optimizer and tooling fixes (35 commits) internal — per-operator and per-back-end bug fixes and cleanups that do not carry design of their own: out-of-registers and splitclean fixes, SSE/386 comparison fixes, componentgen for funarg structs, 64-bit index handling, Reg freeing, debugging output (
30bc5d7bbd,b72c7e943c,97cbf47c78,a7059cc793,2a9410c19c,b185de82a4,823962c521,5d7ece6f44,413fbed341,658482d70f,05ac300830,36df358a30,f2fadfefaf,16bea49ede,0b2ca9e62f,335eef85c3,1e233ad075,7c0cbbfa18,cc224c004d,1bd4a7dbcb,f134742f24,54e8d504e8,81b46f1bcd,4d3cbfdefa,15f2c01f44,fba96e915d,47568c747d,2c09d6992f,7594440ef1,f42fa807a6,ac1015e7f3,66ba4a85e4,4c203172a2,f701e1c320,77e7e4c329) - Build, portability and warning fixes (8 commits) internal — Plan 9/gcc/clang warnings, yacc/bison, format verbs, buffer sizes, output-file handling and Windows paths in the compilers/assemblers/liblink (
af375cde20,60826e0be6,2bddbf5e8f,0cdc0b3b78,f5dce6c853,8883c484cf,3a14b42edf,3467068ef4) - Compiler op constants and misc internal — Reordered gc O* constants, renamed ORRC to ORROTC, and used ArgsSizeUnknown for functions with unknown argument size. (
481e5c6ad0)
Linker and object files
From Linker and object files (Go 1.0–1.9)
External (host) linking is born (-hostobj then -linkmode, -extld), -shared PIC output, symbol table repacked host-endian, args/locals info, race/fieldtrack hooks, and typelinks for reflect.ArrayOf.
- Go symbol table, pc/line table and function metadata (gosymtab, pclntab, findfunc) — Done: host-endian symbol values (
4e2aa9bff0), repacked varint format (c8dcaeb25d), sorted-symtab check in the runtime (40ed753ebd), fix of scope of static objects in the table (7ac20853fc), accurate args/locals (f466617a62), moved symtab and ELF generation to portable code (d37c572ad5). Left open: the commit message of5d363c63571.2 notes the old symtab and pclntab were not yet moved back into an unmapped part of the file. - Stack splitting and the linker’s nosplit overflow check — Done:
-Zflag to zero the stack frame on entry for 6l/8l (b9da27bed2), no-ops separating zero-stack funcs from nosplits (2e73453aca), function entry aligned on an architecture-specific boundary (16 on x86, 4 on ARM) for run-to-run consistency (8820ab5da9: e.g. Fannkuch11 -5.85%). - Dead code and data elimination — Done: user-visible
GOEXPERIMENT=fieldtrack(3d40062c68), a toolchain-time experiment in which fields taggedgo:"track"are reported by the linker if reachable; line-number fix for itsUSEFIELDpseudo-op (a14e143c211.2). Left open: “may be removed at any time” per its message. - DWARF generation in the linker — Done: ARM line numbers (
0cb04168d3); noDW_AT_typeforunsafe.Pointerto match gcc (a891b916bd); relocated DWARF in host-object mode and ELF-only when external (40d356e9ab,825b1e1591,2a1ca145cf). - External (host) linking and cgo — Done: user-visible external linking mode for cgo on linux/amd64/386, darwin and FreeBSD/amd64 with
-linkmode,-extld,-extldflags,-tmpdir(commits above);-shandled for ELF executables and passed to gcc (f2c3122307,e50e4f7ec11.2 in 1.2);-rdynamiconly for ELF (47ec6e23d2);-rpassed as-rpath(8877a2dfee); relocation range checks (700a126c64,5c0d782ab8);cgo_export_static/dynamicsplit (fb59aed60b,5a529b61aa). Left open:-hostobjand 386 steps “disabled” at several checkpoints; Windows and ARM unsupported (30e29ee9b6says so). - Build modes: -shared, c-archive, c-shared, shared, PIE, plugin — Done: user-visible
-sharedPIC output for 5l/6l (3bdeaf2a64). Left open: 8l only had dummy support. - Linker speed and memory (Go 1.7 focus) — Done:
f47346c5fc(8l, 5l: 2% faster), reduced size of Prog and Sym in 5l (9b568ef2b8,e00c9f0dbb). - Runtime type data, GC metadata and sections laid out by the linker — Done:
.gcdata/.gcbss(032e5bfb30), typelinks forArrayOf/ChanOf/MapOf/SliceOf(1120982590), 64-bit alignment of large data (f76f120324), floating point constants in.rodata(3dbbb6eb4c). - Container writers: Windows PE, Mach-O and Plan 9 — Done: PE section symbol values for
ld -r(1c4b77a7c8), PE ignored sections (9ca4a25f4b,782a57811f), Darwin scattered relocs (e607380ff6),__image_base__(5490814c30), zero-fill Mach-O (c5444a8937). - Architecture and OS ports in the linker (arm, power64, arm64, mips, s390x, nacl, BSDs, Solaris) and trampolines — Done: PLD/CLZ/ABS instructions (
2031252fb8,d186d07eda,dee5adcf74), PAX flags (3f34248a77,af92b29fe6), ELF ARM flags (1cf27acfed), OpenBSD (31758b2c1a), AES-NI (e039c405c8,297bb12809), AUNDEF (f2bd3a977d),-Zzeroing (b9da27bed2). - Build IDs, ABI hashes, flags and determinism — Done: user-visible
-Bbuild ID flag (32316bba5b), consistent binary for cgo (section symbol names use pkg path,4d7c81bc67),fieldtrack(3d40062c68), race linker support (cc8cfefd8a: emits dependency onruntime/racewith-b).
Other changes
- Instruction additions internal — PREFETCH (
35d260fa4c,3d462449f6), PLD, CLZ, MULW/MULAW (a0084b3494), ABSD/ABSF (dee5adcf74), BSWAP (ed480128a6,c4ea1c955e), AES-NI/SSE2 (e039c405c8,c1d06cef12,297bb12809,871177df6a), fixes for FSUB/FDIV encoding (72fa142fc5) and MOVB on 386 (354a3a1513,54023a94a6). - Alignment and layout internal — loop alignment, disabled (
c48ce6930f), function alignment (8820ab5da9), 64-bit alignment for large objects (f76f120324), jump rewrite chaining (b91cf50585). - Portability internal — big-endian fixes (
d04ac4b0b7), Plan 9 fixes (154c84cdac,62dfa9c47d,74c03cb814,1a9a63961b,d727d147c0), malloc checks (af375cde20), valgrind and string overflows (6535eb3a6d,77e7e4c329). - Prog/Sym size reductions on ARM internal —
9b568ef2b8,e00c9f0dbb,e6861d8c34; symbol lookup fixes (d815a14718,0e76a943c9common symbols). - arm: GOARM embedded user-visible — the ARM linker embeds
runtime.goarmand auto-detects it (88ba4de152,77e42e2108); VFPv3 check (55ca5ab0be). - ld output fixes internal —
-awrap (4c40e5ae51), retry short writes (592b480746),dynimpnamereplaced withextname(96b243fa47), avoid redundant external relocations (9e13803ae1), consistent usage oflibgcc(5490814c30), Mach-O header details. - Remaining 1.1 ld work internal — PLD and Linux/ARM build fixes (
6a5660f160,e0b0f62d96,85773e6bc2), more ELF sections allowed (586b6dfa46),0bf46d0cf3prepare for 64-bit ints, weak/hidden symbols from compiler-rt (78a6f75241), function symbols from gcc objects (c0927a6797), GC_CALL relative (56a06db360), use-after-free fixes (f7ad816c5c,8bbb6d3ed0,b35019fe9a,f74b4d3de3), CALL reg,reg (d57fcbf05c), BSD/OpenBSD build fixes (e0c430d5b7,e7fc9a5c57,8d4f381f5c,b735eeb323), PE/relocation diagnostics (813590b145,396d3af8d0,0c2b980c49,a555758909), stdcall decorated dynimport names (dab268fac3), warnings and fixes (254caaf90b,1c6b6b125e,255fb521da,a3855013a2,8d732368c2,a3c2d62a9a,fb3ed166e3,b505ff6279). - Hidden/local ELF symbol import user-visible — Fixed import of hidden and local symbols on ELF systems via a new newsym. (
576d648b2a)