Go 1.16
runtime/metrics. Late call expansion. pclntab restructured and sym.Symbol deleted. //go:embed. 387 removed in favour of softfloat. GOOS=ios. MADV_DONTNEED by default again. Early devirtualization. Frame pointers no longer an 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)
Consistent sharded heap statistics, 24-byte size class, checkmarks bitmap, bit-parallel summaries.
- Decentralized GC state machine and mark termination simplification — Done:
gcBgMarkWorkerpreemption simplified (256d729c0b),debugCachedWorkremoved (2517f4946b). Left open: nothing noted. - GC pacer: trigger controller, assists and background utilisation — Done: atomic scan work/assist ratio and defined synchronisation on
heap_scan(93d7d1685e,ce46f197b6,8cc280aa72). Left open: nothing noted. - Precise heap scanning: type information, the heap bitmap and GC programs — Done: checkmarks bitmap (
d19fedd180),heapBitsSetTypedoubleCheck simplified (7148abc1b9), 24-byte class support (14c7caae50). Left open: the bitmap itself (heap-wide, per-word) is what 1.20+ replaces. - Size classes, tiny allocator and mcache/mcentral — Done: 24-byte class, 12-byte alignment on 32-bit (
14c7caae50,5756b35601). Left open: nothing noted. - The bitmap page allocator — Done: binary search
findSucc(76bce1dd52), bit-parallel summaries (4e5ed83e8d,8b8f926fc3), zero-size ranges throw (fe70866d1d), chunk iteration fix (34835df048), heap-lock assertions (9393b5bae5) and world-stopped assertions (6abbfc17c2). Left open: nothing noted. - Heap address space: contiguous arena to sparse arenas — Done: macOS/ARM64 more address bits (
a739306ca7), race-detector address (f7e26467b4). Left open: nothing noted. - Memory statistics and accounting — Done: sharded and consistent stats (
42019613df,e63716bc76,a5088e76f1,cca3d1e553,d677899e90,dc02578ac8,8ebc58452a,ad863ba32a,c02134abb0,fe7ff71185,f77a9025f1,79781e8dd3,39a5ee52b9,ac766e3718). Left open:tinyAllocsremain inconsistent by design.
Other changes
- Misc internal —
MemProfileRate==1shortcut (40f0359d52), unused fields (db185e543f,e313fd7448,9933f66555),os.File.Fdmisuse doc (7bb6fed9b5), physical-page aligned stacks (5ca43acdb3).
Scheduler and concurrency
From Scheduler and concurrency runtime (Go 1.0–1.17)
Timer latency fixes, no stealing from idle Ps, timerpMask, lock-rank assertions, mark-worker pool; threads: timers, scheduler, lock ranking.
- The G-M-P scheduler: from global-lock M:N to per-P run queues, spinning Ms and work stealing — Done: idle Ps no longer stolen from, scaling with GOMAXPROCS
4a2cc73f87; timer steal skipped for Ps without timers (timerpMask)fc116b69e2;injectglistcritical path reduced613388315e; worldsema released with direct G handoff64a9a75ce9; startm without preemption370682ae98; sched.lock assertionsd42b32e321. - Preemption: cooperative stack-check preemption (1.2) to signal-based asynchronous preemption (1.14) — Done: wait for preemption signals before
syscall.Exec05739d6f17/21cfadf0dc; SSE guard restored inasyncPreempton 38667edc0ed81; ignore SIGPROF when profiling disabled2556eb76c8; riscv64’s g register not saved76661d12e8. - Network poller: from the netFD select loop to the runtime-integrated epoll/kqueue/IOCP poller — Done: netbsd netpoll overrun detection in sysmon
cb95819cf6. - Timers: timerproc goroutine → per-bucket heaps → timers on Ps — Done: timer latency fix: expired timers treated like steal-able work
8fdc79e18a; adjust only when neededb4b0144652; skip timer stealing for timerless Psfc116b69e2,89a6540d8a,e02ab89eb8;whenandperiodstrictly validatedb78b427be5,b635e4b808;timerWaitingP field fixd2d155d1ae. - Channels and select — Done: sudog
successfield30a68bfb80,releasetimeremoved78a1064d5d; nil-channel cases omitted from selectgo’s orders8a984e8e3f; stack shrinking disabled in the activeStackChans race windoweb3c6a93c3; race acquire/release order35455fff0e;df68e01b68. - sync.Mutex, RWMutex, WaitGroup, Cond, Once — Done: RWMutex race semantics and Once copy documented
b4f3d52f6a,f8376a55b0; sync special import case removedc305e49e96. - Runtime lock ranking (static lock order checking) — Done: held-lock assertions
53c9b9588a, sched.lock assertionsd42b32e321, nosplit dropped from primary functions989ab8a7d6, newstack panic at acquireLockRank fixb246c0e12f, tighter systemstack assertions420c68dd68, new partial edges (above). - Goroutine and M lifecycle: caches, ids, LockOSThread, Goexit, cgo extra Ms, deadlock detection — Done:
lockedgstatus dumpbc0b198bd7. - Stop-the-world, safe points and GC–scheduler interaction — Done: gcBgMarkWorker global pool
e1faebe7b4; stack shrinking race windoweb3c6a93c3. - Scheduler diagnostics: schedtrace, GODEBUG, execution tracer, block/mutex profiles — Done: user-visible
GODEBUG=inittrace=17c58ef732e.
Other changes
- syscall.AllThreadsSyscall user-visible — POSIX semantics for Linux syscalls
d1b1145cac,7e97e4e8cc1.17 (1.17 fixes). - MADV_DONTNEED default user-visible —
05e6d28849. - Internal ABI for assembly routines internal —
50af50d136,a313eec386. - os ioutil move user-visible —
3d913a9266. - Misc internal —
39b5276914,7bbd5ca5a6,4149493443,9fed39d281,565ad134c9,bda37a0b8a,61debffd97,8414b1a5a4,6b37b15d95,3a778ff50f. - sync doc internal —
d902791b50.
Data structures and type metadata
From Runtime data structures and type metadata (Go 1.0–1.17)
Map seed rotation on clear, itab and GC-map content-addressable symbols, append growth keyed by capacity, Zero buffer, exported/non-exported interface method split, notinheap pointers indirect.
- Hash map core: from the first hashmap.c to the 8-entry bucket design — Done: hash seed rotated when a map is cleared (
93810ac1f4,1a119edd8b), nomemclrcall for keys inmapdelete_fast*(f979d072d3). - Map fast paths and compiler/runtime specialization — Done: no
memclrcall for keys inmapdelete_fast*(f979d072d3; Pointer deletes -16..-30%). - Hash functions and algorithm tables: memhash, AES hash, fallback hash — Done: seed rotation on clear (
93810ac1f4,1a119edd8b). - Compiler-generated equality and hash functions — Done: shared not-equal label (
c95bd2e6a9). - Runtime type descriptors: layout, shrinking and name encoding — Done: GC-map and itab symbols content-addressable (
17344d55d6,cecb7a1cf3), unreachable-method sentinel (0ab72ed020), exported/non-exported interface method split (8f26b57f9a, len = exported, cap = all), pointers togo:notinheaptypes stored indirectly (009d714098). - Interface values, itabs and type assertions — Done: content-addressable itab symbols (
cecb7a1cf3), plugin-exported types marked used in interface (86954d5246). - reflect.Call, MakeFunc, method values and argument-frame GC precision — Done: pending register ABI:
internal/abiconstants zero under regabi (8cfbf34dd91.17). See register ABI thread. - reflect performance, caches and API additions — Done:
Zerobuffer (8925290cf7), DeepEqual depth removed (77a11c05d6), multiple struct tag keys (5d12434eee), Convert int-to-string regression fix (f0ff6d4a67). - memmove, memclr, duff routines and pointer-write atomicity — Done: memclrNoHeapPointers atomicity documented (
68058edc39). - internal/bytealg and string/byte comparison primitives — Done: riscv64 Count (
19f6422e00), mips64x Equal (4f597abe77), CBZ on arm64 (99d6e3eec2), BP-clobber fix (c6a11f0dd2),IndexStringfix (11cdbab9d4). - Slices and append: growslice, makeslice and string/slice conversions — Done: growth regime decided by old capacity (
2333c6299f). - internal/reflectlite and checkptr — Done: reflectlite error includes Kind (
c19725016d).
Other changes
- Misc internal —
funccompilemade non-reentrant (d20298e1c7), struct-tag multiple-keys docs (9b8c272558).
Diagnostics and knobs
From Diagnostics and knobs (Go 1.0–1.17)
runtime/metrics introduced with histograms; consistent memstats; default to MADV_DONTNEED; race on darwin/arm64; msan memmove.
- Race detector integration — Done: user-visible darwin/arm64 (
b53df56001);raceacquire/racereleaseorder swapped in chan send/recv and select to follow the memory model (35455fff0e); arg maps for sync/atomic (0932dc2118); instrumentation no longer clobbers the frame pointer (8c39bbf9c9). Left open: nothing noted. - Heap profile accounting and MemStats — Done:
next_gcatomically accessed (f5c6875f32); MemStats copied field by field (39e335ac06);heap_allocremoved (ae585ee52c); stacks, work-buf and prog-bits stats replaced by consistent stats (f77a9025f1);sysMemStatsmethods nosplit (22d2b984a6);allocs-by-sizebucket fix (8db7e2fecd). Left open: nothing noted. - runtime/metrics — Done: user-visible package interface (
2159c26ceb); memory metrics and baseRead(b08dfbaa43); heap object count (07c3f65d53); heap goal and GC cycle count (a8b28ebc87); allocation and free size distributions (8e2370bf7f);timeHistogramand GC pause distribution (36c5edd8d9,d39a89fd58); goroutine count (80c6b92ecb); wording tweaks (48a1a51898);Readcaveats documented (e0d20e52ee); bucket fixes (8db7e2fecd,b116404444); explicit boundaries (ae97717133); unit and cumulative flags (32afcc9436,6250833911); panic message (4c668b25c6). Left open: metric set is partial relative to MemStats (filled in 1.17). - GODEBUG, runtime/debug, debug log and traceback knobs — Done: user-visible default back to
MADV_DONTNEEDon Linux (05e6d28849), afterMADV_FREEfrom 1.12 gave confusing stats; allocation of too-big stacks error improved (331614c4da); stack trace elision uses inlined function name (e8de596f04). Left open: nothing noted. - MSan and sanitizer integration — Done:
__msan_memmoveused for moving data,msanreadsplit to fields (07cba70d57); dummymsanmove(eb21b31e48). Left open: nothing noted.
Other changes
- Misc internal — ARM64 indexed load/store (
202aa085ab).
OS layer, stacks and panics
From OS interface, stacks and panics (Go 1.5–1.17)
C→Go call path simplified, GOOS=ios, openbsd/amd64 and arm64 on libc, syscall.AllThreadsSyscall, high-resolution Windows sleep, mlock workaround reverted, M-reentrant nanotime1.
- New and ported OS/arch targets, 1.5–1.17 — Done: GOOS=ios (
a413908dd0,869c02ce1f, entry points0040adfd0f,f1e3c8f142,3923460dda), darwin/arm64 without cgo (72dec90bfd,a0a44397e9,7c8d82e92b,28e549dec3,7f688d18c0), cgo on linux/riscv64 (393f2bb067), openbsd/mips64 (4d6dfd64c1,55f8d56c31,9c91cab0da), netbsd/arm64 fixes (8ab020adb2,1f4d035178,567ef8bd8e),darwin/armremnants removed (d277a36123). - Tracebacks, symbol tables and
runtime.Callers/CallersFrames— Done: print faulting instruction on SIGFPE (88c094c96a), compact FUNCDATA indices (f96b62be2e),debug.SetPanicOnFaulterrors get anAddrmethod (d91d0762c7). - Defer, panic, recover and Goexit (runtime side) — Done: removal of open-coded defer entries in all recover cases (
a5a5e2c968). - Signals: masks, forwarding, sigaltstack and the unified Unix signal layer — Done: signal 34 for musl setgid (
49b017fe59), mlock reverted (92bda33d27),needmblocks signals before allocating an M (368c401164), signal handler checks g0 last (3a778ff50f),iscgodoes not block nptl signals (b0b0d98283), Windows ctrl handler no longer exits (c0dded04f7,8cfa01943a),os/signaldeadlock withAllThreadsSyscallfixed (fd6ba1c8a2),setitimerper-process (bd519d0c87). - Asynchronous preemption: signal plumbing, injected calls and per-arch support — Done: wait for/avoid preemption signals around
syscall.Exec(05739d6f17,21cfadf0dc,64fb6ae95f), always on for darwin/arm64 (7c8d82e92b), 386 SSE guard restored (67edc0ed81), riscv64 X27 not saved (76661d12e8). - cgo runtime support: pointer checks, callbacks, extra Ms, C-to-Go call path — Done: simplified C→Go path (
30c1887873),call16everywhere (9dc65d7dc9,40bff82885),tidy cgocallback(c91dffbc9a), Windows callback compile tidy (bda37a0b8a), Android NDK 22 (1d78139128). - Shared-library and buildmode entry points (c-archive, c-shared, plugin, shared) — Done: iOS entry points (
0040adfd0f), Windows PIE symbol export (e463c28cc1), automatic dynamic library linking in the linker (7ee2622443). - vDSO, time sources and process-wide randomness — Done: reentrant nanotime1 (
a93a4c1780), vDSO/vsyscall fallback (3caaaddffd), mips64 return check (df81a15819), riscv64RDTIME(cf9b4f63a5), Darwinclock_gettime(ae76f6e962). - Darwin and OpenBSD move to libc; Solaris and AIX libcall; syscall wrapper layer — Done: openbsd/amd64 and arm64 to libc (listed above),
_exiton darwin (8438a5779b),syscall.Execpreemption guard (64fb6ae95f,05739d6f17),accept4on illumos (9cec50f50c), FreeBSD errors (4d27c4c223),cgo_import_dynamicfor libc.so (66ee8b158f). Left open: openbsd/386 and arm remained on raw syscalls until 1.17. - Windows runtime — Done:
CreateWaitableTimerExusleep (515e6a9b12,6965b01ea2), ctrl handler no longer exits (c0dded04f7,8cfa01943a),DuplicateHandleerror detection (682a1d2176), event handle freeing (dbab079835), sub-word callback args (532c199ee5), windows/arm callbackasm1 (4d048194cd), abort address on windows/arm (0252cfd84d). - CPU feature detection (
internal/cpu), auxv parsing andGODEBUG=cpu.*— Done: arm64 consolidation (de932da453), explicit no-init archs (feb984c96b), s390x/ppc64/AIX moved (f8aecbbff5,96bd0b1d4c), darwin/arm64 (c155931974), FMA/OSXSAVE (dda2991c2e), benchmark CPU label (b7a2d413a3), netbsd/arm64HWCap(1f4d035178). - Assembly-level runtime entry points: memequal/cmp/IndexByte, hashing, atomics and ABI wrappers — Done: CBZ in assembler (
a61a3c378d), arm64 memmove and indexed loads (d5388e23b5,202aa085ab),LoadAcq64ppc64 (15ead857db),And32/Or32(ad61343f88), atomic prefix cleanup (afba990169), nice panic on unaligned 64-bit (83317d9e3c), BP-clobbering asm fixed (c6a11f0dd2), riscv64 write barrier (ae82ee4016), wasmStorepNoWB(c0602603b2),call16(9dc65d7dc9,40bff82885), remove memstats (c5dea8f387,ae585ee52c,32d0eaa44e), liveness knob removal (8414b1a5a4), cheapclone(0941fc3f9f),startupRandomDatalocation (4149493443). - Debugger function calls and conservative preemption frames — Done: removal of liveness knobs (
8414b1a5a4).
Other changes
- Linux, vDSO, time and auxv internal — user-visible syscall: support POSIX semantics for Linux syscalls (
d1b1145cac) - other runtime/OS plumbing internal — all: replace Replace(…, -1) with ReplaceAll(…) (
6f99b33c18) - signals and crashes internal — user-visible runtime: remove remnants of signal stack workaround (
4d89b3231d); user-visible runtime: prevent stack growth after fork in runtime.sigfillset (6fa06d960b) - Darwin/iOS internal — crypto/x509: use macOS/AMD64 implementation on macOS/ARM64 (
ade5161f51) - Traceback and cgo callback cleanup internal — Removed tracebackinit and unused skipPC, and updated the cgo callback description. (
ba97be4b58,f89d05eb7b) - Use os.ReadFile and friends internal — Switched code to os.ReadFile, os.WriteFile, os.CreateTemp and os.MkdirTemp. (
4f1b0a44cb)
Compiler frontend
From Compiler frontend (Go 1.10–1.17)
//go:embed, go:notinheap hardening, type-switch and method-value inlining, early devirtualization, export-data hash as fingerprint, init-cycle reporting fix.
- dev.regabi: from
*Nodestruct to their.Nodeinterface and concrete node types — Done: function nodes no longer declared / pushed ontoFunc.Dcl(a4171d85d7,ace37d35f1);-d=dumpptrsfor Dump (c31540364c). Left open: nothing noted. - Indexed export format and the export-data lifecycle — Done: export-data hash used as the package fingerprint, unifying the linker’s plugin/shared-object hash (
7795523910);//go:notinheapannotation exported to the object file (a9c75ecd3d); [dev.link] defined-type symbols referenced by index (69748f0ce4); fingerprint-read cleanup (84a62453e5). Left open: nothing noted. - The syntax package: parser, scanner, source reader, positions and error recovery — Done:
BadExprplacement and handler fix (e0cb80e4d1). Left open: nothing noted. - Constants: Go 2 number literals, evconst, untyped conversion and go/constant — Done: typecheck sets correct untyped type (
0dc369b127), untyped mixing refactor (06f7e655d1). Left open: nothing noted. - Language version gating (
-lang) and language changes implemented in the frontend — Done: user-visible//go:embed8bde9b320e,ec9470162f,54198b04db,0575e35e50. Left open: nothing noted. - Package initialization order, static initialisation and init functions — Done: exponential init-cycle reporting fixed (
6598c65646),fninitcalled earlier (f4936d09fd, with237410547bmaking funchdr/funcbody save and restore arbitrary Curfn/dclcontext). Left open: nothing noted. - Directives and pragmas in the frontend (
//go:handling) — Done:4f915911e8,37f261010f,22053790fa,a9c75ecd3d,009d714098,8bde9b320e. Left open: nothing noted. - Inlining-related frontend work: export of bodies, type switches, closures, devirtualization — Done:
8fe372c7b3,5736eb0013,5cc43c51c9. Left open: “inlinable type switches are probably too uncommon to” optimise their variable encoding (5736eb0013). - The legacy typechecker: error quality, alias/recursive-type handling and type checking order — Done:
0e85fd7561,c216ae80c9,7ee35cb301,dc59469f51,ad0ab812f8,d3f6e2f300,0dc369b127. Left open: nothing noted. - Lowering in order/walk and the shape of runtime calls emitted by the frontend — Done:
790fa1c546,82c45eb681. Left open: nothing noted. - checkptr instrumentation and compiler debugging flags — Done:
e94544cf01,3bac5faa4a,c31540364c. Left open: nothing noted. - Types package internals and type printing — Done: variable-length
TRESULTStype for SSA (f554eb7bc3),IsUintptr(518369601c). Left open: nothing noted.
Other changes
- RISC-V build modes user-visible —
4f2d213476,8eb846fd37. - msan memmove internal —
07cba70d57. - Runtime select scase cleanups internal —
d36bc7d78a,fe23ba4a14. - Frontend cleanups preceding dev.regabi internal —
ac875bc923,be9ed03f1a,dc025c0f9b,518369601c,2c95e3a6a8,806f478499,237410547b,f3b58edd03,8773d14164,50b7171af0,c06a699fb6,178b0f59ff,bccdd31252,f121e0eddd,e3bb53a768,a745171e6b(SSA type comparison),128f4e51f2([dev.link]). - AST fmt and comments internal — Improved fmt for AST nodes and updated comments on Node types. (
07e4f0fd4b,4f63e0a1f8)
Middle end and SSA optimizer
From Middle end and SSA optimizer (Go 1.10–1.17)
Late call expansion turned on for all call kinds (expand_calls), early devirtualization via staticValue, inlining of for loops and go/defer arguments, escape analysis of known calls, and removal of untyped rules (threads: Late call expansion, Early devirtualization, Inlining, Escape).
- Prove pass: unsatisfiability, partial-order facts, loop bounds-check elimination — Done: indirect if-to-phi connection check (
a6755fc0de); unsigned comparisons to 0 optimized (e30fbe3757). Left open: nothing noted. - Escape analysis: the esc.go fixes, the escape.go rewrite, and the move to package escape — Done: known-call analysis via
staticValue(c0417df156),mustHeapAllocreturns a reason (095e0f48a1) and handles OCLOSURE/OCALLPART (82c45eb681), escape reason for MAKESLICE with no cap fixed (e572218d12), method-value and variadic rewrites moved before escape (681ba430771.15,9f4dd09bf51.15). Left open: nothing noted. - Inlining: budget, mid-stack inlining, closures, and what became inlinable — Done: for loops (
497ea0610e), staticValue (1bcf6beec5), improved single-return inlining (f2c0c2b902), go/defer argument inlining (4fb4291388),Defnfor inlinee params (cced777026), miscompile fixes (35693d037f,7191f1136b,89b44b4e2b). Left open: labeledforloops, per commit message (“future CL”). - Early devirtualization and static value tracing — Done: early devirtualization of interface method calls (
5cc43c51c9), graceful failure and promoted-method fixes (aa4f48b751,e62adb1c0b), reassignment checks (7191f1136b,063a91c0ab,89b44b4e2b). Left open: only locals initialised once are handled (staticValue’s reassign analysis). - Open-coded defers and defer lowering — Done: late call expansion handles simple defer and
callDeferStack(4ad5dd63a7,68bc950583,bb46b60d29),go/deferargument fixes (bdb480fd62,76a615b20a,deaf29a8a8). Left open: nothing noted. - Late call expansion and the SSA side of the register ABI — Done: the late call expansion series above, begun in
35e413c537and44c0586931, with4d7abd7ae6,ad8447bed9,ccf89bef43(store call args in the call block),c3fe874f25(avoid generating CSEs; maintain debug names). Left open: “does not work yet for SSA-able aggregates” initially (4d7abd7ae6), later fixed byad8447bed9. - Rewrite-rule generator, typed Aux/AuxInt, and rule syntax — Done: untyped rules removed (
79a3482d9e), reassociation rules (d556c251a1),ecb79e8afaregenerated missing condition. Left open: nothing noted. - Memory-op optimizations: memmove, Move/Zero, dead stores, nil checks — Done:
85bb4294c0alias detection (walk), memequal(x,const,1) (f2ee58b6bb), keep call args. Left open: nothing noted. - Arithmetic strength reduction, divisibility and intrinsics — Done: reassociation
(op (op y C) x|C)(d556c251a1), 32-bit magic multiply (c1afbf69c7), unsigned comparisons to 0 (e30fbe3757). Left open: nothing noted. - CFG and control-flow passes: branchelim, fuse, shortcircuit, phiopt — Done: shortcircuit and phi flags removed (
ea37a65af6). Left open: nothing noted. - Compiler front of walk/order: ordering fixes and the dev.regabi IR refactor (package walk) — Done: OANDNOT lowered in SSA (
a19cf510af), selection fixes,aliasedimproved (85bb4294c0). Left open: nothing noted. - Diagnostics for the optimizer: ssa.html, GOSSAFUNC and optimizer logging — Done: GOSSAFUNC matching and directory output (
bca0b44629,f4cbf3477f,234e23d763). Left open: nothing noted.
Other changes
- Late-expansion type fixes internal — OpIData/OpLoad types and leaf types in expand_calls (
92c732e901,c306fd6d0b,7dc5d909fb,0a02371b05,fa90aaca7d,f8d80977b7,2414e1f17b),CvtBoolToUint8(cde5fd1c0f), generic op type check (09dd2b004a), volatile copies not short-circuited (304f769ffc), zero-use values invalidated in rewrite (cdc635547f). - Types and walk helpers internal —
Haspointersmethod andIsUnsafePtr/IsUintptr(623652e73f,9cf88333e8,518369601c),go:notinheapnot allowed on heap/stack (d9a6bdf7ef) and storeType (933721b8c7),OVARLIVEattached to calls (1f45216694),nodeNeedsWrapperremoved (5f1b12bfbe), arm64 conditional pseudo-ops in AuxInt (ae658cb19a), read-only static temps content-addressable for dev.link (289c238a33), race instrumentation frame pointer (8c39bbf9c9),racefuncenterfpremoval (0387bedadf), PPC64 shift regression (0ae3b7cb74), REFLECTMETHOD forreflect.(*rtype).Method(ed8079096f), small refactors (17553c6e71,c57c0212eb,0b1cec7ad3,6f02578f9c,d4a5797b88,d317ba5d44,349a287646,8773d14164), cross-area math/big and runtime commits (d54a9a9c42,78a1064d5d,c305e49e96), and checkptr&^handling: walk marksOANDNOTas Implicit when rewriting it toOANDso checkptr still recognizes it (e94544cf01; the rewrite itself was later deferred to SSA bya19cf510af).
Backends and assemblers
From Backends and assemblers (Go 1.12–1.17)
typed aux finished everywhere; late call expansion (AuxCall); 387 removed, softfloat added; arm64 SHA/atomics/SIMD; riscv64 g moved to X27 with PIE; content-addressable symbols; register maps deleted.
- Register-based ABI (ABIInternal) and ABI wrappers — Done: asm ABI selectors for runtime packages (
dd58239dd2);GOEXPERIMENT_REGABIasm macro (4d1cecdee8);-S=2dumps symbol ABI versions (982ac06f3d); the late call expansion groundwork (see next thread); cmd/go/asm get-linksharedplumbing (56b783ad94). Left open: no register assignment in the compiler yet. - Late call expansion, AuxCall and the expand_calls pass — Done:
AuxCallintroduced (b4ef49e527,3c85e995ef,39da81da5e), new LE ops (35e413c537), expansion before late opt (44c0586931), OpArg expansion delayed (15f01d6ae9), regression switch (c78c79f152), correct leaf type (f8d80977b7). Left open: still guarded bygo116lateCallExpansion; results are not expanded late. - Rewrite-rule generator (rulegen): ellipses, commutativity loops, typed aux — Done: ARM, ARM64, AMD64, s390x, mips64 rule files completed;
=>-only enforcement for ARM;aacbd7c3aa. Left open: nothing noted. - amd64 lowering: read-modify-write, load-op, addressing modes pass, intrinsic-friendly rules — Done: And/Or atomic intrinsic (
44dbeaf356), typed-aux completion (39a426d356). Left open: nothing noted. - arm64 backend and assembler — Done: SHA512/SHA3/SIMD instructions (
93eeb819ca,3036b76df0,d7ab277eed,3089ef6bd7,dfdc3880b0,fa04d488bd,5d0b35ca98), CAS (15131caeaa), atomic And/Or/swap intrinsics (cdb19b4dba,ecc3f5112e), darwin/arm64 PIE and c-shared (234de9e1c2,f8e554021b,b85c2dd56c), call reloc fix (3f7b4d1207), unsigned compare to 0/1 (06337823ef), EON (01aad9ea93), VMOVQ fix (cd99385ff4), frame pointers made unconditional (5c2c6d3fbf),a86b6f23f0. Left open: nothing noted. - riscv64 port: assembler and compiler — Done: g moved to X27 (
6f45b39e4d), Duff’s devices, PIE/buildmodes, extension elimination (320cc79002),8b51798304removes X27 and S11 register names, branch-pseudo fix (0433845ad1), MOV for extensions (8a013233ac). Left open: nothing noted. - PPC64 / POWER backend and assembler — Done: MADDLD, SUBFIC, combined shifts, EXTSWSLI, MULLI, bclrl hint (
e7c7ce646f,7615b20d06,967465da29,a424f6e45e,bdab5df40f,cb674b5c13), TOC symbols static (076dc2111b), stop removing NOPs (7d7bd5abc7,46ca7b5ee2). Left open: nothing noted. - s390x backend: compare-and-branch, intrinsics, assembler — Done: shift/mask (
854e892ce1), addressing modes (17ae587383), strongly typed rules finished (03eb7e20e4), atomics And/Or (646531c52a). Left open: nothing noted. - 386, ARM (32-bit), MIPS/MIPS64 and the 387 removal — Done: 387 removal (
fe2cfb74ba), softfloat (04b8a9fea5), ARM typed rules, CMN fix (694025e74f), MIPS atomic And/Or (e5ad73508e). Left open: nothing noted. - WebAssembly backend — Done:
8acbe4c0b3. Left open: nothing noted. - math/bits, atomic and runtime intrinsics (cross-architecture) — Done: And/Or atomics. Left open: nothing noted.
- SSA infrastructure passes: layout, regalloc, scheduling, flagalloc, block shape — Done:
1c0d1f4e97,b2a8317b31,91b7619310,bf833ead62,37a32a1833,6c64b6db68(no constant fold of divide by zero),a4b95cd092(comparison folding fix). Left open: nothing noted. - Safepoints, unsafe points and stack maps for asynchronous preemption — Done:
84d7a85089,01f99b4e95,32a84c99e1. Left open: nothing noted. - Debug info generated by the backend: statements, location lists, line tables — Done:
63fd764502,9ef65ff137,4220d67084. Left open: nothing noted. - New object file format and content-addressable symbols (dev.link, assembler side) — Done: content-addressable symbols and cleanup (hashes above),
c89251204e. Left open: type descriptors are not yet dedup’d (526d99a49asays deduplication is “just an optimization, not a requirement … until we get to type descriptors”). - Assembler directives and tooling: PCALIGN/ALIGN, FuncInfo flags, prologue handling — Done: asm refactor and ABI selectors (
dd58239dd2),8247da3662. Left open: nothing noted.
Other changes
- Object/asm cleanups internal — objfile.go/objfile2.go merged (
3fc2e6b0ce),LSym.RefIdxremoved (c8eea1633e), arm64 VLD[1-4]R post-index check (0e19aaabc0), arm64 load/store immediate encoding refactor (308ec220a2), riscv64 reg-to-reg moves (4a67825628). - darwin/arm64 internal link, PIE, c-shared; ios/amd64 user-visible —
234de9e1c2,f8e554021b,b85c2dd56c,431d58da69(GOOS=ios GOARCH=amd64 simulator, forcing external linking and pie),6c0135d377. - Hard-coded frame pointers user-visible —
5c2c6d3fbf. - Misc internal —
c9c64886ef,3f7b4d1207,751c37fd62,a444458112,0ecf769633,bdab5df40f,17553c6e71,38d1ec8c9d,56b783ad94,6265ed7452,0434d40934,be38746eb4,f0cf4d4d7f,f765dcbd5c,0f92cd75cf,cf3bf9959c,d08bab99b7. - Reject misplaced go:build user-visible — cmd/asm rejects misplaced go:build comments. (
85f829deb8) - Backend cleanups internal — Code cleanup and ppc64 MOV optab reorganization with unused classes removed. (
94b3fd06cb)
Linker and object files
From Linker and object files (Go 1.10–1.17)
sym.Symbol deleted; pclntab split into pcheader/funcnametab/pctab with generator symbols and hashed symbols; streaming external relocations; UsedInIface/R_USEIFACE/R_USEIFACEMETHOD method pruning; darwin/arm64 internal linking and code signing.
- New object file format and the loader (dev.link) — Done:
b97212d1f1deletessym.Symbolandsym.Reloc,4e974292d4sym.Attribute,de1f07d56dsym.Symbols,b8c5d6871fthe SCONST type;80b287fd28removesloader.Reloc;4a92371291/27e3778793drop the “2” suffixes. Content-addressable symbols arrive (27342e5bd9),4f217d5aaa(short hash for short symbols),0e3114871efixes the collision check,f204ca3051drops hash maps after loading; the package hash becomes the compiler fingerprint so the linker never reads export data (7bc3b6e5e4) and “safe mode” is removed (4cc043d883); symbol attribute setting is made atomic (721716ca1c1.15,847b9be3f6); builtins that are referenced but undefined are reported (8e5778ed70);83ed734df0pre-resolves package references to avoid a map lookup per cross-package ref;ce36e7f79echanges the local object/index representation;b22af9b407records only the first reach inReachparent. Left open: nothing noted for the loader itself. - Wavefront conversion of linker passes to the loader; sym.Symbol removal — Done: new reloc pass on each architecture (
0586fbb9d3s390x,8f697c7ac8mips64,9408417d44mips,9f80d91b13riscv64,afbf9d47ddarm,dc048e24abarm64,fee06a6bdappc64) and old reloc pass deleted (85298173f6); asmb2 converted per OS (75ca90e309darwin,fdb9249d82windows,25e9417b98ELF/amd64,744641ef37wasm,88a12a99b4plan9) then moved into generic functions (c551318046,7260ad6f52,13c1401b8e,ebdb15f7f8,c7ade964ba,c5a9b3d63a);2867a85541deletes the undef pass; then the final deletion ofsym.Symbol(b97212d1f1). Symbols’ section info becomes a 16-bit index in a lazily created pointerless array (9570fc8f711.15, -14% Loadlib alloc). Left open: nothing noted. - Linker performance and memory engineering — Done: custom deadcode heap (
7179e426e2: Deadcode 59.8ms to 42.2ms, allocs -95%) and slice reuse (78b96db04e), streaming relocs, generator symbols,586d0755e2(name expansion only when needed, Loadlib -6.4%),d08bab99b7(line table generation with less heap),188e995ae9(reduced alignment for symtab/elfstr),f204ca3051,64fdc8b47a,5402d40d5b“fix memory growth on dev.link”,ae3680b30bno reflection. Left open: nothing noted. - pclntab, funcdata and pc tables — Done:
ba9c639470carves outruntime.pcheader;1fdf5ba50cfindfunctab as generator symbol (allocation 172kB to 0);3067a8dc02pclntabState replaces globals;6ac9914383runtime.funcnametab(the FuncID still needed the name, later fixed by89cf569a45);9bdaf99966per-package filenames;5387cdcb24content-addressable pcdata;26407b2212runtime.pctabfor all deduplicated pc tables (alloc/op 26.4MB to 13.8MB on cmd/compile);c863e14a6cmoves the rest to generator symbols (alloc 13.9MB to 6.4MB, Pclntab time -24% but Asmb +50%);7dbd40babf,a9a1217112handle runtime.text/etext uniformly;575ea5a87asets runtime.text to the address of the first function;b85033d153AIX fix;f0cf4d4d7ffixes last-instruction file/line in the line table.db924fd99ealso removes the compile-time itablink symbols: the linker now generates thego.itablinkslice. Left open: pclntab still relocation-based for function entries andmoduledatapointers (continues in 1.18). - Dead-code elimination and method pruning — Done: UsedInIface / R_USEIFACE / R_USEIFACEMETHOD (see Design),
3a34395363always marks runtime.buildVersion/modinfo,7e54aa2c25does not mark GoType reachable under -linkshared,98f8454a73no longer decodes shared-library type symbols in deadcode. Left open: itab method edges still strong (untile8700f1ce61.17). - DWARF generation in the linker — Done: include dirs (
fb184a383e),d08bab99b7,bc1dbe58cf,27144d166bCU-centric methods,d1a186d29cparallel,ef9e8fbfbcremove dwarf2.go,96ec09da48,8ca2eae206,1e6ad65b43DWARF combining on macOS ARM64,7e25bdba5e. Left open: nothing noted. - DWARF compression and Mach-O dsymutil combining — Done:
e8f918535e,1e6ad65b43,7e25bdba5e. Left open: nothing noted. - Symbol ABIs: stable ABI0 vs ABIInternal in the linker and object files — Done: ABI alias handled in loader (
2a00c137b11.15 folds the zero symbol check),2b8b06ebbfadds theregabiGOEXPERIMENT. Left open: nothing noted. - Mach-O and Darwin support — Done:
ffd95aadcd__DATA_CONST,1aa43a53beexport only necessary symbols dynamically,7d6b304f12/234de9e1c2/f8e554021bplugin/PIE/c-shared on macOS/ARM64,e4ec30965b/627959eb04/b85c2dd56cinternal linking and cgo on darwin/arm64 made default,3a76627df4-race,6f84993e90/0aba8f24cb/cf7aa585accode signing,4bc5f6f45fDYLD_INFO placement,f46a5b1e45PIE internal on darwin/amd64,b110733327/5abda2618blarge addends,612b119447,c321430bdc,59a702aa6aMach-O relocations in mmap,7ee2622443auto-linking dylibs for cgo_import_dynamic (Security/CoreFoundation only linked with x509). Left open: “this signature will likely be invalidated when we stamp the buildid” (kept to size the load command). - PE / Windows — Done:
56dac60074ASLR for c-shared, resource-section fixes for LLVM windres (663cd862ed,8981092d71,c9fb4eb0a2,033390d9ad,48dfa2b2dc),cb84d831c9windows/arm all-PIE. Left open: nothing noted. - Build modes: PIE, plugin, c-shared, c-archive, shared libraries — Done: c-shared ASLR on Windows (
56dac60074), darwin/arm64 plugin/PIE/c-shared (7d6b304f12,234de9e1c2,f8e554021b), internal PIE darwin/amd64 (f46a5b1e45),cb84d831c9windows/arm all PIE. Left open: nothing noted. - Host object loading and external linking — Done:
9138a2a67fno duplicate DT_NEEDED,38367d098ededup shared libraries on openbsd,6398b4725c/75789880a6C static symbols in the symbol table,a52a5d8a43PLT sections executable on ELF,e61d17d3b9,740851bacaavoid-Twith lld,a36ba090fdalwaysR_X86_64_PLT32for SDYNIMPORT calls,f4e7a6b905. Left open: nothing noted. - Architecture ports and trampoline insertion — Done:
3a63d04d2eriscv64 TLS,15eaa870e1external linking linux/riscv64,0b798c46cdloadelf riscv64,bb48f9925copenbsd/mips64,e508c1c67bMIPS64 ELF relocations,d41b9066dadebug option encouraging ppc64 text splits,098504c73f1.17,04b8a9fea5GO386=softfloat user-visible,a2a2237ae0ARM DYNIMPORT jump,623319a847arm64 SDYNIMPORT internal linking. Left open:098504c73f1.17 may generate unnecessary trampolines when packages turn out adjacent. - GOEXPERIMENT plumbing and tool configuration — Done:
2b8b06ebbf. Left open: work “expected to extend over a few releases”. - Build identity, buildinfo and reproducibility — Done:
3a34395363,e8f918535e,79fb187be4cgo-trimpath. Left open: nothing noted.
Other changes
- Further loader / asmb cleanup internal —
6ea7a196d0,781c94e4c6(mmap on more platforms),9a097ea8f2,69261d1f36,ff1a2d02dc,4e03dac77c,2eb475be6b,9c3c8c1b12,1024cabc48,d72ea427c6,9963add628,7f872be02f,1ccd585e94,76a459b361,8e4ab9cb4c,49b12dcca9,25b283bf8c,0ca6098f70,e1c0b751b5,086828ac55,0fb1517b3f,a89fd32316,b473a1f8da,364d320504,3c3cc19564/1e9381207e(container/subsym method names),8c46cb1bf5,130ede0d9e,18ee349880,f3a29d3a34,ea708dc94c,37aa653570,2369e01234,880f43c87f,317c1ca9f2,365059e1d1,5c9b540378(old goobj reader deleted),ccc951637b,9ef3ee3396,db7d42acac/7be9158ce5(ELF constants removed in favour of debug/elf),404899f6b5(stackmap alignment),b194b5151f,1308f11897(R_AARCH64_LDST16_ABS_LO12_NC). - Content-addressable string constants internal —
27342e5bd9(proof of concept). - Sentinel unreachable method internal —
0ab72ed020. - Misc internal —
f547046850,5698ec36a8dump symbol info on crash under -v,c45d78013fignore fallocate permission errors,2c80de74d5,1426a571b7,ccb2e90688exit before Asmb2 on error,b9365488f0/ef603bead5GOARM=7 on Android,6a64f6dc31,953d1feca9introducesinternal/execabs,eb330020dc,79fb187be4. - builtin conversion internal —
cbfced7415basic types to builtin symbols. - Skip symtab entries internal — Skips symtab entries for selected file-local symbols. (
8aa036e913)