Go 1.0 (pre-release history 2008–2012)
Everything up to the go1 tag, 2008–2012. 6g/8g/5g with the C frontend gc, Plan 9-derived C compilers and assemblers. Segmented stacks. A tcmalloc-style allocator with a stop-the-world mark-sweep collector. A global-lock M:N scheduler. hashmap.c and the 2009 and 2011 reflect redesigns. Escape analysis and a first inliner. ELF/Mach-O/PE linkers with DWARF and dead-code elimination. runtime/pprof.
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)
Everything up to the go1 tag: tcmalloc-style allocator (2008-12), stop-the-world mark-sweep (2009-01), finalizers, a faster collector in 2011 (1e063b32cd), helper threads, memory release to the OS (5c598d3c9f); threads "Stop-the-world mark-sweep…", "Size classes…", "Scavenger", "Finalizers".
- Stop-the-world mark-sweep, then the parallel collector — Done:
- 2008-2009: allocator and first collector (
e29ce175ed,1ce17918e3,9f726c2c8b); heap map split from malloc for 64-bit (80f4ab47ee); a bug in the size-class waste check that produced far too many classes fixed (c1e748bd2e); stacks no longer malloc’d during GC (8c357ce269). - 2010: finalizers merged into package runtime (
33e396a4a7); sweep and GC specialisation (f25586a306,fb94be55dc,22a7f2a14ddrops MHeapMapCache); GC clocked on bytes allocated (8ddd6c4181); memory profiling hook (596c16e045). - 2011: simpler dense heap map in bss (
4608feb18b); faster allocator and collector (1e063b32cd); standard-sized stacks off the central FixAlloc (c9152a8568); helper threads for parallel marking (a5f064a3e1,8219cc9af8); per-M MemStats caches (66d5c9b1e9,27753ff108). - 2012:
ReadMemStatsreplaces UpdateMemStats (842c906e2e); 32-bit fallback when the 64-bit reservation fails (d37a8b73c5). Left open: GC was stop-the-world and single-threaded in the go1 tag; stack and heap scanning were conservative.
- 2008-2009: allocator and first collector (
- Span lifecycle in mheap: free lists, treaps, first-fit and the page reclaimer — Done: span list-based heap with coalescing (
9f726c2c8ballspans), release unused memory (5c598d3c9f, see scavenger). Left open: nothing noted. - Scavenger: returning memory to the OS — Done: user-visible periodic release of unused memory with
madvise(5c598d3c9f),HeapIdletracking (33d00fae30). Left open: fixed 2/5-minute thresholds. - Heap address space: contiguous arena to sparse arenas — Done: dense heap map (
4608feb18b), >512 MB 32-bit (70b0de8e98), alignment checks (48535ae3f1), 64→32-bit fallback (d37a8b73c5,073aeff785,3dcedb620c). Left open: fixed contiguous reservation. - Finalizers and span specials — Done: finalizers, table, single goroutine (
33e396a4a7,f25586a306,acfd7b8d12,4e28cfe970,24c58174b2,69a91663d2). Left open: a second mark+sweep pass for finalizers existed until4e28cfe970. - Memory statistics and accounting — Done: per-M caches (
66d5c9b1e9),HeapIdle(33d00fae30),ReadMemStats(842c906e2e), mallocs and sampling fixes (ad35cea762,1135fc3978). Left open: nothing noted.
Other changes
- Allocator hygiene internal —
free(nil)handled (0c32430534), strings allocated NUL-terminated for low-level getenv plus a 32-bit GC fix (1a0a6f9d50),mallocfixes and counters (7e5055ceea), untouched pages not touched, cutting hello-world working set from 6 MB to 1.2 MB (0d3301a557), GC and malloc performance (f25586a306,991a968f44); early GC bug fixes (3e02987508,7cd24361bd,b21425ddee), mcache allocation serialised (7389ab8d21), allocator fixes for 386 and GOMAXPROCS>1 (1cc8c87dc1,250977690b), extra memory stats (d99a3da7b2). - Out-of-memory handling internal — more graceful OOM crash (
e2f9c73391),MemProfileRate=0crash fix (1135fc3978), grsec fix (8eee153bc8), 64-bit/32-bit allocator fallback (d37a8b73c5), deadlock detection fixes during GC (5695915833,84bb2547fb,8584445289,8219cc9af8). - Residual small commits internal — early malloc bug fixes, C/gcc portability, build breaks on Windows/Plan 9/NaCl/Dragonfly, naming, position-independent code and comment/format cleanups with no separate design content:
da0a7d7b8f,7843a14df1,9b8da82d72,2b57a1124e,78a6d68c86,73c10dd967,d3a412a5ab,74a9fc18f6,711088106e,bada653f4d,214a55b06a,5c30325983,1253c75cf5,ce020ffacd,03f2289f7e,dc159fabff,54193689cc1.1,f76f1203241.1,6273c7324f1.1,f24323c93e1.1,7847f328cd1.1,c13866db7f1.1,44cf814d501.1,add33498671.1,c90850277b1.1,c15ca825ad1.2,83d4cd758c1.2,cdfbe00d911.2,2ffaefd1611.2,b9ddb0d8b31.2,dd50dac56c1.2,67c79da8571.2,3b089179c41.2,b7b93a71541.3,0ef0d6cd7b1.3,fb5e1e1fa11.3,9ab4d1d6b31.3,8de04c78b71.3,bee3848f4e1.3,81bc9b3ffd1.3,55e0f36fb41.3,a5b15305571.3,cc817121901.4,92c54e4a731.4,1b47af21991.4,1d88f9dd4d1.4,d889f5f01e1.4,99e8f404881.4,5c795632d61.4,37b85971781.5,0e6a6c510f1.5,d1cae6358c1.5,ada8cdb9f61.5,64e53337af1.5. - Remove malx and skip_depth internal — Deleted the malx function and the skip_depth argument to malloc. (
6363542695)
Scheduler and concurrency
From Scheduler and concurrency runtime (Go 1.0–1.17)
The pre-release runtime: global-lock M:N scheduler, chans/select, Notes and unified OS mutexes, first sync and sync/atomic packages, timers for package time, deadlock detection and the earliest GOMAXPROCS semantics; threads: early scheduler, channels, semaphores/locks, sync, atomics.
- The G-M-P scheduler: from global-lock M:N to per-P run queues, spinning Ms and work stealing — Done: the pre-1.1 scheduler.
- 2008: the first FIFO scheduler
e7d549fbd7; first multithreading on Linuxd28acc42ec; Mac kernel semaphores used only on real contention5ff12f871fand the per-G Note removeda61bb95497; GOMAXPROCS redefinedefc86a74e4,runtime.GOMAXPROCSadded7955490de2;LockOSThread/UnlockOSThreadfor the debugger218c393029;sys.casfor mutexes84ded32817. - 2009: G structs recycled
2aea4a063b; list of all Ms kept so the collector does not free them93689d863c; preemption-by-GC checks in expensive routines5328df6534(fixed in711088106e);runtime.Goroutines51a2183851; idle goroutine582fd17e11; contention reduced by waking on scheduler unlock5e963a826c; scheduling race fixes774333685e,88ce9ce40c,50d6c81d4a; no new threads during malloc4dfd7fdde5. - 2010–2011: GOMAXPROCS vs GC bug
29d78f1243, running-goroutine countbd77619142; faster syscalls025abd530e,ba134539c5; scheduling race9bc58accce; unnecessary locking removed6500065543; bootstrap M counted in mcpu2572ca2ff2; main goroutine locked to main thread during init6808da0163anddc159fabff;runtime.NumCPU6dfdd4c1e3; deadlock detection restored in the simplest case84bb2547fb/5eb007dede; goroutine profile and stack dumpse4b02bfdc0. Left open: one global scheduler lock and one run queue; GC stats and goroutine ids still global (the false-sharing fixes909f31872a,013ad89c9bare band-aids); no preemption of running goroutines.
- 2008: the first FIFO scheduler
- Timers: timerproc goroutine → per-bucket heaps → timers on Ps — Done: runtime-provided timers for package time
3b860269ee, timer callbacks crashdc6726b37f, timer removal corruption (#2495)a899a467f2. Left open: one global heap and goroutine. - Channels and select — Done: chan/select/close (above); select fairness
4f269d3060and memory leak pass 3ec53627ed5; channel data cleared on receive for GCdec248c665;make(chan [0]byte)95323c59ea; sync channels faster90f3cb13fb;x, ok = <-czero valued16bc7a9f2; disallow close on receive-only channelsf58ed4e641; heap sort replaces bubble sort in select (1.1)cb32ea9c191.1; lockorder before pollorder53e139c7a0. - Semaphores, runtime locks and Notes — Done: mach semaphores only under contention
5ff12f871f; sync semaphores5bbd4c2f1b; runtime mutex across OSesee24bfc058; lock-free stacka5dc7793c01.1 (Go 1.1 list). Left open: none noted. - sync.Mutex, RWMutex, WaitGroup, Cond, Once — Done: Mutex, RWMutex rewrite
12206f64dd, Once895c5db6df, Cond05b1dbd0a6, Unlock-of-unlocked check26880d7e03, atomics-based Once and RWMutex fast pathsd2ab2b9f42,daaf29cf93,ee6e1a3ff7, Cond.Signal wakes previously sleeping goroutines17bfa32fde, barrier proposal63457d089e, armv5 support86b0ea6447; Once.Do uses atomic Store (1.1)8c4c6c413f1.1. - sync.Map, atomic.Value and sync/atomic — Done: package introduced (above)
22eab1f5c7, ARM cas fixes540feaae47,0b200b4d09; atomics on 386 with XADDab596cae9e. - Goroutine and M lifecycle: caches, ids, LockOSThread, Goexit, cgo extra Ms, deadlock detection — Done: G recycling
2aea4a063b, deadlock detection84bb2547fb,5eb007dede, LockOSThread218c393029, main thread locking6808da0163, GC stats per-Md839a809b21.1 (1.1 list). - Stop-the-world, safe points and GC–scheduler interaction — Done: GOMAXPROCS vs GC fix
29d78f1243; GC in stoptheworld with parallel GCf18e4e44a3,85916146ea. - Scheduler diagnostics: schedtrace, GODEBUG, execution tracer, block/mutex profiles — Done: creation pc in traceback
324cc3d040; simplified stack traces03e9ea5b74; per-pause GC statsbcd910cfe2; profiling thread creation5b93fc9da6. - Fast random numbers for the scheduler — Done:
cputicksseeding8e765da941, no false sharing909f31872a. - GOMAXPROCS, thread and resource limits — Done: GOMAXPROCS semantics
efc86a74e4,7955490de2,eb48bfbbda; NumCPU6dfdd4c1e3.
Other changes
- Reflection and cgo support for channels user-visible —
5ddaf9a098(reflect chans),653cef1ba0,de7920e6fd(ChanValue Close/Len/Cap),2e20386fc7(cgo export library support),95fa16a892(C.GoStringN),db9229def8(GoBytes),9042c2ce68(runtime/cgo),2d39303429. - Stack/morestack interplay with scheduling internal — stackalloc on the scheduler stack
b5dfac45ba,79e1db2da1, no select stack split6a3b29895f,5273868f67,aa3222d88f,ccdbb8a6c2,e2bde5cf9b,afc6928ad9,b701cf3332,c2b91d4889. - Runtime cleanup and traceback internal —
88a3371a91,d6f25597bb,1a2421e406,3835e01d97,f6d67c9e95,d110ae8dd0,b287d7cbe1,d1cd829405. - Memory allocator/map interplay with goroutines internal —
c9152a8568(plain malloc for stack allocation),86e7323bdf(no static in oldstack),d6ed1b70ad(distributed ncgocall),72e83483a7(cgo calls 669 → 330ns),54e9406ffb,3b860269ee,100a034120,a2677cf363(GC bitmap corruption when GOMAXPROCS changes),e1b47159ab,1707a9977f,2e4a035995,4d903504b3,d6c59ad7b8. - Mutex and Notes internal —
bf3dd3f0ef,ee24bfc058,b83549a7e6,be629138ab,62d627f0bc(finalize chan semaphores),d770aadee5(chan creation 1132 → 381ns). - Misc bugfixes in 2008–2011 internal —
5624e34494,df8ac28975,dee07c884e,7b454bb1d9,2da9783e2b,24838a2df6,3338c71fc6,1da727a31f,8a9752dcfb,79fbbe37a7,9b827cf9a0,a6af484328,e8766354a4,600ee088b6,75647d2024,60db3d6d3f,3f19d8ae8d,cec007d3d2,d4baf3ccb7,88ce9ce40c,d16bc7a9f2,ed575dc2b9,b33f5d537f,9b15ad8c22. - Early chan/select/map/interface fixes and runtime plumbing (2008–2011) internal —
af58f17af9,90da10d7ac,949ab5c7ff,b89d630977,504da53c85,47e6042f73,102b5b34a7(drop the complicated select PRNG),3a07d516b4,175849295c(select pseudo-randomness),45301ba8c0,7c616b3809,a73817716a(one malloc per chan),9c3ecb3617,b57afc2f83,3935610e35,eee50ae1ac,1f8a40d85c,9b6d385cb5,a7f6d4066e,408f0b1f74,e956429166,5adbacb8e7,90846cd447,e42d6a5fe2,85785fe577,1e774d9e6a,1bef250f33. - GC/goroutine-state interplay and misc scheduler bugs internal —
36835c7a47(save stack trace when entering Gsyscall),19c18358ca,72157c300b,214a55b06a,052a66babd,41554e2528,e79bcf8bfd,74a9fc18f6,34d413f562,111005d32b,150a64572b,29aa3ffbf6,d08f0067b5,fe8ff955e9,ad9c6f7700(debugger hooks for newprocreadylocked),a68592a4dd,659780b643,3f8aa662e9. - Platform/glue internal —
72154b042f,f7f6329e26,5bb0c4f88b,61e0fcce8a,73c10dd967,62355959c6,23c41a1ef2,9cc8e9ef48,cd319092e0,c83451971e,a7528f1b81,6b3357129a,623e7de187,69cb8fef43,d44c4c351d,9c774c3f26,33e9d24ad9,3f2d787c2b,0acd879c26,0ae9d812c8,03f2289f7e,89b075cc90,8a4c2b3cc4; docs39ffd546bd,a03c519a8c,76eb911a3c(Cond.Wait cannot return spuriously). - Scheduler reorg internal — Renamed select to nextgoroutine and separated entering the scheduler (sys.gosched) from the scheduler itself. (
4feda71b7d) - Casify and clean up sys internal — Renamed and cleaned up runtime sys functions. (
360962420c) - Comments in proc.c internal — Added comments for various functions in proc.c. (
4ac425fcdd)
Data structures and type metadata
From Runtime data structures and type metadata (Go 1.0–1.17)
Four years of foundations: hashmap.c, the C iface code, the 2009 reflect rewrite from string parsing to compiler-laid-out type structs, the 2011 Type/Value redesign and opaque Value, per-map hash seeds and randomized iteration.
- Hash map core: from the first hashmap.c to the 8-entry bucket design — Done:
- 2008–2009:
hashmap.c(bc0b4f0d2a), pointer keys (5adbacb8e7), hash alignment fix for data >= 8 bytes (9ed2960de8),forloops in hashmap (1f1ae404f8). - 2010–2011: zero value on missing key (
e781303e27), large values (b198c8612e,8599a83727), free old pieces during resize (21518ea2af), memory-leak fix (e7e5c5adb3), nil-map panics and nil range (f2852ba618,86145611b0),gofix -r mapdeletefor the delete builtin change (313c8224d5), randomized iteration start (e40d6e066a, user-visible iteration order is no longer predictable). - 2011-12 to 2012-03: algorithm in type data became a table pointer so compiler-generated code can be called, and the top-level map structure was trimmed from 104/80 to 24/12 bytes on 64/32-bit (
b9ccd077dc); per-map hash seeds fromfastrand1(85aeeadaec). Left open: seed was not yet cryptographically random (“Fastrand1 still needs to be updated”).
- 2008–2009:
- Map growth, iteration order, overflow buckets and GC interaction — Done: randomized iteration start (
e40d6e066a) and incremental-growth predecessor “free old pieces” (21518ea2af). Left open: iteration over one bucket still deterministic. - Hash functions and algorithm tables: memhash, AES hash, fallback hash — Done: alg table pointer (
b9ccd077dc), float64 hash fixes (022aac7883,facee93a86), per-map seeds (85aeeadaec); 2009 alignment fix for data >= 8 (9ed2960de8). - Compiler-generated equality and hash functions — Done: alg table (
b9ccd077dc). - Runtime type descriptors: layout, shrinking and name encoding — Done:
- 2008: reflection from type strings; sys.Reflect/Unreflect (
d6a7cefd1e,a45f947c34,842e1a9aa7). - 2009: struct-based reflect data laid out by the compiler (
4793400bd1,a7b4e9f03e,58c4142e74), maps and channels reflected (764b6ec1aa,5ddaf9a098), methods (12ebbe7463). - 2010–2011:
Kindreplaces per-type structs (45bdf0367e), gc emits correct reflect types (96db724cfc),ptrtoword (8d36a78440), uintptr treated as pointer-bearing (b0c674b65d), runtimeTypedeleted (121a16fa95,6a75ece01c), type-specific algorithms (b9ccd077dc). Left open: type data still lacked GC info.
- 2008: reflection from type strings; sys.Reflect/Unreflect (
- Interface values, itabs and type assertions — Done: 2008–2009: iface runtime (
6f07ec721a,e2e8aa0ee1,900e076d21,4b8c13dc20); 2010–2012: type switch eliminates package-global-name assumption (1912632019),runtime·Typedeleted. - reflect redesign: from string parsing to Type/Value structs — Done:
- 2008: string-parsing reflect,
Value.Interface, tags (554d0aa589,12a3435869,a45f947c34), type cache (842e1a9aa7),DeepEqualin 2009 (c4ad4f9fcf). - 2009: struct-based rewrite (
4793400bd1,a7b4e9f03e,58c4142e74), map/chan/method reflection (764b6ec1aa,5ddaf9a098,12ebbe7463),FieldByNamethrough embedding (a288095813),DeepEqualfor maps (1880b90aff). - 2010:
Kind(45bdf0367e),Type.Bits(fc090a3a54),Append/AppendSlice(8b64cd9c5e),FieldByNameFunc(57e764171c). - 2011:
PtrTo/Addr(e46acb091f), new Type/Value (fb175cf77e,7b6ee1a5d4,40fccbce6b,e1ee3b5db6), struct tag convention (25733a94fd),MethodByName(22484e2262), opaque Value (a479a45548),Interfaceon unexported values disallowed (304cf4dc9b), empty slice/map not DeepEqual to nil (4e65478cbd). - 2012:
DeepEqualon funcs (3a1c226a38),Value.Interfacereturns immutable data (a72b87efa9), MakeSlice argument checks (11cc5a26d5).
- 2008: string-parsing reflect,
- Slices and append: growslice, makeslice and string/slice conversions — Done: 2009–2011: copy single-byte case (
20c1ec263a), typedmakeslice(864c757a1c),make([]T,0)allocation-free (94c2536e3f),SliceHeadermade public and fixed to use int (22ea3f9e49), gc-friendly SliceHeader (4e7aac5413). - Strings: concatenation, conversion and printing helpers — Done: NUL-terminated allocation (
1a0a6f9d50), float print format (ac5a887d5d),rangeUTF-8 fix (a18208fb60),maxstringrace (f9f21aa1fb).
Other changes
- Early reflect (string-parsing library, 2008–2009) internal — type-string parsing support and fixes: moved into place (
5d30161ca7,8327b54169),bool,..., NUL and tag trimming in type strings (613a5c8bc6,16fd356679,730fd707cb,1ff61cefaa,5a1cbe8b64,546f269c3b,bdbb958895,ca9765d83a,178e37e766), unsafe.Pointer-based objects (50d0695ccf,f5cfadde47), nil-interface and uintptr handling (ac09eb4f49,9ba97ca308), pointer mutation support (b1d37b74d9,419e1e05a1,7295b61cdb,a48b35e961), array methods (e4f4ab0b8d), alignment (44a82746a1,4e84174816,c0b8b969ae), cleanup and renames (c4af3e7c2a,ed2ac9b8b0,ba882f9940,9526f3b841,d0424faf17,dfad8ea647,3bc6fd63fe). - Reflect value/type API additions user-visible —
InterfaceValue.Get/Value()(ac6ebfdea9,96cfd154d8,f96662324e),StringHeader/SliceHeader(d7a5ccf36e,29e6eb21ec),Type.Name/PkgPathsplit (ba0cf083a2,1dbd3c8d3d),FieldByNamedetails (a93c5c8550,123ff2ebb8,c36fbdf713),Sliceof arrays andCopyof arrays (3bac16a6bf,6850dba0ca), unexported-keyMapIndex(86e6a44112),Lenon strings (db0e358022),NumMethod(125e8277d5), panics on invalidInterface(a2bb0159d6),Bytes/SetBytes(00d64c7239), slice cap fix (3dc278d3e2), panic strings (cc8e12bb52),%psupport viaGet(148ee9c009), GC bug inCall(da225c231f), fasterGet/SetValueby removing casts, 25%+ (81cb189a06), kind values andKindUnsafePointer(bbaef5f4dc,454f03ff0b), documentation (be560e0401,795ff00df0,ab44a814c2,babbf941c9,2ed7087c8d). - Language-change sweeps touching these files internal —
new/makesplit, composite-literal syntax,closed(c), error type, float/complex deletion, map-index rule and others (5564504507,9f8f2e6130,3f915f51a8,eb6929299b,f2b5a07453,c7122a3c58,062406bc64,1fe42e2d4d,b54133d200,839a68469b,a50cbf6c73,8a7cbadbbe,40621d5c0d,ca6a0fee1b,20011bc878,0496040bd6,b5c57fea96,de13727f0f,00f9f0c056,ef12ae4631,1f6463f823,be2edb5761,535dcf77c8,907509de4a,387df5e176,85fea81d70,73120ee81d). - Runtime printing and low-level fixes internal — traceback pc and
%Sfixes (ec913c42b3,bafd1787fe), misaligned-stack printf (e339d27db7), printf locking and nil-map printing (fb1bcd47c6,cb9c973829), string-conversion race (77f668a0f1), 386 guards (a52fb815e4), map size not multiple of 8 (9795c9e727), strings via cgo-style runtime (fa40c856ac), math moved out of runtime (488ca3c7a6), copy bug (948f3e77e1), complex divide matches C99 (21ff75bc0e), strconv and protocol buffers using reflect (079c00a475,091fb779a1,1b3299ed0b,d4e57ff248), formatter work (3a7df4dde0), UTF-8 replacement rune (9ddeb2105f,3619f1ea6a), cgo helpers (95fa16a892,db9229def8,e1cfb6f3a9), build artifacts (d0abe4cbb2,2f5a05a859,47580f79b4,f1547e511b,87b1124407,b90960e01e,6e0767bb04,90564a9256,175dd773e6). - Compiler metadata fixes internal — non-methods kept out of xmethod list (
11075ed893), no pkgpath forerror(ee09a8cd9f),unsafe.Pointerkind (454f03ff0b). - Early reflect API history and misc runtime internal —
printfvia reflection (418b97c670),CopyArraytoCopyFromand removal of “open” arrays (c5f99ccbdd,9a7332fb5b),IsNil/NewZeroValue(a8f6e38bce,b66d703941,2d5d4a1b41), interface set andGet(92e925778e,97f3a80d93,a8a678fc2a), DeepEqual type/nil checks (64627b04fb,33be0c6465),typestring.cremoved (dbc6d91d70),sys.Reflectmoved to unsafe andunsafe.New/NewArrayintroduced (c367d1b789,33649bd278), pointer-scan optimization disabled because reflect and gob broke it (ed6fd1bcbe), type assertion rules (49e2087848,955638e2fb), printing of -(1<<63), unknown types in panic (68209ed5e3,1dd0319be3), misc (bcd6403cc9,d47d888ba6). - Unicode 5 update internal — Updated Unicode tables to Unicode 5. (
5b904a3bde) - Early reflection library updates internal — Updated reflection for the int/int32 split, adjusted sys.reflect/unreflect for large objects in interface values, and made assorted cleanups and func-rule updates. (
282493bbf6,d0e30cdaa9,484ba939d2,4cf7711568)
Diagnostics and knobs
From Diagnostics and knobs (Go 1.0–1.17)
Everything up to Go 1: runtime/pprof CPU and heap profiling, runtime/debug, pprof.Profile, GOMAXPROCS/NumCPU, gdb support, in the profiler and pprof threads.
- CPU profiler and runtime/pprof writers (legacy format to compressed protobuf) — Done:
- 2009: user-visible
runtime.GOMAXPROCS(7955490de2). - 2010: malloc sampling and a pprof interface (
6eb251f244), heap profile extra information (baf538406b),MemStatsType(87915b6565). - 2011: user-visible
runtime/pprofCPU profiling (b47ec598b7), pprof deadlock fix (bed7e3ed78), OS X documented as broken (d0eaa58b5a);runtime/debugpackage for stack traces (89993544c2). - 2012: user-visible
pprof.Profiletype for custom profiles (ebae73bb24);runtime.NumCPU(6dfdd4c1e3,0ae9d812c8,610757b155removes a duplicate pcln walker). Left open: nothing noted.
- 2009: user-visible
- Heap profile accounting and MemStats — Done:
MemStatsType(87915b6565) and a malloc sampling profile (6eb251f244). Left open: nothing noted. - GDB runtime support — Done: gdb debug info for builtin structured types and pretty printing (
9a71bb00bb); goroutine support and fixes for strings, channels and missing types (db22e236fd,43512e6c70,46ed89b7a3,8a4ef5d1eb,fb2706113f). Left open: nothing noted.
Other changes
- Small API and doc items internal — finalizer and
SetFinalizerdocs (5958fd7f89,78d19b9b73),GOOS/GOARCHconstants andFuncLinefix (4e64555894), NumCPU reference (a03c519a8c), gofix error rename and build cleanup (eb6929299b,2050a9e478).
OS layer, stacks and panics
From OS interface, stacks and panics (Go 1.0–1.4)
Everything from the first 2008 runtime through Go 1: segmented stacks, signals and tracebacks, Linux/Darwin/ARM/386/Windows/Plan 9/FreeBSD/OpenBSD ports, cgo and runtime/cgo, mutex unification, vDSO-free time, GOMAXPROCS and thread startup.
- Segmented stacks to contiguous (copied) stacks — Done: segmented stacks and goroutines
751ce3a77a(2008-07); traceback across segmentsd3204ef19f,44f65c8f08,4b376ef328; fix for stack-limit register placement24838a2df6; 32-bit stack-switching fixes5273868f67,aa3222d88f; stack overflow debuggingadd89dd1ba; stack check added on all OSes5a4a08fab8,0400a7f8b1; cgo stack guard fix for >8K C stacksfbfed49134; linker stack-split logic near the default segment size9e5db8c90a; GC race ong->sched.sp/stackbase/stackguardwhile in syscalls fixed by saving a consistent tripleg->gcsp/gcstack/gcguardin entersyscall (370276a3e5). Left open: each split allocates a segment, so hot-split behaviour was not addressed. - Stack-split prologue, nosplit budget and C-on-Go-stack detection — Done: stack-limit setup bugs
24838a2df6;1ed7f18165better calling of morestack; stack check everywhere (5a4a08fab8). Left open: nothing noted. - Panic, defer, recover and Goexit — Done: panic output and tracebacks for all goroutines (
3835e01d97); array slice error includes bounds (9b8a6dc7da); runtime errors become realruntime.Errorvalues (63e878a750, “type assertion a runtime.Error, the first of many”); divide by zero and nil dereference become panics via signals (5963dbac08); deferred calls run atGoexit(83727ccf7c);startpanicso only one thread handles an incoming SIGQUIT (55a54691f9); no breakpoint on terminal panic (59ce067da8); distinct panic message for calling a nil func value (5032a7dc0c); signal information printed during panic (12307008e9); range+panic line number fixes (12a5774cde). Left open: nothing noted. - Tracebacks, crash output and GOTRACEBACK — Done: 2008: first traceback
aeb43984ec, segmented-stack tracebackd3204ef19f, source linesa5433369aa, formatd040d26863/2b39165f1e, all goroutines3835e01d97, stop when PC leaves textbad8c3d5dd, PC fixesec913c42b3. 2009: call-instruction accountingdbecfbf86d,63810f840f; correct pc infn+%#x4962e7ee9b; 386 32-bit hexa65bf95dd8. 2010–2012: ARM traceback6c196015e0,7081e67565; argument dump7eb13b95a3; crash trace on amd64befecf6b59; creation PC324cc3d040; traceback through active lessstack4b376ef328; omit breakpoint on terminal panic59ce067da8; GOTRACEBACK=248bd13911d;runtime.Callers2b7d147f1a. Left open: nothing noted. - Symbol tables, pclntab and runtime.Caller/FuncForPC — Done: pc/ln table printing
a5433369aa; history-stack decoding84852fe220;runtime.Callers2b7d147f1a,runtime.FuncLinefix4e64555894; ARM symbol-table size and leaf function handling6c196015e0;runtime·prefix on all runtime symbols to avoid collisions with C libraries68b4255a96(symbols left alone: cgo names, linker-known names such aspclntab,epclntab,symtab,esymtab,text,etext). Left open: nothing noted. - Signals: handling, os/signal, foreign threads — Done: 2008: signal handling and registers
aeb43984ec,206daeabda,3311e1b673; SIGSEGV/SIGTRAP details6e8dbc2051,ab9f27b227,a67258f380. 2009: SIGPIPE ignored2cf5c809d0; os/signalb5866494ea; crash by default08579c26dd; sigaction layouts for 386 and linuxf529224039,fd5fa4b301. 2010: snow-leopard kernel bug workaround (2f0cae46d8: OS X forcesgs=0x37, so threads without USER_CTHREAD segment fault on IRET into the handler; fixed by usingthread_fast_set_cthread_self);807605d0fc; 386 handler bug53a529ab2b;68b0a87966. 2011: print signal info12307008e9; signal stack bug820dc9ff1a;8698bb6c8cturns “too many EPIPE” into a real SIGPIPE;5690ddc7fano panic on SIGILL. 2012:35586f718c,55a54691f9,1707a9977f(fix FP control word on all threads),240b1d5b44,224f05ba88. Left open: signals on foreign threads not handled (diagnostics only:b23691148f,9b73238daa). - Threads, locks and the OS scheduler interface — Done: 2008: Darwin threads
376898ca8b, GOMAXPROCS semanticsefc86a74e4, semaphore use5ff12f871f. 2009: clone/futex770b872752, CLONE_PTRACE removed89f8238a99. 2011: Linux mutex4e5086b993; chan finalizer removald770aadee5; unifyee24bfc058; parallel GC enablingosyield/usleepon all OSes (d324f2143b,40c26fff14,723f73caec,d573ad2671); goroutines during initd1bafffa4band main-thread lock6808da0163;runtime.ncpuon OpenBSD/FreeBSD (b2f1eba324,12bf00054e). 2012:cputicks8e765da941. Left open: runtime used 1:1 M:N without per-P state (scheduler redesign is in another area). - cgo runtime support and non-Go threads — Done: 2009: FFI start
fdc4b4a47f; cgo133a158bd8. 2010:runtime/cgob07b04d35f,7eeebf49be; export2d0ff3f1a6,2e20386fc7; initcgo on all amd64a4f8d36ba5. 2011: SWIG17d50d8664; reorganizationf9ca3b5d5b; pthread_create error checka026d0fc76;os.Setenvupdates C env623e7de187; fast cgo72e83483a7; cgo build without cgoc02423902d; g0 stack guard fix for >8Kfbfed49134. 2012: signal masking in runtime/cgo1fc9a17c7e,9eeb90945e; diagnostics for callbacks on non-Go threads9b73238daa. Left open: C threads cannot call Go. - TLS, g/m registers and shared-library linking — Done:
bbcb91a3a7%gs;2d6ae385e1;9569c67a6bWindows TLS slot;7e77623120/e42788628a1.1 Plan 9 TLS (G and M relative to_tos, later PID from TLS in 1.1);1b14bdbf1cnacl (ldt0setupsets GS itself). Left open: no shared libraries. - Clocks, vDSO and timers — Done:
c19b373c8a,8dee872963,3b860269ee,f437331f80,efe3d35fc5,8e765da941(cputicksseeds fastrand against hash-table complexity attacks; RDTSC on amd64, constant 0 on ARM). Left open: the commit says “update 8a to recognize RDTSC”. - Windows runtime port — Done:
6bfe5f55f4,e00795859b,aae5f91213,f0b8f84d37,f83609f642,9b011500c0,9569c67a6b(TLS via ArbitraryUserPointer),9fd26872cbpprof on Windows,b873701dbdcallbacks not GC’d,428062da4e. Left open: cgo on Windows via ld flags only. - Platform ports: OS and architecture matrix — Done: 2008–2009: arch/OS split
aeb43984ec,fcd76f7dc9,878822f355; 3860d3a043de9,4702c0e5ef; ARM start7943556970,be639b9a51; nacl1b14bdbf1c; FreeBSD0489a260da,b3f538a4fd,5a4a08fab8. 2010: Windows6bfe5f55f4; Plan 999a10eff16,8221eb9103; ARM softfloat7c2b1597c6; nacl removal0c54225b51. 2011: OpenBSD21ac258e07,9ef17990c2,1075af0cce,8aa2591b13; windows/amd64f83609f642; NetBSD26089cfe25,728c16cf13; godefs->cgodd2abe5152. 2012: ARM OABI errorbb40196ebf. Left open: nothing noted. - Startup, auxv, randomness and security-adjacent runtime details — Done:
8e765da941,3f7a32405dwarns on SELinux mmap failures,65b036c381avoids doubling memory on grsec kernels,102274a30esizes arena to fit address-space limit. Left open: nothing noted.
Other changes
- Early runtime structure and portability (2008) internal — explicit install paths (
54bca54655), os.Error now echoes call context asPathError(a0bcaf4c00, user-visible API change in 2009), a revert (a41d85498e), execute bits cleared (504963e6a4), goos/goarch split (2b77d87fca,28429aaaa6,959f9fb3d4), ANON flag difference darwin/linux (fa259ff89c), print PC on faults (88a3371a91), signal interface code on linux (12c2864e4f), PC/SP tracking checks (d4c2da409b), runtime as archive with Makefile (c87597de2c,9ff0e6288e),sys.readfile/writefileand args (3e4e83ab1e,66b240c7a4,c870ac239e,cbdaa10f8c), runtime.c broken into per-topic files (8e82a673db,ef12ae4631,f28ec1af7f,bcfd31f0e9), dead code and cleanups (b07e084a99,1e774d9e6a,90da636c15,873ba78b79,e9047d1fc2), acid debugger support (c8dee2770d), removal of array-bounds trap handling (c1ad0509ee), “when main.main returns, the program exits” (ebd1eef41e), exec preparation (dfa5893d4f), bsdthread_create arg (7ca5a0d323), printf check, off-by-one source files and printarray (5bb0c4f88b,7df571aef7,61e0fcce8a), races (53e69e1db5). - 2009 runtime organization and ARM/386 bring-up internal — sys-to-os/runtime moves and docs (
918afd9491,4f21161269,3f6acf1120), Makefile work (63c2d52117,ab7a8d43a4,090efde407,d281748a6d,285b6021e9), missing syscalls (528919520d), SIGCHLD race on darwin (cd80000d8d), ARM details: Gobuf.r0 (111005d32b), stack-only in-params for 5c (46e392e01c), registers (bcfc6e631f), syscall convention (6f91ba1b0f), closure cache flush (6dbd142951), ARM memmove (744d5ae48a,093493c6a5,d08d33f389), cas/getcallerpc (d58b5fca45,b83549a7e6,33a7bcf315,a2cf914379), newproc arg copying (03bbfe6724), cgo2c padding for the new output-arg alignment (88e7fd5410,150a64572b), reflection for functions (bba278a43b), FreeBSD signal structure differences (7ada6018a7,1444f1bb1d,cdce7325c8,659780b643), Darwin thread start (e1c5c3df77), misc (3ff5e727e2,32e979c0de,41554e2528,597b2a91a6,857d4cf1a9,a23746ea65,4c0f262a2d,f39fcd7e42). - 2010 port maintenance internal — tiny/embedded targets (
9f5264f299,c0aac20e20,129c6c14d1,1b6282a799), malloc instrumentation (e4f06812c5), build fixes across FreeBSD/NaCl/Windows/ARM/Plan 9 (de90a7d4aa,2b4a9fa176,a24cf69fd8,7ecefdc03f,059c7ba996,636342292c,89e9231865,5b7e50a0aa,9cc8e9ef48,d10963b6d7,4fd12c04c5,2b18b18263,555feea117,60c91bbf4c,e04ef7769e,33405ecc86,3832389036), NaCl closures and defers (c6138efbcb,9ce0eb2d07), Windows details (d5a8647d80,fdb460ec11,bc4a9caa41,b611137098,7f9e247489,eee095399f,b0c6bba8e8,9f77e7ea3c,70deac67cf,c83451971e), print of floats and fixed strings (26e846429d,4843b130bb), darwinbsdthread_createfailure message (718da3339a), Leopard 16-bit divide fault (c9172fb2a3), ARM fixes (fa4da33315,df88fc6109,2012604002,079cbddbd8,85d9ab61d2,7e69c90ade), GC manual stack (d4cc557b0d), SysFree stats (929fdd860b,a2450c1456), runtime file splits (e63ae242e6,35f8a3f90e,340f28deab), writes ignored on failure during print/panic (b3e8fdce8d), GOBIN/GOROOT cleanup (5c603dbb75,1fab0cd12a), debugging help (7e14bd81f4,45e12c7cd3,7c99dcbdf9). - 2011 Windows, ARM, Plan 9, OpenBSD maintenance internal — Windows callbacks, stdcall and SEH details (
239ef63bf2,12bdb29bdf,ff7d7b271f,c4206cb231,c3be760889,6b648cafde,9c774c3f26,c8ee9c60d2,2a80882601,f627215bab,ae891b5528,7406379fff,6bc0346e28,603d80c28d,0d37998a06,6d4c18a4af,78479163cb,e7042418c5,6876ad37f3,ad29ef9561,4fa6d57f6e,6c240d7671,b7949035d6,6606995c91,38d3f58528,89cc4d7814), ARM (1f2234633f,079a5cffb3,90d8c8a09f,1fddbab736,c475c3071a,d4a9bce70a,141a4a1759,7f5ae484eb,6b3357129a), Plan 9 (ceef10c222,0924185840,f7d754fcce,c1f035ba4c,b546f50716,528ccdc513,4a2d30e13b,1cb254a085), OpenBSD/FreeBSD (c7f6f9f318,cb2040b2ab,a1c622dfea,85b7419211,13dc53055f,0e5cd9d3f6,be8025604e,e5437ab065,1c05a90ae2,db89e19d26), memory and malloc (4608feb18b,5b1b2ba9c7,591c74ad20,a8bf6f32cc,e4492ce3c3,47410a2490,439694125f,dde435587d), Darwin thread VM footprint (59a8926829), Mac OS X 10.7 cgo (95963e6294), print and goc2c (f9fc1ddf75,5f40c5b384,3693cd2988,bed7e3ed78), cgo runtime (b97005c1d3,1c42db8835,0cfa0fe242,90294a08c8), versioning and GOOS (bc874ec0dd,31ccf19612,aee6b1160e,fd0cf08748),3c7104479cdrops CLONE_PARENT,c14b2689f0faster finalizers (38-96% depending on core count),85916146eafixes linux/386 usleep and re-enables parallel GC,31452a3618. - Build system transition (Dec 2011–Feb 2012) internal — runtime build made friendly for the
gotool: separate auto-generated files (851f30136d,bd9243da22,86dcc431e9,55889409f8),gobuilds runtime/cgo (54fb9940cf,41a6165c03,e83cd7f750,a462816753), Makefile ordering and cleanup (e628144aeb,3800b14071,3435438948,bacb1b70f7,56e6a02490,961f96b5d2,0ae6084fef,9a15c2186c), math assembly stubs (dd8dc6f059: one Go file declaresSinand a lowercase portablesin, each arch has a tiny assembly stub, so godoc sees one declaration),13b26cb36a, 2012 fixes (1250f94f93,c30ba7e65a,dff5535aaa,8542dc0764,0bd53d2ce0,7c2607a91d,2d53d227f6,07a2989d17,1064f3a97b,b8f465644c,22c41ff019,51a84bbfaa,b0beeb1501,36aa7d4d14,8a1b3d5a57,2d3cc97c9c,16ade99d9d,bd6404a4cc), OS X CPU profiling (6e2ae0a12c). - Runtime symbol prefix internal — all runtime external symbols are prefixed
runtime·to avoid conflicts with linked C libraries (printf, malloc, free) (68b4255a96,718be3215f,e8605b1279). - Memory interface (OS side) internal —
SysAlloc/SysMap/SysUnused/SysFreeper OS: MADV on Linux/Darwin (e6f5a90b5f,c354f93b93),SysFreefixes on Windows (4e69976a60), MAP_FIXED on 64-bit Linux (ddde52ae56), FreeBSD mmap (e1e829b786), nacl chunks (1b14bdbf1c), 2GB malloc (d89b357f76), mmap null page (649aab835f, removed951318c0df). - 386 FPU state internal — FPU set to 64-bit precision on linux/386 (
cc1556d9a2) and on all threads (1707a9977f); DF flag reset (f85abf01bc). - Hardware/atomics internal — native xadd (
491aa1579d), cas on ARM (6a48aab747,9ad9742157,540feaae47), 64-bit atomics (46675716191.1, 1.1). - Go defs for C structs internal — parallel Go definitions of C structs (
85cae877f5,7400be87d8). - Misc runtime OS plumbing internal — GOROOT/GOROOT_FINAL (
0c3a93ceb7,d3ac545f80),runtime.Compiler(4e110af169),runtime.writeback to C (c9e5600f7d), no malloc during malloc (fc7ed45b35),Itabdata race (86a659cad0), memmove replacing mcpy (fe9991e8b2), os/signal Incoming SIGCHLD (43d2e59a81). - Func literal equality user-visible — every func literal expression allocates a closure so
==on funcs is consistent (9346c6d901). - Early runtime development: segmented stacks, scheduler, locks internal — Updated darwin for segmented stacks, rewrote the lock implementation, adjusted stack growth with coherent SP/PC in gobuf, and removed sys.sleep. (
3719aa4d9a,96824000ed,afd04fdb98,7343e03c43) - 386 port and runtime renames internal — Updated 386 to the new runtime and renamed sys functions to runtime. (
8522a478bb,22a5c78f44) - Softfloat stub and runtime cleanup internal — Added a first stub for softfloat that skips float instructions, moved memory code into GOOS-specific directories and allowed printing of static strings. (
d85bb81878,12518e441b) - Windows improvements internal — Multiple Windows improvements and cleanups, and a fix for stack cleanup on windows/amd64. (
62afa225af,0f5902d6be)
Compiler frontend
From Compiler frontend (Go 1.0: 2008–2012)
The compiler frontend went from a prototype tracking a weekly-changing spec (semicolons, chan operators, export keywords) to the Go 1 language with a separate typecheck pass, exact constants, Eface interfaces, closures, escape analysis, inlining and a stable textual export format.
- Lexer, grammar and statement syntax (semicolons, chan operators, conversions) — Done: user-visible everything above, in chronological order.
- 2008: optional semicolons (
8200a0b088),a,b := fun()(81b325db1b),new chan syntax(ac048ce7f4), send/receive operators (47919799b4), semicolon rules (d364d28142),*Tas implicit declaration ofTremoved (02d184b303), trailing comma in braced lists (82e41cc533),DOTDOTDOT(74427c6346),range(26b357ca5b), chan/map no longer pointers (dc7b2e98d2),T{}/T(x)(0194aaf918). - 2009: composite-literal paren syntax and back (
07244f7c80,49cc649e59), type switches withcase nil(a4a10ed856,0f469a99a3), lexer-driven semicolons (8abcdee175), conversion rules per the new spec (7f3eb2738f), no parens around type in struct literal (9c3c140984), semicolon/package-clause rules (aaaa1fc69b),x[y:]for strings (aa4c638b7b). - 2010:
//linedirectives (444066e56d), EOF semicolon (ec13ed1fce),selectcaseexpr = <-c(9b62461a8f), new slice spec (fce222a95b), improved syntax errors (2a01d72878,78c27ed650). - 2011:
ifneeds a condition (52943bfe4d), else needs braces (58e19aa4cb), non-blocking send/receive statement syntax removed (cb584707af),x, ok := <-creplacesclosed(c)(8bf34e3356). - 2012:
switch _ := v.(type)rejected (74ee51ee92), diagnose(x) := 0and similar (112267d55e, 2011), top-level var/const rules (4bcc9c6b5e). Left open: nothing noted in the commits; the C yacc grammar is still the parser at the go1 tag.
- 2008: optional semicolons (
- Package system, visibility and import resolution — Done: user-visible
- 2008:
exportadjectives (989676d2ba,695f83a9e0),packagelocals (d3f6093931), autolib (e90ae879d6). - 2009: case-based visibility and the removal of export lists (
07d344e442,06869eedf9,61590c4c44),-I(062d6998ab), whole-package compilation (66bb399fdd, see the typecheck thread), unused imports (73e52ae971),import .fixes (63aeaa2a03,5a5799f613,7b240e8135). - 2010: global name space dropped (
531e6b77c8), full paths in type data (1cecac8134),-urequires imports marked safe (d20ad1c75a), canonical path checks (555f5b6b24,7e92e1cbfa). - 2011:
mainnot reserved (c1a695c160),-pimport-cycle flag (1e480cd1ad), package paths in symbol names with period/0x7f escaping (33f1d47b38). - 2012: import path validation (
dc38756ce1,d0d251f858,daacba5184,cc99d8ad0b),-Dfor relative imports (604f375110). Left open: nothing noted.
- 2008:
- Export/import data format — Done:
- 2008: first import/export (
2254a8ee99), new format (b8babed7c2), embedded type export (21617250f4), mp float constants (f8797daa9f). - 2009: re-export of bools fixed (
dec12d3654),unsafeimport foundation (1d4daa2d39), import-name resolution fixes (c715b58dad,e733766dda). - 2010: complex constants (
713e3e1541), export of complex types (cd016d7558), full paths (1cecac8134). - 2011: metadata for all dependencies (
e6f3aa6c36), inlining-preparation format changes (b536adbfba,40b2fe004f), byte/rune distinction (862179b0f5). - 2012: limits and fixes (
aa63a928ea,feaa9ed10a,5c52404aca). Left open: the textual format has to carry inline bodies, which the 2011 commits say they were preparing; no binary format yet.
- 2008: first import/export (
- Constants and multi-precision arithmetic — Done:
- 2008: mp ints (
9c2ade358d,272ae659db), exact large-constant export (2b75556436), mp floats (3fa4610601),(1<<x)(944ad62ecd). - 2009: ideal bools (
a95ee61aea),^on consts (b8be809c10), shift checks (0aa1b1508a), float/int64 conversions (1620023d03). - 2010: complex (
33d6a260c1,fc010adcd7), precision (95b93c28e3,f6b93ab432), const simplifications (ed13d39972). - 2011: denormal rounding (
cf63e34b1d), shift rules (5ab096d030), character constants (be0ffbfd02, Dec). - 2012: ideal bool dropped and relaxed (
126d475a43,e29d3dfc49), shift overflow (79db6ada48),len(array)/cap(array)constant rule (d4fb568e04). Left open: nothing noted.
- 2008: mp ints (
- Typecheck/walk separation and package-level declaration order — Done:
- 2009: typecheck pass (
9271c6402e,9dc22b6d6f,d8c19c80dc), lazy declaration processing (dbe004efe4,54b403723b,2609731736), no forward declarations (b648716ee9,a92610208e), whole-package compilation (66bb399fdd), per-file filename disambiguation dropped (107d404378). - 2010: spec-mirroring conversion/assignment (
565b5dc076), less aggressive name binding for line numbers (76da2780c3), types inside function bodies (17f90c68c6). - 2011: whole-tree typecheck (
e59aa8ea4a), cumulative error count (3208917d54). - 2012: typecheck-loop diagnostics (
2aafad25b4), field+method same name (7dd90621f8),returnexpression-list checks (1d3ca9236e). Left open: nothing noted.
- 2009: typecheck pass (
- Interfaces, type switches, assertions and comparability — Done:
- 2008: signatures and conversions (
ead7a6d47a,1bf38484d1), interface equality (edb1412c50). - 2009: new interface rules (
a6ba5ec535),Eface(2da5022bcf), type switches (a4a10ed856,0f469a99a3), embedded interfaces (b4af09ab56), map key checks (98b34e5bbd). - 2010: new comparison rule (
23bd214aee), recursive interfaces (44898c7b76), equality algorithm specialisation (4d903504b3). - 2011: algorithms (
54e9406ffb),errorand experiments (2a0e15d36c,47f4bf763d,ae7a003cf9), map/func compare removed (5bb54b8e9c), struct/array==(196b663075). - 2012: zero-size algorithms (
1ff1405cc7), comparison recursion fix (427b5bddcd), struct with_field (c4c92ebeb6), float map keys (408f0b1f74). Left open: the pointer-methods heuristic was labelled a heuristic that “catches the problem” only (4eb7ceba58,935953a9f8).
- 2008: signatures and conversions (
- Embedded fields, method sets and receivers — Done:
- 2008:
61361af9e8,6fecb76eea,b642cf8c00, method on*Tnames (258c817a1b). - 2009: methods on slices, funcs, chan, map, string (
b2dfd787d7,5e2c05877d,316d377ac2), method expressions (0d668259dc). - 2010–11:
883d68f885,0b209b36b6,1bd4b6371a. - 2012:
4267974c0b,987a580b9f,7dd90621f8. Left open: nothing noted.
- 2008:
- Closures — Done:
- 2009:
0970c46863,416b27548e,941ed00b1d. - 2011:
9b82408f6d,2c4edb0eea,e8ff9a624f,890bdc5339. - 2012:
ba25778f3f,075eef4018. Left open: closures containing closure expressions were excluded from inlining (a62722bba4).
- 2009:
- Escape analysis and heap allocation — Done:
391425ae55(2009),a75e347a21(2009),847b61b554anddb5f9da425(2011),c45c0c0c1d,bf9c778fe2,9bf3478658,075eef4018(2012). Left open: nothing noted. - Inlining — Done: 2011:
b536adbfba,40b2fe004f,a62722bba4,7e6890a670. 2012:4a6b07f235,ee9bfb023a,2332439b1b. Left open: excluded calls, closures and...(a62722bba4). - Builtins and unsafe — Done: 2008:
b2d9020242. 2009:01c2de0c15,8a70545b57,64c3fe05bf. 2010:d8b5d039cd,01eaf780a8,9b1507b050,a186b77b03,3910161307. 2011:1d687c742d,5fc3771b3a,6ed3fa6553,012798a325,cf9f380499. 2012:1f2445d27b. Left open: nothing noted. - Channels, select, maps and strings as built-in types — Done: 2008:
cb9b1038db,79fbbe37a7. 2009:3657061550,a91a8042b4. 2010:f47d403cb4. 2011:5038792837,b0543ddd8a,65bde087ae,3770b0e60c,6b2ec06587. Left open: nothing noted. - Initialization and static data — Done: 2008:
fb3af53f4e,1ea5bc7533. 2009:b91a043d02,e2613711aa,0631d65dc5. 2010:33da9afc3e,d348971103,b3dd22fecb. 2012:896f0c61c8. Left open: nothing noted. - Composite literals — Done: 2008-09:
4539ced714,182f91ffe0. 2009:a016081f43,18840f5429. 2010:8ffc4ec5d0. 2011:7dc9d8c72b,5cb1c82d96,bf899befdb. Left open: nothing noted. - Variadic functions (
...) — Done: 2008:74427c6346. 2009:d122bb2193. 2010:68796b0270,75dd8fdb34. 2011:2795b13156,5b62ba14c4. Left open: nothing noted. - Statement and flow rules — Done:
33ee52727f(2008),59914723df(2009),7f4c5ea7d8andc18d1a78a4(2011),1d3ca9236e(2012). Left open: the unused variable check was disabled when added (59914723df). - Diagnostics, error recovery and compiler plumbing — Done: as above in each year; 2009-03-30: portable code moves into gc (
bac922c6e1,5e792b6c09). Left open: nothing noted.
Other changes
intbecomes a distinct type, arrays unified user-visible — “the end of life as we know it: int is new type” (c21d9a1ec9,4a3ce5f19e); the static/dynamic array distinction is removed (c6130e9f1f,66a603c986); declarations of type map/chan/string must be pointers until the 2008-12 pointer removal (c7ab332744);*Tshortcuts and[...]fixes (c458c98388,a1391c2d13).anyas a compiler-internal type internal —anydemoted from reserved word (e1a06ccc80), disabled outside canned imports with a-Aflag for mkbuiltin (30f2799f88), then allowed in any import (1ea28570ec) and finally checked outside the grammar (903d28bd1e).- Export-syntax bug fixes during the 2008 rewrite internal — method sort order, inheritance syntax, incomplete types, interface prerequisites (
dc04d096f0,1101d406ec,5f0a5e7a13,bcd07252e1,8545700af8,9f3d600be6,b033c581db,59167e5bdb,ba46bd1e5a,73dd4a37f9,655c281303,2d7eecbbf4);%Zstring escaping for tags with quotes, backslashes and NULs (dc6bd11ce8,57804f1d2d,8a1ad75644). - sys package scaffolding of 2008 internal — runtime-facing helpers added to
sysbefore builtins existed: argc/argv (2987c8434b),bytestorune/stringtorune(6db99de606,7ee60b174d),writefile(c870ac239e),caller(a3ed4e716a), float bits (335a5236e7,2f4d35ffb9), plus early coroutine/channel runtime hooks (0d079a5362,3856e45e03,97cab903af,2d9ff40774,120827284e,e5d9a5c9f0). - Type identity corner cases internal — method function type comparison (
0be746d581,689b28fd96), embedded vs non-embedded field ineqtype(aa7bd48389), struct field tags included in type equality (2fc0b4f01b), infinite recursion ineqtype(282bf8cc8c), duplicate method-table entries (2d5e732c54), anonymous interface method offsets (6aa85d1cbe), sub-pointer-size receivers in interfaces (607eaea456). - Portability and build of the C frontend internal — Plan 9 build and warnings (
12995e2d35,4ca2172f38,4ba677c6ea,5f132b93eb), Windows detection and symbol tables (3bcef5ac30,69a2e1dc52,77a70ddb7b), bison on FreeBSD/clang (1cb951d994,859ba57bbb), makefile and environment-variable removal (6609d2f88d,4f8117d9eb,da392d9136,5c603dbb75,857d4cf1a9). - Remaining bug fixes, error-message and diagnostic tweaks, 2008 internal — 95 small commits (test/bugs fixes, syntax/typecheck error text, line numbers, printing, crash avoidance):
e372be9e76,609cf0c3a7,b6218e6907,feb1c77f9c,36bfd2a906,27d95f1372,610644a1ca,9abf9e8a37,f9c58c25e0,0b3093f0a5,32aa0d9198,e2e6b7e4cc,efec14bc5a,53ec6500bc,504aa698f7,7131bf476c,75937c2a16,102fcc6689,57d80398e6,4d6d4e7f4e,c6e8e1cebf,44b8934d35,9e2d185040,0ca551fc36,963753d3f9,05caa7f820,b1abcc195d,67c4cc473c,091047f36c,a8a9dbc9c6,4797523572,c1ab5a554f,30fd44cf9d,a7f1af81bd,9c5669bd0b,9dbaab54d1,1ae08bee90,d01a1ec260,721cb9c6a1,13f3149a01,39a4b1421f,4332e0a546,5383e28ea0,fb86c39362,7be2b9fdf6,b6f59358b5,4d571c9093,8dc08788ef,53a22770a7,45f4e38506,c8b9970e16,1b257b2bb3,96da920f1a,0adc1db757,1836541566,4248607ffe,7cd173a4f8,2e4b8d94cd,1163b1db6f,28912ce03f,1a149ca1be,0347e95b63,14c639161a,ad48706a24,c14c961ae4,6d3d56d55a,a3cdd2e802,e8278bcb29,4fdf3d6247,2f5a05a859,2c050571d8,e5d9a5c9f0,0eda21a2fd,792145723e,a1585b676b,10002bb0fb,ffafad1919,28a30254e7,92a1190c6c,8bce3b5658,57bd0da375,7dd62cb3bc,5f1a3be9dd,cb64ec5bb6,fa945d5bf8,e683fb7a54,42d89ac02c,99435cac09,e53d5ad620,697cb17b30,4026500d18,92f74ca7e2,9786f69f74,c4416ac06b,cbff09d666 - Remaining bug fixes, error-message and diagnostic tweaks, 2009 internal — 110 small commits (test/bugs fixes, syntax/typecheck error text, line numbers, printing, crash avoidance):
20595ac4b0,c1e7e270f1,3c5f3a8641,4efad58d0a,f1fe21a08f,5b129cda5f,1e1cc4eb57,4b8e030762,6e395cfecf,360f0aacee,aab26a5248,b0009bef20,d3d0c256be,3c0fc400fb,63985b489b,6eb54cb05b,5fbadf0bc3,a2cbc2998d,e224b1ebdb,aacdc25399,58f5f4f18d,07687705a4,39436f2a74,b03b541b7a,ad36c39211,7a98315c96,f821e3c7c3,c4de24981a,b5e212ffdd,88a1aa8e1a,d4fa253837,2a4dcfffc9,ca2fe5d8bd,4beac9985b,850cd6a2fe,b46e7c4d3c,18890eebbf,0a6d83567e,3b37b02834,fbcbcdbb1d,c17ce9f94f,2f2577a4f6,30a28aec25,eba82f4391,0aef57e37f,466dd8da4e,4bce6d455f,fa6df47986,5851a1b5ad,480f51243c,9435dc2bdf,5d5904bb4d,db312fa8de,53ebd163c6,7af032b87b,ef4ddd63f8,a1b64821f8,42af80348c,a68b1da3cc,ed124a971e,e11447f7da,6e1ad041f7,1d51978fed,5a74c0b6ba,059bbdd340,a587d9a73f,9953c48dc4,aa347c4a0d,a121410541,468f244416,d1ee5d6e8f,7732f79daa,866b272336,3e98a40793,d594639087,5600435fe4,e1c5d179d6,59e2e54eab,ac9d833c1e,ef3e6810b8,14be733a25,d66d65da96,27c4e7e74e,bebe06a784,ee2d5128d6,7a0f4cac03,32aa5be6ef,e780fa8669,83bdb805a2,f4ee9f133c,e7f9452da5,d515063588,680ee6af63,c736b6579f,fd76b4f385,8fffa1d698,4c3a85d73a,1be74762c1,62c4818ee0,a15648658f,60ff8cc86f,71983af4a1,7932950844,8c3d2f015b,e5636d6e27,a338231526,8777759f59,3997495dc3,5d754bfaea,5f132b93eb - Remaining bug fixes, error-message and diagnostic tweaks, 2010 internal — 76 small commits (test/bugs fixes, syntax/typecheck error text, line numbers, printing, crash avoidance):
c6f4d68667,1b1f39eb86,307a899d5b,d668d4fbbd,07fc145744,e0059ae811,8e996304f3,ff6e310b00,fd150e77e1,d1b14a6fb0,5f4c052e2d,288c1c83d9,0bd41e2ff0,674458e1c4,1ca39fb1fd,5ab8f00bf8,4589c34580,80a14df122,f015c53ada,4408659e81,5d0ec6c076,5d230418c7,2379fdec04,fe7826858c,d97bbabbaa,4ba177ae36,d6e4e18c8c,10eb76b04e,77817e08d5,b5f54db359,32df678894,a3a0a5fdc3,6dbba67214,d2aa74118c,80ac15ec12,5e253645d2,43c0a46ac6,2e9b67afa6,8c2bc4419b,ea941f09bf,98b27814ae,a212d174ac,9f002f6892,ed39c764b8,c9f83372d8,691d765121,08a263a991,cdb446feb5,b693847ea8,0decedf636,f20c2e1cf5,491a3ca5b7,c6cb303a8a,585eae3bce,a9a62eef6b,b1311cbc93,e24910d09b,dea283750b,5baaa490d6,c3900387db,abb73a4a86,d19fcd0784,b1f44a120f,00ffd59c1a,52d619cfdf,a3c682267f,42c26b734c,2a7019894a,0db8d3df4c,f0d174b776,1ee4512b98,f980577064,1f6b6ca9ba,603f9feeec,9e26c4bd1a,3a2ba994b6 - Remaining bug fixes, error-message and diagnostic tweaks, 2011 internal — 58 small commits (test/bugs fixes, syntax/typecheck error text, line numbers, printing, crash avoidance):
7e84666df1,05b9050bda,b57ac97c27,6e03ed32c7,7da86983a8,4c052844dd,e39dc76884,35c880b1e2,e7c4a6dfca,017e73c1b2,bd77eedacf,db7a2024f9,ec735c4ec8,f10a7882c6,256df10eae,7879d3118c,815a1b84c7,3f335f80b4,67b4db9e9e,7c19d88b0f,17ca32e9db,e852202f37,6aaa86ff66,ff4518da17,13d048a221,8cf8806d31,33ff947cac,12995e2d35,cce10dacc6,49b70d01c0,dec8009fe8,f91eb3c2f9,2f8190a8f8,032ffb2e90,cf79411b1d,4ca2172f38,4ba677c6ea,8b92066e31,29a5ae657f,2e1bb76f9b,986ad31b2d,d5a5855ba1,40afe58692,8e515485e2,882368939c,7a42dddbe6,0c64972dd1,2ab9bb6aaf,d56ca13c03,0f4f3c6769,e1b1a5fea2,7cf4825425,3c638f2892,1f6d130b14,e14d1d7e41,5b2f8d96ce,1d0f93b4be,fd1c1b9679 - Remaining bug fixes, error-message and diagnostic tweaks, 2012 internal — 13 small commits (test/bugs fixes, syntax/typecheck error text, line numbers, printing, crash avoidance):
a15448d65e,556258e57b,b16f3a2d50,9523b4d59c,18ee75ec88,46e7cb57c9,290e68b983,bf0c190343,8039683cef,0b9f090861,7ac03695f8,2f3d695a61,6c7daca236 - Code hygiene and tooling internal —
3adcf6fa0e,f1880579ef,bbb2073223early plumbing;e1a06ccc80lvalue/rvalue contexts andanydemoted from reserved word;4e8142c929maps;d915b96100new iota. - Reflect and signatures internal —
44b0ecc5ca,c367d1b789. - Large data and alignment user-visible —
7e7008fa5e,67edf9cb87size ofstruct{}and[0]byteis 0 bytes,6361f52fc4pickier sizes. - Order of evaluation user-visible —
ee9bfb023a,5efd5624cc. - Early compiler (6g/gc) cleanups internal — Cleanups and renames across the original gc compiler: runtime function reordering, magic name renames, grammar cleanup, scoping preparation, typecheck split, and removal of dead code. (
03febb6773,c249a8de32,c3077f7606,a91af04c06,ae167bf08f,0183baaf44,af678a593d,e81d97ea84,f1f970ad21,8f4af6d205,70a273476b,2acbc37166,0dadc4fe4f,ff3a73b407,a2b8e38766,87f2208bda,3443656bce,6fceadbba3,a6736fa4ff,a2a7d473f4,d5a80d0ba4,0849944694,ab8ed7f8dd,087bec3dcd) - Func rules, type rules, signal names user-visible — Updated the compiler to new func rules, new type equality restrictions, renamed packages handling, spec-conforming type switches, and the signal name fix. (
28b9702741,4a43198390,b3533dfd72,5d16d23362,6f1698774d)
Middle end and SSA optimizer
From Middle end and SSA optimizer (Go 1.0–1.9)
The pre-release compiler (6g/gc in C): walk/switch/select lowering and a growing escape analysis, first inliner (2011–2012) and the old cgen code generators; mostly bug-fix commits (threads: escape analysis, inlining, order/walk).
- Escape analysis (esc.c → esc.go) — Done:
42687d6ce4(simplified recursion),0227c45ede,f2460a8c57,9bf3478658,4e78818259,94ff311d1b(scalar struct fields no false positives). Left open: the whole package was one batch and escaping params all tied to the sink (as 1.1 addressed). - Inlining (inl.c → inl.go) — Done:
7e6890a670,86deacc0bc,93e547a0c2,81728cf06d,e0b2ce3401,cae604f734. Left open: nothing noted. - Order, walk and temporary lifetimes (order.c, walk.c) — Done: 2008–2009: fix-ups to the first walker for maps (
dee07c884e,90846cd447), channels, select (949ab5c7ff,bd397d2f9b),convert(52861558f4), eval order in args (0ffacfd995),&T{}as allocation (beee6915f8),new new(dabdfa6cce), range over channels (54aa835b44), slice conversion (65d397f747); 2010–2011:s == ""aslen(s) == 0(c9293f0cc7), zero unnamed returns when the function has defer (d9254d00f9), newlenspec optimisation (81c3e8cabc), complex/=(4e5a59591b),introduce temp = nod+tempname(9854fd2a0e),go print(b4bb970e18); 2012: order of&&/||codegen (5efd5624cc), ninit recursion in order.c (0a55958b52), append inline preserving args (47b6197a01), delete of old map delete (9069721b0e). Left open: nothing noted. - Switch, type-switch and select lowering — Done:
820f42d977,79fa5b65cb,2450c590e9,6b72b07016,6f14cada11. Left open: nothing noted.
Other changes
- Early bring-up fixes in the first compiler (2008–2009) internal — a stream of single-bug fixes in
walk.c/swt.cfor select, maps, multi-assign and closed arrays, e.g.2bba3a610d,c5bb50c9dc,dee07c884e,1a7fc7b3a71.8,81b325db1b,f7e2bb55ae,4c5a165873,5649c23c8c,944ad62ecd,077fe40867,a0e57201c7,d30c9a4be5,beee6915f8,a8b56a73a4,b682f924d7,a0a14b98fa,bf6164719a,73653841af,f38d2b80a4,b0f627a6e1,179af0bb19,3f135be389,a6c59ce274,3b3e63735e,0c4f4587d7,907cb4f1e6,3067781ab9,3ea8d854a3,b5e7562191,47e5152790,a39bae095a,8b6b380605,7f3eb2738f,d436a70193,0417aafe75. - Static initialisation (
sinit.c) internal —a24a26c107(“more static init almost done”),0421cf072e(maps),61c83b6407(recursion fix). - Front-end error text user-visible —
769919c4ee“illegal types for operand: EQ” for impossible switch case types, plusd50c70d261line numbers during walk. - Misc bug fixes 2010–2012 internal —
a3a0a5fdc3,2795282b50,17f90c68c6,31c07dfddf,01385b400d,8a2891fc56,15dcdf751c,e8ff9a624f,564a1f3358,e1f22bdcc5,6b72b07016,93e547a0c2. - Pre-Go-1 front-end bug fixes (107 commits) internal — individual
bugNNNfixes and diagnostics in the C compiler (walk.c,swt.c,typecheck.c) covering select, simultaneous assignment, type switches, composite literals, conversions and error messages (1926fef175,1a3f944530,73f85f8a53,ff65872fbf,47580f79b4,13f3149a01,5eb9e0621b,8a9752dcfb,3a884d76ac,6499fbe734,e2e8aa0ee1,dbabeb1d7a,40fa690d75,6fecb76eea,89f341db23,6b05518553,90e5574f1c,83a798513c,92f74ca7e2,78fc888e64,cd40cd2435,af5e16cfd9,85815fe0ad,84953bdaa8,c458c98388,eed3addb9d,1b7881adb4,5b129cda5f,4b8e030762,9e735985d4,a81870badf,d3d0c256be,a665e2924c,955638e2fb,d27e9f528d,767845b6fa,1e0c17e294,1cdcfda140,f7772627ad,9efd6b8a3d,1cb3b7d124,34b6f642de,190a540892,b03b541b7a,83e976d53e,b5e212ffdd,850cd6a2fe,51ddddc67e,b46e7c4d3c,b3f303ec9a,be63b6dc44,d6a9817051,c17ce9f94f,ea7f5505d1,75fe1303c1,6bb3c48d3d,53ebd163c6,74b546aefd,0aa1b1508a,5ff7d84892,f664d0e904,03b25a92a3,811e59f2fa,059bbdd340,a587d9a73f,18840f5429,d1ee5d6e8f,39b12e2dcb,6be0f50b97,3e98a40793,2d73b7f7f0,bebe06a784,1c9e4b358f,55edf49a01,7518613430,c6e316a4b9,6a4b2492b3,307a899d5b,fe01d4c8a1,44898c7b76,7b5789b584,a9b9afa930,3908c16ffe,560283c880,253fd30e66,b03d7f4d8f,4c0de303ce,fa3d86ca39,3f19d8ae8d,0acb63769c,0db8d3df4c,cb3754fd43,2281ca169c,661bcb773b,de5616fbb4,c0a895fc0a,f58d911698,cce10dacc6,77f0bdce07,2d489e67dc,aac144b120,0d6f857c3f,ea9e93862d,d7634ad7d9,41806ec26d,93c4e29605,0e919ff2c9)
Backends and assemblers
From Backends and assemblers (Go 1.0–1.6)
Everything from the first 6g (2008) through the 2012 release: 6g, 8g and 5g become full compilers with a first generation of registerization and peephole optimization, complex numbers, ARM hardware float, and the C compilers/assemblers are imported from Plan 9/Inferno. Threads: per-architecture compilers, register allocator/peephole, C compilers, assemblers.
- Per-architecture compilers 6g/8g/5g/9g and the shared gc code generator — Done:
- 2008: 6g emits amd64 (
0cafb9ea3d,d83b994da6,f7753f1687,36bfd2a906, method/interface code8231e94520); morestack magic number$a-bproduced by 6g and 6c (3f982aeaf6); fat-copy and overlap fixes (30fd44cf9d). - 2009: 8g and 5g created and bootstrapped (
dc5b4678e2,a8e4ed6a3d,3aa006b8cd,eac5db7f4c,63e1b714de,190b5c9ad2,4556c04d8b,86987055a3,6d0983ae46); nil-pointer checks in 8g (9dd2e1e30f); inlinex[lo:]slicing (652f55672d,9bf597a210,bf0130cc0f); Go types in the object symbol table (43f29e64a6); first attempt at bounds-check elimination for range and[256]array[byte](fdb030d86f); 8g bounds failures callthrowindex(dc30800c28). - 2010: complex numbers (
426099f42efor 6g,f229c8b546identical 6g/8g with 5g a stub,b0ad7a42685g regalloc for complex); string index inlined in all three (e48c0fb562); amd64 TLS moved to segment memory so R14/R15 return to the register pool (e473f42b2d); ARM hardware float (9c6df3ca13); O(1) string compare when lengths differ (30dd191171); dead code elided (410927d1ad). - 2011–Feb 2012: explicit alignments (
e7a0f67603), inlineappendwhen len<cap (d6b2925923), compact stack frames (2ac375b2df, ARM2ad42a8249, unified layout5ddf6255a1),f() < g()order (bac8f18035),gotorestrictions (7f4c5ea7d8), interface==/!=fast-path on differing types (f91cc3bdbb, ~3x forerr == io.EOF), correct boundary checks in all compilers (6ed2b6c47d),NOPTRBSSfor large pointer-free data (5bcad92f07). Left open: 6g still had 32-bitint; 5g and 8g trailed 6g in code quality.
- 2008: 6g emits amd64 (
- Register allocation and the peephole optimizer (reg.c, peep.c) — Done: optimizer and indexing/op= improvements (
2dd16a3208,e081f25c3e,a6182dab47,9a5c7eab16,c8a66a98ff); constant propagation for assignments (567a7bf664); 8g optimizer (0eb2a79ff3,4ab0ce107a); aliasing fixes (bedfc2c2f1,cd00bc78da); ARM optimizer (90ca4d75a4,4ed17ceace), disabled for the release (1c99bdc8e5,d88f717da6), peep re-enabled (1f55105f66,2799e0ecb9,dc331e6565,63c24081a0); register liveness (84f291b1bd); “registerize variables again” (e419535f2a); loop finding (e2d326b878); flush modified globals aggressively (8998835543); constant propagation friendly to inlining (fff732ea2c); byte-move rewrite in 8g with up to -69.83% on crc32 (23f6479be6). Left open: ARM peephole disabled in releases; optimizer bugs recurring. - Expression and statement code quality in 6g/8g/5g (division, bounds checks, loops, slices, interfaces) — Done: divide-by-constant (
f1baf78247,34f76b5de5), 8-bit div/mod (3f91f80a21), inline slicearray/sliceslice (9bf597a210,bf0130cc0f),x[lo:](652f55672d), scaled indexing (c8a66a98ff), 64-bit shift fix (e5bd12ea90), NaN-safe comparisons (109a976355,ef46a9ddac), avoid unneeded conversions in bounds checks (d14baee96e),a[byte(x)]truncation (ba50599e46),bounds checks offsupport (c332ff42fe),8g: float->uint64(a551ffe809,f570d9d765). - Stack frame layout, prologues, stack split and frame pointers — Done: morestack magic operand (
3f982aeaf6), stack-split segment size bug (cb15bbe748),argsizerounding smash on 32-bit (de663b2d6b), 5l morestack for ARM (1ac2cfc720), NOSPLIT checks in cc (36c5c5bf40), frame compaction (2ac375b2df,2ad42a8249,5ddf6255a1), . - Zeroing and copying: Duff’s device, REP, unaligned moves and AVX2 runtime assembly — Done: direction-bit convention (
8f53bc0612), fat copy overlap (30fd44cf9d), reverse character copy insgen(1d0b65d33f). - The Plan 9 C compilers (cc, 5c/6c/8c) in the Go toolchain — Done: the imports and 8c/5c bring-up above; many
6c/8ccode-gen fixes (902a4d5f29large constants,5e5476c2febyte* difference,d4ad8e8ce3misaligned arguments,494bcc80e4extern static registers in 5c,ee7c64efe5extern register vars only in MOVL,3e0adc9ffbvlong condition,5124e66fca), removal of fixed-size buffers (139a053733,77053797e0,0e47c75f60),-Sline numbers (2cda191aef), 5c do not use R9/R10 (c475c3071a) and gcc/Plan 9 build fixes (b0449c50f7,5ea4d73b17,4c6280b0f1,3f2cc8ba7e,c8c6e1961d),b0449c50f7. - Assemblers: 5a/6a/8a/9a and the Go cmd/asm — Done: documentation of the assemblers and loaders (
b5ab5d4f12), Windows paths (aed2c06dcb), fixed buffers (07d3e0dce4,0e47c75f60,77053797e0), delete 8a’sdreg l.s(783c46b197).
Other changes
- Object-file version header user-visible — object files begin with
go object $GOOS $GOARCH release.tag version; stale or mismatched objects are diagnosed rather than silently linked (3f61184e1b). - Address-taken locals moved to heap internal — if the address of a local is taken it is moved to the heap, the first escape handling (
391425ae55). - Goroutine/defer fixes internal — go/defer on interface methods (
751d13cbce),go method(7889e03477), defer fix (5cc32a5348). - Type tables internal — Sigt/Sigi gain room for a type hash for log-time type switches (
5136a9e1f7); no debug symbols for internal-only method types: 15% overhead instead of 30% (ce9b379c90). - Strings as separate symbols internal — 6g emits each string as its own symbol so 6l can discard strings used by dead code, DUPOK for short strings (
83cd4ee070). - Pointer rewrite for -r internal — heap pointer moves rewritten as xchg (
8fb60768c3). - Complex numbers user-visible — type complex implemented in 6g/8g (
426099f42e,f229c8b546,38ad41c317,8021296179,6d8b8101ea). - cgo on 386 internal — cgo working on linux/386 (
e67a5084b8); dynamic-loading FFI attempt (8c253bcae5,165a99038f). - Line numbers internal — plan9 line tables (
efec14bc5a), precise statement line numbers in all assemblers (2ad521c19a), better ATEXT numbers (1678dcc378). - 8g 387 stack, float internal — 387 stack bug (
e1c347ca59), FCHS for float negation (9686ab2da9), float compare ullman (fb5506600f). - Build hygiene internal —
gcc -Werror(1d26908d3f), many Plan 9 build fixes by Lucio De Re (see C compilers thread), checked-iny.tab.[ch](0f78ee574b), bison flags (3053778965). - Index checking and bounds-check elimination internal — drop checks in range over array and
[256]array[byte](fdb030d86f),c332ff42fe; wide index fix on amd64 (155ec1d904,c18db5aa18). - sigfpe-free constants internal — large immediates avoided (
c00f9f49bb), 64-bit shifts (e5bd12ea90). - ARM internal — software floating point (
69188ad9bb), unsigned conversion (41b5fb4761), bugfixes (fa4da33315,8d76a15122,0aa2317096,be443ee8bc,a2d2341e80),TST(2a74009675,a093f3d5a0), SP adjust bugs (fa9befd777,7963b04a18), many arm register bugs (2c35e548bb,3965519ae5,3537b79329,eead5e8879). - Remaining small code-generation, optimizer and tooling fixes (286 commits) internal — per-operator and per-back-end bug fixes and cleanups that do not carry design of their own: division/modulo and byte arithmetic, shifts, ullman ordering, string/slice/interface/complex code, register-allocation and out-of-registers cases, float conversions, array/slice indexing (
6633be6a86,8527f49e24,498ed50061,d1493d1edc,6b8bd3556a,a93099cd8c,181ad4743c,610644a1ca,b6eca3534c,36f21e00f5,2694a85a52,24dbd2413b,ef61a4cb1e,3f2d542817,c5bb50c9dc,1926fef175,78c8dec944,87dae02a63,7d11924c13,10296166a5,75937c2a16,390d5fe5b2,ca029d34b6,dc1602ca23,d3237f9a2a,caa7193c95,1d31a25d83,c6e8e1cebf,e9a194382e,41861ca7bb,851100683e,907f38acfc,b89c538473,2679eefb31,c6130e9f1f,53010efe01,33ee52727f,a7f1af81bd,1423bf3dc4,193eac7917,d40f032d18,0a7e4a7415,d30c9a4be5,bb3269fba0,5d5e9f74cb,adaec0c4f4,8545700af8,970d6a14c4,d015f896bb,53a22770a7,8877d27b40,f25843e65e,b4f8e01acb,907fea6b54,4a3ce5f19e,fd922c875d,74427c6346,d2472eb812,250ec1665a,ec81145565,dc78c64f23,79f5697b02,792145723e,e875055461,93c8d3c41b,64718ec262,8e3fe10ee3,a0a14b98fa,a4459c5520,937ac13f26,719b088697,23fc0ac061,42d89ac02c,dcc064fe94,c9954c63a8,6fa74e0973,a91a0a6a7a,7cfe782a69,2b33a134a8,1b1f1b53ea,1b7881adb4,35e37bbf41,e90314d024,743ac07cc3,282bf8cc8c,4f49b88dda,56003374d3,0c4f4587d7,48f6b516e2,0932b1f9b8,5a68303a15,99cc2fee81,e5ba266e93,b199035ba8,6b07021a2b,f9854978e2,91ce0ef8f3,a5a878986c,3e9b171b79,5a67ea3883,52b0f77bf9,4238b18344,798b19bf77,51bb8795cd,1c7bee0567,9a9ffb2b0e,25ac4d07a2,e9e388412c,0aef57e37f,b2871b727e,a7735f8a16,6da41be2d3,cd4aab62e3,908cd8f857,7472f4c951,9e2f2fcd2e,7258bac6e8,60d223a418,30228a3bc6,d6f89c69c4,2946069e3f,b754b4348f,d169dcee3b,4dec8ef35a,76a763e0be,8b8a2bd945,07044ba6e5,812f06b3ca,60238e25bf,f70e285178,dd5f32330c,b0a0e3c439,e7acb5df07,382a19c3de,8e96b45fd6,8811896597,8a45917f3d,f50e7b156e,c6fd23ce6d,89f69bb3be,c19c933f5a,ee31157e16,47c568880d,3983171b08,be219c5e9b,6e8524be18,9e85c790e5,18f2e360a0,2204cfddea,4c952153aa,ff196fbde7,803a73c431,6b0bd43fe4,2c7ec3d861,2975308125,8ce5f6e14a,5de6096415,24bfaaf07a,8ccf8240f4,187cc1eb49,399d23d4f4,a1b4796394,8fd53f4754,57f834aeff,3e5a817d07,11d3805579,5afce0ca85,620ec45c5f,116beb2653,6084dcdd07,101f7cbd61,545dbd810c,8fffa1d698,dde4090372,02fd255a14,03bbfe6724,a9e03ae52a,942d6590d9,f860bc0f4e,68d5c51287,1228112b50,58ee1f5d54,d00248980b,3fa379e797,fd7d803535,ae39a1d8ec,b18bee948e,bae4f5085e,2b1133ff86,1664e81585,69c0edd59b,62be24d949,7c4aeec868,3ca1b1d27f,dfc0ed9559,cd47c903e2,758f2bc556,7263bfc73b,424f9ca6ab,45515011cc,0b4d8c19af,f59cb49a5a,bc6878331a,7d4b1e4c0d,ac499ed7a5,4f89dcdf99,16e6df9807,60c2e5f453,9e0ae94e72,97d0e8fe6c,f75d0d224f,c66b49845c,b0283611e4,09b2de77b5,9fc9246bf3,6a060200cc,a212d174ac,e5d748a333,1246ad8390,7c9ed7946c,b2a919fc29,ece6a8c549,607eaea456,14e0df34fd,1d77ff5b6b,5b0c317c9c,57858b70fb,53fff1e74d,d9c989fa25,6096fc83cd,45c48d51f7,d853b594b4,8d50557979,1b31c37428,ab4d8bf16c,1558834248,50fe459ce2,5cf120827c,e6a934a1d9,80f07cfbea,e26b741523,5080d7617a,acc82ad721,cc4d57abac,66f09fd459,4c137b6162,a12d70f60d,beb64bbd6e,3a1fdc655e,a46a311dec,2286471651,e59aa8ea4a,17ca32e9db,fd2e24727e,5d9dbe19a7,5a5a7b5163,e852202f37,c945d9c8a1,a84abbe508,f91eb3c2f9,08bfb39515,8c23c1ab87,28a23675cd,317911c9ff,61f84a2cdc,4fb3c4f765,919cb2ec7c,ad7dea1e96,092a211fb9,1bc1caa802,6bee4e556f,8c0b699ca4,61655bc513,a6c49098bc,5ad9e2db28,f3492a7d40,ca5da31f83,5340510203,a7b83f2287,1c987a321f,b40000423b,f2ad374ae6,a5bc16d619,123130f789,436f297d1e,9984a5bca4) - Build, portability and warning fixes (47 commits) internal — Plan 9/gcc/clang warnings, yacc/bison, format verbs, buffer sizes, output-file handling and Windows paths in the compilers/assemblers/liblink (
461d1b7987,34514bdb72,76036192b9,b676b0e125,45f4e38506,b7f01f9f41,859ba57bbb,8f5bba0d82,58b280db3b,122ed3e988,f61639d4e2,58f7fc331f,8720b4721f,1faf06eabf,189153ed13,a121410541,ebdbbe0f49,f63b0d6b71,7a87a3e0df,40bcbb30b7,d4903abeae,1a0860b93f,a0a965fbcf,b71c484c91,8037e3ba5e,8c3d2f015b,e9ac56fb99,c3343ef62c,593ccd1d44,e69f12ae1d,6fc820729e,aafe474ec9,66905bd9ac,29cf90a4ef,f1781bec3b,2d310a0087,12b2269860,6bcfb95168,d0ac84fe40,67edf9cb87,5e188b40f2,335da67e00,6273d6e713,e280035fc1,7ac03695f8,fec7fa8b9d,dbec42104f) - Object format and early backend work internal — Updated 8a/8c/8l to the new object format, brought up 8g, renamed dynld to dynimport, and added comments, dead code removal and small cleanups. (
2bd101c4b1,f54d73b880,2d259c817a,d8c7980514,021abfbd28,3c06bd6201,0e2cce70cb,e667e8a4f7)
Linker and object files
From Linker and object files (Go 1.0–1.9)
Everything from the first 6l/8l/5l through Go 1: ELF, Mach-O and PE writers, the shared src/cmd/ld, dead-code elimination, symbol/pclntab as rodata, DWARF, NOSPLIT checking, cgo dynamic imports, and ports to OpenBSD/NetBSD/Windows/NaCl.
- Early loaders 5l/6l/8l and the shared src/cmd/ld (2008–2011) — Done:
- 2008: ELF header and
.shstrtabhandling for 6l (6a659ebf13,2c52881a85,67e141b637); symbol table and line/pc information in6.out(e9c9c9ace5), Mach-O debug support (073486c3ed); segmented stacks in 6l (1f6828bcdf,b987f7a757);.gosymtab/.gopclntabas ELF note sections and text starting at 4MB (c3ca056143); archive/__.PKGDEFhandling and a pkg search directory (12c81a0ce8); dynamically linked output on darwin (cfb9425460). - 2009: 8l generating Mach-O and ELF (
7d443bb67a); 5l ELF support (4e1896a1b5,3c7a1ef208); dead data and code actually eliminated, not just symbols (8d8225d529,9cba9c8890); elf64 scaffolding (1593b1fc23,e86dcf1603,b63d40a53e) and dynamically-linked 6l output with.interp(3d42e691b9,304b7954e8); dynamic loading / FFI pragmas feeding cgo (bd4161fcba,165a99038f,133a158bd8,732f3919ab,9e0ae94e72); FreeBSD touch-ups (60b1a17b9e),-dmeaning flipped; hash table for dynamic symbols (dc43b74eb1). - 2010: Native Client steps in 8l (
4a4ec23870,eae0906bed,7390aa0102); Windows PE output for 8l (977e19d69f,3b1a71862e,30f981d980) and Windowsdynexport(a3120f67ca);-sbinaries kept valid (000ab98df6); rodata moved into the text segment (698fb4f192,b7e9e9188a); function-at-a-time layout, pclntab/symtab as ordinary rodata (19fd5c787f, below); ELF/Mach-O object reading for cgo (4d8d6d5cda,cf42a45587,f5690004c2); weak symbols (d94bf76239); OpenBSD (ffa14e849c,26d9c804f8) and netbsd/ELF note (420fe22921,5842f7e46a) support; 6l moved to PE for windows/amd64 (3aec5516ed). - 2011: Plan 9 native-build fixes (
9baaa6f742,10b5519d3a,5ea4d73b17,4c6280b0f1); rpath dropped (afac1c2654); Mach-O linkedit rework socodesignworks (78ad19f214,4566868b41,280d85a80b); alignment of ELF data sections (bf43161c00);-X(e3755434b8);GOROOT_FINALrewrite of file names (6e3a7930eb); fix of NOSPLIT stack-overflow near segment size (9e5db8c90a). Left open: the pclntab/symtab encoding was still the Plan 9 format with big-endian values (see 1.1); the three linkers still shared only part of their code; no way to link with the host linker.
- 2008: ELF header and
- Go symbol table, pc/line table and function metadata (gosymtab, pclntab, findfunc) — Done: symbol and line tables added (
e9c9c9ace5); stack offset table marker per TEXT (f997bc6eb6,ddba96aed8) later replaced by the in-memory symbol table (3aa063d79c); Go type info in the symbol table (43f29e64a6,311c0b4807: archive size +70%, binary +30%), later with the gotype pointer carved out (57a9bd0ee3); symbols for type/string/go.string omitted (7a09a88274); pclntab/symtab as ordinary rodata (19fd5c787f);-selides the Go symbol table (10d0dffd76); ELF symbol table fornm/oprofile (96ea081c04,70798eaad6); symbol table letter correctness (c2cd0d09c2) and sizes preserved through data layout (f0ab14647a). Left open: encoding fixed to big-endian Plan 9 format. - Stack splitting and the linker’s nosplit overflow check — Done: the above plus the detection of NOSPLIT overflow (
d9fd11443c), a fix for near-segment-size stacks (9e5db8c90a), frame-size-aware morestack on 5l/8l (1fa4173444). Left open: nothing noted. - Dead code and data elimination — Done: dead data and code elimination (
8d8225d529,9cba9c8890,7b29dbb866), object-granularity loading replaced by “load everything and flood” (fc8dca9dac,49084db386); struct field tracking experiment is separate (1.1). Left open: nothing noted. - DWARF generation in the linker — Done: initial DWARF for 6l/8l on ELF, Mach-O and later PE (
ca9098ee94,b433552ebc,728003e340,f1751e7de5); frame info (eb572e0174); gdb type support (9a71bb00bb,7a4ce23d65); filenames in the.debug_lineheader (d164b6081d); Mach-O DWARF before linkedit (4566868b41); relocated DWARF for external objects (below). Left open: ARM had no line info until 1.1. - Linker speed and memory (Go 1.7 focus) — Done:
1bc84b7e18,8a6da2f6a0,9c7535432a,505fd760a2. - Runtime type data, GC metadata and sections laid out by the linker — Done: noptr data/bss (
4e3f8e915f,5bcad92f07,433e47dc03), type symbol machinery (0532f89b1f,47caf6424c), reflectPtrTo(44fd7573aa). - Container writers: Windows PE, Mach-O and Plan 9 — Done: PE, Mach-O code signing, dynamic Mach-O and Windows cgo as listed (
977e19d69f,3aec5516ed,78ad19f214,c9bf048337,133a158bd8). Left open: Plan 9 output was maintained by community patches (c14c4e55e0,8221eb9103,c7008f47ec). - Architecture and OS ports in the linker (arm, power64, arm64, mips, s390x, nacl, BSDs, Solaris) and trampolines — Done: ARM, 386, amd64 ports with the ISA additions listed (e.g.
9c6df3ca13,fc41e621e8,895631770a); OS ports: OpenBSD, NetBSD, FreeBSD, Windows, NaCl. - Build IDs, ABI hashes, flags and determinism — Done:
GOROOT_FINALrewrite (6e3a7930eb),-X(e3755434b8),-usafe check (6519a6ba5b,829896168c).
Other changes
- Instruction-set additions in the loaders internal — 6l/8l/5l grew encodings as the runtime and libraries needed them: SSE/MOVQ (
17105870ff,c8a2be8c38,884dceca1f,4d429c7fe5), CMOV/FCMOV/FCOMI (baea3e946d,4af0a58ea9,5107aa82a1), CMPXCHG8B/XADD (895631770a), EMMS/fences (aaac05ae23,fc444ebac1), RDTSC (6392b43a15), LDREX/STREX (f72ea8eb76; LDREXD/STREXD96c785de39), SQRT in ARM (fc41e621e8),MOVLQZXas plainmov(bf10982739), JCXZ forms (a88994f804,26608d4fbb), IMUL3Q/SHLDL (36d3707009), CALL reg encodings, vDSO syscalls on Linux x86 (c20a338c2f). - Hardware floating point on ARM internal —
9c6df3ca13added VFP with softfloat still broken at that point;ae60526848simulation;8052786e51stopped using R12 as SB. - ELF layout fixes internal — PHDR in PT_LOAD (
f1df07bf6a,1c0c252880),DT_DEBUG(a55de2ba61), Xen-friendly ELF TLS sequence on linux/386 (2d6ae385e1), strip-safe sections (000ab98df6,cf143e9dbf,ba2e3af177), read-only.rodata(a84e9d01f0,15d8b05f0c), versioned ELF symbols for cgo (09092a78e6), static-binary detection when no shared libs (296d6871a8,e69b9ddd42). - Import cycles and invalid inputs internal — all import cycles detected (
b9b204d55d) — rejects invalid input files (e692977af3,9a442211c6), unsafe import exit code (d4b19bdbed). - Heap/gc diagnostics and leaks internal —
a2ba34d374,916eea04f8fix memory leaks;f0e6a3caacdangling pointer found by valgrind. - Build system internal —
4f8117d9ebbakesGOOS/GOARCH/GOROOTdefaults into tools,ccbcefe2b6ignores$GOARCHin compiler and linker; makefile restructuring (6609d2f88d,9dd354c63fdrops use ofed). - Early object/loader mechanics (2008–2009) internal — typestring and type-signature machinery that preceded compiler-emitted strings (
2c3ddf5ef6,1983121bbbmarks signatures DUPOK so several.6can contain them,d6a7cefd1e,8f14451fe5),sys.unreflect-related loader changes, archive handling (c5f21c0dc2ignores references into the original source directory,bfd5ede78d-P pkgdir,2f1a321d4fsearchruntime.ain the package path,122f3980c7quoted spaces), diagnosing missing symbols (8559e3ad54,29e93590b0), JMP/branch handling (e2fa41ab3b,cc4dc5a22a,4d6bccb0f1,de0d762a0f), runtime location changes (9ff0e6288e,34a5537edb,b7f0580274), 8l/5l bring-up (af0143ce03,07393f8706,f2201185abportingld/go.cfunctionality to 5l,97fe55720d,a2cf914379,fcb9387089,0c71ead9e6,8613eb56b2), mach/ELF debugging aids (284a50c109,67addd4e11,7fa5941fad,e2c3ec3173,36f21e00f5), and small linker bug fixes (95100344d3runtime stack overflow with deferproc+morestack,8db677b0a7,10e995fba8,997b6f9d89,fd6cdbd807more ELF constants and a simple relocation demo,a0a965fbcf,c64986f706merging the first span pass into the main loop to halve NaCl changes,98fff8ffb2,86cfaf66a7,dfeceddd3f,45ce825544debugging symbols for 8g,a1b64821f8,002623704f,005509e367,285b6021e9). - Stack-split fixes on ARM and amd64 internal —
1ed7f18165,5963f59067,0af8e1045c,c2b91d4889,231fcea7e6,0af8e1045c,71c4244430,29c6c09f71fix morestack calling conventions and float-instruction branch targets. - Bring-up of ports and fixes internal — ARM instruction fixes (
35a775d045SWI with long constants,2a74009675,a093f3d5a0TST,ca5179d3f6,888ab02228,40745a579cpre-ARMv4 removed,e8f2692ca2,60238e25bf11 FP registers,b28d84f644,1fddbab736,3d0a85785adata-relocatable layout), Windows PE fixes (6e18e8c82f,77eb94c032,d5dffb9f29,5e4963d9e8,8f8f625cb1,48d2de7eb9,d08df51366,8ba4df2e9a,354219951e,2da651f115,1ac7a69701,b05679cdd6,ff866c4ca3,8ed9fc600c,74a23646bc,e7042418c5,77a70ddb7b,c2c7ee2736), Mach-O (3d0726b04d,8a1b2e59ef,cf3323f511,2aceea630f,047e698c52,d2b2b3f4a8), ELF (91cf0af181,14eba969d8,1116ec4f20,01464cf956,8ec6f7cd11,1b2d5b4c93,7431a3165e,c5030e5f4b,89d334ffe1,2ccbf83b32,033585d675,6334b499e8,44e51fad28,f3ed1ad50c), Plan 9 (4fca395321,45407bd559,340251e43d,36b6d1aaf2,f367c13c79), DWARF (fbd92dba96,f08baa38f8,cc9e6b5cdb,a647f59c1f,da42312268,0cc055e8f7,c7c16175e0,ac1b9545e3,054be1b6c3,b99d722963) and3554325937,caa5647408,be2c2120d0,54aba2e6dd,92c6061b5c,423ab2333a,1a472026da,837c204ada,dd93df35b9,507df959e4. - Housekeeping and build hygiene internal — gcc/Plan 9 warning cleanups and documentation (
326bb67fbf,6fff0efdd8,354e61cc52,d6197d94b5,e1325d916e,2a1c9377d9,b5ab5d4f12,3fa379e797,18cb960f3e,6634e3432d,26b55e44d9,f2c7a20142,b73b43ea31,3884f7321f,d64a2bddf0,63623ba2d8,05cc83bf4e,1f6f563900,d42903119b,d9c989fa25,88cf5564fc,f8b7eda5f6,0cd3475386,eaa082f691,12b2269860,3e57d7f7bf,b88e669a8f,648f25b237,29cf90a4ef,a89c0ff39e,07dc26f88d,f1781bec3b,11e07d23ed,d26e73646e,839abc2ea7,1063ed8f3b,33405ecc86,f0bde7c51b,1964417e41,c6138efbcb,4304de6e0c,0490eb60bb,8c5c3c504c,93ecb5bb1b,f12e543255,05f734c8b4,f554c90cef,2cf5359830,11fe7cd6e3,b24d1cb5ec,2d64bab1de,9af4b01654,916f896a3b,40ff071e9b,f8e9bbe475,5aea33742a,489494cac3,44eaaaaa78,bd43a2d9ff,7b04471dfa,eae0a48cf5,9f4c288c16hash/crc32 SSE4.2,1ed7f18165,99cc2fee81,94d89ede1c). - Early linker cleanups internal — Cleaned up exec header generation, ELF64 magic numbers, 5l/6l/8l, and removed D_SBIG. (
fe734d8630,f687fb7e73,335b3855c6,0e25c1dc6d,085be1740a,8132f1d016,14b9032f84) - FFI relocations internal — Used //ffi comments in import data to generate relocations and library loads. (
1f177cd8b2)