Go 1.5
The toolchain is Go: compilers, linker and assemblers translated (cmd/compile, cmd/link, cmd/asm, cmd/internal/obj), C compilers deleted. Concurrent GC with pacer, assists and stack barriers. GOMAXPROCS defaults to NumCPU. Execution tracer. Build modes c-archive, c-shared and shared. ppc64 and arm64 ports. Frame-pointer experiment.
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)
The concurrent collector: allocator and GC translated to Go, dev.garbage barriers, pacer with assists and utilisation scheduling, 2-bit heap bitmap, stack barriers; the largest release for the GC arc.
- Concurrent sweep and proportional sweep — Done: bgsweep started eagerly (
5789b28525); sweep finished before concurrent GC starts (24a7252e25); proportional sweep on span bytes (fc9ca85f4c,e30c6d64ba). Left open: credit accounting was fragile (underflows fixed in 1.6). - Concurrent mark: write barriers and the dev.garbage collector — Done: dev.garbage landing: concurrent scan (
6184f46ea3), barrier plumbing (b035e97315,d3d60975b4,28c5385965,9eded54fa3), default on (8cfb084534,273507aa8fstops running Gs during scan);GODEBUG=wbshadowto find missing barriers (dcec123a49, later removed1635ab7dfe) and checkmark mode on by default (9626561030); the GC internals reorganised intogcWork(b30d19de59,02dcdba7c8),gcMark/gcSweepsplit (89a091de24),mbarrier.go,mbitmap.go(3965d7508e),gcWorkper-P caches (1b4025f4bd); mark runs on a regular stack (fa2f9c2c09) with preemption allowed during concurrent phases (af060c3086); ragged barrier for barrier enabling (bb6320535d); prompt start (4b956ae317) and aggressive ending of mark (90a19961f2);GODEBUGgcshrinkstackoff,gcstackbarrieroff,gcstoptheworld(d5b40b6ac2);invalidptr=1default (d3ffc975f3) with bad-pointer check re-enabled (4addec3aaa, afterd57056ba26stopped freeing stack spans during GC). Left open: pause still includes rescanning all stacks and globals in mark termination; coordination via a single GC goroutine (decentralised in 1.6). - GC pacer: trigger controller, assists and background utilisation — Done: scan-work accounting, proportional assist, utilisation-scheduled workers, trigger controller,
heap_live(4b2fde945a,8d03acce54,a0452a6821,d7e0ad4b82,571ebae6ef,4e9fc0df48);gctracereports heap sizes and trigger (8c3fc088fb,cb10ff1ef9,1ccc577b8a,dc870d5f4b,10083d8007,cc6ed285e5,babeb4a963);gcpacertrace(f9dc3382ad). Left open: utilisation controller still based on an estimate of floating garbage, assists computed once at cycle start and revised only by heuristics; mark 2 and small workbufs cause pacing noise (fixed 1.6–1.12). - Stack scanning: conservative, precise by frames, stack barriers, hybrid barrier, async safe points — Done: concurrent stack scan and stack barriers (
6184f46ea3,3f6e69aca5,306f8f11ad,7529314ed3,724f8298a8,3c60e6e8cfrace fixes,22e57c66551.6 locking,9c9d74aba71.6 no sigprof during barrier ops,a7c09ad4fb1.6);GODEBUGgcstackbarrieroff(d5b40b6ac2) and every-frame barrier (3bfc9df21a1.6, 1.6). Left open: rescan during mark termination remained O(stacks). - Precise heap scanning: type information, the heap bitmap and GC programs — Done: boundary bits removed and 2-bit bitmap (
122384e489,e375ca2a25,feb8a3b616,ecfe42cab0,266a842f55,4212a3c3d9); runtime converted to Go (1e2d2f0947,8420df622a);heapBitsForObjectfaster (9feb24f3ed,899a4ad47e,63caec5dee); GC-program fixes (a8ae93fd26,d231cb8249). Left open: mark bit and scan bit still in the heap bitmap. - Size classes, tiny allocator and mcache/mcentral — Done: prefetch in allocation (
99482f2f9e), fix tiny allocator pointer past data (0e84088715), minimum heap 4 MB (813e97b786). Left open: nothing noted. - Span lifecycle in mheap: free lists, treaps, first-fit and the page reclaimer — Done: handling of holes in the heap (
6d1ebeb527), reorganised memory code (484f801ff4), unusedsince fix (e604c6e293),mSpanListtype (1652a2c3161.6, 1.6). Left open: nothing noted. - Scavenger: returning memory to the OS — Done: scavenger disabled on 64K page kernels (
f9cc72ccfe), huge page flags at huge page granularity (44078a32281.6). Left open: nothing noted. - Heap address space: contiguous arena to sparse arenas — Done: 512 GB, 32-bit fallbacks (
43aac4f9e7,85d09574fd,6d1ebeb527,324f38a222,f9357cdec11.6,0de59c27eb1.6); high-address wbshadow (bc2601a1df). Left open: 512 GB heap limit. - Mark work distribution: parfor, work buffers, gcWork and root jobs — Done: gcWork (
b30d19de59,02dcdba7c8,277d5870a0,c2de2f87f0,cf964e1653,1ac65f82ad,15c9a2ef4e,60a16ea367,1b205857a4,a15818fed3caches workbufs on Ms), per-P cache (1b4025f4bd),parformoved to its own file (6b7b0f9a0c,8e2bb7bb4a,ebbdf2a14c,428afae027), work buffer tracing off (5b66e5d0d8). Left open: small buffers. - Runtime allocators for runtime metadata and the port to Go — Done: malloc and GC in Go (
1e2d2f0947,8420df622a),runtimememory layout reorganised (484f801ff4,6c4b54f409), allocator on Plan 9 fixed with a K&R-style allocator with coalescing and splitting, no header on blocks because size is always passed tosysFree(fb75f856df,3c3848ad92,27ed1fcb04,c84ae1c4991.6). Left open: nothing noted. - Memory statistics and accounting — Done: user-visible
GCCPUFraction(23e4744c07),PauseEndin UNIX time (ad60cd8b92,777ab5ce1a), gctrace format (babeb4a963,cc6a7fce53,10083d8007). Left open: nothing noted. - Allocation-site profiling and GC debugging modes — Done:
wbshadow,gccheckmarkdefault,invalidptr(dcec123a49,9626561030,d3ffc975f3,38d9b2a3a9,5250279eb9,1635ab7dfe). Left open: nothing noted.
Other changes
- Tiny/persistent alloc internal — pointers not past allocation (
0e84088715,3423b7b40a),fb75f856dfPlan 9 allocator. - GC and heap-size knobs user-visible —
runtime.GC()documented as blocking (df2809f04e,1942e3814b,ed9a4c91c2),GODEBUG=invalidptr(d3ffc975f3),gctrace=1format (cc6a7fce53,babeb4a963). - Concurrent-GC bug-fix and tuning commits internal — mark-phase races and window fixes (
02f89331c2,aae0f074c0,c1f7a56fc0,e95bc5fef7,cf225a1748,64a32ffeee,f5e67e53e7), trigger fixes (44529d9391,34bc85f6f3,ed09e0e2bf,88e945fd23,d57f037302,b86e71f5aa,1f39beb01a), assist fixes (b8526a8380,4f188c2d1c,500c88d40d,510fd1350d,100da60979), worker scheduling (26eac917dc,913db7685e,79a990b845,ce502b063c,4e32718d3e), scan-accounting (4fffc50c26,c4931a8433), scan loop speed (77f56af0bc,8903b3db0e,497970f421), barrier details (2050f57141,fa6c54953c,001438bdfe,433c0bc769,3ae17043f7,b0532a96a8,d0eab03091), and driver tidying (2b655c0b92,929597b9e9,5254b7e9ce,e31e35a0de,b3d791c7bb,07b73ce146,1b917484a8,6f6403eddf,cc8f544198,abdc77a288,4b71660c5b,7eeeae2a5c,e28a679216,0635706849,3ca20218c1,506615d83e,77fcf36a5e,d21cef1f8f,631d6a33bf,06de3f52a7,653426f08f,5f7060afd2,277acca286). - Heap address-space ordering internal —
arena_usedordering and validation fixes (d57c889ae8,2a331ca8bb,9a3112bcae,eabdd05892,1ab9176e54), linker/moduledata changes (378c2515ae,67426a8a9e,fae4a128cb),[dev.garbage]fixes (91658f934d,5550249ad3,e1f7c3f82f,cc73a44f67), power64 early GC of Defer objects (a9b9ecc9ef), finalizer iterator and heapdump (b796cbc406,561ce92fa0), reserve fixes (c9321f3fb1,ed8cc5cf9b), freed page accounting (69001e404e,91c80ce6c7,6ad33be2d9), trace events (6afb5fa48f,bedb6f8aef),add1/subtract1(94934f843e), atomic fields (363fd1dd1b), pointer-cheap tweaks (1ae124b5ff,c25c371098,bceb18e498), power64 and compiler touches (6482fe6c65,4a2233cea1,6acd5a65b2,4d2b3a0b5f,404472e50b). - New gctrace line user-visible — Updated the gctrace output line to report the new concurrent collector. (
24ee948269) - Write barrier code on dev.garbage internal — Added write barrier code with comments laying out the concurrent GC algorithm; the acknowledgement code was left out. (
0226351d27) - Comments no longer refer to .c/.h files internal — Fixed comments in runtime, reflect and the compiler that referred to C files after the Go conversion. (
cd5b144d98)
Scheduler and concurrency
From Scheduler and concurrency runtime (Go 1.0–1.17)
The concurrent collector's scheduling machinery (ragged barrier, background workers, forEachP), GOMAXPROCS = NumCPU, runnext, mutex spinning, bounded caches, execution tracer; threads: scheduler core, STW/GC, Mutex, diagnostics.
- The G-M-P scheduler: from global-lock M:N to per-P run queues, spinning Ms and work stealing — Done: user-visible default GOMAXPROCS = NumCPU
3ffcbb633e; whole scheduler file converted C→Go in dev.ccb2cdf30eb6;runnextsemantics “yield time slice to most recently readied G”e870f06c3f; stealing changed so a P that is about to run a just-readied G is not robbed (c4fe503119), runqvictims/copy removeda0fc306023; spinning bug when readying inside mspinningb0b1a66052; panic when idling a P with runnable Gs2a46f55b35;runqemptyfactorede5e52f4f2c; procresize simplifiedce9a4afa6f; time slice made a consta23a341e10; “do not do futile netpolls”f47e581e02; randomized scheduling in -race2028077899; sysmon-triggered GC concurrent4b2774f5ea. - Preemption: cooperative stack-check preemption (1.2) to signal-based asynchronous preemption (1.14) — Done: preemption used by the concurrent collector’s ragged barrier (see GC interaction thread).
- Network poller: from the netFD select loop to the runtime-integrated epoll/kqueue/IOCP poller — Done: spurious deadlock in netpoll
776aecaf6e; futile netpolls skippedf47e581e02; Windows netpoll converted0438182c30. - Channels and select — Done: doubly-linked sudog queues
8eb8b40a49; permutation tightenedfd5540e7e5, modulus removed9a0fd97ff3; typed memmove for chan content54bb4dc390; memory barrier for sync send in select8c3533c89b; sudog cache bounded5ef145c809. - Semaphores, runtime locks and Notes — Done: write-barrier throw in
lock_semafixed (uintptr)87ec06f961. - sync.Mutex, RWMutex, WaitGroup, Cond, Once — Done: active spinning
edcad8639a; WaitGroup simplified03a48ebe1c. - sync.Map, atomic.Value and sync/atomic — Done: pointer write barrier on atomic stores
7b4df8f018; arm642a0833da50, darwin/arma1457cac9c, openbsd/arm6900a421a4, power6456949d33d8, memory barriers in arm cas4bd8040d47. - Runtime from C to Go: scheduler, channels, semaphores, timers, netpoll — Done: dev.cc: headers
fee9e47559, schedulerb2cdf30eb6, Windows netpoll0438182c30,fc288681cf, missing constse5d01a5ffc; write barriers on typed chan/map/interface copies54bb4dc390,9b638bf1bf. - Goroutine and M lifecycle: caches, ids, LockOSThread, Goexit, cgo extra Ms, deadlock detection — Done: bounded defer pool, sudog cache
8059071153,5ef145c809,b759e225f5; system goroutines hidden from traces59495e8dfd; freezetheworld with gomaxprocs=15a828cfcde. - Stop-the-world, safe points and GC–scheduler interaction — Done: dev.garbage concurrent scan
6184f46ea3,d42328c9f7, write barriersd3d60975b4; background mark8d03acce54, ragged barrier57afa76471,bb6320535d, prompt start4b956ae317, no write barriers during STW41dbcc19ef; forEachPf0dd002895,a1da255aa0(STW/start factoring),277acca286(worldsema while starting),edfc979725,e42413cecc, ; controller diagnosticsdc870d5f4b,f244a1471d; sysmon-triggered GC concurrent4b2774f5ea; stack barriers3f6e69aca5,840965f8d7,ad731887a7,87f97c73d3. - Scheduler diagnostics: schedtrace, GODEBUG, execution tracer, block/mutex profiles — Done: execution tracer
f30a2b9ca7,5288fadbdc, sequence numbers80c98fa901,e72f5f67a1,26baed6af7; GODEBUG memprofilerate3c4be235be,27aed3ce68. - Fast random numbers for the scheduler — Done: randomized scheduling under -race
2028077899. - GOMAXPROCS, thread and resource limits — Done: user-visible default GOMAXPROCS = NumCPU
3ffcbb633e;NumCPUdoc2de67e9974.
Other changes
- dev.power64 and platform support internal —
87b4149b22,a1457cac9c,2a0833da50. - Misc runtime internal —
b3a8b0574a,5da1c254d5,725aa3451a,3b22ffc07e,d1b1eee280(c-shared/c-archive),fa896733b5,b6e178ed7e,6e70fddec0. - dev.garbage / dev.cc glue and GC debug knobs internal —
a3630c9e44,62a4359e2e,0f66d785cf,841de809bb,76f71959c8,7a524a1036,13aff7831d,6d37c830b6,027e47b7b1,564eab891a(GODEBUG=sbrk=1),8e5346571c,9626561030,0211d7d7b0(gccheckmark on then off),d3ffc975f3(invalidptr=1 by default). - Runtime plumbing internal —
882f21d6ae,c61d86af72,919fd24884,4396ea96c4,ce9b512ccc,fb9fd2bdd7,e9d9d0befc,c1c667542c,0e6a6c510f,e610c25df0,3c60e6e8cf,cfa3eda587,dff9108d98,fde392623a. - Comment fixups internal — Applied review comments from CL 3742 and moved orphaned comments to proper homes. (
84f53339be) - Type-based write barrier skipping internal — Replaced function-based write barrier skipping with a type-based mechanism. (
181e26b9fa)
Data structures and type metadata
From Runtime data structures and type metadata (Go 1.0–1.17)
Pointer-free maps unscanned, overflow pointer at bucket end, new fallback hash, 1-bit pointer bitmaps in type data, FuncOf/ArrayOf, duff routine generation and assembly cmpstring.
- Hash map core: from the first hashmap.c to the 8-entry bucket design — Done: overflow pointer at end of bucket (
fbc56cf050,c6669e7af5,c5dff7282e), reflexive-key shortcut (df1739c77d), pointer-free maps not scanned (85e7bee19f,52dadc1f31noscan fix), typed memmove with write barriers for map contents (54bb4dc390), reflect map zeros on demand (7e26a2d9a8,d820d5f3ab). - Map growth, iteration order, overflow buckets and GC interaction — Done: overflow slice for pointer-free maps (
85e7bee19f), pointer bucket layout (fbc56cf050). - Hash functions and algorithm tables: memhash, AES hash, fallback hash — Done: new fallback hash (
cda0ea1c0e), randomized fallback seeds (ce5cb037d1), size argument removed (d5e4c4061b),goalgremoved (b1f29b2d44). - Runtime type descriptors: layout, shrinking and name encoding — Done: 1-bit bitmaps (
6d8a147bef), pointer size (98a9d36837),PtrTofinds existing pointer types by string before synthesizing (2f0828ef7c, needed for dynamic linking), method-name equality instead of identity (e1366f94ee),kindNoPointerson function layouts (d11f411181). - Interface values, itabs and type assertions — Done: inlined
_, ok := i.(T)(25e793d7ea), assertion fixes (c4092ac398), typed memmove for interface contents (54bb4dc390). - reflect dynamic types: ArrayOf, ChanOf, MapOf, SliceOf, FuncOf, StructOf — Done: user-visible
FuncOf(e1c1fa2919),ArrayOf(918fdae348), pointer lookup (2f0828ef7c),ChanOfdir (48d63035ce), call-frame GC bitmap uses two bits per pointer (7c1e33033d). - reflect.Call, MakeFunc, method values and argument-frame GC precision — Done: correct
funcLayoutbitmap (7c1e33033d),kindNoPointersfor pointer-free layouts (d11f411181),mapassignnoescape (84e2567537). - reflect performance, caches and API additions — Done:
mapassignnoescape (84e2567537), struct tag key validation (6ea3adc3ba),DeepEqualunsafe pointers. - memmove, memclr, duff routines and pointer-write atomicity — Done: duff routines generated and tuned (
ad3600945a,7e0c11c32f), memmove in append (497970f421). - internal/bytealg and string/byte comparison primitives — Done: arm and arm64
cmpstring(e2543ef62c,ee349b5d77). - Slices and append: growslice, makeslice and string/slice conversions — Done: memmove append, barriers (
497970f421,a73c1cef07,0d6a0d6c3f,ab4df700b8,537ddc9456zero-widthslicecopy). - Strings: concatenation, conversion and printing helpers — Done: no copy for concat/compare (
205ae07cd3,69cd91a598). - Soft-float, 64-bit division and complex arithmetic helpers — Done: softfloat in Go (
c81d248eca,2ceca80e3f), SQRT register fix (102436e800). - C-to-Go conversion of runtime data-structure code — Done: dev.cc conversions (
fee9e47559,0c3c2c1724,c81d248eca),noasm.gocmove (fb57459b48), arm assembly regularized (69ddb7a408).
Other changes
- dev.power64/dev.cc/dev.garbage branch merges and arm64 reflect internal — reflect on arm64 and aligned frame sizes (
1abd8185b2,421220571d);ca7f2c796f,b697c120f6,700ab16daf,977fba763a,7cae2a5004,9e719ceefe,2774b37306. - Compiler/runtime plumbing internal — Android logging (
bee8ae1185,84e200cbcb), printlock race (bfeda9188a), format and importpath symbol (f58a5cb9e2,612d78d681,0de359da30,b92a0a8969),checkgccode removed (822a24b602), type-based write barrier for remote stack write in chansend (80ec711755), struct padding for trailing zero-sized fields (6f07ac2f28). - Docs and fmt interplay user-visible —
fmttreatsreflect.Valueas the value it holds (049b89dc6f), docs (895e48cac5,a1c9e10371,eced964c2d,2adc4e8927). - Softfloat and type-name cleanups internal — Cleaned up softfloat code, alg.go and type names in comments, and updated dalgsym to use obj.LSym. (
21a4c93166)
Diagnostics and knobs
From Diagnostics and knobs (Go 1.0–1.17)
Execution tracer, go tool trace and runtime/trace introduced; sequence-numbered ordering; GODEBUG gccheckmark and memprofilerate.
- Execution tracer (trace v1): events, per-goroutine sequencing, annotations — Done: user-visible
runtime: add execution tracing functionality(f30a2b9ca7) withruntime/pprofhooks (986a1d2d1c);cmd/trace(edadffa2f3) moves the parser intointernal/traceand shows trace view, blocking profile, network IO profile and per-goroutine traces; thread id dumped on proc start (9d332a8324) and goroutine analysis moved tointernal/trace(7b0c73aa28); futile wakeups (unblock->start->block) are marked by an event on channels and removed by the parser (4396ea96c4); fixes for GC start/end on different Ps (eec6fdc90b), syscall exit (089d363a91), trace tick frequency on Windows and non-x86 (256116ad25,5f69e739d3), a false race report (4a45ac577f, the race detector is taught thetrace.shutdownSemasynchronisation); explicit sequence numbers (80c98fa901); stable sort and fuzzer fixes (64e48bbaba,e1ee31400a); the API moves fromruntime/pprofto the new user-visibleruntime/tracepackage (ae1ea2aa94). Left open: global sequencer cost on many CPUs (the Go 1.5 commit message says only that time cannot be made reliable); “sync.Mutex will be supported in a separate change” (4396ea96c4). - Race detector integration — Done: race implementation converted from C to Go [dev.cc] (
59e3e5354d);appendinstrumentation, stack corruption and PC adjustment fixes (ed8cc5cf9b,f59f9b8527,3fc529eabe); write barriers no longer instrumented (972a478ddf);OGETGandOKEYhandled (08c43488ee,cd0a8ed48a). Left open: nothing noted. - CPU profiler and runtime/pprof writers (legacy format to compressed protobuf) — Done: CPU profiler simplified (
3c8a89daf3,481ce36ec4); heap statistics always written (c26fc88d56,79986e24e0) and heap profile content documented (6b8762104a);GODEBUG=memprofilerate(see knobs,3c4be235be,027e47b7b1);runtime.callerswalks the calling G (719efc70eb). Left open: nothing noted. - Heap profile accounting and MemStats — Done: user-visible GC CPU utilisation in MemStats (
23e4744c07);gctraceformat documented (4c9464525e);GODEBUG=gccheckmark(654297cb02, see knobs). Left open: nothing noted. - GODEBUG, runtime/debug, debug log and traceback knobs — Done: user-visible
GODEBUG=gccheckmark=0/1(default on during 1.5 dev) replacing runtime functions (654297cb02);GODEBUG=memprofilerate(3c4be235be, renamed027e47b7b1); stack of G printed during signal (4b78c9575d). Left open: gccheckmark “will probably remain [enabled] for much of the 1.5 development cycle”. - GDB runtime support — Done: loading,
SliceValue, rtype and map printers, Python 2 (a25af2e99e,545686857b,98651d6edf,02d80b9e93,1c82e236f5,53840ad6f1). Left open: nothing noted.
Other changes
- Trace clock check internal — negative tick frequency reported as a time-ordering problem (
ca6f7e45cb). - dev.cc / dev.garbage conversions internal — parallel support code C→Go (
ece09790af), lfstack simplification (62a4359e2e), data/bss ordering assumptions removed (378c2515ae), stoptheworld pattern factored (a1da255aa0), pointers to strings printable (c45751e8a5), frame-pointer check tweaks (67a03fd6a2,fc5baec37f), tracebacks of early crashes (dd82d5e728), GC scan work estimator (4e9fc0df48), reachable heap estimate for trigger/goal fixes the floating-garbage feedback loop: heap max from ~500MB to ~73MB on the garbage benchmark (4655aadd00), stack accounting (7c7cd69591), build fixes for race incmd/internal/gc(8b2503d5f5,d6b4069852,d3252a2db9),outervaluecopies (c1bbf0a2ea). - Atomics on non-heap addresses under race internal — Fixed atomic operations on addresses not declared with __tsan_map_shadow, such as data and bss. (
2b3f379080)
OS layer, stacks and panics
From OS interface, stacks and panics (Go 1.5–1.17)
The all-Go runtime ([dev.cc] conversion), the power64/ppc64, arm64, darwin/arm(64), Android, openbsd/arm ports, GC stack barriers, the first signal-mask policy and forwarding, shared-library entry points and the first cgo pointer plumbing.
- C-to-Go conversion of the runtime’s OS, arch and signal layers ([dev.cc]) — Done: everything above, plus the ppc64 sigctxt/asm conversions (
312a64ec4e,54d731452d,3f27c3ae37,0da27cb8b0,70f6769b60,f4627d1b05,d11a425959), a siginfosi_addrfield (f4a525452e) and a generated Windows callback list (dcb2ec3b65,3f19541752). Fixes needed for the converted code: nil-pointer crash handler on Solaris (9d6825edee), freebsd__prognameexport (37cae806cb), missed “M stack” references (0e8fed098c), Windowsgoenvs(0a38b2cdaf,a88d709268). Left open: Solaris was “just a rough translation of the original C code, cleanup will come in a different CL” (e088e16256). - New and ported OS/arch targets, 1.5–1.17 — Done: [dev.power64] bring-up for linux/power64 and power64le: manual and portable parts, generated headers,
switchtoM/onM,morestack,newstackcall,reflect.call,time.now, 64k pages on power64le (5f691cfaf1,2abf3c5583,91447ab502,ab29d5b4ae,c229cec23a,268d901199,ebf42035b7,b7a6fd28db,5f02073ded,f9fdc887ae,fd21b9f8b5,062e354c84,1b130a08d8,8881e032d4,b6d6eb21ec,6e73ae88b5,b3375771fc,ecbe6b9f7f,249e8f700a,e445f75dbc,a08783f078,cb4f5e1970,87b4149b22,b55791e200,097362fd2e,c24156bafe,6e86003651,40a5b3ecb1), then renamed ppc64 (09d92b6bbf) and given cgo (af7ca8dce4,f1c4444dfc). linux/arm64 (846ee0465b, syscall error checks3a56aa0d3e, 64k page rounding7a63ab1a65, cgod0b62d8bfa,0accc80fbb); darwin/arm (56e8f8e822, cgoa5bff443c7,EXC_BAD_ACCESShandler1b49a86ece, later turned off by default4044adedf7) and darwin/arm64 (4a71b91d29,828de09f8b,989f0ee80a,9cde36be54, c-archive entrye8b7133e9b); openbsd/arm (be3133bfda); android/arm shared-library init (d1eee2cebf,ede863c673); Solaris cgo (121489cbfd) and direct libc linking in place of dlopen/dlsym once lazy binding existed (fe5ef5c9d7); FreeBSD uses theSYSCALLinstruction (e9ce76b0ec); the dragonfly/386 port is removed (3b1d692093). Left open: the darwin/arm cgoEXC_BAD_ACCESShandler was disabled by default pending a fix (4044adedf7). - Goroutine stack growth, shrinking, GC stack barriers and stack objects — Done: stack barriers (
faa7a7e8ae), no write barrier inadjustpointers(a5c3bbe0b4),shrinkstackhonours the stack guard (7387121ddb), avoid double-scanning of stacks (724f8298a8), no barrier incgocallback_gofunc,Goexitcallsgoexit1to avoid “leftover stack barriers” (ad731887a7), stack debug fixes (0c22a74e85), 2-bit heap bitmap which also shifted stack-map formats (0234dfd493),profiling on g0(db6f88a84b). Left open: barriers cost 2–3% on non-recursive programs (faa7a7e8ae). - Tracebacks, symbol tables and
runtime.Callers/CallersFrames— Done: traceback fixes (894024f478,0bcdffeea6,68117a91ae,e544bee1dd), no container symbols infunctab(6dd31660b0), missing pcdata tables recorded (434e0bc0a0), pcln check near foreign code (74ec5bf2d8), moduledata validity checks (fa896733b5,692054e76e,be0cb9224b), per-thread traces duringGODEBUG=crash(5bfed7c6c0,f0876a1a94,142e434006). Left open: everypcvaluelookup decodes from scratch. - Defer, panic, recover and Goexit (runtime side) — Done: panic/stack code in Go (
d98553a727),reflectcallwrite barriers (df027aceb9),Goexitcallsgoexit1(ad731887a7),goexitprototype hardened (ad731887a7). - Signals: masks, forwarding, sigaltstack and the unified Unix signal layer — Done: signal forwarding (
5c8fbc6f1e), mask policy (84cfba17c2,8017ace496),os/signalignore/reset (194ad16b83), SIGPROF from foreign threads ignored before cgo init (5da9c8cd0a), notes on Plan 9 (d5d4ab7819), signal handling on Plan 9 (f85a05581e,3d032d7653), runtime·raise on dragonfly (d9ee9a0f6e), windows exception code made arch independent (6e774faed7,d1af6bed84,e0d9342da7,5c4a86d0d0). Left open: forwarding only on Linux and darwin/amd64. - cgo runtime support: pointer checks, callbacks, extra Ms, C-to-Go call path — Done: the extra M for cgo is initialized during
mstart(b8caed823b),needextrambecomes a bool (e9d9d0befc),cgocallbackwaits for package init (3b22ffc07e), shared-library init waits for runtime init at the first cgo call (e8694c8196), pointers passed to C escape to the heap (2c2770c3d4), TMPDIR/initial working directory handling in cgo (b54d313205,f6fb549d22,249894ab6c),PTHREAD_*_INITIALIZER(0c62c93a09), TLShalvedoffset on ELF/intel (658a338f78). - Shared-library and buildmode entry points (c-archive, c-shared, plugin, shared) — Done: init at library load (
e8694c8196), darwin/amd64, ARM, android, 386 entry points (b0a85f5d93,93644c9118,d1eee2cebf,ede863c673,9c1868d06d,c8aba85e4a) andaddmoduledatafix per platform ABI (be0cb9224b). Left open: only linux/amd64 first (“Next step is to support it on linux_arm”,e8694c8196). - vDSO, time sources and process-wide randomness — Done:
urandominstead ofrandom(1de9c4073b),AT_RANDOMon arm (3aba41d6c3,f15c675fb4),get_random_byteson NaCl (003dccfac4), fake time to stdout/stderr (242050d07f). - Windows runtime — Done: WER dialog suppressed (
03d6637dbb), VEH on XP (77f4571f71,d5004ee69e), unified stack reservation (da11a9dda3), goenvs (a88d709268), exception trace output (e544bee1dd),sysargsand pipe fixes. - Assembly-level runtime entry points: memequal/cmp/IndexByte, hashing, atomics and ABI wrappers — Done: a better fallback hash (
cda0ea1c0e),eqstringspeedups (135ef49fde),cmpstringasm on arm/arm64 (e2543ef62c,ee349b5d77), tail-call memeq (c526f3ac10),strings.Compare(90ce1936e3,fd4dc91a96), BP elimination on amd64 for framepointer (20a6ff7261),cputicksfixes (6e70fddec0,e629cd0f88), alignment checks (7a71726b1f),procyield/SETEQfor cas (17577e48c9), duff routines autogenerated (ad3600945a), cmp on 386. - Thread lifecycle, physical page size and scheduler-facing OS hooks — Done: NOHUGEPAGE (
7e1b61c718), CPU masks up to 64k CPUs (77d38d9cbe), ARM affinity buffer (2b0ddb6c23) later. - Plan 9 and NaCl ports — Done: Plan 9 conversion and fixes (
e9c57d8a2d,d5d4ab7819,3d032d7653,10be797578,5c2233f261,f85a05581e,7de86a1b1c), NaCl randomness (003dccfac4,400f58a010),108ec5f75a.
Other changes
- Linux, vDSO, time and auxv internal — user-visible runtime: Add gc mark verification pass. This adds an independent mark phase to the GC that can be used to verify the the default concurrent mark phase has found all reachable objects. It uses the upper 2 bits of the boundary nibble to encode the mark leaving the lower bits to encode the boundary and the normal mark bit (
77db737ac3); user-visible runtime: add write barrier to casp (37186d91fa); user-visible runtime: Add write barriers to c code Also improve missing GC mark diagnostics (18ed947ee1); user-visible runtime: fix linux build (a87e4a2d01); user-visible runtime: change set_sec to take int64 (580cba42f4); user-visible runtime: fix bus error accessing auxv random data on arm5 (14d23bfd7b); user-visible runtime: add prefetcht0, prefetcht1, prefetcht2, prefetcht3, prefetchnta for GC (8c3f64022a); user-visible runtime: explicitly exclude android in zgoos_linux.go (adbca13cb3); user-visible runtime: fix missing newline when dumping bad symbol table (006ceb2f1d); user-visible runtime: remove go prefix from a few routines (0bb8fc6614); user-visible runtime: remove unnecessary GOOS switch (1ebfb082a7); user-visible runtime: remove trailing empty arrays in structs (1dd0163ce3); user-visible runtime: remove stray commas in assembly (f7e43f14d3); user-visible runtime: move SetErrorMode constants into function so they are not exported (bc244008af); user-visible runtime: avoid race checking for preemption (f6d0054e71); user-visible runtime: fix *bsd/amd64 build (636de7afb6); user-visible runtime: add missing to error message (c901bd01c1); user-visible runtime: speed up eqstring (82a761b656); user-visible runtime: move wbuf-related functions to new gcwork.go (277d5870a0); user-visible runtime: simplify CPU profiling code (3c8a89daf3); user-visible runtime: remove makeStringSlice (ec7d8a6167); user-visible runtime: do not share underlying envs/argv array (402f71a839); user-visible runtime: add argument sizes for asm functions for bytes, strings (3b00197017); user-visible runtime: fix linux/amd64p32 build (98485f5ad4); user-visible runtime: Remove write barrier on g (546a54bb2e); user-visible runtime: disallow write barriers in handoffp and callees (392336f94e); user-visible runtime: fix arm, arm64, ppc64 builds (I hope) (32dbe07621); user-visible runtime: fix arm64 build (969f10140c); user-visible runtime: remove runtime wait/notify from ppc64x architectures (a888fcf7a7); user-visible runtime: merge clone0 and clone (ca9128f18f); user-visible runtime: re-enable TestNewProc0 on android/arm and fix heap corruption (4d1ab2d8d1); user-visible runtime: fix software FP regs corruption when emulating SQRT on ARM (102436e800); user-visible runtime: disallow preemption during startTheWorld (9c44a41dd5); user-visible runtime: ensure GC sees type-safe memory on weak machines (f5d494bbdf); user-visible runtime: set m.procid always on Linux (a9e536442e); user-visible runtime: fix broken arm builds (8b99bb7b8c); user-visible runtime: replace divide with multiply in runtime.usleep on arm (c9d2c7f0d2) - cgo and C interop internal — runtime/cgo: add missing import _ “unsafe” for //go:linkname (
22293bb1a4); runtime/cgo: fix freebsd build? (a9695a5d38); runtime/cgo: guard against redefinition of PTHREAD_KEYS_MAX (340ef004d6); runtime/cgo: initialize our pthread_create wrapper earlier on openbsd (77cd6197d7); runtime/cgo: change PC to R15 in asm_arm.s (0f3f2c4110); runtime/cgo: fix darwin/arm build (7e93610b07); runtime/cgo: fix darwin/amd64 signal handling setup (e0c180c44f); user-visible runtime: align stack pointer during initcgo call on arm (2a60d77059) - BSD, Solaris, AIX, Plan 9, NaCl internal — user-visible runtime: make SIGSYS notifiable on freebsd (again) (
b2ec4cf50c); user-visible runtime: fix nacl build (1757b5cc74); user-visible runtime: fix accidentally exported OpenBSD constants (95ab84a34f); user-visible runtime, syscall: add names to FP offsets in freebsd, netbsd arm assembly (c72a21189b); user-visible runtime: simplify OpenBSD semaphores (9f926e81c2); user-visible runtime: simplify NetBSD semaphores (2fdb728d01); user-visible runtime: change sigset_all and sigset_none into constants on OpenBSD (5324cf2d45); user-visible runtime: remove reference to openbsd kern.rthreads sysctl (f076ad893b); user-visible runtime: fix return values for open/read/write/close on openbsd/arm (4f35ad6088); user-visible runtime: remove unnecessary noescape to fix netbsd (d707a6e0e2); user-visible runtime: correct implementation of raiseproc on Solaris (d7223c6cc1); user-visible runtime: fix definitions of getpid and kill on Solaris (deaf0333df); user-visible runtime: run on GOARM=5 and GOARM=6 uniprocessor freebsd/arm systems (4a19081358) - Windows internal — user-visible runtime: raise StackGuard limit for Windows (again) (
db40624110); user-visible runtime: import unsafe in os_windows.go (fixes windows build) (7f4c26850a); user-visible runtime: fix RuntimeGogoBytes on windows/amd64 (70321df02f); user-visible runtime: remove comma at the end of DIVL instruction (fixes windows build) (201b12499c); user-visible runtime: use _main instead of main on windows/386 (b6ed943bef); user-visible runtime: really pass return value to Windows in externalthreadhandler (9402e49450) - signals and crashes internal — user-visible runtime: provide a dummy value of _SIGPROF on plan9 and windows (
1f28238557); user-visible runtime: support panic/print logging in android-L (3a87135754); user-visible runtime: remove write barrier on G in sighandler (9b0ea6aa27) - stacks, defer and unwinding internal — user-visible runtime: use 2*regSize for saved frame pointer check (
67a03fd6a2); user-visible runtime: store syscall parameters in m not on stack (85d4d46f3c); user-visible runtime: fix darwin/amd64 assembly frame sizes (f6dfe16798) - other runtime/OS plumbing internal — user-visible syscall: Add Foreground and Pgid to SysProcAttr (
f7befa43a3); Fix several out of date references to 4g/5g/6g/8g/9g (8628688304) - Darwin/iOS internal — user-visible runtime,syscall: add symbols for FP and SP references in darwin-arm (
218ff3f9a4); user-visible runtime: use uintXX instead of *byte for si_addr on Darwin (ec2c7e6659); user-visible runtime: always load address of libcFunc on Solaris (c94f1f791b); user-visible runtime: fix darwin/386, darwin/arm builds (c844bf4cfc); user-visible runtime: don’t define libc_getpid in os3_solaris.go (0229317d76) - Delete scalararg and ptrarg, onM to systemstack internal — Deleted scalararg and ptrarg and renamed onM to systemstack. (
656be317d0) - Windows and darwin comment/code tidy internal — Simplified and commented some Windows code and fixed a bsdthread_register return type in comments. (
e810a079eb,a173357cd5) - open/close/read/write return -1 on error internal — Runtime open, close, read and write now return -1 on error. (
f584c05fcc)
Compiler frontend
From Compiler frontend (Go 1.1–1.9)
Compiler translated from C to Go (cmd/internal/gc → cmd/compile), math/big-based constants, Node slimming, capture-by-value closures and closure-call transformation, stack allocation of strings/maps/interfaces, transitive inlining, flow of params to results in escape analysis.
- The C-to-Go translation of the compiler (cmd/gc → cmd/internal/gc → cmd/compile/internal/gc) — Done: [dev.cc]
fd2bc95d53prepares cmd/gc for runtime C removal (-asmhdr,//go:linkname,//go:cgo_*, pointer-only interface data word); the compiler is converted to Go ascmd/internal/gc(9c8c0e729d,6eaa095012expands theDBGmacro,d68f52aa43restores mkbuiltin,2bcfe8b935NULL→nil,8d44ede0dc“simplify code for c2go”); yacc ported with expecting-messages;math/bigvendored; Node slimmed; package becomescmd/compile/internal/gc(d00e7ad640-d panic=1to show compiler panics,7bcc6a1615-importmap,442959ec47fix builtin generation). Left open: the grammar is still yacc-generatedy.go;NodeListlinked lists and C-style global state persist. - Parser: from yacc to a hand-written recursive-descent parser — Done: yacc ported to Go, expecting-messages restored (
e7d9f81645), lexer allocation reduction9f4c25e223. Left open: hand-written parser not yet. - Binary export data and the object-file split — Done:
f09887cdceno original expression in exported constants;7c3eeda66fgo.builtinpackage prefix;bed481d683. - Inlining — Done:
77ccb16eb1transitive inlining;2e4b659954embedded field in inlined function;ec0ebc2281non-local vars inlined into wrappers treated as escaping;4224d81faeinlinex := y.(*T). - Escape analysis and stack allocation — Done:
7fbb1b36c3,e6fac08146,b3be360f16,2270133981,9568126f35,4ce4d8b2c4,71be013842,5be61b18d4,3bf005cea3. Left open: “ought to yield better results with a more competent escape analysis algorithm” (7fbb1b36c3). - Closures, method values and variable capture — Done:
0e80b2e082,eaa872009d,c4ee44b7b9,3a0fbfab57,731dcdae6d,27edd7209e(PAUTO capture variables on non-amd64). Left open: nothing noted. - Language changes and rules as implemented in the compiler — Done: user-visible
5cc29ab95e,b59dd94f33,b581ca5956,73d109c509,c735064cde,a3dfcf51c6,3f209abb29,596bb76248,cb1897a58c,5726af54eb. - Constant arithmetic,
Mpint/Mpfltand floating-point constants — Done:888767fcc4,5bb89eb009,e5a0d6399e,4da157a723,a51d5f27e8,1122836b5f,bb418a59f8(approximate float formatting in errors),13485be939,71080fbb9e,99475dfb59(spurious div-zero errors). - Static initialization, composite literals and
init— Done:2fc29a83ae,632217aae4,9f90f31c3a,0c9f3e4972,fa1ea497d5/1125cd4997(func value symbols at declaration). - Walk-level lowering and runtime-call optimisations — Done:
77a2113925,ccdb50931f,f03c9202c4,4224d81fae,1d4bfb3ebb,81d4072eb0,f5b8813e93;32fddadd98(runtime: slice growth reduced to 2x),6f07ac2f28(pad structs ending in zero-sized fields),dbe9ab69d9. - Write barriers, precise stacks and liveness (compiler side) — Done:
0ad4f8b1f7,653d56075d,a7bb393628,e5ef657264,557a61d270,2050f57141;08e25fc1ba//go:systemstack,19b8aa3b5d(OASWBname). - Compiler data structures:
Node,Nodes,Type, and thetypespackage — Done: Node splits and field moves (see first thread),Val.Uinterface (13485be939),d970bea885startssyntax.gofor the syntax tree definitions,96c91fa9dbString methods,e64764c8d0cache commonly usedPtrtotypes,8b3670ffc6. - Pragmas, directives and compiler flags — Done: user-visible
fd2bc95d53,557a61d270,08e25fc1ba,7bcc6a1615,6c328efc4c,0f6da8923f,01512b3edb.
Other changes
- Allocation reductions in the frontend internal —
42fcc6fea0internConcat,9f4c25e223,05ca0f3370,4b27c9d72e,acba34e45f,aed88be021,e0e1cee8e9,1ba13a5ae8,fcff3ba740,76b2f06ee5,32f2f72c47(method called without receiver),c7e1453e3d,d47fe8092e(registerization limits),25da594c6a,e2ca3e6c0f,69b2f70fa1,6f6512bd60,f716c5c5bb,d4bb72b485,7c0db1b7e2,77d7771a82,a5e48cf023,05d8f1d166,494ff188f8,27edd7209e,55203c7dd5,7929a0ddfa,2584974d16,765c0f37ed;888d44d3c1(zero register in Componentgen),c735064cde,75d3f62b3c([dev.garbage] locks around print),f68d1df6b9(fieldtrack + race),8ffc450049,61dca94e101.4 (1.4). - Node field and C-leftover cleanups internal —
4b6337813d(removeNode.Builtin),dcf6e20606(Reslice),2b063bdff1(depths int32),82833b313e(rearrange fields),102b80652f(class uint8),ddc93398b9(Etype instead of Ostk),e5be6432a8(mv builtins builtin),bd7c1f1fb3/75250a9f79(mpgetflt Float32),8d16253c90,ea2f3f9e7a,9b6ccb1323,783297ad6a,75d779566b(runtime/cgo with race),debe12cfcf,c09d284953. - Go-port cleanups of gc internal — Mechanical cleanups after the C to Go translation of the compiler: int to bool, Node cleanups, Sprintf elimination, moving fix/flt functions, removing /untyped/ comments, and Node trimming. (
b006d38acc,44e903158f,e498181942,c8198344ef,5750b7118f,c231228085,a53710ffcb) - Vendored math/big updates internal — Updated the compiler’s vendored copy of math/big. (
da5ebecc6e,db0594b633)
Middle end and SSA optimizer
From Middle end and SSA optimizer (Go 1.0–1.9)
The compiler converted to Go; write barriers emitted by gc; concrete==interface, _, ok := i.(T), re-slice and &T{} escape improvements (threads: write barriers, escape analysis, interface conversions, switch lowering).
- Escape analysis (esc.c → esc.go) — Done:
22c16b4b92,1b87f01239,a21cf5b6a2,b19ec6842d,66130907d1,878a86a129,5d18282695,e5060c7f75,bc44b818a6(toughened against bugs),6f6bcadc17. Left open: nothing noted. - Order, walk and temporary lifetimes (order.c, walk.c) — Done:
18d98bc9cb,205ae07cd3/69cd91a598(no[]bytecopy in string concatenation or comparison),77a2113925,25e793d7ea,4ce06f4b5c. See other threads. Left open: nothing noted. - Write-barrier insertion: from gc to the SSA writebarrier pass — Done:
d8ee1c5a2c,e5ef657264,ff979626fc,a7bb393628,2a73559023,8552047a32,9c9e36b340,972a478ddf,9aefdc80281.4 (fat writebarrier w/o temp). Left open: inline check for typedmemmove barriers (“sets us up to generate an inline check”). - Switch, type-switch and select lowering — Done:
4bc9badd75,4ce06f4b5c. Left open: nothing noted. - Interface conversions, type assertions and devirtualization — Done:
77a2113925,25e793d7ea,fd85a6c640(fast-pathed conversion condition fix). Left open: nothing noted. - Lowering of copies, strings and slices; intrinsics — Done:
43e6923131,205ae07cd3,69cd91a598,764c751ae5. Left open: nothing noted.
Other changes
- Bring-up of the Go-written compiler internal —
dbf406a9d8(disable magic multiply for power64),2c2a6df4e9,2feff0038b,ad73dc349b,786825c5e8,13f9c8b08e(single-pass argtype),6d448440d5,3120adc212(OSQRT off for GOARM=5),60e5f5bdff,c1bbf0a2ea,9a36beb2af,eaa872009d,8e2423a67d,08c43488ee,3b6e86f48a,9f90f31c3a,731dcdae6d,c4092ac398,f68d1df6b9,f90d802b61,24f246c1b6. - Compiler fixes and refactors (1 commits) internal — small fixes, line-number repairs, node-API tidy-ups and diagnostics in
gcand thessapackage that do not carry separate design (f763da3d34)
Backends and assemblers
From Backends and assemblers (Go 1.0–1.6)
The toolchain becomes Go: liblink to cmd/internal/obj, cmd/asm, all compilers and linkers translated, C compilers deleted, go tool compile/link; ppc64 and arm64 ports; shared-library codegen; frame pointers; portable cgen. Threads: C→Go, assemblers, obj normalisation, ppc64, arm64, PIC/TLS.
- Per-architecture compilers 6g/8g/5g/9g and the shared gc code generator — Done: back ends converted to Go and moved to
cmd/internal/gc(8c195bdf12,3af0d791be); portable cgen/regalloc/componentgen (b115c35ee3,b960263244),reg.cportable (ad88fd1d4a),cmd/gcmade a library (349ecfb0d6,eb1774fa19); 9g and 7g added (see port threads);go tool compile/go tool linkreplace 5g/5l etc. (17eba6e6b7). Left open: machine-translated C idioms (goto, pointer arithmetic) cleaned only gradually (4492811c05,acba34e45f). - Register allocation and the peephole optimizer (reg.c, peep.c) — Done: float-constant propagation and
MOVSD $0→ XORPS (43c87aa481); 9g regopt (743bdf612a) and peephole (ed5488eece);Bitsas uint64 array (fa32e922d5); registerization limits raised (d47fe8092e) and extended to 7g/9g (e040fd4654); cached ProgInfo (fd38dbc8a1);reg.cportable (ad88fd1d4a); debug prints (5b38501a4f). Left open: generated temps in bool codegen (a44becef4a) still produced extra moves. - Expression and statement code quality in 6g/8g/5g (division, bounds checks, loops, slices, interfaces) — Done: float-constant propagation (
43c87aa481), componentgen on string constants (94410c794e), zero via register (01ef6dbfa5,8f734d4e2f), 2- and 3-word sgen (747c849833,c1c3ce6b36), boolean values via SETcc instead of jumps (13cb62c764), hardwaremath.Sqrton amd64/arm (92dba0d278),runtime.getginlined (92c826b1b2, garbage benchmark +2.6%),MOVinstead ofLEA 0(R0)(0f0bc0f016), shifts for power-of-two indexing (135389d0ff), write-barrier-aware slice updatex = x[:i](d447279927) andtypedmemmovefrom sgen (2a73559023,2b7505e28afor RISC), panicindex marked as not returning (fc595b78d2),ginscmphook (f8d14fc3a0), generated temps in bool codegen (a44becef4a), missing write barrier inappend(x, BigStructWithPointers)(366ba526e8,9c9e36b340). - Stack frames, pointer maps and liveness analysis in the compiler — Done: 1-bit stack/data/bss bitmaps (
4d0f3a1c95), fixed-size frames ingoproc/deferproc(53c5226f9f), larger stack guard for unoptimized builds (a55b131393), liveness debugging (fa7efa2cb0),gc: restore stack frame debugging(aed88be021). Left open: nothing noted. - Stack frame layout, prologues, stack split and frame pointers — Done: frame pointer experiment (
3c0fee10db,08af4c3a79,90c0fefe51), predictable prologues (f4b48de3ad,5353cde080,54789eff38), correct pc/sp info for the prologue (0a3c991fd3), arm64 frame alignment (3952057cf6,034a10d44c), stack guard (a55b131393),Link.Symmorestackremoved (4b23b50fb4), 386 prologue fixes in position-independent mode. - Zeroing and copying: Duff’s device, REP, unaligned moves and AVX2 runtime assembly — Done:
747c849833,c1c3ce6b36,01ef6dbfa5,8f734d4e2f(zero via a register in componentgen), fasteraeshashhashing several streams in parallel (7a4a64e8f3). - liblink: a shared assembler/linker library — Done: the C library is converted to Go (see C→Go thread), made uniform (see
cmd/internal/objthread) and finally deleted (3317e7f19a); liblink fixes during the transition (0185ba76ed,e04c8b063fdo not patch jumps to jumps to symbols,3be0a0ef6f,52d277906d,dba9eb3369GOEXPERIMENT in runtime and liblink,281ae92881SETcc encoding,ab9ec2e401,6c78443b3ecode for debugging bad returns,9b1b0a46ddfail for too-large register offset). - Normalising Prog/Addr in cmd/internal/obj (the portable instruction representation) — Done: the list above;
cmd/internal/objcreated from liblink (d6f6e420fc,24dfaba6d1,1fc330d8fe,dc7b54bed2), shift of x86SHRQsecond source toFrom3(3d0397a4f4),CALL *name(SB)(b66a509992),PINSRD(29f18f2800),CMPPSmemory third arg (59584ede73), cleanup (ad49c7bb62,fc28fd1eb8,e7ffafdb6e,0088ddc3a0,873483c682,8d16253c90). Left open: the code generator still producedProglists per function and wrote objects at the end. - The Plan 9 C compilers (cc, 5c/6c/8c) in the Go toolchain — Done: cc, 5c, 6c, 8c removed on dev.cc (
4a42fae2cd), 9c removed (1a68ac2538, an earlier 9c existed on dev.power64:83f6aadf16,95e8a3a1da,860f941e7f,25bde37af4),lexbody/macbodydeleted after the assemblers were replaced (184eb0ac9e). - Assemblers: 5a/6a/8a/9a and the Go cmd/asm — Done: the new assembler: arch, addr and lex packages and the assembler proper (
6017f68029,40eb0ed0d8,8642639575,fdeee3a538), identical output tonew6a(89162307cd),TEXT $3-2parsing (92e5120c77), macros (d6eb21e331,5beec6a699), rewrite for the new obj API (cb19a20121), runtime final fixes (e59ed477c3), architectures: 386 (ef664199cb), ARM (c497349a5b,5d111b898a,5d987f1513MCR), ppc64 (e559c5cce2,5b9429d122,adff896e4c), ppc64le (9c0c050773), arm64 (18d9ddc35c,a175fa3bc3,ef49b4ca78);4(SP)illegal except on 386 (345350bf07);LOOPas a branch on x86 (9a420f4cf3); order of assemblers (4100f7d95c); removing the objects when assembly fails (3b1d0d0f07); function-scoped labels (b55791e200,b528063099); old assemblers deleted (621d75999frename toold5a,ba0c142d32,861af80458). Left open: shift handling and macros had follow-up bugs (58d177c63e,989b372a5c,d6eb21e331). - C→Go translation of the toolchain (liblink, assemblers, compilers; dev.cc) — Done: conversions and the switch (above),
go tool compile/go tool link(17eba6e6b7), old assemblers deleted (ba0c142d32),cmd/distGo constant for external linking (7934199877). Left open: generated code still C-flavoured (acba34e45f). - The ppc64 / ppc64le port (dev.power64, 9g/9a/9l) — Done: the port as above, plus
cmd/asmsupport (e559c5cce2,9c0c050773),9g: fix nilopt(810019286f),fix under-zeroing in clearfat(6e86003651),fix addr width and enable MOV* width check(22c929f538,c1e8c57c3d), nilopt (5e4989cf0adisables,810019286ffixes), REGZERO for the zero register (1e1c9dc2c8). Left open: “disable stack split for now” at the start (05d670f757), “No peep optimizer” on 7g; nilopt disabled initially (5e4989cf0a); suboptimal copy code noted (36f879780a). - The arm64 (ARMv8) port (7g/7a/7l) — Done:
26bbe7ac9b,18d9ddc35c,02c1a9d87d,6e3a2a3f9f,ef49b4ca78,a175fa3bc3,72f8102244,888d44d3c1,0f27b91522,54789eff38,3952057cf6,034a10d44c,467a2cb73c. Left open: “No peep optimizer yet”, no shared linking. - Native Client (nacl/386, nacl/amd64p32, nacl/arm) and amd64p32 in the toolchain — Done: amd64p32 build fixes (
12079acaa0,cbc854a799), nacl/arm stack offsets (782eea0190). - Position-independent code, dynamic linking and TLS in the assemblers — Done:
09d9520be9,e73981512f,14fbec49dc,84207a2500,1d1c61ba7d,8a3132dd5e,264858c46e,0661143447.
Other changes
- Local symbols internal — compiler taught about local symbols (
029c7bbdfe). - PAUTO capture variables internal — enabled for all architectures except amd64 (
27edd7209e, “arch != 6”). - GOARM validation user-visible —
GOARMvalue validated before use (5c7f94421e). - ARM software divide internal — denominator passed in
mrather than pushed on the stack (b2dfacf35e). - Plan 9 and warnings cleanups internal — many (
6f999f239b,c8af6de2e8,2f28916f02,213a6645ce,7aa89ea798). - Misc compiler cleanups internal —
qsorttotal order (90965718a8), region array (be4ecd9815),canemitcode(6582d1cf8b),Naddr(8b9a3d4752),Etypeinstead ofOstk(ddc93398b9),explicitly set zero bool Val(3c06cff7d1), stale reg use array (e97ab0a0ac),ARM64 clearfat(467a2cb73c),-g mode branches(351897d9d4). - Ldflags/debug internal —
bool2intcoalesced (ac1cdd13e0),ARM tls(0661143447). - Remaining small code-generation, optimizer and tooling fixes (80 commits) internal — per-operator and per-back-end bug fixes and cleanups that do not carry design of their own: dev.power64 and dev.cc follow-ups: liblink fixes for ppc64 (branch targets, wrappers, $nnn(reg), large SP offsets), 9a/9g fixes, cmd/asm and cmd/internal/obj small fixes, import/format tweaks, 8g/5g register fixes, Dconv/Rconv printing, x86 prep changes (
2358603f0c,5b0ac5f76e,53b78c84bc,f0393221a7,f285537b7f,f3f332851f,76b1ddbb96,4f557008e8,d0be55a662,04d5796b29,fdb0cc6e7b,11ec8ab5cb,32c75a2d3d,6be0c8a566,c2364b58cc,c8f50b298c,473bfae5ae,4f81684f86,f45fd5753c,e156f0e997,7739533f61,c3dadb3d19,b21e936f3e,3b2de80309,4aa63d49ac,ad82238653,29428e322d,36e5f4d53f,1d0664ef0d,a99369fdb5,a293c7e68f,68475da68d,975c82fd9b,eeebcd9db3,b8a3e88ea7,da4abda2a1,2978ebbc7b,7e3b30aea6,fbd17986ea,b6fd455c0d,01925bd3f3,ae2b145da2,581c309d8f,bf2d611a85,575bdd6753,d0c21af7d3,43a01db9a4,f60fb5c5ad,28c6648416,90590a0cd2,940f22eea2,d24e62f2fb,4bbd7ae8e0,f05f273525,b745ab95af,5a16d6fc34,43941d85cf,383e6b2ce2,2897d6dea7,818eff0367,8afb3967a3,b0d545201e,ed263f4dd2,6f6512bd60,d7f6d46c5c,b93fa309f2,00b3b40b07,6ca91d264f,b09925b31d,73e791a38a,5ed90cbbb0,0112f6f6b6,443a32e707,c70b4b5f7e,ba57781181,791bb4f5ae,8f4d964641,3cab4760d5,71859efceb,214c7a2c43) - Build, portability and warning fixes (18 commits) internal — Plan 9/gcc/clang warnings, yacc/bison, format verbs, buffer sizes, output-file handling and Windows paths in the compilers/assemblers/liblink (
05d72029db,7904e951d4,1f420c13bd,cf06ea68d5,7b596457d1,0d4d582c68,daa64ddfe6,db52315c88,925861f306,e90a91eac4,a91c2e0d2d,2b417dc3e1,527b478edb,cd277e28f2,1fdd1d181b,8fc73a39ef,17228f44b2,511faf696a) - C to Go translation cleanups internal — Restored comments lost in the C to Go conversion, exported obj symbols, delayed var decls, removed dead code and mechanical cleanup of the 5g/6g/8g sources. (
cdb7d7dcc2,ebaf8db4f6,382b44eb7c,79f727a70e,175929b9fe,27067df9db,a13cf8c104,1467776b17) - x86 assembler changes user-visible — x86 obj took over i386 duty, cleaned up PINSRQ and CMPSD, and cmd/asm switched to the new x86 instruction encoding; jump alias comments were restored. (
0bf79b2de8,845c4ff52a,a88994c137)
Linker and object files
From Linker and object files (Go 1.0–1.9)
The linker is converted from C to Go via c2go and moved to cmd/link; -buildmode c-archive/c-shared/shared/-linkshared appear; power64, arm64 and darwin/arm ports; external linking on Windows and arm64; findfunc lookup table.
- Go symbol table, pc/line table and function metadata (gosymtab, pclntab, findfunc) — Done: faster
findfuncvia a link-time lookup table (63116de558), poisonedpcln.frame(a0ac493852), missing pcdata tables recorded correctly (434e0bc0a0), filetab slice size fixed (cf125a36d51.6, 1.6). Left open: the pclntab still contained pointers requiring relocations in PIE/shared builds (visible in 1.7 offset work). - Stack splitting and the linker’s nosplit overflow check — Done: check restored for power64 (“detect, fix nosplit overflows”
ed68c7df55) and made flexible and fixed incmd/link(ca19e55f9a,767e065809); the size of the fixed part of the stack centralized (d66f6c2c861.6, 1.6); PE stack reservation unified with the runtime (da11a9dda3). Left open: nothing noted. - Dead code and data elimination — Done:
Etextpmaintained when dead code is removed (8e9c6431f0); c-archive uses the usual flooding (46b4f675bf); gcbits symbols elided individually (0acecb7164); compiler lets the linker drop string headers when not needed (e8f2eb4349). - DWARF generation in the linker — Done: DWARF in external link mode on darwin (
8b83306cf2,be59731d9f), combined dwarf file location (5659964d67), correct.debug_frameon RISC (fd392ee52b), no dwarf on darwin/arm (58578de0dc). - External (host) linking and cgo — Done: the cases above plus
-Bpassed to host linker (e9fcd6ed2b),.bssfrom external objects into real.bss(1c0c611fc2), ppc64 R_CALLPOWER (6f755f2f8f,005ba4db82),-vshows external linker output (714291f2d8),-sfixed with external linking (34846aef78). - Build modes: -shared, c-archive, c-shared, shared, PIE, plugin — Done: user-visible
-buildmode=c-shared,c-archive,sharedand-linksharedas above (2a5f88d850,449969a4ac,ced7ffe95b,00bc19e996,75c0566b55,cc6554f750for darwin/amd64 c-shared,8da54a4eec,f616af23e0,7820d27049global vars of types from other modules,9f5d0bff41R_PCREL to function in another library). Left open: arm/arm64/ppc64le/386 not yet supported. - liblink, the object file format and the move into the compilers — Done: goobj into cmd/internal (
3e7d4f11c0), stricter object decoding (1082e2390e), export data may be$$or$$B(28ef4c38c81.6, 1.6), 0-bytes allowed in export data (4e777c8eff1.6, 1.6). - From C to Go: cmd/link — Done: C-to-Go conversion and rename (
5f1efe738b,1f9dbb60ef,dca5f2e9b3), move to cmd/link (cf932cd897), new5l skeleton moved tocmd/newlink(2a141dedc4),cmd/internal/ldcleanups. Left open: the code is “c2go-flavoured” with globals. - Runtime type data, GC metadata and sections laid out by the linker — Done:
512f75e8df,c949cff6a7,0acecb7164,e8f2eb4349, module data initialized directly (3a84e3305b). - Container writers: Windows PE, Mach-O and Plan 9 — Done: stack reservation unified (
da11a9dda3), PE timestamp zero (98376204e8),.exehandling in external Windows link (ad84f84cb4),-scrash on windows (ab08f79af3). - Architecture and OS ports in the linker (arm, power64, arm64, mips, s390x, nacl, BSDs, Solaris) and trampolines — Done: power64, arm64, darwin/arm, darwin/arm64 ports and the ELF ABI details above (
1a1d450712,3d1ce27ba5,db923390a0,1083715b7f),R_CALLPOWER(6f755f2f8f), 2-byte relocations (fcdffb3f33), relocation variants (ac5a1ac318). - Build IDs, ABI hashes, flags and determinism — Done: user-visible
-X name=value(12795c02f3),-buildid(ac1f48e2f6,9ae3c560b9),-memprofilerate(00d4a6b35d), ABI hash note (65518032b9).
Other changes
- ARM/ppc64/Plan 9 fixes internal — power64 header and type formatters (
7c33e5078f,6e02e1cfc2,40d7a6d582,552d8b79dd,231b8d61e9,1222cc4682,b21e936f3e,9b1b0a46dd), openbsd 5l (4feee8c659), ucontext fixes (01b6b4b43a),ea2f3f9e7a,48469a2c86,810a499bda(.debug_gdb_scriptafter runtime reorganization),2fb88eceb3,e15221acec,91e7ca588d,60b8908588,1b9049b554. - TLS handling internal — runtime.tlsg typed in the runtime (
d738c6b0ca), always STLSBSS (ae3229ae5c), TLS and imported symbols regularized (b8417854c3),R_TLSafter Xsym not read from objects (ccc76dba60),R_TLS_LEfine on Darwin (c20ff36fe2), no “initial exec” misnomer (264858c46e). - Cleanup of cmd/internal/ld internal — Biobuf deletion (
71274e4857,05d53165ce,ea426dcae1), Cpos (3475ec7f36),Ctxt.Endian(ea7be5170a),Diag;ErrorexittoExitf(7816a096d9),elf64bool (7ac67b5568), local symbols (d765e41c62),a1858e9cf0(go: rebuild stale shared objects), flag syntax (8a072ada84,d5ff441d9a,3925a7c5db,2ae77376f7),0de359da30(gc passes importpath),ccaaf1f134,54af9a3ba5(GC dead space, see GC area). - ELF details internal — remove bogus dynsym section indexes (
7e424ecdc1),.rel.pltalignment (855145d5c0),.relacontiguous (83b25d9342),ELFRESERVEa full page (66cb5cd530), recomputeresoff(96dad7ff3e), no.dynamic/.dynsymcreation when externally linking (ddc4c146a4),a5f57d7950duplicates in bss from shared libraries,274976f45cfinalize linkmode before runtime/cgo,8ce80ce87d,6f80e5edf4. - Remaining 1.5 linker work internal — text generation pass (
326ceeabc4), package-data parsing (d533e3955d),moduledatasizewith-linkshared(f9bc9a7a2e),-roverriding rpath (fd0419b344), concrete field types (cf2736c4c5), parenthesis cleanup (bec4481dd3). - Skip dwarf combining on darwin/arm internal — Linker skips combining DWARF for darwin/arm. (
5ee552815c)