Go 1.7
SSA backend for amd64: CSE, nil-check elimination, prove/BCE, a global register allocator. Mark-bit-based allocation (allocBits/freeindex). Smaller type descriptors (nameOff/typeOff). Binary export data by default. Linker speed and memory campaign. Frame pointers on by default on amd64.
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)
dev.garbage bitmap allocator (allocBits, freeindex, ctz), allocate-black, O(dirty) stack rescan, concurrent stack shrink, 32-bit full address space.
- Decentralized GC state machine and mark termination simplification — Done: only per-P gcWork (
0168c2676f),markrootDonegeneralised (c14d25c648); reset mark state before STW (9ab9053344). Left open: nothing noted. - GC pacer: trigger controller, assists and background utilisation — Done: allocate black plus counting black allocations toward scan work (
6002e01e34,479501c14c,64a26b79ac); floating garbage estimate removed (c8bd293e56); reduced assist extra credit (ccca9c9cc0); sweep ratio in gcpacertrace (17f6e5396b). Left open:next_gcstill the trigger not the goal. - Stack scanning: conservative, precise by frames, stack barriers, hybrid barrier, async safe points — Done: O(dirty stacks) rescan, no global rescan, concurrent shrink (
2a889b9d93,b49b71ae19,f11e4eb5cc,e8337491aa,269c969c81,9f263c14ed,efb0c55407span root marking out of mark termination). Left open: rescan still needed. - Precise heap scanning: type information, the heap bitmap and GC programs — Done: conditional branch removed from
heapBits.bits(4eb33f6b8d), clears reduced (0d26efb12a), first-word scan bit reclaimed (a20fd1f6ba), morePointers/isPointer without branches (a5d3f7ece9,d5e3d08b3a). Left open: noscan still checked through the bitmap. - Allocating from mark bits: allocBits, freeindex and ctz — Done: the allocBits/freeindex/allocCache scheme (
2ac8bdc52a,e1c4e9a754,dc65a82eff,3479b065d4,4093481523,1354b32cd7,2063d5d903,2fb75ea6c6);stackfreelistadded (aed861038f);mspan.starteliminated forbase()(b7adc41fba,3e2462387f); allocation-count fixes (d97625ae9e); publication barrier even for noscan objects (d8b08c3aa4). Left open: sweep and bitmap code needed further simplification (1.9). - Size classes, tiny allocator and mcache/mcentral — Done: user-visible
runtime.KeepAlive(6ab45c09f6),maxSliceCapfor division-free slice caps (a4dd6ea152, MakeSlice -32%). Left open: nothing noted. - Scavenger: returning memory to the OS — Done: physical-page aligned scavenging (
2cdcb6f829,1151473077,f407ca9288). Left open: nothing noted. - Heap address space: contiguous arena to sparse arenas — Done: full 4 GB on 32-bit (
e6ec82067a). Left open: nothing noted. - Mark work distribution: parfor, work buffers, gcWork and root jobs — Done: only per-P gcWork (
0168c2676f,7b229001e7),gcWorktryGet/put fast paths (1354b32cd7), scanstack takes the gcWork (3be48b4dc8). Left open: nothing noted.
Other changes
- Misc internal —
maxSliceCap,KeepAlive, priority elevation by GC worker + runnext (44497ebacbwith91740582c3addingnextflag to ready), atomic pointer stores (7c7081f514,d8e8fc292a,8f6c35de2f), NOSPLIT address helpers (30172f1811). - GC clean-up internal — workbuf logging removed (
3b3d58e119), noescape hacks (98130b39f5), root-check debugging (b5481dd0a6,d7cedc4b74), start time merge (ff71ed86b6), pagesInUse accounting (61f56e925e), documentation (2e8b74b695,a1f7db88f8),stackfreeon system stack (6a86dbe75f), poisonStack checks removed (9e8fa1e99c).
Scheduler and concurrency
From Scheduler and concurrency runtime (Go 1.0–1.17)
Concurrent stack shrinking support for channels, new Cond, better randomized stealing; threads: channels, Cond, scheduler.
- The G-M-P scheduler: from global-lock M:N to per-P run queues, spinning Ms and work stealing — Done: improved randomized stealing (the PRNG missed Ps with “frightening probability”: at GOMAXPROCS=3 one P missed 101,620 times per 1e6 tries)
ea0386f85f; usleep(100) inrunqgrabreduced to 3us, osyield on Windows3b246fa863, CPU underutilizationfcd7c02c70; spinning in scang/casgstatus replaced with yielding475d113b53; MaxGomaxprocs clamp31cf1c1779. - Channels and select — Done: indexes for select lock order
26594c3dfd;g.waitingin lock order005140a77e; hchan.lock protects sudog.elemdb72b41bcd; lock order between G status and channel lockd45bf7228f; sudog documented857d0b48db. - sync.Mutex, RWMutex, WaitGroup, Cond, Once — Done: new Cond
8e7072ca83; RWMutex recursive RLock documentedb3f98d7a42. - sync.Map, atomic.Value and sync/atomic — Done: plan9 arm
5c613e9162; s390x7da42d7597. - Goroutine and M lifecycle: caches, ids, LockOSThread, Goexit, cgo extra Ms, deadlock detection — Done: gfree split
1a2cf91f5e; extra Ms50048a4e8e; cgo SIGPROF traceback84e808043f. - Stop-the-world, safe points and GC–scheduler interaction — Done: concurrent-safe shrinkstack
276b177771, gopark never passed stack pointers8fb182d020, O(# dirty) rescan2a889b9d93,5b765ce310. - Scheduler diagnostics: schedtrace, GODEBUG, execution tracer, block/mutex profiles — Done: per-goroutine trace sequence
a3703618ea; schedtrace blocked field25a609556a. - GOMAXPROCS, thread and resource limits — Done: clamp
31cf1c1779, 1024fcb45b9c611.9, unlimitedee55000f6c1.10.
Other changes
- gopark rule internal —
8fb182d020. - Misc internal —
59fc42b230,e4f1d9cf2e(execution error panic values implement Error),7e460e70d9,f135c32640,a2b615d5271.8,88518e7dd61.8,61db2e4efa1.8,c14050646f1.8,0c942e8f2c1.8. - G-state and sudog cleanups internal —
1e91e2a25a,cbe849fc38(remove _Genqueue),bdc14698f8(dropg always unwires),a4b833940d,ac74e5debc,7043d2bb5e,001e8e8070,1f7a0d4b5e,56e5e0b69c. - Comment fixups internal — Applied review comments from CL 3742 and moved orphaned comments to proper homes. (
02b8e6978a)
Data structures and type metadata
From Runtime data structures and type metadata (Go 1.0–1.17)
Descriptor shrinking (nameOff/typeOff, static name encoding, tflag, embedded rtype fields), StructOf, compiler itabs and pointer-shaped convT2I, growslice/makeslice division avoidance.
- Hash map core: from the first hashmap.c to the 8-entry bucket design — Done: no algs generated for map bucket types (
a6abc1cd70), no write barrier on iteration (974c201f74). Left open: nothing noted. - Map fast paths and compiler/runtime specialization — Done:
appendfast-path spill avoided (6b33b0e98e, slice side). - Hash functions and algorithm tables: memhash, AES hash, fallback hash — Done: hash algs initialized before typemap so shared-library typemaps (themselves maps) work (
f135c32640); eq/hash generation simplified (199cc194ac). - Compiler-generated equality and hash functions — Done: simplified generation, no bucket algs (
199cc194ac,e0032df81e,d3794f88e9,a6abc1cd70). - Runtime type descriptors: layout, shrinking and name encoding — Done: the shrinking series and name encoding above (
a858931200,0231f5420f,30f93f0994,a24b3ed753,8df733bd22,f2772a4935,24ce64d1a9,7d469179e6,95df0c6ab9,f120936dff,1492e7db05,c165988360,4d920410d2,e369490fb7,797dc58457,af0fc83985,43a274fd67pkgPath on all struct types,c9638810df). Left open: “further shrink run time type information in Go 1.8” (e369490fb7). - Interface values, itabs and type assertions — Done: compiler itabs (
7427f2c4bd,7043d2bb5e,998c8e034c),getcallerpcargument fixes. Left open: shared-library duplicates. - reflect dynamic types: ArrayOf, ChanOf, MapOf, SliceOf, FuncOf, StructOf — Done: user-visible
StructOf(633ab7426a), unnamed directional channels (69285a8b46),SelectDir(368507bb6f),StructTag.Lookup(5c8674a497), unexported-methods hidden (be1b930653). Left open: embedded fields with methods unsupported (905ced0e6a). - reflect performance, caches and API additions — Done: tflag/Name speedups (
797dc58457,ed9362f769,e75c899a10,3c6ed76da2),ptrToThisback (e369490fb7), unnamed types have no PkgPath (1f4e68d92b). - memmove, memclr, duff routines and pointer-write atomicity — Done: MOVSB (
6a33f7765f,4b209dbf0b), ppc64 (c4807d4cc7). - Slices and append: growslice, makeslice and string/slice conversions — Done: division avoidance (
43ed65f869,6b0688f742,a4dd6ea152,ad7448fe98,0150f15a92,44532f1a9d,6f3f02f80dzeroing tmpbuf). - Soft-float, 64-bit division and complex arithmetic helpers — Done: arm5 FP stores (
9cb79e9536), MININT softfloat fix (6db98a3c51).
Other changes
- Compiler/linker metadata internal — argument count (
7c546566c3), pruning methods prunes funcType (d06b0db5bd),KindSlicemapping (e05b9746dd), canonical import ordering in object files (d78c84c419), pedantic int-to-string conversions (e6066711a0), unnecessary conversions (0da4dbe232), race annotation forreflectOffs.lock(56e5e0b69c). - Reflect semantics user-visible — s390x port (
db9348b866), unnamed interface types have no name (217be5b35d),Fieldpanics when out of bounds (9edb27e76f), method type string (0cc710dca6). - Softfloat and type-name cleanups internal — Cleaned up softfloat code, alg.go and type names in comments, and updated dalgsym to use obj.LSym. (
e6d6ad47f5,903f096992)
Diagnostics and knobs
From Diagnostics and knobs (Go 1.0–1.17)
Per-goroutine sequence numbers cut tracing overhead (453% → 26% at 48 cores); file:line in traces; per-P TSan contexts.
- Execution tracer (trace v1): events, per-goroutine sequencing, annotations — Done: per-goroutine sequence numbers (
a3703618ea); file:line in traces (0fb7b4cccd) and parsing of 1.5 traces (3fafe2e888); fixes for timestamp overflow and coarse timestamps (944a0859b9,c4c182140a); trace-event descriptions (2d342fba78); error when the binary is missing for an old trace (c3818e56d0). Left open: StartTrace cost with many goroutines (fixed in 1.8). - Race detector integration — Done: per-P TSan contexts (
caa2147532);racefinionce only (733162fd6c); atomic ops on external memory (bb337372fb); OASWB rewriting (595426c0d9); a TSan memory leak (5.6GB after one day, 12.2GB after six) fixed by rebuilding the.sysofiles (d73ca5f4d8). Left open: nothing noted. - CPU profiler and runtime/pprof writers (legacy format to compressed protobuf) — Done: counted profiles sorted by count (
6969d9bf03);runtime.CallersFrames/Framesintroduced for file and line (ad03af66eb); PIE profiling (4223294eab);ThreadCreateProfilestack copying simplified (756ea30eb0). Left open: CPU profiles are stored in memory in full. - Heap profile accounting and MemStats — Done: scavenger memory summary documented (
77026ef902). Left open: nothing noted. - Traceback correctness and inlining (diagnostic output) — Done: traceback stops at foreign function (
88d3db0a5b), cgo traceback PC and signal context (c08436d1c8,3d037cfaf8,03abde4971). Left open: nothing noted.
Other changes
- Misc internal —
WriteHeapProfileEnableGC flag removed (8c838192b8),WriteHeapDumpSTW clarified (ed73efbb74), pprof package docs and a stray 0 after goexit (1cb3044c9f,b11fff3886,29ed5da5f2).
OS layer, stacks and panics
From OS interface, stacks and panics (Go 1.5–1.17)
concurrent-safe stack shrinking during concurrent mark, s390x port, extra-M batching for cgo callbacks, plan9/arm, symbolic C backtraces, set_thread_area on 386, signal names in panics.
- New and ported OS/arch targets, 1.5–1.17 — Done: linux/s390x (
cc17d1ba76,0f08dd2183,e6f36f0cd5,7cbe7b1e86,78ecd61f62,d8e8fc292a,0324a3f828), linux/mips64x cgo (b6687c8933,5d002dbc21,6e90432342,2e32efc44a), plan9/arm signal handling and files (d145456b16,0de0cafb9f),set_thread_areainstead ofmodify_ldton linux/386 (0f86d1edfb),int 0x80for linux/386 syscalls (1439158120). Left open: nothing noted. - Goroutine stack growth, shrinking, GC stack barriers and stack objects — Done: concurrent-safe shrinkstack (
276b177771), shrink during concurrent mark (f11e4eb5cc), copy before adjusting (da153354b2), stack free-list (aed861038f),stackfreeon the system stack (6a86dbe75f), duplicate channels inshrinkstackselects (84bb9e62f0), transient_Gwaitingstates fixed innewstack(3c2a21ff13),poisonStackchecks dropped (9e8fa1e99c), stack guard shrunk in [dev.ssa] (d3f15ff6bc). - Tracebacks, symbol tables and
runtime.Callers/CallersFrames— Done: print signal name in panic messages (1a7fc2357b), symbolic backtrace of C code during a cgo crash (ea306ae625), call userError/Stringmethods before freezing the world on crash (e960302410), off-by-one in module-for-PC (1716162a9a), cgo traceback gets signal context (3d037cfaf8), SIGPROF on non-Go thread collects a stack (84d8aff94c). - Defer, panic, recover and Goexit (runtime side) — Done: simplified
setPanicOnFault(6af4e996e2), userError/Stringcalled before the world freezes (e960302410). - Signals: masks, forwarding, sigaltstack and the unified Unix signal layer — Done: better last-ditch forwarding for Unix libraries (
df2b2eb63d), don’t unblock all signals on BSDs (6f59ccb052), drop_SigUnblockfor SIGSYS (be730b49ca), yield after raising a killing signal (c1b32acefb), openbsd/386 sigreturn (5bd37b8e78), darwin amd64INT $3after sigtramp (ff227b8a56), SIGPROF on non-Go thread traceback (84d8aff94c), Solaris signals (562e38c0af), Plan 9 signals (d145456b16). - cgo runtime support: pointer checks, callbacks, extra Ms, C-to-Go call path — Done:
cgo context function(5f9a870bf1,b30814bbd6,88e0ec2979), TSAN support for malloc, acquire/release and locks (a5d1a72a40,66736880ca,cf862478c8),mp.cgocallers(59fc42b230,58394fd7d5), extra Ms as needed (50048a4e8e),cgocallback_gofuncfixes on arm64/ppc64x/arm (9fe572e509,58f52cbb79,690de51ffa), callee-saved FP registers (71916437fb,a7f7a9cca7,72eb46c5a0), iOS exception handler signals (be10c51500). - Shared-library and buildmode entry points (c-archive, c-shared, plugin, shared) — Done: ppc64le library startup (
8a1dc32447,32302d6289), Windows c-archive (ed8f0e5c33), defer in 386 shared (26849746c9), 16-byte stack alignment (26015b9563,10c8b2374f). - vDSO, time sources and process-wide randomness — Done:
AT_RANDOMon arm64/mips64x (a2eded3421,2e32efc44a), common auxv (c955bb2040,90addd3d41), Sierrananotimefixes (fad2bbdc6a,2da5633eb9), iOS 10 gettimeofday ABI (9fde86b012). - Windows runtime — Done: only search System32 for DLLs (
683448a304),SwitchToThreadosyield (1f5b1b2b66), c-archive on Windows (ed8f0e5c33), XMM callee-saved in cgo (71916437fb), framepointer mode safe on Windows (d9557523c2). - Assembly-level runtime entry points: memequal/cmp/IndexByte, hashing, atomics and ABI wrappers — Done: no
REPfor IndexByte (687abca1ea),memequnification (bd70bd9cb2), ppc64 unaligned loads and Equal (15ea61146e,baec148767,b75b0630fe),REP;MOVSBonly when fast (4b209dbf0b), Ctz/Bswap asm on 386 (9c8809f82a), intrinsic fallbacks (98b6febcef),strings.Index17–31 bytes (429bbf3312), aeshash seed (c83e6f50d9), 386 vsyscall PIC. - Plan 9 and NaCl ports — Done: plan9/arm (
d145456b16,0de0cafb9f), GC-exit race (6b59d61822), fork/exit race (967b9940b4).
Other changes
- Windows internal — user-visible runtime: fix windows build (
594c3aa063); user-visible runtime: revert “do not call timeBeginPeriod on windows” (0435e88a11); user-visible runtime: merge os{,2}_windows.go into os1_windows.go (e095f53e9b) - other runtime/OS plumbing internal — all: use cannot instead of can not (
e43c74a0d8); cmd/go: ignore C files when CGO_ENABLED=0 (0c7ccbf601); all: single space after period (5fea2ccc77); cmd/compile: note escape of parts of closured-capture vars (d8c815d8b5); user-visible os: consolidate os{1,2}_*.go files (8455f3a3d5) - Darwin/iOS internal — user-visible runtime: use correct psABI SP alignment before calling libc mmap (
315f4c70f1); user-visible runtime: move machport into darwin’s mOS (a4b833940d); user-visible runtime: merge the darwin os*.go files together (d9712aa82a) - Linux, vDSO, time and auxv internal — user-visible runtime: eliminate unnecessary type conversions (
a03bdc3e6b); user-visible runtime: don’t clear gcscanvalid in casfrom_Gscanstatus (5b765ce310); user-visible runtime: merge os_linux.go into os1_linux.go (5103fbfdb2); user-visible runtime: remove remaining references to TheChar (ba09d06e16); user-visible runtime: remove empty 386 archauxv (d6b177d1eb); user-visible runtime: use s.base() everywhere it makes sense (b7adc41fba); user-visible runtime: use morePointers and isPointer in more places (d5e3d08b3a); user-visible runtime: merge the last four os-vs-os1 files together (2dc680007e); user-visible runtime: delete empty files (61602b0e9e); user-visible runtime: check only up to ptrdata bytes for pointers (538537a28d); user-visible runtime: better error message for newosproc failure (c7ae41e577); runtime/internal/atomic: fix assembly arg sizes (4054769a31) - cgo and C interop internal — runtime/cgo: make cgo work with openbsd ABI changes (
0dcd330bc8) - stacks, defer and unwinding internal — user-visible runtime: unwind BP in jmpdefer to match SP unwind (
b92f423879) - cgo check skips non-pointer slice elements internal — The cgo pointer check skips slice elements that cannot hold pointers. (
c8e7b34b59)
Compiler frontend
From Compiler frontend (Go 1.1–1.9)
Binary export data on by default (inlined bodies, positions, -linkobj), NodeList removed in favour of Nodes, Type encapsulation and shrinking, itabs emitted by compiler, [dev.ssa] backend lands with frontend support, lexer rewrite.
- The C-to-Go translation of the compiler (cmd/gc → cmd/internal/gc → cmd/compile/internal/gc) — Done:
NodeListeliminated in favour ofNodes(see data-structure thread). - Parser: from yacc to a hand-written recursive-descent parser — Done: lexer/parser simplifications listed above;
3a11c8d319,e4571d33ac,9f301643bd/bb3b10214d(parameter parsing without OKEY nodes),135109d241. Left open: new AST parser exists only as an unused package. - Binary export data and the object-file split — Done:
4598382724,a9ea36afbb,5c593a3227,7538b1db8e(default),feb6131b1a(-linkobj),a5cd53a9fdinvalid types/constants,d78c84c419sorted imports for canonical obj files,6e4a8615f6deterministic output viaAbsFileLine,eb4d1be285keep variable numbering for inlinable exported funcs;80e9a7f079all-or-no named params,8650c23034verify imported types after full import,87a2ae1fa2,ef62f641c3,21d781070cone format for builtin calls,054a721dcasafemode bit from package header,30282b091dlabels/goto/fallthrough import,bbd1dcdf7d,575a871662//go:nointerface,15f7a66f36blank names,1402e522c6load builtin export data once,d930d69fd9,113c4d2581/7d3a40978arefactor import/export parsing,7d80291c4c,f8e41f6f59,699a2ba137,338a891e79,3e40f13cf3,e7524d51fdremoval of lexer-IO-state globals (the “Io” type). Left open: position export disabled “for now” (889c0a66fc) and parameter numbering kept (0b8c0767d0). - Inlining — Done:
fc6bcdee79,e41f527f4d,ac8d97b679,a9ea36afbbmakes imported bodies actually available;17db07f9b5don’t discard empty inlinable functions. - Escape analysis and stack allocation — Done:
20803b845f,b6dc3e6f66,fb2af2b35b,7e88826a69(escape reads function decls instead of OTFUNC node slices). - Closures, method values and variable capture — Done:
20803b845f,93369001c7,b64f549ba9,e0f986bf26(function literal name collision with “glob”),c7917de0bb. - Language changes and rules as implemented in the compiler — Done: user-visible
49dad0f571,75b886ab79,3eaa304629,f5423a63df,e48a2958d1. - Constant arithmetic,
Mpint/Mpfltand floating-point constants — Done:d3253876f2,07749aef98,97360096e5,35dd2ed58d(rename mparith files),f32161daf8(one new Node per defaultlit: Unicode compile alloc −5.8%). - Static initialization, composite literals and
init— Done:934c359964,55ab07c224,b024ed0d94,3c6e60c0e4,f973e79d09/7971864267/4e75932cf7sinit cleanups,f3575a9561. - Walk-level lowering and runtime-call optimisations — Done:
f00bbd5f81,859b63cc09,4cef0e980a/bc8458ab02/36694064e5(no algs for[0]Tand[1]T,&&in generated eq),d0c11577b9,0f5d78f678,92bf58c238,b30e1d728calg-generation cleanups,8ffe496ae7fewer algorithm kinds,d1341d6cf3. - Write barriers, precise stacks and liveness (compiler side) — Done:
b6dc3e6f66,dec1bae916,d25c3eadea. - Compiler data structures:
Node,Nodes,Type, and thetypespackage — Done:466c948b55..72655afb4e,6c4e90a99e,52d9479e3b,2e9369067b,517b6131b2,f38f43d029,5f525ca60d,40f1d0ca9f,eb98e51563,09c672d50a,e3c7497327(typWrapper),fdf6761e01,76e72691a0,8640b51df8(Type.Elem),1624a9c9e7,3efefd9395,e76fc1b921,007b12977a(Maplineno out of Type),b83618f964(Type.Nname),b2b5e779f5(ignore receiver in Eqtype; moves receiver check intoaddmethod),62e26e7511,b594b8b039,1765863e57(TypeList→slice),34699bc7a8(reduce**Nodeparams: Template allocs −15.7%, Compiler −17.5%),7e8e9abe0a,a4be24cbe6/edca4cda88/removingNod(OXXX,...),3621600c92magic.go,9d7b2b7b10universe.go,4720f49e18relocate Type code,11d916b157(Node.Nointerface),e3a9dca7cc,3da1a26fba(‘any’ no longer leaks into user package);1220ac27ce,68c86a0096. Left open: Type still lives in package gc. - Compiler performance, formatting and concurrency — Done:
ad4c55c076,65b4020403,135109d241,d447613875,0373128318,1a9373bc57,ea5091fcd7,f32161daf8. - Pragmas, directives and compiler flags — Done:
feb6131b1a,3c0fae5306. - Race detector and sanitizer instrumentation in the frontend — Done:
c3b3e7b4ef.
Other changes
- SSA-era frontend adjustments ([dev.ssa] commits shipped in 1.7) internal — the SSA backend commits that touch gc as the frontend:
23df95b9b5,7af53d98cf(OCAP),b06961b4f0,5254be3a9c,212a1763fc,0ffd9c8cad,e3869a6b65(write barriers in SSA),8c5bfcc52b,57670ad8b2,fbfc18c522,18559e2da7,5ba31940dc,6a8a9da572,846bc6c5ab,b64c7fc683(“never CSE two memories”); these belong to the SSA backend report and are only noted here. - Smaller lexer/Type refactors internal —
f28bbb776a(hiter, hmap, scase definitions into builtin.go),9a184b22ee,a689f6b8af,d481ffc1af,c1a4fe8d57,3a0783c504,e504055e78,5dd129bcff,e775b8df7a,00289c296c,7c4d53c2c8,331f962508,268c31870a,390d1ce686,bf5f24b98e,093a9a1f56,2592e0999e,cabf73ffb8,a6c95ae1df,55e7636f9c,1e4e09612c,d2e1dae3fe,d1cc7f70cd,772cea817d,211cc40b11,ac006ad103,37c2972772,b83f3972fe,2faf5bca2e,c41608f4ac,533f30b924,868fb9ff1d,2350ca5a41,075d66646c,bd83cc6dae,f6bca3f32d,fe5b4a6503,ed4a27a8dd,9c8f549abb,1c2bdfb7d9,88a21ebb21,157f069873,def9c0b06d,d9bb693960,a2a48069fe,11a80860ad,f6fab93a46,63142027de,fc4358951a,d53287d0c3,fcca9d265c,7e88826a69,621aa713d4,e6066711a0,ca397bb68e,93368be61e,012557b376,24967ec122,db5338f879,6531fab06f,0e01db4b8d,f4f1b30749,f12bd8a5a8,1da62afeef,d3c79d324a,733f835f30,2da642a917,f027241445,fca0f331c8,707aed0363,8d075beeef,ae98045958,980ab12ade,d57a118afa,a5386f3c7d,ae98045958,5ec87ba554,3747c00923,448246adff,85e3c9e6b8,2f088884ae,1f446432dd,6e5027a37a,0b8c0767d0,b04f3b06ec,7d80291c4c,a4dce12803,34699bc7a8,bd83cc6dae. - Large map values stored indirectly internal —
60fd32a47fchanges how large map values are handled (compiler decides indirect storage; companion to themapassignwork).394ac818b0adds an internal option, enabled, to track only named types in the type cache. - List/Type/lexer micro-refactors internal —
6bd63ca346,6abc8c9a88,188e3d2515,52f099c426,7e92c86df2(listsort),4ab1793a78,a81283d5d9,e28a890d5e,c4012b6bbb,7758a9405f,db506fe98c,38921b36ba,33fd4535a4,aa3650f019,b014b55b82,0cff505871,c63dbd87c1,de4317cbd7,ec7c494535,060a6915d4,29267c2131,386c0e6598,5ba797bd18,fda831ed3f,49e07f2b7e,2244ae4173,86c93c989e(no position info for builtin packages),5621b09dad,e34295e647,11e51ed4bc,e78ff3823e,af558acc47. - Vendored math/big updates internal — Updated the compiler’s vendored copy of math/big. (
c12e1b0b2e) - Comment updates in gc internal — Updated old C-style comments, go.y references and added comments on how declarations and scopes work. (
b330987711,cca4ddb497) - Lexer and sinit cleanups internal — Moved the lexer into its own file, moved lexn and lexname to lex.go, cleaned up maplit, sinit.go, Isfoo type helpers and made minor cleanups. (
1b417e20ff,998b6dd75c,76461c93a1,d33e37a7e3,b9feb91f32,00e5a68c3e)
Middle end and SSA optimizer
From Middle end and SSA optimizer (Go 1.0–1.9)
SSA arrives (dev.ssa merged): IR, rulegen, CSE, nilcheckelim, prove/BCE and induction-variable BCE, regalloc, decompose, phi building, dominators; amd64 default (threads: SSA arrival, rewrite rules, CSE, nilcheck, prove, phi construction, dominators/CFG, write barriers).
- SSA backend arrival (dev.ssa): bring-up, coverage, default-on — Done: The whole dev.ssa history is listed under 1.7. 2015-05: global variables (
23df95b9b5), code generation from SSA (083a646f63), reorganised opcode tables (b3137966db), dead-store pass (8d32360bdd), string ops (f7f604e284), block rewriting rules (a9cec30fdc), removal of thecgenpass (7bdecbf840). Summer 2015:Auxintfield (8f22b5292f), per-Value line numbers (81ccf508aa), nilcheckelim (2a846d2bd3), call opcodes (290d8fc14a), Lengauer-Tarjan dominators (078ba138d3), constant bools, loops,OANDAND/OOROR(e81671115c), width/sign-specific opcodes (67fdb0de86),Constsplit intoConst8..64(9cb332efd4), the HTML printer (35fb514596), per-pass timing (24dcede1c0), initial likely-direction (bbf8c5ce2f), the first global register allocator replacing the per-block one (0b46b42943), first floating point (997a9f32b0), division and high-multiply (a45f2d8f28,67cbd5b51d), decompose pass (9f954db170), complex arithmetic (3a9d0ac3c8), explicit exit blocks vs implicit ones (f5c53e0deb). Autumn: append (9d22c101f5), type assertions (269baa981e), struct/array literals (d3886906b1), stack-based pointer arithmetic withoutuintptr(582baae22a), arguments start spilled (02f4d0a130), better register allocation (75102afce7), panic deduplication (74e568f43a). Dec 2015–Feb 2016: compilation trigger (5b355a7907), structs SSA-able (a734bbc953), phi optimisation (b5c5efd5de), empty-block short-circuiting (3c26c0db39),&&/||optimisation (d8a65672f8),PPARAMOUTSSA-able (6a8a9da572), constant cache (194c79c163), inlinable bool ops (8b92397bcd). The remaining 1.7-cycle work on master is in the other threads. Left open:5b355a7907leaves “get rid of all the UnimplementedF stuff” as a TODO; the in-treessa/TODOfile kept the list of unfinished work (9787ba43ee,7730880f7c,ad5ceafa2cupdate it). - Generic rewrite rules and rulegen — Done: block-rewriting rules (
a9cec30fdc), rulegen sanity checks and logging as above, first folding rules (9b25da732b,198fc9a9eb,fd458ba499), constant-comparison rules (cdc36252fe,d4a95e78fa), constant-shift rules (93a0b0f315),Negfolding (964dda9bf1), strength-reduction of 64-bit constant divides copied fromcgen_div(a3055af45e: TimeFormat from ~40% slower to ~10% slower than the old backend), rewrite of Phis (d0d04d2d6c), opt run twice after lowering builtins later (dfcb853d9d, which also makesSliceLen/SliceCapvisible to bounds-check passes and saves ~45K in tool binaries),Phi→Or8/And8(8b20fd000d,caef4496fc), Trunc/AND, mod and bounds folds (97b2295f06,060501dc0e,68325b56e7),unsafe.Pointerconversion cleanup (a3180d8b1d). Left open:882dd1c3ba1.8 in 1.8 shows arch rules still blocked by old backends. - Common subexpression elimination (cse) and its scalability — Done: type-refined CSE (
d9a704cd40), the phi bug (00437ebe73), key/alloc improvements (317226e61c,851ceebceb,8c954d5780,6a96a2fe5a), N^2 dominator fix (2a29576562), zero-arg CSE pass (94f0245114), commutative ops (88c1ef5b45), faster initial partitions (b96189d1a0), shared dominator tree (e0611b1664), dominance sort (3ea7cfabbb,77d374940e). Left open:3ea7cfabbbfixes a pathological case but CSE was still super-linear (e6051de0351.8 in 1.8). - Nil check elimination and the redesign of nil checks — Done: the pass (
2a846d2bd3), benchmarks (1746e711ad), DFS rewrite (4dcf8ea1a4), non-nil sources (b14b8d6bc7,e0e556620a,3c1a4c1902), faulting-load checks (31115a5c98,4a346e7489), optimiseOCHECKNILuse (e22ae879d3), opt-time simplification (fb2f99d5fd), no simplification in loops (c1892b9c4b), nilcheck for interface go/defer calls (f3689d1382). Left open: intra-loop use of facts was disabled. - Prove pass and bounds-check elimination — Done:
bdea1d58cf,34f048c9d9,b91cc53033,cd798dcb88,47c9e139ae,27ebc84716,6c6089b3fd,1747788c56,9549c06ce6(IsInBounds with small index),bbd3ffbd83,68325b56e7. Left open: derived induction variables; pointer-increment form of range loops. - Escape analysis (esc.c → esc.go) — Done:
2d56dee61b,d8c815d8b5,d603c27c6b,fb2af2b35b(don’t walk field-name syntax),7e88826a69(look at function decls instead of OTFUNC). Left open: data structure for reasons “might be extendable to allow a cleanup of the underlying algorithms”. - Inlining (inl.c → inl.go) — Done:
e41f527f4d,060038bdd0,e6ea01685f,ed4a27a8dd. Left open:break/type switch. - Write-barrier insertion: from gc to the SSA writebarrier pass — Done:
aebf6611df,3e54ca9a46(omit barrier on global function),15ed37d7b7(enforce nowritebarrier in SSA),42da35c699,6b33b0e98e,a4650a2111,03e216f30d,934c359964,8107b0012f. Left open: barrier decisions still in the front end. - Switch, type-switch and select lowering — Done:
e41f527f4dmakes switches inlinable. Left open: nothing noted. - Interface conversions, type assertions and devirtualization — Done:
7427f2c4bd,5c5e8d4105. Left open: nothing noted. - Phi construction and the SSA builder’s scalability — Done:
b5c5efd5de,6b99fb5bea,bc1989f115,8b20fd000d. Left open: old algorithm remains for small functions. - Dominators, loops, CFG editing and block-level passes — Done:
078ba138d3,d32229b3b1,0b6332eb54,4fa050024f,6ed79fbd1a,9743e4b031,d610d304f8,f91ff1a509,c67cac0703,3c26c0db39,6b3462c784,c03ed491fe,6b85a45edc,815c9a7f28,305a0ac123,e197f467d5,bbf8c5ce2f,186cf1b9ba. Left open: nothing noted. - Compile-time performance and determinism of the SSA package — Done: the items above plus pass stats (
a3f72956f1),24dcede1c0. Left open: nothing noted. - Lowering of copies, strings and slices; intrinsics — Done:
995fb0319e(stringtoslicebytetmp fix),b024ed0d94. Left open: nothing noted.
Other changes
- Front-end containers refactor (NodeList → Nodes / nodeSeq) internal —
466c948b55,7047742f12,132ebeac3f,eb6ee75add,cd6619d2e6,ed4a27a8dd,89cfdda44d,e28a890d5e,ec7c494535. - Algs for tiny types internal —
4cef0e980a,b6b144bf97. - SSA bring-up fixes (dev.ssa) internal — long tail of per-construct implementation commits (strings, complex numbers, OLEN, ODOT, OCALLMETH, defer, etc.), e.g.
f7f604e284,cc3f031a31,15dcdfba0f,a3f72956f1,3a9d0ac3c8,1792b36310,fa5fe19137,9aba7e76f6,ddc6b64444. - GOSSA debugging internal —
d298209b1c,378a863682(command-line option processing for SSA),c0740fed37,09a9ce60c7,13f74db304. - DWARF naming of compound AUTOs internal —
4a7aba775d,259b7edf5c,b04e145248: strings/slices/interfaces named by splitting into one-word autos so liveness can handle them. - Slice zero-cap detection internal —
69a7c152a7. - dev.ssa per-construct implementation, debugging aids and small SSA fixes (175 commits) internal — the long tail of the SSA bring-up: implementing individual node kinds (
OSLICESTR,OCOMPLEX,OFALL,OCFUNC,ORETJMP,OGETG,OSPTR,PPARAMREF,len/capof maps and channels), floating-point and complex comparison fixes, defer/return handling,-Nfixes, logging and HTML printer tweaks, TODO updates (bd95412d23,e00d60901a,6f1884757f,ba8a146af4,d5ad9ced1c,0ad9c8c720,47791c1a18,ea5cd68646,3b817ef8f8,703ef06039,a5c3b6642b,2aabacdb5a,8c46aa5481,37ddc270ca,7b858018b3,66b47812eb,dbd83c4464,596ddf4368,c9372619f2,be2a3e2ac9,1edf4897df,0a133cddd5,d465f049cd,6c14059e65,7d10a2c04a,5173868325,06f329220f,050ce4390a,4c521ac8f2,7e4c06dad0,c3c84a2544,337b7e7e3b,b383de2ef9,3dcc424be7,cd7e059496,766bcc92a5,2574e4ac1c,21bd483c4a,26f135d7c1,61aa0953e5,8fb6358153,e61e7c96f7,be1eb57a8b,5254be3a9c,d90e0481bf,52d76f7a6a,8d31df18af,5c5f2a731c,0bb2a50a55,b61f8c8df3,9ca24fcda8,67df7934cc,25d1916816,1bab5b9b41,20550cbaf1,9271ecc8c6,6d9362a1f7,165c1c16d1,93c354b6cc,38ed6c10eb,b8efee0d8a,683f5d7bdb,54dca047dd,573c791e81,9495e45c80,d1c15a0e3e,cfd8dfaa10,e13954981e,5584523224,dee1f2750b,2af0648014,d56d2fa206,a2d1580fdb,3d23afb913,867662da6a,3e7904b648,d4cc51d411,759b9c3b80,d9dc2f2230,8e601b23cd,7393c24877,0ffd9c8cad,3526cf586b,a2f8b0d0e4,752fe4dcb5,e0e4068c6e,73151067bc,35ad1fcb11,44d87035b6,525785885e,f8093b8f24,67ac8a3b22,a5cffb6182,707af252d9,67e43c1e3b,47d6799b0f,9654873a76,0726931c10,5fdd4fea90,ec8a597cd2,65677cabfd,19285efaed,10f38f51ef,d9f2cafb50,991036aef3,19447a66d6,4178f20776,c3eb1a7e8a,3fa0a75a02,def7c65b70,ca9e450bed,c684d4d26c,a7cfc759f2,fd8c71be86,8a1f6217c5,cea441427e,2f51807157,db380bf44b,c244ce097c,c7081409bb,1e4ebfdda5,7e390724d2,46ffb026b4,fda72e0375,5505e8ccc7,5f10573e60,b32217a273,37590bddc4,d29e92be52,579ccd831f,808d7c70d5,8824dccc28,32ffbf7e0f,9703564c9a,d076ef749b,d694f83c21,10462eb30f,cd01c0be26,129261ae83,74180dd7da,991873116e,d19bfc3b68,170589ee1c,7807bda91d,9094e3ada2,035fcc0c4d,da8af47710,90065eaba4,733bf6ef67,8a961aee28,16b1fce921,955749c45f,2df4b9c265,a0da2d242c,e93410d3e5,faf1bdb42b,58cfa40419,7f7f7cddec,65855cf640,9dc1334cc7,bc1fb32e9d,e4bee4be92,ae276d8c23,c17b6b488c,40f2b57e0b,8906d2a171,d337e55672,e173ab1434,ed737fd8cd,a5325761cd,fb54e0305f,91f69c675d,1b1d0a9a80,4e95dfed01,f1f366c1e7) - Compiler fixes and refactors (56 commits) internal — small fixes, line-number repairs, node-API tidy-ups and diagnostics in
gcand thessapackage that do not carry separate design (bcce5bdabd,26594c3dfd,59681802ad,88e18032bd,8b4deb448e,3a880bae91,c41608f4ac,71d13a8c01,16e2e95dd9,e3a9dca7cc,dafbcf6df7,4c8589c328,df035a8d86,0321cabdfa,31d13f479a,d20b92e07a,40bfec0022,8ec80176d4,98b88de56f,1b9f168f73,8edb72587f,f6fab93a46,ac74e5debc,a9407b5797,d4663e1353,a4be24cbe6,7e8e9abe0a,babc73547e,688840593b,d7f7ea6ea8,92bb694a49,75a22d0d10,309144b7f1,5e1b7bdecf,7208a2cd78,68ac1f7746,7f53391f6b,811ebb6ac9,6b0b3f86d6,644493f109,508a424eed,3c6e60c0e4,bfe0cbdc50,c65647d620,4938d7b5fc,e48434887e,7879e9193b,3b0efa689e,a19e60b2c3,5325fbc7db,b13b249f43,24744f6561,9d7c9b4384,0e13dbc1a9,29f0984a35,846bc6c5ab) - Early dev.ssa cleanups internal — Handled more instructions in the early SSA package and reorganized it. (
cfc2aa56b0,247786c174) - SSA and inlining cleanups internal — Some SSA cleanup, fixed misaligned comments, removed unused code and simplified inlnode. (
62ac107a34) - uintptrescapes directive user-visible — Added the //go:uintptrescapes comment directive and used it in syscall. (
bbe5da4260)
Backends and assemblers
From Backends and assemblers (Go 1.7–1.11)
The dev.ssa SSA backend for amd64 lands (IR to SSA, generic and AMD64 rules, global register allocator, tighten, flag recomputation, scheduler), together with intrinsics, load combining, and a slew of cmd/internal/obj cleanups (As type, ADATA removal, cmd/internal/sys); s390x object/assembler support arrives and the ARM SSA port is started. Threads: SSA bring-up, register allocation, scheduling, obj refactoring.
- SSA backend bring-up on amd64 (dev.ssa merge) — Done: user-visible the SSA path exists and generates amd64 code: conversion from IR (
d2fd43aa77), codegen from SSA (083a646f63), memory zeroing (66b47812eb), static data (6b41665039,7c18f8cdc3writes static data straight into the linker symbol instead of ADATA Progs), strength reduction of constant multiplies/divides (3e7e519c36,d8f1f8d856,a3055af45efor 64-bit constant divides,77b527e283for 24), const folding for floats (f6ceed2cab), bool ops (8b92397bcd), intrinsics (8eec2bbfbc). The compilation trigger changed from “compile everything with SSA and decide whether to use it” to deciding up front which functions go through SSA (5b355a7907). Compile-time work made the pass pipeline cheap: sparse sets cached on Func and reused across passes (f962f33035,3297a4f5f3), preallocated values/blocks and backing store for Preds/Succs/Values (2f57d0fe02,056c09bb88), faster CSE (6a96a2fe5a,88c1ef5b45handling commutative ops), value use counts kept in SSA (56e0ecc5ea), critical-edge pass tweaks (50bc546d43,b2dc1f82a5). Bugs of the period (flags clobbered by SETcc/REPSTOSQ/LEA, e.g.8f51ae8ba5,f3171994e9,4219aba5db,2511cf03b9) show the flag handling being worked out empirically. Also:ba8a146af4prints register names,288817b05areduces line-number churn,686fbdb3b0makes compilation deterministic. Left open:* only amd64 is supported (4c9a470d46“start on ARM port” at the end of the cycle); the oldcgen-based backend still exists and is the fallback, andUnimplementedFstubs remain (5b355a7907TODO: “get rid of all the UnimplementedF stuff”). - Register allocation, flag allocation and stack slots — Done: global allocator (
0b46b42943), reserved registers (7d61246972), rematerialization (c64a6f6362), stack-slot reuse (366dcc4529), separate flag allocation (c140df0326) and spilling flags by recomputation (9f8f8c27dc,d04f38e3ee), allocation-order change (7d9f1067d1), two-address instruction allocation (369f4f5de5,0004f34cef), loop-aware and forward-looking tweaks (815c9a7f28,9d6e605cf7,b57ac33331), moving constant phi arguments closer to the phi (305a0ac123),3572c6418bkeeping pointer input arguments live. Left open: spills always placed right after the defining op; stack-slot assignment still coarse. - Scheduling, tighten, block layout and CFG passes — Done: scheduler fixes (
4e204b42f5,a678a5c7a5,e98edc88c9), tighten (f91ff1a509), priority-queue scheduler (b1785a5065), critical edges (a2f8b0d0e4), constant-time CFG editing (4fa050024f), exit vs return blocks (10f38f51ef), load-of-store replaced with copy (5c5fa3628c), prove pass extended to constant comparisons (47c9e139ae). Left open: tighten ran only before lowering. - Rewrite-rule machinery and compile-time performance of the SSA compiler — Done: rule sanity checks (
e4355aeedf), strength-reduction rule generalizations (3e7e519c36,d8f1f8d856),1cc5789df9many small rewrites,0fb818a424copy values during rewrites,4989337192allow control values to be CSEd,16b1fce921aux typing. Left open: both operand orders written out by hand. - Multi-architecture SSA ports: ARM, 386, ARM64 (dev.ssa) — Done:
4c9a470d46starts ARM port;7c6b48ffbafixes comparison and conditional branch for SSA on ARM;74a9bad638enables const division on arm64 (-67% for DivconstI64);52fe472472zeroes unaligned memory a byte at a time on ARM;f3d54789f7power5 instructions for uint64 to float on ppc64;1f4f2d0d39,bf151cc2aaunsigned to float fixes. Left open: all ports other than amd64 still on the old backend. - Multi-architecture SSA ports: PPC64, MIPS64, MIPS32, s390x — Done: s390x assembler/object/asm/ssa/gc support (
2a7e85f162,13f97ea456,85bbabd9c4,354e9778a3,a223ccae38,613ba6cda8,cd6b2b7451,3c8ef0e0c964-bit multiplication with immediates); MIPS64 REGTMP/SB/TLS work (a409fb80b0,8dc0444a04,981395103e,3b0b30727c); ppc64x atomics (eeca3ba92f, with sync moved outside the lwarx/stwcx loop). Left open: s390x and MIPS64 only reach SSA in the next release. - Removal of the legacy backend and decoupling gc from the code generators — Done: amd64 code removed from
gc(a4e31d42ee);a40b27e304eliminates arch-specific typedefs;cea5d26aa2removesThearch.Linkarchinit. Left open: old backend still compiles everything not in SSA. - Liveness, stack maps, safepoints and write barriers — Done:
d5297f7261fixes quadratic regalloc liveness (slice3.go >10m to ~20s),d2107fc987GC bitmaps for SSA code,4a7aba775dsplitting compound autos,3572c6418bpointer args live throughout,6effdd28de,519b469795,f4d38a8792de-dups gclocals symbols. Left open: liveness still operates on Progs. - Intrinsics for atomics, math/bits, math and runtime helpers — Done: first intrinsics (
8eec2bbfbc). Left open: bit-scan family incomplete (8eec2bbfbc). - Memory-op combining, byte-order idioms and load/store folding — Done: load combining (
12e60452e9,7294ccb54e,b81f2f106f,481fe59012), store combining (217c284995), idx1 loads/stores (af517da2f9),ec5083e49bSHLQ into loads/stores,3dd4f74e06shifts into LEAs,036d09d5bf/dc5a7682f0/9e3c68f1e032-bit operands for byte ops, drop most byte/word insns. Left open: bounds checks of combined loads separate issue (12e60452e9). - amd64 and 386 instruction selection — Done: the items above;
6b02a19247SSE4.2 strings.Index;009c002c92AVX2 for sha. Left open: indexed forms incomplete. - Memory clearing and copying: Zero, Move and Duff’s device — Done:
66b47812eb,f8fc3710fd,039d455f9d,d55a099e22,111d590f86. Left open: Duff’s device unsafe interplay with the allocator. - cmd/internal/obj: Prog/LSym refactoring, concurrent backend and object-writing — Done: As type (
0d9258a830,e853131699,7893442011,4fc02d175b), ADATA removal (2dcbbbd193,4f753e77f1,7c18f8cdc3), object file symbol refs (3648d2d4cd),c6e11fe037newcmd/internal/syscommon architecture representation (b17b95301aArchFamily iotas) replacing the ‘8’,‘6’ constants, remove LSym fields (61b9315d37,dd2ba0c7a7,31a9e50524), Prog cache (f388b58540,45c2e38b37). Left open: assemblers use global Link state. - x86 assembler: AVX, AVX2, AVX-512 and the instruction table — Done:
76f272d717,0b4f578266,009c002c92,8262564971,7de8cfdf9cdynlink rewrite no longer clobbers flags. Left open: AVX coverage partial. - Prologues, frame pointers, NOFRAME and tail calls — Done:
7fdec6216c,d9557523c2,26849746c9fixes for defer in 386 shared libraries.
Other changes
- Compiler data-structure and memory work internal — reuse of
[]Flow(028247d2cd, -14.8% alloc for Template), Prog cache (f388b58540),Dcl/Inldclas slices (b66a892358), shrink tables (0ac0e22fa7), int32 line numbers (b83f3972fe),LSym.RefIdxpacking (826831acf7), deterministic compilation (686fbdb3b0). - Sqrt on Power user-visible —
math.Sqrtuses the sqrt instruction on ppc64/ppc64le (b4b2ddb867). - strings.Index with SSE4.2 user-visible — (
6b02a19247). - GOSSAFUNC HTML internal — improved readability (
b13b249f43). - s390x load/atomic instructions internal — MULHD (
cd6b2b7451). - cmd/asm internal — removal of nonexistent instructions (
0b4f578266), EOF message (45c4ebec5b), arm64 SIMD register name (c9389a101b). - Stack guard internal — SSA shrinks the stack guard (
d3f15ff6bc). - Inlined IR bug fixes internal — pointless gotos while inlining (
d1faf3879e1.8, 1.8). - dev.ssa feature-by-feature lowering internal — the incremental steps that took SSA from a prototype to a compiler: line numbers on Values (
81ccf508aa,3a0df1f82a,0991ec454b), call and comparison ops (290d8fc14a,46815b9f62,71b570774d,9f8a677eab,9ca24fcda8), 64-bit shifts and small-int ops (6f1884757f,73054f5729,20550cbaf1,4b803151ce,c55870a541,d2150c8328), bool and logical ops (d9c72d739c,e81671115c,8adc905a10,edff881ce5,7402416a8b,954d5ada29), multiply/divide/mod/hmul (be1eb57a8b,a45f2d8f28,67cbd5b51d,57d9e7e3c4), sqrt, itab, getg, slicestr (a329e21ccd,d1c15a0e3e,3d23afb913,3526cf586b), SETcc/branch/idx genValue (a794074da0,a402b58e51,3e3d162f50), AMD64 SETEQ/InvertFlags rewrites (71a4c4bb8d,c15b0e83d2), PAUTO/PHEAP variables and variable handling (c31b6dd0be,8c46aa5481), zero type (a92bd66282), constant-fold fixes (3b705824ce,7a6de6d5f2,198fc9a9eb,9b25da732b,c1593da817,db5232620a,7a982e3c49),d4cc51d411explicit size for store ops,95aff4db54Copy instead of ConvNop,85e0329fbcmoving most types out of SSA,65677cabfddefault op types,19447a66d6floats stored in AuxInt,634b50c6e1truncating float to int,e99dd52066/10462eb30fOpConvert and better copying,d43f2e37ed/a6fb514bf8storeconst ops,582baae22a/7807bda91dpointer arithmetic with int and uintptr/unsafe.Pointer safety,463858e6ff/8d23681cc8nil-check and panic support. - dev.ssa regalloc/liveness debugging and correctness internal —
cff0c6ad0f,a0022d9b8c,763afe13b9,6b3d4a5353,32efa16c3d(instrumentation and stats),67bfd69564,0bb2a50a55,c9a38ce758,9094e3ada2,cd0cb0a9d6,2dc88eead8,d694f83c21,7cadf23afb,6b0b3f86d6,8ad8d7d87e,3c09001917,7b773946c0(xor clearing disabled when flags are live),3a17fdaba0,8dc04cbedc,ca088cf4e5,2efdaefdb0,47d6799b0f,6411533ebf,5cb352edeb,220e705404,e514021153,c24681ae2e,01490eb96c,9f66636c93,ac8127d7e6,ade0eb2f06,3dcc424be7,8fb6358153,bc1f5768ce,cea441427e,cde977c23c,6d40c62732,789c5255a41.9. - -N and tooling behavior internal — keep JMPs with -N (
8906d2a171,e360f7c4db), line numbers for Unimplemented/Fatal (da8af47710),c17b6b488ctruncate AuxInt in Prog,e49c910900,88b230eaa6do-log boolean,9787ba43eeTODO list,270e2152c4,50ceef26e6,fb54e0305f,8c6abfeacbseparates logging, work-in-progress and fatal errors so SSA can be attempted for every function (turning the standard library into a compilation test),37ddc270ca,2df4b9c265,43a2676ff0,703ef06039. - Allocation and cleanup in the compiler internal —
f3a29f1f81preallocated storage for three Value args,ca5417b8e0,b86cafc7dc,6cb2e1d015,e6beec1fc8,8edb72587f,ddc6b64444,beabd872f4,cc158403d6(track reflect.Type.Method in deadcode),afad74ec30,7e40627a0e,5609a48931,2a4158207e,613ba6cda8(s390x in gc),bf3909824c,def1e7276a,c3dfad5df9,d20b92e07a,def9c0b06d,e59c1729ba,a4dce12803,361b334cbd,e76fc1b921,38e11d05b9,786a2ef380,8f2e780e8a,1441f76938,e07a4459a1,d0fb649713,70090654de,41f9f6f471,68e86e6dfa,7177cb9fa4,080e2d4320,7735dfb67c. - obj minor cleanups internal —
14113b3a89,c747fce242,d05773ce73,edde955d7f(arbitrarily sized string data),af1c29c1c1,04f23b6428,63142027de,fb950cd778,3504945081,39af1eb96f,ca0f5c9740,b07a214d39,2326c24cc7,71ab3c1ccf,045411e6f2,babfb4ec3b,060a2bacb7(eliminates ~700 conversions on ppc64),b4c66b176e,9c269e6a46. - Backend cleanups internal — Style cleanups in obj and link, post-CL cleanups, peep.go and bv.go cleanups. (
106b9d3915,a162d11540,dbe54d23fe,5edcff0134)
Linker and object files
From Linker and object files (Go 1.0–1.9)
Linker speed/memory campaign, new object format with reference indexes and contiguous data, string merging and method pruning, typelink offsets, cmd/newlink removed, deterministic builds, s390x.
- Go symbol table, pc/line table and function metadata (gosymtab, pclntab, findfunc) — Done:
typelinksstored as offsets (f028b9f9e2), padding between functions rather than inside them (5701174c52), short type symbol names (f81ae3b22c). - Dead code and data elimination — Done: method pruning (
862b9ddda7,e2836935bb,d06b0db5bd), unusedgo.string.hdrsymbols (1.8,80a034642e1.8),-dumpdepflag for the dependency graph (d224e98d9a) and Allsym no longer contains.dupsymbols (956e9e6c83). Left open: method pruning is all-or-nothing onreflect.Value.Call. - DWARF generation in the linker — Done: DWARF from symbols (
a037c73ccf), own hashmap replaced (c0f7195d62), PC table without seeking (3601a1e77d), framepointer offsets fixed (adff422779), hide go.dwarf symbols (9658b7ef83), DWARF disabled without symtab (e6181eb9e1),.defsuffix collision (6901b08482). - External (host) linking and cgo — Done: deterministic output: pass
-gno-record-gcc-switchesand-fdebug-prefix-map=$WORK=/tmp/go-build, empty ELF NAME symbol (5bbb98df09);-znocopyreloc(3c8d6af8e0), gold on arm64 (a3c92c9db1),-no-piefor race (3a72d626a8,cb97fd7741,2a6544b604), no PIE with sanitizers (2c1791b13b),-z relrofor PIE (45f39fb467), mips64 (073d292c45). - Build modes: -shared, c-archive, c-shared, shared, PIE, plugin — Done: c-archive on windows/darwin text relocation fix (
ed8f0e5c33,aea4222f67), mips64 external (073d292c45),-linkobj(feb6131b1a, compiler flag splitting export data from link data), PIE/sanitizer interplay (2c1791b13b). - liblink, the object file format and the move into the compilers — Done: the size/speed changes above; Biobuf code extracted to
cmd/internal/bio(4b7e36cdfe,8f2edf1199). - From C to Go: cmd/link — Done: delete
cmd/newlink(fb880b8a03); cleanups and concurrency: alignment concurrently (5a0881a1d1), data symbol processing with slices (ed41054b6d). - Linker speed and memory (Go 1.7 focus) — Done: the micro-optimizations above. Left open: nothing noted.
- Runtime type data, GC metadata and sections laid out by the linker — Done: offsets (
f028b9f9e2),go.stringhandling, itablinks slice (79688ca58f). - Container writers: Windows PE, Mach-O and Plan 9 — Done: PE symbol table rewrite (
bb48b864b1). - Architecture and OS ports in the linker (arm, power64, arm64, mips, s390x, nacl, BSDs, Solaris) and trampolines — Done: s390x (
163ff700b8,29a6149e67), mips64 external,Minalign(90cb1fdaf2), sys.Arch common representation (c6e11fe037,d481ffc1af,22ef687da8), gdb backtrace on link register architectures (55154cf0b2), dynamic symbol size for 386 (0b6e5e3d73). - Build IDs, ABI hashes, flags and determinism — Done: user-visible deterministic cgo builds (
5bbb98df09),-dumpdep(d224e98d9a),-H elfremoved (71ab3c1ccf).
Other changes
- Misc internal —
1012892f1eremove C-calling check,d0fb649713operator&^,acc757f678SeekStart,fe5be5aced,ec3c5b9d17elf64/rela switches,1934a77f5a,79048df2cclong symbol names,96b8f70e22,b0cbe158da,66afbf1010,9568d54fb8plt/rel ordering,4b175fd23b,25d95ee918,1dad218da1,854ab14b7e,79c527f4a7,d7cdf66978elfhash garbage,9629f55fbbdarwin/arm c-archive absolute address,3c4ebd2023mips64 extld argument,a0abecf102andf2f3b6cd8fgold detection,e79fef8e55Solaris,3375974e0dshort buildid,2f41edf120dynimport type data,438ce713a1,cb97fd7741,6fee4aa5c7,9d4efdfd12,de7ee57c7e,2ac8555d57,1441f76938,90a59d448e. - Remaining 1.7 linker cleanups internal —
dd0a128a02,021e0c5f1f,1661493c73(queue as slice),4c69e92f51,74a3b205eb,2e90192b0e,1b6402ea9d,8677cad199,bc94282306. - Linker allocation and main internal — Skipped allocation reading symbol names, skipped arch-specific main, and removed unnecessary comments. (
07ccc21295)