]> Cypherpunks repositories - gostls13.git/log
gostls13.git
5 weeks ago[dev.simd] cmd/compile: zero only low 128-bit of X15
Cherry Mui [Mon, 8 Dec 2025 17:14:24 +0000 (12:14 -0500)]
[dev.simd] cmd/compile: zero only low 128-bit of X15

Zeroing the upper part of X15 may make the CPU think it is
"dirty" and slow down SSE operations. For now, just not zeroing
the upper part, and construct a zero value on the fly if we need
a 256- or 512-bit zero value. Maybe VZEROUPPER works better than
explicitly zeroing X15, but we need to evaluate.

Long term, we probably want to move more things from SSE to AVX.

This essentially undoes CL 698237 and CL 698238, except keeping
using X15 for 128-bit zeroing for SIMD.

Change-Id: I1564e6332c4c57f9721397c92c7c734c5497534c
Reviewed-on: https://go-review.googlesource.com/c/go/+/728240
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
5 weeks ago[dev.simd] simd, cmd/compile: move "simd" to "simd/archsimd"
David Chase [Mon, 8 Dec 2025 18:24:12 +0000 (13:24 -0500)]
[dev.simd] simd, cmd/compile: move "simd" to "simd/archsimd"

Also removes a few leftover TODOs and scraps of commented-out code
from simd development.

Updated etetest.sh to make it behave whether amd64 implies the
experiment, or not.

Fixes #76473.

Change-Id: I6d9792214d7f514cb90c21b101dbf7d07c1d0e55
Reviewed-on: https://go-review.googlesource.com/c/go/+/728220
TryBot-Bypass: David Chase <drchase@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
5 weeks ago[dev.simd] simd: add carryless multiply
David Chase [Thu, 4 Dec 2025 22:51:04 +0000 (17:51 -0500)]
[dev.simd] simd: add carryless multiply

now with comments, and also a test.

choice of data types, method names, etc, are all up for comment.
It's NOT commutative, because of the immediate operand (unless we
swap the bits of the immediate).

Change-Id: I730a6938c6803d0b93544445db65eadc51783e42
Reviewed-on: https://go-review.googlesource.com/c/go/+/726963
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

5 weeks ago[dev.simd] simd: replace checking loops with call to slice-checker
David Chase [Fri, 5 Dec 2025 15:17:27 +0000 (10:17 -0500)]
[dev.simd] simd: replace checking loops with call to slice-checker

the function was already there, it works, replace
a loop with a one-line call.

Change-Id: Ie6ff3706c676da6dfc214c0d69577e8e8afc1fb1
Reviewed-on: https://go-review.googlesource.com/c/go/+/727200
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
6 weeks ago[dev.simd] internal/buildcfg: turn GOEXPERIMENT=simd back on
David Chase [Wed, 3 Dec 2025 22:11:00 +0000 (17:11 -0500)]
[dev.simd] internal/buildcfg: turn GOEXPERIMENT=simd back on

Turn the experiment back on by default on the dev.simd branch, for
the ease of experimenting and development.

Change-Id: I89d6d9b616e620d2be21bb807aaf8b6de2788a97
Reviewed-on: https://go-review.googlesource.com/c/go/+/726660
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
6 weeks ago[dev.simd] all: merge master (5945fc0) into dev.simd
David Chase [Wed, 3 Dec 2025 20:43:09 +0000 (15:43 -0500)]
[dev.simd] all: merge master (5945fc0) into dev.simd

Merge List:

+ 2025-12-03 5945fc02fc doc/next: delete
+ 2025-12-03 dcc5fe0c62 api: promote next to go1.26
+ 2025-12-03 7991da1161 crypto/hpke: remove unused hybridKEM field
+ 2025-12-03 2729e87aa5 doc/next: pluralize 'result'
+ 2025-12-03 6e72f526cd doc/next/6-stdlib/99-minor/go/ast/76031.md: add BasicLit caveat
+ 2025-12-03 fa30b68767 go/{ast,doc}: update BasicLit.ValueEnd as well as ValuePos
+ 2025-12-03 32a9804c7b cmd/link: don't update offset of existing ELF section name
+ 2025-12-02 509ddf3868 cmd/compile: ensure bloop only kept alive addressable nodes
+ 2025-12-02 7cab1b1b26 doc: pre-announce removal of gotypesalias and asynctimerchan GODEBUG flags
+ 2025-12-02 1a64db3a4b spec: remove restriction on channel element types for close built-in (bug fix)
+ 2025-12-02 2e06fa6b68 doc/next: release note for scheduler metrics
+ 2025-12-02 77c795011b doc/next: document cgo call overhead improvement
+ 2025-12-02 6e4abe8cef doc: mention stack allocation of slices
+ 2025-12-02 88c24de8b5 doc/next: add section for Green Tea
+ 2025-12-02 043b9de658 net: parse addresses without separators in ParseMac
+ 2025-12-02 e432b4f3a1 cmd/compile: more generated equality function tests
+ 2025-12-02 c1acdcb345 crypto/x509: prevent HostnameError.Error() from consuming excessive resource
+ 2025-12-02 8ae5d408ed spec: more precise prose for built-in function new
+ 2025-12-02 c5c05a0e43 cmd/go: add test checking version with experiment is valid
+ 2025-12-01 f22d37d574 runtime/internal/testprog: log initial SchedMetrics GOMAXPROCS
+ 2025-12-01 8b5db48db1 net/http: deflake TestClientConnReserveAndConsume
+ 2025-12-01 94616dad42 internal/runtime/cgroup: remove duplicate readString definition
+ 2025-12-01 67851547d8 internal/runtime/cgroup: lineReader fuzz test
+ 2025-12-01 ac3e0ae51a doc: document go tool pprof -http default change
+ 2025-12-01 42e03bbd27 debug/elf: correct case of DWARF in comment
+ 2025-12-01 18015e8c36 doc/next: clean up some Go 1.26 release notes
+ 2025-12-01 4be545115c cmd/pprof: update vendored github.com/google/pprof
+ 2025-12-01 16c0f7e152 cmd/compile: run go generate for internal/ir
+ 2025-12-01 dc913c316a all: update vendored dependencies
+ 2025-12-01 1555fad47d vendor/golang.org/x/tools: update to 1ad6f3d
+ 2025-12-01 eec1afeb28 debug/elf: make check for empty symbol section consistent for 64-bit and 32-bit binaries
+ 2025-11-28 3f94f3d4b2 test/codegen: fix shift tests on riscv64
+ 2025-11-28 2ac1f9cbc3 cmd/compile: avoid unnecessary interface conversion in bloop
+ 2025-11-28 de456450e7 runtime/secret: disable tests under memory validating modes
+ 2025-11-27 67d4a28707 fmt: document space behavior of Append
+ 2025-11-27 c079dd13c0 runtime/secret: reorganize tests to fix -buildmode=shared
+ 2025-11-27 2947cb0469 runtime/_mkmalloc: fix log.Fatal formatting directive
+ 2025-11-26 cead111a77 internal/runtime/cgroup: stricter unescapePath
+ 2025-11-26 c2af9f14b4 internal/runtime/cgroup: fix path on non-root mount point
+ 2025-11-26 6be5de4bc4 internal/runtime/cgroup: simplify escapePath in test
+ 2025-11-26 481c6df7b9 io: reduce intermediate allocations in ReadAll and have a smaller final result
+ 2025-11-26 cec4d4303f os: allow direntries to have zero inodes on Linux
+ 2025-11-26 f1bbc66a10 cmd/link: test that moduledata is in its own section
+ 2025-11-26 003f52407a cmd/link: test that findfunctab is in gopclntab section
+ 2025-11-26 21b6ab57d5 cmd/link: test that funcdata values are in gopclntab section
+ 2025-11-26 c03e25a263 cmd/link: always run current linker in tests
+ 2025-11-26 9f5cd43fe6 cmd/link: put moduledata in its own .go.module section
+ 2025-11-26 43cfd785e7 cmd/link, runtime, debug/gosym: move pclntab magic to internal/abi
+ 2025-11-26 312b2034a4 cmd/link: put runtime.findfunctab in the .gopclntab section
+ 2025-11-26 b437d5bf36 cmd/link: put funcdata symbols in .gopclntab section
+ 2025-11-26 4bc3410b6c cmd/link: build shstrtab from ELF sections
+ 2025-11-26 b0c278be40 cmd/link: use shdr as a slice rather than counting in elfhdr.Shnum
+ 2025-11-26 0ff323143d cmd/link: sort allocated ELF section headers by address
+ 2025-11-26 4879151d1d cmd/compile: introduce alias analysis and automatically free non-aliased memory after growslice
+ 2025-11-26 d8269ab0d5 cmd/link, cmd/internal/obj: fix a remote call failure issue
+ 2025-11-26 c6d64f8556 cmd/internal/obj/loong64: remove the incorrect unsigned instructions
+ 2025-11-26 c048a9a11f go/types, types2: remove InvalidTypeCycle from literals.go
+ 2025-11-26 ff2fd6327e go/types, types2: remove setDefType and most def plumbing
+ 2025-11-26 3531ac23d4 go/types, types2: replace setDefType with pending type check
+ 2025-11-26 2b8dbb35b0 crypto,testing/cryptotest: ignore random io.Reader params, add SetGlobalRandom
+ 2025-11-26 21ebed0ac0 runtime: update mkmalloc to make generated code look nicer
+ 2025-11-26 a3fb92a710 runtime/secret: implement new secret package
+ 2025-11-26 0c747b7aa7 go/build/constraint: use strings.Builder instead of for { str+=str }
+ 2025-11-26 0f6397384b go/types: relax NewSignatureType for append(slice, str...)
+ 2025-11-26 992ad55e3d crypto/tls: support crypto.MessageSigner private keys
+ 2025-11-26 3fd9cb1895 cmd/compile: fix bloop get name logic
+ 2025-11-26 3353c100bb cmd/go: remove experiment checks for compile -c
+ 2025-11-26 301d9f9b52 doc/next: document broken freebsd/riscv64 port
+ 2025-11-26 de39282332 cmd/compile, runtime: guard X15 zeroing with GOEXPERIMENT=simd
+ 2025-11-26 86bbea0cfa crypto/fips140: add WithoutEnforcement
+ 2025-11-26 e2cae9ecdf crypto/x509: add ExtKeyUsage.OID method
+ 2025-11-26 623ef28135 cmd/go: limit total compile -c backend concurrency using a pool
+ 2025-11-26 3c6bf6fbf3 cmd/compile: handle loops better during stack allocation of slices
+ 2025-11-26 efe9ad501d go/types, types2: improve printing of []*operand lists (debugging support)
+ 2025-11-26 ac3369242d runtime: merge all the linux 32 and 64 bits files into one for each
+ 2025-11-26 fb5156a098 testing: fix bloop doc
+ 2025-11-26 b194f5d24a os,internal/syscall/windows: support O_* flags in Root.OpenFile
+ 2025-11-26 e0a4dffb0c cmd/internal/obj/loong64: add {,x}vmadd series instructions support
+ 2025-11-26 c0f02c11ff cmd/internal/obj/loong64: add aliases to 32-bit arithmetic instructions
+ 2025-11-26 37ce4adcd4 cmd/compile: add tests bruteforcing limit complement
+ 2025-11-26 437d2362ce os,internal/poll: don't call IsNonblock for consoles and Stdin
+ 2025-11-26 71f8f031b2 crypto/internal/fips140/aes: optimize ctrBlocks8Asm on amd64
+ 2025-11-26 03fcb33c0e cmd/compile: add tests bruteforcing limit negation and improve limit addition
+ 2025-11-26 dda7c8253d cmd/compile,internal/bytealg: add MemEq intrinsic for runtime.memequal
+ 2025-11-26 4976606a2f cmd/go: remove final references to modfetch.Fetcher_
+ 2025-11-26 08bf23cb97 cmd/go/internal/toolchain: remove references to modfetch.Fetcher_
+ 2025-11-26 46d5e3ea0e cmd/go/internal/modget: remove references to modfetch.Fetcher_
+ 2025-11-26 a3a6c9f62a cmd/go/internal/load: remove references to modfetch.Fetcher_
+ 2025-11-26 c1ef3d5881 cmd/go/internal/modcmd: remove references to modfetch.Fetcher_
+ 2025-11-26 ab2829ec06 cmd/compile: adjust start heap size
+ 2025-11-26 54b82e944e internal/trace: support event constructor for testing
+ 2025-11-25 eb63ef9d66 runtime: panic if cleanup function closes over cleanup pointer
+ 2025-11-25 06412288cf runtime: panic on AddCleanup with self pointer
+ 2025-11-25 03f499ec46 cmd/go/internal/modfetch: remove references to Fetcher_ in test file
+ 2025-11-25 da31fd4177 cmd/go/internal/modload: replace references to modfetch.Fetcher_
+ 2025-11-25 07b10e97d6 cmd/go/internal/modcmd: inject modfetch.Fetcher_ into DownloadModule
+ 2025-11-25 e96094402d cmd/go/internal/modload: inject modfetch.Fetcher_ into commitRequirements
+ 2025-11-25 47baf48890 cmd/go/internal/modfetch: inject Fetcher_ into TidyGoSum
+ 2025-11-25 272df5f6ba crypto/internal/fips140/aes/gcm: add more GCM nonce modes
+ 2025-11-25 1768cb40b8 crypto/tls: add SecP256r1/SecP384r1MLKEM1024 hybrid post-quantum key exchanges
+ 2025-11-25 a9093067ee cmd/internal/obj/loong64: add {,X}V{ADD,SUB}W{EV,OD}.{H.B,W.H,D.W,Q.D}{,U} instructions support
+ 2025-11-25 7b904c25a2 cmd/go/internal/modfetch: move global goSum to Fetcher_
+ 2025-11-25 e7358c6cf4 cmd/go: remove fips140 dependency on global Fetcher_
+ 2025-11-25 89f6dba7e6 internal/strconv: add testbase tests
+ 2025-11-25 6954be0baa internal/strconv: delete ftoaryu
+ 2025-11-25 8d6d14f5d6 compress/flate: move big non-pointer arrays to end of compressor
+ 2025-11-25 4ca048cc32 cmd/internal/obj/riscv: document compressed instructions
+ 2025-11-25 a572d571fa path: add more examples for path.Clean
+ 2025-11-25 eec40aae45 maps: use strings.EqualFold in example
+ 2025-11-25 113eb42efc strconv: replace Ryu ftoa with Dragonbox
+ 2025-11-25 6e5cfe94b0 crypto: fix dead links and correct SHA-512 algorithm comment
+ 2025-11-25 2c7c62b972 crypto/internal/fips140/sha512: interleave scheduling with rounds for 10.3% speed-up
+ 2025-11-25 5b34354bd3 crypto/internal/fips140/sha256: interleave scheduling and rounds for 11.2% speed-up
+ 2025-11-25 1cc1337f0a internal/runtime/cgroup: allow more tests to run on all OSes
+ 2025-11-25 6e4a0d8e44 crypto/internal/fips140/bigmod: vector implementation of addMulVVWx on s390x
+ 2025-11-25 657b331ff5 net/url: fix example of Values.Encode
+ 2025-11-25 bd9222b525 crypto/sha3: reduce cSHAKE allocations
+ 2025-11-25 e3088d6eb8 crypto/hpke: expose crypto/internal/hpke
+ 2025-11-25 a5ebc6b67c crypto/ecdsa: clean up ECDSA parsing and serialization paths
+ 2025-11-25 e8fdfeb72b reflect: add iterator equivalents for NumField, NumIn, NumOut and NumMethod
+ 2025-11-25 12d437c09a crypto/x509: sub-quadratic name constraint checking
+ 2025-11-25 ed4deb157e crypto/x509: cleanup name constraint tests
+ 2025-11-25 0d2baa808c crypto/rsa: add EncryptOAEPWithOptions
+ 2025-11-25 09e377b599 internal/poll: replace t.Sub(time.Now()) with time.Until in test
+ 2025-11-25 4fb7e083a8 crypto/tls: expose HelloRetryRequest state
+ 2025-11-24 31d373534e doc: pre-announce removal of 1.23 and earlier crypto GODEBUGs
+ 2025-11-24 aa093eed83 crypto/fips140: add Version
+ 2025-11-24 1dc1505d4a cmd/go/internal/modfetch: rename State to Fetcher
+ 2025-11-24 d3e11b3f90 cmd/go/internal/modload: make State.modfetchState a pointer
+ 2025-11-24 2f7fd5714f cmd/go: add setters for critical State fields
+ 2025-11-24 6851795fb6 runtime: add GODEBUG=tracebacklabels=1 to include pprof labels in tracebacks
+ 2025-11-24 0921e1db83 net/http: add Transport.NewClientConn
+ 2025-11-24 6465818435 all: update to x/net@bff14c52567061031b9761881907c39e24792736
+ 2025-11-24 1a53ce9734 context: don't return the wrong error when Cause races cancellation
+ 2025-11-24 c6f882f6c5 crypto/x509: add ExtKeyUsage.String and KeyUsage.String methods
+ 2025-11-24 97d5295f6f crypto/internal/fips140test: add ML-DSA coverage
+ 2025-11-24 62cd044a79 cmd/compile: add cases for StringLen to prove
+ 2025-11-24 f1e376f342 cmd/go/internal/auth: fix typo
+ 2025-11-24 7fbd141de5 runtime: use m.profStack in traceStack
+ 2025-11-24 0bc192368a runtime: don't write unique string to trace if it's length zero
+ 2025-11-24 d4f5650cc5 all: REVERSE MERGE dev.simd (7d65463) into master

Change-Id: I4273ac3987ae2d0bc1df0051d752d8ef6c5e9af5

6 weeks ago[dev.simd] internal/buildcfg: default-disable simd experiment, for merge w/ master
David Chase [Wed, 3 Dec 2025 19:20:55 +0000 (14:20 -0500)]
[dev.simd] internal/buildcfg: default-disable simd experiment, for merge w/ master

this will be undone after the two branches are both in sync.

Change-Id: I114e8a9b4ed29646ec22db1135e59f8bad47c4da
Reviewed-on: https://go-review.googlesource.com/c/go/+/726521
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
6 weeks ago[dev.simd] simd: make "best" instruction choice also depend on commutativity
David Chase [Wed, 3 Dec 2025 17:49:30 +0000 (12:49 -0500)]
[dev.simd] simd: make "best" instruction choice also depend on commutativity

the compare-based-on-immediate instructions are sometimes commutative,
sometimes not.  In this case, that means the instruction cannot be
commutative.

also improve the comments for comparisons.

Change-Id: I83a55fa5ffbd6cbbaf5cb23b3e8a68a5da8aae2f
Reviewed-on: https://go-review.googlesource.com/c/go/+/726440
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Austin Clements <austin@google.com>
6 weeks agodoc/next: delete
Gopher Robot [Wed, 3 Dec 2025 16:44:34 +0000 (08:44 -0800)]
doc/next: delete

The release note fragments have been merged and added
as _content/doc/go1.26.md in x/website in CL 726360.

For #75005.

Change-Id: I13533b8a6aac470afe066ddf420028c0360a5bb1
Reviewed-on: https://go-review.googlesource.com/c/go/+/726341
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
6 weeks agoapi: promote next to go1.26
Gopher Robot [Wed, 3 Dec 2025 16:14:27 +0000 (08:14 -0800)]
api: promote next to go1.26

Change-Id: I078af0e9aa310a94ec5038f2bfd850e4b43a497e
Reviewed-on: https://go-review.googlesource.com/c/go/+/726340
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Gopher Robot <gobot@golang.org>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
6 weeks agocrypto/hpke: remove unused hybridKEM field
qmuntal [Wed, 3 Dec 2025 11:32:15 +0000 (12:32 +0100)]
crypto/hpke: remove unused hybridKEM field

hybridKEM.pqGenerateKey is not used anywhere. Having it around
is confusing, as it suggests that the mlkem seed is generated within
the mlkem package, when it is not.

Change-Id: Ie0bdb79d6b774db7b21dfff2b966452463f1ce08
Reviewed-on: https://go-review.googlesource.com/c/go/+/726260
Reviewed-by: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
6 weeks agodoc/next: pluralize 'result'
Will Faught [Tue, 2 Dec 2025 22:34:44 +0000 (22:34 +0000)]
doc/next: pluralize 'result'

Change-Id: Id53ee875ee31b43a6d7bd3f180260276ddd4f8b9
GitHub-Last-Rev: c90e3869671888b71b3c6a34bd639ce013f89762
GitHub-Pull-Request: golang/go#76664
Reviewed-on: https://go-review.googlesource.com/c/go/+/725922
Reviewed-by: Mark Freeman <markfreeman@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Bypass: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
6 weeks agodoc/next/6-stdlib/99-minor/go/ast/76031.md: add BasicLit caveat
Alan Donovan [Fri, 21 Nov 2025 14:32:26 +0000 (09:32 -0500)]
doc/next/6-stdlib/99-minor/go/ast/76031.md: add BasicLit caveat

For #76395

Change-Id: Ied054b54f319a2a448ccdfa4b42044250abb5af7
Reviewed-on: https://go-review.googlesource.com/c/go/+/722820
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
6 weeks agogo/{ast,doc}: update BasicLit.ValueEnd as well as ValuePos
Alan Donovan [Fri, 21 Nov 2025 16:05:05 +0000 (11:05 -0500)]
go/{ast,doc}: update BasicLit.ValueEnd as well as ValuePos

For #76395

Change-Id: Ie2ad715a05cb298b08667cfe8a8394f1dfa3936c
Reviewed-on: https://go-review.googlesource.com/c/go/+/722880
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 weeks agocmd/link: don't update offset of existing ELF section name
Ian Lance Taylor [Wed, 3 Dec 2025 01:01:57 +0000 (17:01 -0800)]
cmd/link: don't update offset of existing ELF section name

Fixes #76656

Change-Id: If2e823ba1577700af00f5883e4ea5c139e4749c1
Reviewed-on: https://go-review.googlesource.com/c/go/+/726100
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Michael Stapelberg <stapelberg@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 weeks agocmd/compile: ensure bloop only kept alive addressable nodes
Cuong Manh Le [Mon, 1 Dec 2025 09:54:54 +0000 (16:54 +0700)]
cmd/compile: ensure bloop only kept alive addressable nodes

Fixes #76636

Change-Id: I881f88dbf62a901452c1d77e6ffca651451c7790
Reviewed-on: https://go-review.googlesource.com/c/go/+/725420
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
6 weeks agodoc: pre-announce removal of gotypesalias and asynctimerchan GODEBUG flags
Robert Griesemer [Tue, 2 Dec 2025 19:58:29 +0000 (11:58 -0800)]
doc: pre-announce removal of gotypesalias and asynctimerchan GODEBUG flags

This announcement follows the policy outlined in #76163.

For #76472.

Change-Id: I4299e7f474e314810883dc4f50be6afba8c3e3e7
Reviewed-on: https://go-review.googlesource.com/c/go/+/726020
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 weeks agospec: remove restriction on channel element types for close built-in (bug fix)
Robert Griesemer [Tue, 2 Dec 2025 22:32:13 +0000 (14:32 -0800)]
spec: remove restriction on channel element types for close built-in (bug fix)

The spec states that if the argument type for close is a type parameter,
it's type set must only contain channels and they must all have the same
element type. This latter requirement (all must have the same element
type) was never enforced by the compiler, nor is it important for
correctness or required by the implementation.

This change removes this requirement also in the spec and thus
documents what was always (since 1.18) the case.

Fixes #74034.

Change-Id: If65d50bfb581b7f37999413088d3d3b1820e054a
Reviewed-on: https://go-review.googlesource.com/c/go/+/725923
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
6 weeks agodoc/next: release note for scheduler metrics
Michael Anthony Knyszek [Mon, 1 Dec 2025 18:22:04 +0000 (18:22 +0000)]
doc/next: release note for scheduler metrics

For #15490.

Change-Id: Ic268a7d1d54814e903fc44f5f143008fb5d6dcde
Reviewed-on: https://go-review.googlesource.com/c/go/+/725663
TryBot-Bypass: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>

6 weeks agodoc/next: document cgo call overhead improvement
Michael Anthony Knyszek [Mon, 1 Dec 2025 18:29:34 +0000 (18:29 +0000)]
doc/next: document cgo call overhead improvement

Change-Id: Ibac18513d2f76172665b4f3a4ea09b69ae0bdef3
Reviewed-on: https://go-review.googlesource.com/c/go/+/725664
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>

6 weeks agodoc: mention stack allocation of slices
Keith Randall [Tue, 2 Dec 2025 22:22:34 +0000 (14:22 -0800)]
doc: mention stack allocation of slices

Very similar to last release's note.

Change-Id: Ie7afe21d98cee1c9718e53b20e8af8ee18504bb9
Reviewed-on: https://go-review.googlesource.com/c/go/+/725921
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Keith Randall <khr@golang.org>

6 weeks agodoc/next: add section for Green Tea
Michael Anthony Knyszek [Mon, 1 Dec 2025 18:07:50 +0000 (18:07 +0000)]
doc/next: add section for Green Tea

Change-Id: I420e8d673e5d34d1b09c02b8bc84b890da42e320
Reviewed-on: https://go-review.googlesource.com/c/go/+/725662
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 weeks agonet: parse addresses without separators in ParseMac
Devon Mar [Tue, 25 Nov 2025 07:38:09 +0000 (07:38 +0000)]
net: parse addresses without separators in ParseMac

IEEE EUI guidelines states that "an EUI-48 can be represented in the IEEE RA
hexadecimal (hex) form with the octets separated by hyphens, or as a pure
base-16 numerical representation without hyphens"
(https://standards.ieee.org/wp-content/uploads/import/documents/tutorials/eui.pdf p.9).
The latter form is used in Azure Instance Metadata Service
(https://github.com/Azure/azure-container-networking/pull/4122) among others.

Fixes #66682

Change-Id: Id66c23d50ebb1fed1f3bdb5cf3822a8fd60b886d
GitHub-Last-Rev: 77900cc1a68cb535b685a63cf84b5413b480df2c
GitHub-Pull-Request: golang/go#76387
Reviewed-on: https://go-review.googlesource.com/c/go/+/722720
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 weeks agocmd/compile: more generated equality function tests
khr@golang.org [Mon, 1 Dec 2025 18:32:23 +0000 (10:32 -0800)]
cmd/compile: more generated equality function tests

Change-Id: I05cd103ea8d8bbee0ad907ff3e594de273d49e86
Reviewed-on: https://go-review.googlesource.com/c/go/+/725600
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
6 weeks agocrypto/x509: prevent HostnameError.Error() from consuming excessive resource
Nicholas S. Husin [Mon, 24 Nov 2025 19:56:23 +0000 (14:56 -0500)]
crypto/x509: prevent HostnameError.Error() from consuming excessive resource

Constructing HostnameError.Error() takes O(N^2) runtime due to using a
string concatenation in a loop. Additionally, there is no limit on how
many names are included in the error message. As a result, a malicious
attacker could craft a certificate with an infinite amount of names to
unfairly consume resource.

To remediate this, we will now use strings.Builder to construct the
error message, preventing O(N^2) runtime. When a certificate has 100 or
more names, we will also not print each name individually.

Thanks to Philippe Antoine (Catena cyber) for reporting this issue.

Fixes #76445
Fixes CVE-2025-61729

Change-Id: I6343776ec3289577abc76dad71766c491c1a7c81
Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/3000
Reviewed-by: Neal Patel <nealpatel@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/725920
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Bypass: Dmitri Shuralyov <dmitshur@golang.org>

6 weeks agospec: more precise prose for built-in function new
Robert Griesemer [Thu, 20 Nov 2025 22:05:27 +0000 (14:05 -0800)]
spec: more precise prose for built-in function new

1) explain new(type) (simpler) before new(expr) (more complicated)
2) for new(expr), explain what happens when expr is an untyped bool
3) explain that new(nil) is not permitted
4) streamline examples slightly

Fixes #76122.

Change-Id: I5ddb26bd88241b4b2b9aa9b532a62f7861c2341c
Reviewed-on: https://go-review.googlesource.com/c/go/+/722482
Auto-Submit: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Commit-Queue: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 weeks agocmd/go: add test checking version with experiment is valid
matloob@golang.org [Fri, 14 Nov 2025 18:10:00 +0000 (13:10 -0500)]
cmd/go: add test checking version with experiment is valid

For #75953

Change-Id: I6a6a69645d6d2af9be1b076f2460cdb295ea3c6e
Reviewed-on: https://go-review.googlesource.com/c/go/+/720600
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 weeks agoruntime/internal/testprog: log initial SchedMetrics GOMAXPROCS
Michael Pratt [Mon, 1 Dec 2025 20:47:33 +0000 (15:47 -0500)]
runtime/internal/testprog: log initial SchedMetrics GOMAXPROCS

For #76613.

Change-Id: I6a6a636ccf28676b9cd1f820bbe42c2f3e974fee
Reviewed-on: https://go-review.googlesource.com/c/go/+/725660
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Pratt <mpratt@google.com>

6 weeks agonet/http: deflake TestClientConnReserveAndConsume
Damien Neil [Mon, 1 Dec 2025 20:28:19 +0000 (12:28 -0800)]
net/http: deflake TestClientConnReserveAndConsume

This test includes an assertion that a client conn's state hook
is called exactly once, but some of the test cases can result in
two events occurring: A request completes and a connection closes.

Change the assertion to just check that the hook is called
at least once.

Fixes #76480

Change-Id: Ie1438581b072b10623eb3d5fe443294a639c9853
Reviewed-on: https://go-review.googlesource.com/c/go/+/725601
Commit-Queue: Damien Neil <dneil@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Nicholas Husin <husin@google.com>
Reviewed-by: Nicholas Husin <nsh@golang.org>
TryBot-Bypass: Damien Neil <dneil@google.com>

6 weeks agointernal/runtime/cgroup: remove duplicate readString definition
Michael Pratt [Mon, 1 Dec 2025 21:00:01 +0000 (16:00 -0500)]
internal/runtime/cgroup: remove duplicate readString definition

Both CL 723241 and CL 723581 added identical definitions.

Change-Id: I6a6a636c9e5f8c9080b9389ebf9d3f10305d79ac
Reviewed-on: https://go-review.googlesource.com/c/go/+/725661
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
6 weeks agointernal/runtime/cgroup: lineReader fuzz test
胡玮文 [Sun, 23 Nov 2025 18:29:24 +0000 (02:29 +0800)]
internal/runtime/cgroup: lineReader fuzz test

The original unit test is converted to a fuzz test, to be more confident
on future refactors. All sub-tests are converted to seed corpus.

Change-Id: Id0c167ed47729a00ea0614d17746ddcc284697d3
Reviewed-on: https://go-review.googlesource.com/c/go/+/723581
Auto-Submit: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
6 weeks agodoc: document go tool pprof -http default change
Michael Pratt [Mon, 1 Dec 2025 18:15:52 +0000 (13:15 -0500)]
doc: document go tool pprof -http default change

For #74774.

Change-Id: I6a6a636c579fa95938021cc73d7d11a86f8a19a3
Reviewed-on: https://go-review.googlesource.com/c/go/+/725540
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
6 weeks agodebug/elf: correct case of DWARF in comment
Ian Lance Taylor [Fri, 28 Nov 2025 22:34:06 +0000 (14:34 -0800)]
debug/elf: correct case of DWARF in comment

Change-Id: I5b80b0e3e50fafdb732c732cdae6e2756d919d20
Reviewed-on: https://go-review.googlesource.com/c/go/+/725360
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 weeks agodoc/next: clean up some Go 1.26 release notes
Brad Fitzpatrick [Wed, 26 Nov 2025 18:11:41 +0000 (10:11 -0800)]
doc/next: clean up some Go 1.26 release notes

The Var.Kind stuff was in Go 1.25.

And the net additions were in the wrong tense and didn't have links.

Change-Id: Ie710e1d41c714fe627a3a21a5afb6b7f78301f68
Reviewed-on: https://go-review.googlesource.com/c/go/+/724780
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
6 weeks agocmd/pprof: update vendored github.com/google/pprof
Dmitri Shuralyov [Mon, 1 Dec 2025 16:29:26 +0000 (11:29 -0500)]
cmd/pprof: update vendored github.com/google/pprof

Pull in the latest published version of github.com/google/pprof
as part of the continuous process of keeping Go's dependencies
up to date.

For #36905.

[git-generate]
cd src/cmd
go get github.com/google/pprof@v0.0.0-20251114195745-4902fdda35c8
go mod tidy
go mod vendor

Change-Id: Id26eb632f637fb2c602d87cb83fdff7f099934ce
Reviewed-on: https://go-review.googlesource.com/c/go/+/725500
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
6 weeks agocmd/compile: run go generate for internal/ir
Lin Lin [Mon, 1 Dec 2025 13:08:38 +0000 (13:08 +0000)]
cmd/compile: run go generate for internal/ir

Updates #70954

Change-Id: I00ddb37650d27a98da921f04570d33535865622c
GitHub-Last-Rev: 69d52f3d720bd6e34befa1c6b92b2e80ed7ab2d1
GitHub-Pull-Request: golang/go#76638
Reviewed-on: https://go-review.googlesource.com/c/go/+/725440
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
6 weeks agoall: update vendored dependencies
Dmitri Shuralyov [Mon, 1 Dec 2025 15:32:57 +0000 (10:32 -0500)]
all: update vendored dependencies

The Go 1.26 code freeze has recently started. This is a time to update
all golang.org/x/... module versions that contribute packages to the
std and cmd modules in the standard library to latest master versions.

For #36905.

[git-generate]
go install golang.org/x/build/cmd/updatestd@latest
go install golang.org/x/tools/cmd/bundle@latest
updatestd -goroot=$(pwd) -branch=master

Change-Id: I39c68d4c36d0c83ac07c3cda3c4d042bb32a9624
Reviewed-on: https://go-review.googlesource.com/c/go/+/725480
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
6 weeks agovendor/golang.org/x/tools: update to 1ad6f3d
Alan Donovan [Mon, 1 Dec 2025 15:26:29 +0000 (10:26 -0500)]
vendor/golang.org/x/tools: update to 1ad6f3d

cmd$ go get golang.org/x/tools@1ad6f3d
cmd$ GOWORK=off go mod tidy
cmd$ GOWORK=off go mod vendor

This merge pulls in the following commits, which include several fixes
needed for go1.26, marked by an asterisk. None of the unmarked commits
affects vendored packages, so it is safe (and simpler) to merge rather
than cherrypick via a release branch.

tools$ git log --oneline 68724afed209...1ad6f3d02713
*4a3f2f81eb go/analysis/passes/printf: panic when function literal is assigned to the blank identifier
*d5d7d21fe7 gopls/internal/cache: fix %q verb use with wrong type
*92a094998a go/analysis/passes/modernize: rangeint: handle usages of loop label
*ffbdcac342 go/analysis/passes/modernize: stditerators: add reflect iters
*2e3e83a050 internal/refactor/inline: preserve local package name used by callee
 d32ec34454 gopls/internal/protocol/generate: move injections to tables.go
 98d172d8bd gopls/internal/protocol: add form field in type CodeAction
 e1317381e4 go/packages: suppress test on (e.g.) wasm
*e31ed53b51 internal/stdlib: regenerate
*6f1f89817d internal/analysis/driverutil: include end positions in -json output
 7839abf5e8 gopls/internal/metadata: document when Module can be nil
 98aa9a7d0b gopls/internal/cache: make unimported completions deterministic
 4c5faddb0f internal/modindex: unescape import paths
 c2c902c441 gopls/completion: avoid nil dereference
*4bf3169c8a go/analysis/passes/modernize: waitgroup: highlight "go func" part
 ba5189b063 gopls/internal/template: fix printf mistake in test
*a7d12506a0 go/analysis/passes/printf: clarify checkForward
 c7a1a29f93 internal/pkgbits: fix printf mistake in test
 af205c0a29 gopls/doc/release/v0.21.0.md: tweaks

Change-Id: I23c991987afeb2db3e0f98f76f8ee5000c8a6e02
Reviewed-on: https://go-review.googlesource.com/c/go/+/725460
Auto-Submit: Alan Donovan <adonovan@google.com>
TryBot-Bypass: Alan Donovan <adonovan@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Commit-Queue: Alan Donovan <adonovan@google.com>

6 weeks agodebug/elf: make check for empty symbol section consistent for 64-bit and 32-bit binaries
Aditya Sirish A Yelgundhalli [Wed, 10 Sep 2025 02:34:03 +0000 (02:34 +0000)]
debug/elf: make check for empty symbol section consistent for 64-bit and 32-bit binaries

The check for whether a binary's symbols section is empty is
inconsistent across the 32-bit and 64-bit flows.

Change-Id: I1abc235320a53cf957cfb83c9e7bcad6e52bc529
GitHub-Last-Rev: f264915ca2964ad8f34ce1deee4f42c2f9dc21bf
GitHub-Pull-Request: golang/go#75334
Reviewed-on: https://go-review.googlesource.com/c/go/+/702195
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
6 weeks agotest/codegen: fix shift tests on riscv64
Joel Sing [Sat, 22 Nov 2025 14:10:41 +0000 (01:10 +1100)]
test/codegen: fix shift tests on riscv64

These were broken by CL 721206, which changes Rsh to RshU for
positive inputs.

Change-Id: I9e38c3c428fb8aeb70cf51e7e76f4711c864f027
Reviewed-on: https://go-review.googlesource.com/c/go/+/723340
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
Reviewed-by: Mark Ryan <markdryan@rivosinc.com>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 weeks agocmd/compile: avoid unnecessary interface conversion in bloop
Cuong Manh Le [Fri, 28 Nov 2025 10:19:42 +0000 (17:19 +0700)]
cmd/compile: avoid unnecessary interface conversion in bloop

Fixes #76482

Change-Id: I076568d8ae92ad6c9e0a5797cfe5bbfb615f63d2
Reviewed-on: https://go-review.googlesource.com/c/go/+/725180
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>

7 weeks agoruntime/secret: disable tests under memory validating modes
Daniel Morsing [Fri, 28 Nov 2025 09:40:00 +0000 (09:40 +0000)]
runtime/secret: disable tests under memory validating modes

These tests rely on reading memory that has been freed, so any of the
modes that validate memory accesses are going to fail. Disable them for
now.

Fixes #76586.

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-msan-clang15,gotip-linux-amd64-asan-clang15,gotip-linux-amd64-race
Change-Id: I14ee5dfccbafa0e4da684a95ee42acf54499b013
Reviewed-on: https://go-review.googlesource.com/c/go/+/725140
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
7 weeks agofmt: document space behavior of Append
Alan Donovan [Fri, 18 Jul 2025 18:57:38 +0000 (14:57 -0400)]
fmt: document space behavior of Append

Also, introduce the {Print,Fprint,Sprint,Append}{,f,ln}
cross product of functions at the top of the docs.

Fixes #74656

Change-Id: I85a156cd545ca866e579d8020ddf165cd4bcb26f
Reviewed-on: https://go-review.googlesource.com/c/go/+/688877
Reviewed-by: Rob Pike <r@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
7 weeks agoruntime/secret: reorganize tests to fix -buildmode=shared
Daniel Morsing [Thu, 27 Nov 2025 06:45:20 +0000 (06:45 +0000)]
runtime/secret: reorganize tests to fix -buildmode=shared

The testing assembly methods had a linkname that was implicitly
satisfied during the regular build but not there during the shared
build. Fix by moving the testing routine into the package itself.

For good measure, section off the assembly files from the non-experiment
build. Should prevent further build failures as we work on this.

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-linux-arm64-longtest
Change-Id: I2b45668e44641ae7880ff14f6402d982c7eaedd7
Reviewed-on: https://go-review.googlesource.com/c/go/+/724001
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
7 weeks agoruntime/_mkmalloc: fix log.Fatal formatting directive
Filippo Valsorda [Thu, 27 Nov 2025 10:42:27 +0000 (11:42 +0100)]
runtime/_mkmalloc: fix log.Fatal formatting directive

Change-Id: I9b9b9dbde440c3a24599efd55ef6f85a6a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/724281
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>

7 weeks agointernal/runtime/cgroup: stricter unescapePath
胡玮文 [Sat, 22 Nov 2025 03:00:47 +0000 (11:00 +0800)]
internal/runtime/cgroup: stricter unescapePath

8 and 9 in escape sequence is invalid now, it should be octal.

Escape sequence larger than \377 is invalid now, it does not fit one
byte.

Change-Id: I3fdebce1d054c44919f0e66a33c778b5a2b099e2
Reviewed-on: https://go-review.googlesource.com/c/go/+/723242
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>

7 weeks agointernal/runtime/cgroup: fix path on non-root mount point
胡玮文 [Fri, 21 Nov 2025 17:44:14 +0000 (01:44 +0800)]
internal/runtime/cgroup: fix path on non-root mount point

We should trim the mount root (4th field in /proc/self/mountinfo) from
cgroup path read from /proc/self/cgroup before appending it to the mount
point.  Non-root mount points are very common in containers with cgroup
v1.

parseCPURelativePath is renamed to parseCPUCgroup, as it is unclear what
it is relative to. cgroups(7) says "This pathname is relative to the
mount point of the hierarchy." It should mean the root of the hierarchy,
and we cannot concat it to arbirary cgroup mount point. So just use the
word cgroup, since it parses /proc/self/cgroup.

It now returns errMalformedFile if the cgroup pathname does not start
with "/", and errPathTooLong if the pathname can't fit into the buffer.
We already rely on this when composing the path, just make this explicit
to avoid incorrect paths.

We now parse cgroup first then parse the mount point accordingly.  We
consider the previously read cgroup pathname and version to ensure we
got the desired mount point.  The out buffer is reused to pass in the
cgroup, to avoid extra memory allocation.

This should also resolve the race mentioned in the comments, so removing
those comments.  If our cgroup changed between the two read syscalls, we
will stick with the cgroup read from /proc/self/cgroup. This is the same
behavior as cgroup change after FindCPU() returns, so nothing special to
comment about now.

parseCPUMount now returns error when the combined path is too long, to
avoid panic or truncation if we got a really long path from mountinfo.

cgrouptest is changed to use dev returned from stat() to detect
filesystem boundary, since we don't return mount point and sub-path
separately now. This also avoid using os.Root since we don't handle
untrusted input here. os.Root is too complex, and the performance is
bad.

Fixes #76390

Change-Id: Ia9cbd7be3e58a2d51caf27a973fbd201dac06afc
Reviewed-on: https://go-review.googlesource.com/c/go/+/723241
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
7 weeks agointernal/runtime/cgroup: simplify escapePath in test
胡玮文 [Sat, 22 Nov 2025 09:15:04 +0000 (17:15 +0800)]
internal/runtime/cgroup: simplify escapePath in test

Don't work on rune, kernel does not use utf-8 here.
Can be verified like this:

  # mkdir "$(echo -e "\xff\x20")"
  # mount -t tmpfs tmpfs "$(echo -e "\xff\x20")"
  # tail -n 1 /proc/self/mountinfo | xxd
  00000000: 3133 3334 2031 3030 2030 3a31 3632 202f  1334 100 0:162 /
  00000010: 202f 726f 6f74 2fff 5c30 3430 2072 772c   /root/.\040 rw,
  00000020: 7265 6c61 7469 6d65 2073 6861 7265 643a  relatime shared:
  00000030: 3433 3520 2d20 746d 7066 7320 746d 7066  435 - tmpfs tmpf
  00000040: 7320 7277 0a                             s rw.

Change-Id: I7468b56eb26f14bc809f8f7580535e6562795c62
Reviewed-on: https://go-review.googlesource.com/c/go/+/723300
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
7 weeks agoio: reduce intermediate allocations in ReadAll and have a smaller final result
thepudds [Thu, 20 Nov 2025 19:43:50 +0000 (14:43 -0500)]
io: reduce intermediate allocations in ReadAll and have a smaller final result

Currently, io.ReadAll allocates a significant amount of intermediate
memory as it grows its result slice to the size of the input data.

This CL aims to reduce the allocated memory. Geomean benchstat results
comparing existing io.ReadAll to this CL for a variety of input sizes:

                      │     old     |      new       vs base    │
          sec/op           132.2µ        66.32µ     -49.83%
            B/op          645.4Ki       324.6Ki     -49.70%
  final-capacity           178.3k        151.3k     -15.10%
    excess-ratio            1.216         1.033     -15.10%

The corresponding full benchstat results are below. The input data sizes
are a blend of random sizes, power-of-2 sizes, and power-of-10 sizes.

This CL reduces intermediate bytes allocated in io.ReadAll by reading
via a set of slices of exponentially growing size, and then copying
into a final perfectly-sized slice at the end.

The current memory allocations impact real uses. For example, in #50774
two real-world reports were ~60% more bytes allocated via io.ReadAll
compared to an alternate approach, and also a separate report of
~5x more bytes allocated than the input data size of ~5MiB.

Separately, bytes.Buffer.ReadFrom uses a 2x growth strategy, which
usually can beat the pre-existing io.ReadAll on total bytes allocated
but sometimes not (depending on alignment between exact input data size
and growth). That said, bytes.Buffer.ReadFrom usually ends up with
more excess memory used in a larger final result than the current
io.ReadAll (often significantly more).

If we compare bytes.Buffer.ReadFrom to this CL, we also see
better geomean overall results reported with this CL:

                  │  bytes.Buffer  |    io.ReadAll (new)       │
          sec/op           104.6µ        66.32µ       -36.60%
            B/op          466.9Ki        324.6Ki      -30.48%
  final-capacity           247.4k        151.3k       -38.84%
    excess-ratio            1.688         1.033       -38.84%

(Full corresponding benchstat results comparing this CL vs. bytes.Buffer
are at https://go.dev/play/p/eqwk2BkaSwJ).

One challenge with almost any change of growth strategy for something
widely used is there can be a subset of users that benefited more from
the old growth approach (e.g., based on their data size aligning
particularly well with the old growth), even if the majority of users
on average benefit from the new growth approach.

To help mitigate that, this CL somewhat follows the old read pattern
in its early stages.

Here are the full benchstat results comparing the existing
io.ReadAll vs. this CL. The standard metrics are included, plus
the final result capacity and an excess capacity ratio, which is
the final capacity of the result divided by the input data size (so 1.0
is no excess memory present in the result, though due to
size class rounding the ratio is usually above 1.0 unless the
input data size exactly matches a size class).

We consider smaller reported excess capacity to be better for most
uses given it means the final allocation puts less pressure on the GC
(both in cases when it will almost immediately be garbage in user code,
or if for example the final result is held for multiple GC cycles).

The input data sizes used in the benchmarks:
  - Six powers of 10.
  - Six powers of 2.
  - Ten random sizes between 1KiB and 100MiB (chosen uniformly
    on a log scale).
  - size=300 (so that we have something below 512, which is the
    initial read size).

goos: linux
goarch: amd64
pkg: io
cpu: AMD EPYC 7B13
                       │      old     │             io.ReadAll (new)  │
                       │    sec/op    │   sec/op     vs base          │
ReadAll/size=300-16          113.0n ± 0%   115.4n ± 2%   +2.08% (p=0.005 n=20)
ReadAll/size=512-16          295.0n ± 2%   288.7n ± 1%   -2.14% (p=0.006 n=20)
ReadAll/size=1000-16         549.2n ± 1%   492.8n ± 1%  -10.28% (p=0.000 n=20)
ReadAll/size=4096-16         3.193µ ± 1%   2.277µ ± 1%  -28.70% (p=0.000 n=20)
ReadAll/size=6648-16         4.318µ ± 1%   3.100µ ± 1%  -28.21% (p=0.000 n=20)
ReadAll/size=10000-16        7.771µ ± 1%   4.629µ ± 1%  -40.43% (p=0.000 n=20)
ReadAll/size=12179-16        7.724µ ± 1%   5.066µ ± 1%  -34.42% (p=0.000 n=20)
ReadAll/size=16384-16       13.664µ ± 1%   7.309µ ± 1%  -46.51% (p=0.000 n=20)
ReadAll/size=32768-16        24.07µ ± 2%   14.52µ ± 2%  -39.67% (p=0.000 n=20)
ReadAll/size=65536-16        43.14µ ± 2%   24.00µ ± 2%  -44.37% (p=0.000 n=20)
ReadAll/size=80000-16        57.12µ ± 2%   31.28µ ± 2%  -45.24% (p=0.000 n=20)
ReadAll/size=100000-16       75.08µ ± 2%   38.18µ ± 3%  -49.15% (p=0.000 n=20)
ReadAll/size=118014-16       76.06µ ± 1%   50.03µ ± 3%  -34.22% (p=0.000 n=20)
ReadAll/size=131072-16      103.99µ ± 1%   52.31µ ± 2%  -49.70% (p=0.000 n=20)
ReadAll/size=397601-16       518.1µ ± 6%   204.2µ ± 2%  -60.58% (p=0.000 n=20)
ReadAll/size=626039-16       934.9µ ± 3%   398.7µ ± 7%  -57.35% (p=0.000 n=20)
ReadAll/size=1000000-16     1800.3µ ± 8%   651.4µ ± 6%  -63.82% (p=0.000 n=20)
ReadAll/size=1141838-16     2236.3µ ± 5%   710.2µ ± 5%  -68.24% (p=0.000 n=20)
ReadAll/size=2414329-16      4.517m ± 3%   1.471m ± 3%  -67.43% (p=0.000 n=20)
ReadAll/size=5136407-16      8.547m ± 3%   2.060m ± 1%  -75.90% (p=0.000 n=20)
ReadAll/size=10000000-16    13.303m ± 4%   3.767m ± 4%  -71.68% (p=0.000 n=20)
ReadAll/size=18285584-16    23.414m ± 2%   6.790m ± 5%  -71.00% (p=0.000 n=20)
ReadAll/size=67379426-16     55.93m ± 4%   24.50m ± 5%  -56.20% (p=0.000 n=20)
ReadAll/size=100000000-16    84.61m ± 5%   33.84m ± 5%  -60.00% (p=0.000 n=20)
geomean                   132.2µ        66.32µ       -49.83%

                       │      old      │              io.ReadAll (new) │
                       │     B/op      │     B/op      vs base         │
ReadAll/size=300-16            512.0 ± 0%     512.0 ± 0%        ~ (p=1.000 n=20) ¹
ReadAll/size=512-16          1.375Ki ± 0%   1.250Ki ± 0%   -9.09% (p=0.000 n=20)
ReadAll/size=1000-16         2.750Ki ± 0%   2.125Ki ± 0%  -22.73% (p=0.000 n=20)
ReadAll/size=4096-16         17.00Ki ± 0%   10.12Ki ± 0%  -40.44% (p=0.000 n=20)
ReadAll/size=6648-16         23.75Ki ± 0%   15.75Ki ± 0%  -33.68% (p=0.000 n=20)
ReadAll/size=10000-16        45.00Ki ± 0%   23.88Ki ± 0%  -46.94% (p=0.000 n=20)
ReadAll/size=12179-16        45.00Ki ± 0%   25.88Ki ± 0%  -42.50% (p=0.000 n=20)
ReadAll/size=16384-16        82.25Ki ± 0%   36.88Ki ± 0%  -55.17% (p=0.000 n=20)
ReadAll/size=32768-16       150.25Ki ± 0%   78.88Ki ± 0%  -47.50% (p=0.000 n=20)
ReadAll/size=65536-16        278.3Ki ± 0%   134.9Ki ± 0%  -51.53% (p=0.000 n=20)
ReadAll/size=80000-16        374.3Ki ± 0%   190.9Ki ± 0%  -49.00% (p=0.000 n=20)
ReadAll/size=100000-16       502.3Ki ± 0%   214.9Ki ± 0%  -57.22% (p=0.000 n=20)
ReadAll/size=118014-16       502.3Ki ± 0%   286.9Ki ± 0%  -42.88% (p=0.000 n=20)
ReadAll/size=131072-16       670.3Ki ± 0%   294.9Ki ± 0%  -56.01% (p=0.000 n=20)
ReadAll/size=397601-16      1934.3Ki ± 0%   919.8Ki ± 0%  -52.45% (p=0.000 n=20)
ReadAll/size=626039-16       3.092Mi ± 0%   1.359Mi ± 0%  -56.04% (p=0.000 n=20)
ReadAll/size=1000000-16      4.998Mi ± 0%   2.086Mi ± 0%  -58.27% (p=0.000 n=20)
ReadAll/size=1141838-16      6.334Mi ± 0%   2.219Mi ± 0%  -64.98% (p=0.000 n=20)
ReadAll/size=2414329-16     12.725Mi ± 0%   4.789Mi ± 0%  -62.37% (p=0.000 n=20)
ReadAll/size=5136407-16      25.28Mi ± 0%   10.44Mi ± 0%  -58.71% (p=0.000 n=20)
ReadAll/size=10000000-16     49.84Mi ± 0%   21.92Mi ± 0%  -56.02% (p=0.000 n=20)
ReadAll/size=18285584-16     97.88Mi ± 0%   35.99Mi ± 0%  -63.23% (p=0.000 n=20)
ReadAll/size=67379426-16     375.2Mi ± 0%   158.0Mi ± 0%  -57.91% (p=0.000 n=20)
ReadAll/size=100000000-16    586.7Mi ± 0%   235.9Mi ± 0%  -59.80% (p=0.000 n=20)
geomean                   645.4Ki        324.6Ki       -49.70%

                       │     old     │              io.ReadAll (new)   │
                       │  final-cap  │  final-cap   vs base            │
ReadAll/size=300-16          512.0 ± 0%    512.0 ± 0%        ~ (p=1.000 n=20) ¹
ReadAll/size=512-16          896.0 ± 0%    512.0 ± 0%  -42.86% (p=0.000 n=20)
ReadAll/size=1000-16        1.408k ± 0%   1.024k ± 0%  -27.27% (p=0.000 n=20)
ReadAll/size=4096-16        5.376k ± 0%   4.096k ± 0%  -23.81% (p=0.000 n=20)
ReadAll/size=6648-16        6.912k ± 0%   6.784k ± 0%   -1.85% (p=0.000 n=20)
ReadAll/size=10000-16       12.29k ± 0%   10.24k ± 0%  -16.67% (p=0.000 n=20)
ReadAll/size=12179-16       12.29k ± 0%   12.29k ± 0%        ~ (p=1.000 n=20) ¹
ReadAll/size=16384-16       21.76k ± 0%   16.38k ± 0%  -24.71% (p=0.000 n=20)
ReadAll/size=32768-16       40.96k ± 0%   32.77k ± 0%  -20.00% (p=0.000 n=20)
ReadAll/size=65536-16       73.73k ± 0%   65.54k ± 0%  -11.11% (p=0.000 n=20)
ReadAll/size=80000-16       98.30k ± 0%   81.92k ± 0%  -16.67% (p=0.000 n=20)
ReadAll/size=100000-16      131.1k ± 0%   106.5k ± 0%  -18.75% (p=0.000 n=20)
ReadAll/size=118014-16      131.1k ± 0%   122.9k ± 0%   -6.25% (p=0.000 n=20)
ReadAll/size=131072-16      172.0k ± 0%   131.1k ± 0%  -23.81% (p=0.000 n=20)
ReadAll/size=397601-16      442.4k ± 0%   401.4k ± 0%   -9.26% (p=0.000 n=20)
ReadAll/size=626039-16      704.5k ± 0%   630.8k ± 0%  -10.47% (p=0.000 n=20)
ReadAll/size=1000000-16     1.114M ± 0%   1.008M ± 0%   -9.56% (p=0.000 n=20)
ReadAll/size=1141838-16     1.401M ± 0%   1.147M ± 0%  -18.13% (p=0.000 n=20)
ReadAll/size=2414329-16     2.753M ± 0%   2.417M ± 0%  -12.20% (p=0.000 n=20)
ReadAll/size=5136407-16     5.399M ± 0%   5.145M ± 0%   -4.70% (p=0.000 n=20)
ReadAll/size=10000000-16    10.56M ± 0%   10.00M ± 0%   -5.28% (p=0.000 n=20)
ReadAll/size=18285584-16    20.65M ± 0%   18.29M ± 0%  -11.42% (p=0.000 n=20)
ReadAll/size=67379426-16    78.84M ± 0%   67.39M ± 0%  -14.53% (p=0.000 n=20)
ReadAll/size=100000000-16   123.2M ± 0%   100.0M ± 0%  -18.82% (p=0.000 n=20)
geomean                  178.3k        151.3k       -15.10%

                       │      old     │              io.ReadAll (new)  │
                       │ excess-ratio │ excess-ratio  vs base          │
ReadAll/size=300-16           1.707 ± 0%     1.707 ± 0%        ~ (p=1.000 n=20) ¹
ReadAll/size=512-16           1.750 ± 0%     1.000 ± 0%  -42.86% (p=0.000 n=20)
ReadAll/size=1000-16          1.408 ± 0%     1.024 ± 0%  -27.27% (p=0.000 n=20)
ReadAll/size=4096-16          1.312 ± 0%     1.000 ± 0%  -23.78% (p=0.000 n=20)
ReadAll/size=6648-16          1.040 ± 0%     1.020 ± 0%   -1.92% (p=0.000 n=20)
ReadAll/size=10000-16         1.229 ± 0%     1.024 ± 0%  -16.68% (p=0.000 n=20)
ReadAll/size=12179-16         1.009 ± 0%     1.009 ± 0%        ~ (p=1.000 n=20) ¹
ReadAll/size=16384-16         1.328 ± 0%     1.000 ± 0%  -24.70% (p=0.000 n=20)
ReadAll/size=32768-16         1.250 ± 0%     1.000 ± 0%  -20.00% (p=0.000 n=20)
ReadAll/size=65536-16         1.125 ± 0%     1.000 ± 0%  -11.11% (p=0.000 n=20)
ReadAll/size=80000-16         1.229 ± 0%     1.024 ± 0%  -16.68% (p=0.000 n=20)
ReadAll/size=100000-16        1.311 ± 0%     1.065 ± 0%  -18.76% (p=0.000 n=20)
ReadAll/size=118014-16        1.111 ± 0%     1.041 ± 0%   -6.30% (p=0.000 n=20)
ReadAll/size=131072-16        1.312 ± 0%     1.000 ± 0%  -23.78% (p=0.000 n=20)
ReadAll/size=397601-16        1.113 ± 0%     1.010 ± 0%   -9.25% (p=0.000 n=20)
ReadAll/size=626039-16        1.125 ± 0%     1.008 ± 0%  -10.40% (p=0.000 n=20)
ReadAll/size=1000000-16       1.114 ± 0%     1.008 ± 0%   -9.52% (p=0.000 n=20)
ReadAll/size=1141838-16       1.227 ± 0%     1.004 ± 0%  -18.17% (p=0.000 n=20)
ReadAll/size=2414329-16       1.140 ± 0%     1.001 ± 0%  -12.19% (p=0.000 n=20)
ReadAll/size=5136407-16       1.051 ± 0%     1.002 ± 0%   -4.66% (p=0.000 n=20)
ReadAll/size=10000000-16      1.056 ± 0%     1.000 ± 0%   -5.30% (p=0.000 n=20)
ReadAll/size=18285584-16      1.129 ± 0%     1.000 ± 0%  -11.43% (p=0.000 n=20)
ReadAll/size=67379426-16      1.170 ± 0%     1.000 ± 0%  -14.53% (p=0.000 n=20)
ReadAll/size=100000000-16     1.232 ± 0%     1.000 ± 0%  -18.83% (p=0.000 n=20)
geomean                    1.216          1.033       -15.10%

                       │ io.ReadAll │              io.ReadAll (new)     │
                       │ allocs/op  │  allocs/op   vs base              │
ReadAll/size=300-16         1.000 ± 0%    1.000 ± 0%        ~ (p=1.000 n=20) ¹
ReadAll/size=512-16         2.000 ± 0%    3.000 ± 0%  +50.00% (p=0.000 n=20)
ReadAll/size=1000-16        3.000 ± 0%    4.000 ± 0%  +33.33% (p=0.000 n=20)
ReadAll/size=4096-16        7.000 ± 0%    9.000 ± 0%  +28.57% (p=0.000 n=20)
ReadAll/size=6648-16        8.000 ± 0%   10.000 ± 0%  +25.00% (p=0.000 n=20)
ReadAll/size=10000-16       10.00 ± 0%    11.00 ± 0%  +10.00% (p=0.000 n=20)
ReadAll/size=12179-16       10.00 ± 0%    11.00 ± 0%  +10.00% (p=0.000 n=20)
ReadAll/size=16384-16       12.00 ± 0%    13.00 ± 0%   +8.33% (p=0.000 n=20)
ReadAll/size=32768-16       14.00 ± 0%    15.00 ± 0%   +7.14% (p=0.000 n=20)
ReadAll/size=65536-16       16.00 ± 0%    16.00 ± 0%        ~ (p=1.000 n=20) ¹
ReadAll/size=80000-16       17.00 ± 0%    17.00 ± 0%        ~ (p=1.000 n=20) ¹
ReadAll/size=100000-16      18.00 ± 0%    17.00 ± 0%   -5.56% (p=0.000 n=20)
ReadAll/size=118014-16      18.00 ± 0%    18.00 ± 0%        ~ (p=1.000 n=20) ¹
ReadAll/size=131072-16      19.00 ± 0%    18.00 ± 0%   -5.26% (p=0.000 n=20)
ReadAll/size=397601-16      23.00 ± 0%    22.00 ± 0%   -4.35% (p=0.000 n=20)
ReadAll/size=626039-16      25.00 ± 0%    23.00 ± 0%   -8.00% (p=0.000 n=20)
ReadAll/size=1000000-16     27.00 ± 0%    24.00 ± 0%  -11.11% (p=0.000 n=20)
ReadAll/size=1141838-16     28.00 ± 0%    24.00 ± 0%  -14.29% (p=0.000 n=20)
ReadAll/size=2414329-16     31.00 ± 0%    26.00 ± 0%  -16.13% (p=0.000 n=20)
ReadAll/size=5136407-16     34.00 ± 0%    28.00 ± 0%  -17.65% (p=0.000 n=20)
ReadAll/size=10000000-16    37.00 ± 0%    30.00 ± 0%  -18.92% (p=0.000 n=20)
ReadAll/size=18285584-16    40.00 ± 0%    31.00 ± 0%  -22.50% (p=0.000 n=20)
ReadAll/size=67379426-16    46.00 ± 0%    35.00 ± 0%  -23.91% (p=0.000 n=20)
ReadAll/size=100000000-16   48.00 ± 0%    36.00 ± 0%  -25.00% (p=0.000 n=20)
geomean                  14.89         14.65        -1.65%

Finally, the read size in this CL currently grows exponentially
at a 1.5x growth rate. The old approach had its read size grow at
a ~1.25x growth rate once the reads are larger. We could consider
for example using a 1.25x read size growth rate here as well.

There are perhaps some ~mild trade-offs. One benefit might
be something like a ~5% smaller peak live heap contribution
(at the end, when copying into the final result) if we used
a 1.25x read growth instead of 1.5x read growth.

That said, for some systems, larger read sizes can trigger
higher throughput behavior further down the stack or
elsewhere in a system, such as via better read-ahead behavior,
larger transfer sizes, etc.

I've observed this effect in various real-world systems,
including distributed systems as well as for example with
spinning platters (which are still widely used, including
backing various "Internet scale" systems). When the effect
exists, it is usually substantial.

Therefore, my guess is it is better to get to larger read
sizes faster, which is one reason the CL is using 1.5x
read size growth rate instead of 1.25x. Also, for something
like peak live heap contribution, we are already getting
substantial wins in this CL for total heap bytes allocated,
so maybe that is OK.

(I have the actual benchmark in a separate commit, which I can
send later, or I can update this CL if preferred).

Fixes #50774
Updates #74299

Change-Id: I65eabf1d83a00fbdbe42e4c697116955f8251740
Reviewed-on: https://go-review.googlesource.com/c/go/+/722500
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
7 weeks agoos: allow direntries to have zero inodes on Linux
Dave Vasilevsky [Tue, 25 Nov 2025 03:55:45 +0000 (03:55 +0000)]
os: allow direntries to have zero inodes on Linux

Some Linux filesystems have been known to return valid enties with
zero inodes. This new behavior also puts Go in agreement with recent
glibc.

Fixes #76428

Change-Id: Ieaf50739a294915a3ea2ef8c5a3bb2a91a186881
GitHub-Last-Rev: 8f83d009ef0320fd3fe7cf03e55d5d24df57f015
GitHub-Pull-Request: golang/go#76448
Reviewed-on: https://go-review.googlesource.com/c/go/+/724220
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

7 weeks agocmd/link: test that moduledata is in its own section
Ian Lance Taylor [Tue, 18 Nov 2025 04:20:26 +0000 (20:20 -0800)]
cmd/link: test that moduledata is in its own section

This is a test for CL 720660.

For #76038

Change-Id: I2f630b738ddb5a9c48e3c5d4374c1e995910541a
Reviewed-on: https://go-review.googlesource.com/c/go/+/721480
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: David Chase <drchase@google.com>
7 weeks agocmd/link: test that findfunctab is in gopclntab section
Ian Lance Taylor [Tue, 18 Nov 2025 02:35:50 +0000 (18:35 -0800)]
cmd/link: test that findfunctab is in gopclntab section

This is a test for CL 719743.

Change-Id: I2d7b9d00d2d4dd63a21ca00f09eb7c9378ec70f8
Reviewed-on: https://go-review.googlesource.com/c/go/+/721461
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
7 weeks agocmd/link: test that funcdata values are in gopclntab section
Ian Lance Taylor [Tue, 18 Nov 2025 02:29:42 +0000 (18:29 -0800)]
cmd/link: test that funcdata values are in gopclntab section

This is a test for CL 719440.

For #76038

Change-Id: I8fc55118b3c7dea39a36e04ffb060fcb6150af54
Reviewed-on: https://go-review.googlesource.com/c/go/+/721460
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>

7 weeks agocmd/link: always run current linker in tests
Ian Lance Taylor [Mon, 17 Nov 2025 19:54:48 +0000 (11:54 -0800)]
cmd/link: always run current linker in tests

This ensures that the tests are testing the current linker sources,
not the installed linker.

Change-Id: I14a2ca9d413e1af57c7b5a00657c72023626a651
Reviewed-on: https://go-review.googlesource.com/c/go/+/721220
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
7 weeks agocmd/link: put moduledata in its own .go.module section
Ian Lance Taylor [Fri, 14 Nov 2025 19:48:55 +0000 (11:48 -0800)]
cmd/link: put moduledata in its own .go.module section

There is a test for this in CL 721480 later in this series.

For #76038

Change-Id: Ib7ed1f0b0aed2d929ca0f135b54d6b62112cae30
Reviewed-on: https://go-review.googlesource.com/c/go/+/720660
TryBot-Bypass: David Chase <drchase@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
7 weeks agocmd/link, runtime, debug/gosym: move pclntab magic to internal/abi
Ian Lance Taylor [Thu, 13 Nov 2025 21:01:14 +0000 (13:01 -0800)]
cmd/link, runtime, debug/gosym: move pclntab magic to internal/abi

Change-Id: I2d3c41b0e61b994d7b04bd16a791fd226dc45269
Reviewed-on: https://go-review.googlesource.com/c/go/+/720302
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

7 weeks agocmd/link: put runtime.findfunctab in the .gopclntab section
Ian Lance Taylor [Tue, 11 Nov 2025 23:53:24 +0000 (15:53 -0800)]
cmd/link: put runtime.findfunctab in the .gopclntab section

There is a test for this in CL 721461 later in this series.

For #76038

Change-Id: I15f9a8d0d5bd9424702a9ca7febb2fa76035aaf8
Reviewed-on: https://go-review.googlesource.com/c/go/+/719743
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Florian Lehner <lehner.florian86@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

7 weeks agocmd/link: put funcdata symbols in .gopclntab section
Ian Lance Taylor [Tue, 11 Nov 2025 00:08:48 +0000 (16:08 -0800)]
cmd/link: put funcdata symbols in .gopclntab section

There is a test for this in CL 721460 later in this series.

For #76038

Change-Id: Icd7a52cbabde5162139dbc4b2c61306c0c748545
Reviewed-on: https://go-review.googlesource.com/c/go/+/719440
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
7 weeks agocmd/link: build shstrtab from ELF sections
Ian Lance Taylor [Fri, 7 Nov 2025 20:25:03 +0000 (12:25 -0800)]
cmd/link: build shstrtab from ELF sections

Since before Go 1 the Go linker has handled ELF by first building the
ELF section string table, and then pointing ELF section headers to it.
This duplicates code as sections are effectively created twice,
once with the name and then again with the full section header.
The code duplication also means that it's easy to create unnecessary
section names; for example, every internally linked Go program
currently contains the string ".go.fuzzcntrs" although most do not
have a section by that name.

This CL changes the linker to simply build the section string table
after all the sections are known.

Change-Id: I27ba15b2af3dc1b8d7436b6c409f818aa8e6bfb4
Reviewed-on: https://go-review.googlesource.com/c/go/+/718840
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

7 weeks agocmd/link: use shdr as a slice rather than counting in elfhdr.Shnum
Ian Lance Taylor [Fri, 7 Nov 2025 19:20:15 +0000 (11:20 -0800)]
cmd/link: use shdr as a slice rather than counting in elfhdr.Shnum

Change-Id: I293e50e3a6ab19fb927099e106095d6aa1241b9f
Reviewed-on: https://go-review.googlesource.com/c/go/+/718820
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
7 weeks agocmd/link: sort allocated ELF section headers by address
Ian Lance Taylor [Fri, 7 Nov 2025 03:52:54 +0000 (19:52 -0800)]
cmd/link: sort allocated ELF section headers by address

For an executable, emit the allocated section headers in address order,
so that section headers are easier for humans to read.

Change-Id: Ib5efb4734101e4a1f6b09d0e045ed643c79c7c0a
Reviewed-on: https://go-review.googlesource.com/c/go/+/718620
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Bypass: David Chase <drchase@google.com>
Reviewed-by: David Chase <drchase@google.com>
7 weeks agocmd/compile: introduce alias analysis and automatically free non-aliased memory after...
thepudds [Tue, 25 Nov 2025 14:57:50 +0000 (09:57 -0500)]
cmd/compile: introduce alias analysis and automatically free non-aliased memory after growslice

This CL is part of a set of CLs that attempt to reduce how much work the
GC must do. See the design in https://go.dev/design/74299-runtime-freegc

This CL updates the compiler to examine append calls to prove
whether or not the slice is aliased.

If proven unaliased, the compiler automatically inserts a call to a new
runtime function introduced with this CL, runtime.growsliceNoAlias,
which frees the old backing memory immediately after slice growth is
complete and the old storage is logically dead.

Two append benchmarks below show promising results, executing up to
~2x faster and up to factor of ~3 memory reduction with this CL.

The approach works with multiple append calls for the same slice,
including inside loops, and the final slice memory can be escaping,
such as in a classic pattern of returning a slice from a function
after the slice is built. (The final slice memory is never freed with
this CL, though we have other work that tackles that.)

An example target for this CL is we automatically free the
intermediate memory for the appends in the loop in this function:

    func f1(input []int) []int {
        var s []int
        for _, x := range input {
            s = append(s, g(x))   // s cannot be aliased here
            if h(x) {
                s = append(s, x)  // s cannot be aliased here
            }
        }
        return s                  // slice escapes at end
    }

In this case, the compiler and the runtime collaborate so that
the heap allocated backing memory for s is automatically freed after
a successful grow. (For the first grow, there is nothing to free,
but for the second and subsequent growths, the old heap memory is
freed automatically.)

The new runtime.growsliceNoAlias is primarily implemented
by calling runtime.freegc, which we introduced in CL 673695.

The high-level approach here is we step through the IR starting
from a slice declaration and look for any operations that either
alias the slice or might do so, and treat any IR construct we
don't specifically handle as a potential alias (and therefore
conservatively fall back to treating the slice as aliased when
encountering something not understood).

For loops, some additional care is required. We arrange the analysis
so that an alias in the body of a loop causes all the appends in that
same loop body to be marked aliased, even if the aliasing occurs after
the append in the IR:

    func f2() {
        var s []int
        for i := range 10 {
                s = append(s, i)  // aliased due to next line
                alias = s
        }
    }

For nested loops, we analyse the nesting appropriately so that
for example this append is still proven as non-aliased in the
inner loop even though it aliased for the outer loop:

    func f3() {
        for range 10 {
            var s []int
            for i := range 10 {
                s = append(s, i)  // append using non-aliased slice
            }
            alias = s
        }
    }

A good starting point is the beginning of the test/escape_alias.go file,
which starts with ~10 introductory examples with brief comments that
attempt to illustrate the high-level approach.

For more details, see the new .../internal/escape/alias.go file,
especially the (*aliasAnalysis).analyze method.

In the first benchmark, an append in a loop builds up a slice from
nothing, where the slice elements are each 64 bytes. In the table below,
'count' is the number of appends. With 1 append, there is no opportunity
for this CL to free memory. Once there are 2 appends, the growth from
1 element to 2 elements means the compiler-inserted growsliceNoAlias
frees the 1-element array, and we see a ~33% reduction in memory use
and a small reported speed improvement.

As the number of appends increases for example to 5, we are at
a ~20% speed improvement and ~45% memory reduction, and so on until
we reach ~40% faster and ~50% less memory allocated at the end of
the table.

There can be variation in the reported numbers based on -randlayout, so
this table is for 30 different values of -randlayout with a total
n=150. (Even so, there is still some variation, so we probably should
not read too much into small changes.) This is with GOAMD64=v3 on
a VM that gcc reports is cascadelake.

goos: linux
goarch: amd64
pkg: runtime
cpu: Intel(R) Xeon(R) CPU @ 2.80GHz
                         │ old-1bb1f2bf0c │        freegc-8ba7421-ps16 │
                         │     sec/op     │   sec/op     vs base       │
Append64Bytes/count=1-4       31.09n ± 2%   31.69n ± 1%   +1.95% (n=150)
Append64Bytes/count=2-4       73.31n ± 1%   70.27n ± 0%   -4.15% (n=150)
Append64Bytes/count=3-4       142.7n ± 1%   124.6n ± 1%  -12.68% (n=150)
Append64Bytes/count=4-4       149.6n ± 1%   127.7n ± 0%  -14.64% (n=150)
Append64Bytes/count=5-4       277.1n ± 1%   213.6n ± 0%  -22.90% (n=150)
Append64Bytes/count=6-4       280.7n ± 1%   216.5n ± 1%  -22.87% (n=150)
Append64Bytes/count=10-4      544.3n ± 1%   386.6n ± 0%  -28.97% (n=150)
Append64Bytes/count=20-4     1058.5n ± 1%   715.6n ± 1%  -32.39% (n=150)
Append64Bytes/count=50-4      2.121µ ± 1%   1.404µ ± 1%  -33.83% (n=150)
Append64Bytes/count=100-4     4.152µ ± 1%   2.736µ ± 1%  -34.11% (n=150)
Append64Bytes/count=200-4     7.753µ ± 1%   4.882µ ± 1%  -37.03% (n=150)
Append64Bytes/count=400-4    15.163µ ± 2%   9.273µ ± 1%  -38.84% (n=150)
geomean                       601.8n        455.0n       -24.39%

                          │ old-1bb1f2bf0c │      freegc-8ba7421-ps16  │
                          │      B/op      │  B/op      vs base        │
Append64Bytes/count=1-4       64.00 ± 0%     64.00 ± 0%        ~ (n=150)
Append64Bytes/count=2-4       192.0 ± 0%     128.0 ± 0%  -33.33% (n=150)
Append64Bytes/count=3-4       448.0 ± 0%     256.0 ± 0%  -42.86% (n=150)
Append64Bytes/count=4-4       448.0 ± 0%     256.0 ± 0%  -42.86% (n=150)
Append64Bytes/count=5-4       960.0 ± 0%     512.0 ± 0%  -46.67% (n=150)
Append64Bytes/count=6-4       960.0 ± 0%     512.0 ± 0%  -46.67% (n=150)
Append64Bytes/count=10-4    1.938Ki ± 0%   1.000Ki ± 0%  -48.39% (n=150)
Append64Bytes/count=20-4    3.938Ki ± 0%   2.001Ki ± 0%  -49.18% (n=150)
Append64Bytes/count=50-4    7.938Ki ± 0%   4.005Ki ± 0%  -49.54% (n=150)
Append64Bytes/count=100-4  15.938Ki ± 0%   8.021Ki ± 0%  -49.67% (n=150)
Append64Bytes/count=200-4   31.94Ki ± 0%   16.08Ki ± 0%  -49.64% (n=150)
Append64Bytes/count=400-4   63.94Ki ± 0%   32.33Ki ± 0%  -49.44% (n=150)
geomean                     1.991Ki        1.124Ki       -43.54%

                          │ old-1bb1f2bf0c │     freegc-8ba7421-ps16   │
                          │   allocs/op    │ allocs/op   vs base       │
Append64Bytes/count=1-4         1.000 ± 0%   1.000 ± 0%        ~ (n=150)
Append64Bytes/count=2-4         2.000 ± 0%   1.000 ± 0%  -50.00% (n=150)
Append64Bytes/count=3-4         3.000 ± 0%   1.000 ± 0%  -66.67% (n=150)
Append64Bytes/count=4-4         3.000 ± 0%   1.000 ± 0%  -66.67% (n=150)
Append64Bytes/count=5-4         4.000 ± 0%   1.000 ± 0%  -75.00% (n=150)
Append64Bytes/count=6-4         4.000 ± 0%   1.000 ± 0%  -75.00% (n=150)
Append64Bytes/count=10-4        5.000 ± 0%   1.000 ± 0%  -80.00% (n=150)
Append64Bytes/count=20-4        6.000 ± 0%   1.000 ± 0%  -83.33% (n=150)
Append64Bytes/count=50-4        7.000 ± 0%   1.000 ± 0%  -85.71% (n=150)
Append64Bytes/count=100-4       8.000 ± 0%   1.000 ± 0%  -87.50% (n=150)
Append64Bytes/count=200-4       9.000 ± 0%   1.000 ± 0%  -88.89% (n=150)
Append64Bytes/count=400-4      10.000 ± 0%   1.000 ± 0%  -90.00% (n=150)
geomean                             4.331        1.000       -76.91%

The second benchmark is similar, but instead uses an 8-byte integer
for the slice element. The first 4 appends in the loop never call into
the runtime thanks to the excellent CL 664299 introduced by Keith in
Go 1.25 that allows some <= 32 byte dynamically-sized slices to be on
the stack, so this CL is neutral for <= 32 bytes. Once the 5th append
occurs at count=5, a grow happens via the runtime and heap allocates
as normal, but freegc does not yet have anything to free, so we see
a small ~1.4ns penalty reported there. But once the second growth
happens, the older heap memory is now automatically freed by freegc,
so we start to see some benefit in memory reductions and speed
improvements, starting at a tiny speed improvement (close to a wash,
or maybe noise) by the second growth before count=10, and building up to
~2x faster with ~68% fewer allocated bytes reported.

goos: linux
goarch: amd64
pkg: runtime
cpu: Intel(R) Xeon(R) CPU @ 2.80GHz
                       │ old-1bb1f2bf0c │        freegc-8ba7421-ps16        │
                       │     sec/op     │   sec/op     vs base              │
AppendInt/count=1-4         2.978n ± 0%   2.969n ± 0%   -0.30% (p=0.000 n=150)
AppendInt/count=4-4         4.292n ± 3%   4.163n ± 3%        ~ (p=0.528 n=150)
AppendInt/count=5-4         33.50n ± 0%   34.93n ± 0%   +4.25% (p=0.000 n=150)
AppendInt/count=10-4        76.21n ± 1%   75.67n ± 0%   -0.72% (p=0.000 n=150)
AppendInt/count=20-4        150.6n ± 1%   133.0n ± 0%  -11.65% (n=150)
AppendInt/count=50-4        284.1n ± 1%   225.6n ± 0%  -20.59% (n=150)
AppendInt/count=100-4       544.2n ± 1%   392.4n ± 1%  -27.89% (n=150)
AppendInt/count=200-4      1051.5n ± 1%   702.3n ± 0%  -33.21% (n=150)
AppendInt/count=400-4       2.041µ ± 1%   1.312µ ± 1%  -35.70% (n=150)
AppendInt/count=1000-4      5.224µ ± 2%   2.851µ ± 1%  -45.43% (n=150)
AppendInt/count=2000-4     11.770µ ± 1%   6.010µ ± 1%  -48.94% (n=150)
AppendInt/count=3000-4     17.747µ ± 2%   8.264µ ± 1%  -53.44% (n=150)
geomean                           331.8n        246.4n       -25.72%

                       │ old-1bb1f2bf0c │         freegc-8ba7421-ps16          │
                       │      B/op      │     B/op      vs base                │
AppendInt/count=1-4        0.000 ± 0%       0.000 ± 0%        ~ (p=1.000 n=150)
AppendInt/count=4-4        0.000 ± 0%       0.000 ± 0%        ~ (p=1.000 n=150)
AppendInt/count=5-4        64.00 ± 0%       64.00 ± 0%        ~ (p=1.000 n=150)
AppendInt/count=10-4       192.0 ± 0%       128.0 ± 0%  -33.33% (n=150)
AppendInt/count=20-4       448.0 ± 0%       256.0 ± 0%  -42.86% (n=150)
AppendInt/count=50-4       960.0 ± 0%       512.0 ± 0%  -46.67% (n=150)
AppendInt/count=100-4    1.938Ki ± 0%     1.000Ki ± 0%  -48.39% (n=150)
AppendInt/count=200-4    3.938Ki ± 0%     2.001Ki ± 0%  -49.18% (n=150)
AppendInt/count=400-4    7.938Ki ± 0%     4.005Ki ± 0%  -49.54% (n=150)
AppendInt/count=1000-4   24.56Ki ± 0%     10.05Ki ± 0%  -59.07% (n=150)
AppendInt/count=2000-4   58.56Ki ± 0%     20.31Ki ± 0%  -65.32% (n=150)
AppendInt/count=3000-4   85.19Ki ± 0%     27.30Ki ± 0%  -67.95% (n=150)
geomean                                     ²                 -42.81%

                       │ old-1bb1f2bf0c │        freegc-8ba7421-ps16         │
                       │   allocs/op    │ allocs/op   vs base                │
AppendInt/count=1-4        0.000 ± 0%     0.000 ± 0%        ~ (p=1.000 n=150)
AppendInt/count=4-4        0.000 ± 0%     0.000 ± 0%        ~ (p=1.000 n=150)
AppendInt/count=5-4        1.000 ± 0%     1.000 ± 0%        ~ (p=1.000 n=150)
AppendInt/count=10-4       2.000 ± 0%     1.000 ± 0%  -50.00% (n=150)
AppendInt/count=20-4       3.000 ± 0%     1.000 ± 0%  -66.67% (n=150)
AppendInt/count=50-4       4.000 ± 0%     1.000 ± 0%  -75.00% (n=150)
AppendInt/count=100-4      5.000 ± 0%     1.000 ± 0%  -80.00% (n=150)
AppendInt/count=200-4      6.000 ± 0%     1.000 ± 0%  -83.33% (n=150)
AppendInt/count=400-4      7.000 ± 0%     1.000 ± 0%  -85.71% (n=150)
AppendInt/count=1000-4     9.000 ± 0%     1.000 ± 0%  -88.89% (n=150)
AppendInt/count=2000-4    11.000 ± 0%     1.000 ± 0%  -90.91% (n=150)
AppendInt/count=3000-4    12.000 ± 0%     1.000 ± 0%  -91.67% (n=150)
geomean                                     ²               -72.76%                 ²

Of course, these are just microbenchmarks, but likely indicate
there are some opportunities here.

The immediately following CL 712422 tackles inlining and is able to get
runtime.freegc working automatically with iterators such as used by
slices.Collect, which becomes able to automatically free the
intermediate memory from its repeated appends (which earlier
in this work required a temporary hand edit to the slices package).

For now, we only use the NoAlias version for element types without
pointers while waiting on additional runtime support in CL 698515.

Updates #74299

Change-Id: I1b9d286aa97c170dcc2e203ec0f8ca72d84e8221
Reviewed-on: https://go-review.googlesource.com/c/go/+/710015
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
7 weeks agocmd/link, cmd/internal/obj: fix a remote call failure issue
limeidan [Mon, 24 Nov 2025 09:28:42 +0000 (17:28 +0800)]
cmd/link, cmd/internal/obj: fix a remote call failure issue

When a function call exceeds the immediate value range of the instruction,
a trampoline is required to assist in the jump. Trampoline is only omitted
when plt is needed; otherwise, a check is required.

Change-Id: I7fe2e08d75f6f574475837b560e650bbd4215858
Reviewed-on: https://go-review.googlesource.com/c/go/+/724580
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
7 weeks agocmd/internal/obj/loong64: remove the incorrect unsigned instructions
Xiaolin Zhao [Fri, 21 Nov 2025 09:22:05 +0000 (17:22 +0800)]
cmd/internal/obj/loong64: remove the incorrect unsigned instructions

The loong64 ISA does not support the 32-bit unsigned arithmetic
instructions ADDU, SUBU and MULU.

Change-Id: Ifa67de9c59aa12d08844189ed23e6daad0cc11ea
Reviewed-on: https://go-review.googlesource.com/c/go/+/722760
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
7 weeks agogo/types, types2: remove InvalidTypeCycle from literals.go
Mark Freeman [Tue, 25 Nov 2025 18:56:18 +0000 (13:56 -0500)]
go/types, types2: remove InvalidTypeCycle from literals.go

Both CL 722161 and CL 724140 implement a more general solution to
detecting cycles involving values of a type on the object path.

The logic in literals.go was intended to be a stop-gap solution and
is no longer necessary.

Change-Id: I328c0febf35444f07fc1894278dc76ab140710bf
Reviewed-on: https://go-review.googlesource.com/c/go/+/724380
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Mark Freeman <markfreeman@google.com>

7 weeks agogo/types, types2: remove setDefType and most def plumbing
Mark Freeman [Mon, 24 Nov 2025 19:34:39 +0000 (14:34 -0500)]
go/types, types2: remove setDefType and most def plumbing

CL 722161 replaced the setDefType mechanism with boundaries on composite
literals, removing the need to pass the def argument in all but 1 case.

The exception is interface types, which use def to populate the receiver
type for better error messages.

Change-Id: Ic78c91238588015153f0d22790be5872a01c5f63
Reviewed-on: https://go-review.googlesource.com/c/go/+/723920
Auto-Submit: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Griesemer <gri@google.com>
7 weeks agogo/types, types2: replace setDefType with pending type check
Mark Freeman [Mon, 24 Nov 2025 22:04:49 +0000 (17:04 -0500)]
go/types, types2: replace setDefType with pending type check

Given a type definition of the form:

  type T RHS

The setDefType function would set T.fromRHS as soon as we knew its
top-level type. For instance, in:

  type S struct { ... }

S.fromRHS is set to a struct type before type-checking anything inside
the struct.

This permit access to the (incomplete) RHS type in a cyclic type
declaration. Accessing this information is fraught (as it's incomplete),
but was used for reporting certain types of cycles.

This CL replaces setDefType with a check that ensures no value of type
T is used before its RHS is set up.

This CL is strictly more complete than what setDefType achieved. For
instance, it enables correct reporting for the below cycles:

  type A [unsafe.Sizeof(A{})]int

  var v any = 42
  type B [v.(B)]int

  func f() C {
    return C{}
  }
  type C [unsafe.Sizeof(f())]int

Fixes #76383
Fixes #76384

Change-Id: I9dfab5b708013b418fa66e43362bb4d8483fedec
Reviewed-on: https://go-review.googlesource.com/c/go/+/724140
Auto-Submit: Mark Freeman <markfreeman@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

7 weeks agocrypto,testing/cryptotest: ignore random io.Reader params, add SetGlobalRandom
Filippo Valsorda [Mon, 15 Sep 2025 16:58:04 +0000 (18:58 +0200)]
crypto,testing/cryptotest: ignore random io.Reader params, add SetGlobalRandom

First, we centralize all random bytes generation through drbg.Read. The
rest of the FIPS 140-3 module can't use external functions anyway, so
drbg.Read needs to have all the logic.

Then, make sure that the crypto/... tree uses drbg.Read (or the new
crypto/internal/rand.Reader wrapper) instead of crypto/rand, so it is
unaffected by applications setting crypto/rand.Reader.

Next, pass all unspecified random io.Reader parameters through the new
crypto/internal/rand.CustomReader, which just redirects to drbg.Read
unless GODEBUG=cryptocustomrand=1 is set. Move all the calls to
MaybeReadByte there, since it's only needed for these custom Readers.

Finally, add testing/cryptotest.SetGlobalRandom which sets
crypto/rand.Reader to a locked deterministic source and overrides
drbg.Read. This way SetGlobalRandom should affect all cryptographic
randomness in the standard library.

Fixes #70942

Co-authored-by: qiulaidongfeng <2645477756@qq.com>
Change-Id: I6a6a69641311d9fac318abcc6d79677f0e406100
Reviewed-on: https://go-review.googlesource.com/c/go/+/724480
Reviewed-by: Nicholas Husin <nsh@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Nicholas Husin <husin@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

7 weeks agoruntime: update mkmalloc to make generated code look nicer
matloob [Wed, 26 Nov 2025 23:04:22 +0000 (18:04 -0500)]
runtime: update mkmalloc to make generated code look nicer

This cl adds a new operation that can remove an if statement or replace
it with its body if its condition is var or !var for some variable var
that's being replaced with a constant.

Change-Id: I864abf1f023b2a66b2299ca65d4f837d6a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/724940
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Matloob <matloob@google.com>
Auto-Submit: Michael Matloob <matloob@google.com>

7 weeks agoruntime/secret: implement new secret package
Daniel Morsing [Thu, 25 Sep 2025 16:26:03 +0000 (17:26 +0100)]
runtime/secret: implement new secret package

Implement secret.Do.

- When secret.Do returns:
  - Clear stack that is used by the argument function.
  - Clear all the registers that might contain secrets.
- On stack growth in secret mode, clear the old stack.
- When objects are allocated in secret mode, mark them and then zero
  the marked objects immediately when they are freed.
- If the argument function panics, raise that panic as if it originated
  from secret.Do. This removes anything about the secret function
  from tracebacks.

For now, this is only implemented on linux for arm64 and amd64.

This is a rebased version of Keith Randalls initial implementation at
CL 600635. I have added arm64 support, signal handling, preemption
handling and dealt with vDSOs spilling into system stacks.

Fixes #21865

Change-Id: I6fbd5a233beeaceb160785e0c0199a5c94d8e520
Co-authored-by: Keith Randall <khr@golang.org>
Reviewed-on: https://go-review.googlesource.com/c/go/+/704615
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
7 weeks agogo/build/constraint: use strings.Builder instead of for { str+=str }
Alan Donovan [Wed, 26 Nov 2025 22:53:04 +0000 (17:53 -0500)]
go/build/constraint: use strings.Builder instead of for { str+=str }

(This works around a bug in the stringsbuilder modernizer.)

For #76476

Change-Id: I1cb8715fd79c0363cb9c159686eaeb3482c93228
Reviewed-on: https://go-review.googlesource.com/c/go/+/724721
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Bypass: Alan Donovan <adonovan@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
7 weeks agogo/types: relax NewSignatureType for append(slice, str...)
Alan Donovan [Mon, 21 Jul 2025 18:35:08 +0000 (14:35 -0400)]
go/types: relax NewSignatureType for append(slice, str...)

CL 688815 contained a partial fix for the reported bug, but
NewSignatureType continued to panic. This change relaxes it
to permit construction of the type "func([]byte, B) []byte"
where "type B []byte". We must do so because a client
may instantiate the type "func([]byte, T...)" where [T ~string|~[]byte]
at T=B, and may have no way to know that they are dealing
with this very special edge case of append.

Added a regression test of NewSignatureType, which I should
have done in the earlier CL.

Also, make typestring less pedantic and fragile.

Fixes #73871

Change-Id: I3d8f8609582149f9c9f8402a04ad516c2c63bbc6
Reviewed-on: https://go-review.googlesource.com/c/go/+/689277
TryBot-Bypass: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
7 weeks agocrypto/tls: support crypto.MessageSigner private keys
Filippo Valsorda [Wed, 26 Nov 2025 20:11:35 +0000 (21:11 +0100)]
crypto/tls: support crypto.MessageSigner private keys

Fixes #75656

Change-Id: I6bc71c80973765ef995d17b1450ea2026a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/724820
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Nicholas Husin <husin@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Nicholas Husin <nsh@golang.org>
7 weeks agocmd/compile: fix bloop get name logic
Junyang Shao [Tue, 25 Nov 2025 01:37:13 +0000 (01:37 +0000)]
cmd/compile: fix bloop get name logic

This CL change getNameFrom impl to pattern match addressible patterns.

Change-Id: If1faa22a3a012d501e911d8468a5702b348abf16
Reviewed-on: https://go-review.googlesource.com/c/go/+/724180
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
7 weeks agocmd/go: remove experiment checks for compile -c
matloob [Wed, 26 Nov 2025 15:30:34 +0000 (10:30 -0500)]
cmd/go: remove experiment checks for compile -c

There's a comment that we should test that compile -c is compatible with
the fieldtrack and preemptibleloops experiments and then remove the
check disabling -c when those experiments are enabled.

I tested this and the tests pass with fieldtrack (with the exception of one go command test that makes the assumption that fieldtrack is off), and the preemptibleloops experiment is already broken without this experiment.

Also remove the check for the value of the GO19CONCURRENTCOMPILATION
environment variable. The compiler concurrency can be limited by setting
GOMAXPROCS.

Change-Id: I0c02745de463ea572673648061185cd76a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/724680
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

7 weeks agodoc/next: document broken freebsd/riscv64 port
Dmitri Shuralyov [Wed, 26 Nov 2025 21:12:53 +0000 (16:12 -0500)]
doc/next: document broken freebsd/riscv64 port

Also update comment in cmd/dist's broken map to point to the top-level
umbrella issue.

For #76475.
For #75005.

Change-Id: I43b8384af4264dc5d72ceea8d05730b9db81123a
Reviewed-on: https://go-review.googlesource.com/c/go/+/724860
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Bypass: Dmitri Shuralyov <dmitshur@golang.org>

7 weeks agocmd/compile, runtime: guard X15 zeroing with GOEXPERIMENT=simd
Cherry Mui [Wed, 26 Nov 2025 15:56:15 +0000 (10:56 -0500)]
cmd/compile, runtime: guard X15 zeroing with GOEXPERIMENT=simd

If simd experiment is not enabled, the compiler doesn't use the
AVX part of the register. So only zero it with the SSE instruction.

Change-Id: Ia3bdf34a9ed273128db2ee0f4f5db6f7cc76a975
Reviewed-on: https://go-review.googlesource.com/c/go/+/724720
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
7 weeks agocrypto/fips140: add WithoutEnforcement
Daniel Morsing [Mon, 24 Nov 2025 13:08:10 +0000 (13:08 +0000)]
crypto/fips140: add WithoutEnforcement

WithoutEnforcement lets programs running under GODEBUG=fips140=only
selectively opt out of strict enforcement. This is especially helpful
for non-critical uses of cryptography routines like SHA-1 for content
addressable storage backends (E.g. git).

Fixes #74630

Change-Id: Iabba1f5eb63498db98047aca45e09c5dccf2fbdf
Reviewed-on: https://go-review.googlesource.com/c/go/+/723720
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
7 weeks agocrypto/x509: add ExtKeyUsage.OID method
Roland Shoemaker [Wed, 26 Nov 2025 17:21:13 +0000 (09:21 -0800)]
crypto/x509: add ExtKeyUsage.OID method

And OIDFromASN1OID for converting between asn1.ObjectIdentifier and OID.

Fixes #75325

Change-Id: I3b84dce54346d88aab731ffe30d0fef07b014f04
Reviewed-on: https://go-review.googlesource.com/c/go/+/724761
Reviewed-by: Neal Patel <nealpatel@google.com>
Auto-Submit: Roland Shoemaker <roland@golang.org>
Commit-Queue: Neal Patel <nealpatel@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

7 weeks agocmd/go: limit total compile -c backend concurrency using a pool
Michael Matloob [Mon, 24 Nov 2025 23:33:30 +0000 (18:33 -0500)]
cmd/go: limit total compile -c backend concurrency using a pool

Previously we limited the value we passed in to compile -c (which set
the number of SSA compile goroutines that run at one time) to 4. This CL
allows the -c value to go up to GOMAXPROCS, while limiting the total
number of backend SSA compile goroutines to still be less than the
previous worst case of 4*GOMAXPROCS (actually four times the value of
the -p flag, but the default is GOMAXPROCS). We do that by keeping a
pool of tokens to represent the total number of SSA compile goroutines
(with some buffer to allow us to run out of tokens and not exceed
4*GOMAXPROCS). Each time a compile requests a -c value, we'll hand out
half of the remaining tokens (with the number handed otu capped at
GOMAXPROCS) until we run out of tokens, in wich case we'll set -c to
one.

This leads to a speed up of 3-10% on the 16 core intel perf builder and
5-16% on the 88 core builder on the Sweet go-build benchmark.

Change-Id: Ib1ec843fee57f0fb8d36a507162317276a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/724142
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@google.com>
7 weeks agocmd/compile: handle loops better during stack allocation of slices
Keith Randall [Thu, 20 Nov 2025 17:42:16 +0000 (09:42 -0800)]
cmd/compile: handle loops better during stack allocation of slices

Don't use the move2heap optimization if the move2heap is inside
a loop deeper than the declaration of the slice. We really only want
to do the move2heap operation once.

Change-Id: I4a68d01609c2c9d4e0abe4580839e70059393a81
Reviewed-on: https://go-review.googlesource.com/c/go/+/722440
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

7 weeks agogo/types, types2: improve printing of []*operand lists (debugging support)
Robert Griesemer [Wed, 26 Nov 2025 00:26:25 +0000 (16:26 -0800)]
go/types, types2: improve printing of []*operand lists (debugging support)

Special-case an sprintf argument of []*operand type, similar to what
we do for other lists. As a result a list of operands is printed as
[a, b, c] rather than [a b c] (default formatting for slices).

(We could factor out this code into a generic function, but this is
a minimally intrusive change at this point.)

Change-Id: Iea4fc6ea375dd9618316b7317a77b57b4e35544d
Reviewed-on: https://go-review.googlesource.com/c/go/+/724500
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>

7 weeks agoruntime: merge all the linux 32 and 64 bits files into one for each
Jorropo [Thu, 23 Oct 2025 08:54:00 +0000 (10:54 +0200)]
runtime: merge all the linux 32 and 64 bits files into one for each

Change-Id: I57067c9724dad2fba518b900d6f6a049cc32099e
Reviewed-on: https://go-review.googlesource.com/c/go/+/714081
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
7 weeks agotesting: fix bloop doc
Junyang Shao [Wed, 26 Nov 2025 19:15:51 +0000 (19:15 +0000)]
testing: fix bloop doc

This CL deletes the compiler detail part from bloop documentation.

Change-Id: I73933707a593d4958e2300416d15e7213f001c3a
Reviewed-on: https://go-review.googlesource.com/c/go/+/724800
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
7 weeks agoos,internal/syscall/windows: support O_* flags in Root.OpenFile
qmuntal [Wed, 26 Nov 2025 11:11:50 +0000 (12:11 +0100)]
os,internal/syscall/windows: support O_* flags in Root.OpenFile

These file flags are supported by os.OpenFile since CL 699415.

Closes #73676

Change-Id: Ib37102a565f538d394d2a94bd605d6c6004f3028
Reviewed-on: https://go-review.googlesource.com/c/go/+/724621
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
7 weeks agocmd/internal/obj/loong64: add {,x}vmadd series instructions support
Guoqi Chen [Mon, 24 Nov 2025 12:19:06 +0000 (20:19 +0800)]
cmd/internal/obj/loong64: add {,x}vmadd series instructions support

Go asm syntax:
  VMADD{B, H, W, V}                         V1, V2, V3
  VMSUB{B, H, W, V}                         V1, V2, V3
 XVMADD{B, H, W, V}                         X1, X2, X3
 XVMSUB{B, H, W, V}                         X1, X2, X3
 VMADDWEV{HB, WH, VW,QV}{,U}                V1, V2, V3
 VMADDWOD{HB, WH, VW,QV}{,U}                V1, V2, V3
XVMADDWEV{HB, WH, VW,QV}{,U}                X1, X2, X3
XVMADDWOD{HB, WH, VW,QV}{,U}                X1, X2, X3
 VMADDWEV{HBUB, WHUH, VWUW, QVUV}           V1, V2, V3
 VMADDWOD{HBUB, WHUH, VWUW, QVUV}           V1, V2, V3
XVMADDWEV{HBUB, WHUH, VWUW, QVUV}           X1, X2, X3
XVMADDWOD{HBUB, WHUH, VWUW, QVUV}           X1, X2, X3

Equivalent platform assembler syntax:
 vmadd.{b,h,w,d}                            v3, v2, v1
 vmsub.{b,h,w,d}                            v3, v2, v1
xvmadd.{b,h,w,d}                            x3, x2, x1
xvmsub.{b,h,w,d}                            x3, x2, x1
 vmaddwev.{h.b, w.h, d.w, q.d}{,u}          v3, v2, v1
 vmaddwod.{h.b, w.h, d.w, q.d}{,u}          v3, v2, v1
xvmaddwev.{h.b, w.h, d.w, q.d}{,u}          x3, x2, x1
xvmaddwod.{h.b, w.h, d.w, q.d}{,u}          x3, x2, x1
 vmaddwev.{h.bu.b, d.wu.w, d.wu.w, q.du.d}  v3, v2, v1
 vmaddwod.{h.bu.b, d.wu.w, d.wu.w, q.du.d}  v3, v2, v1
xvmaddwev.{h.bu.b, d.wu.w, d.wu.w, q.du.d}  x3, x2, x1
xvmaddwod.{h.bu.b, d.wu.w, d.wu.w, q.du.d}  x3, x2, x1

Change-Id: I2f4aae51045e1596d4744e525a1589586065cf8e
Reviewed-on: https://go-review.googlesource.com/c/go/+/724200
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: abner chenc <chenguoqi@loongson.cn>

7 weeks agocmd/internal/obj/loong64: add aliases to 32-bit arithmetic instructions
Xiaolin Zhao [Tue, 18 Nov 2025 08:00:35 +0000 (16:00 +0800)]
cmd/internal/obj/loong64: add aliases to 32-bit arithmetic instructions

Both the MULW and MUL instructions point to the mul.w instruction
in the loong64 ISA. Previously, MULW was not encoded; now it is
encoded and used as an alias for MUL.
The same applies to the following instructions: ADD, SUB, DIV.
For consistency, we have added additional aliases for DIVU, REM and REMU.

Change-Id: Iba201a3c4c2893ff7d301ef877fad9c81e54291b
Reviewed-on: https://go-review.googlesource.com/c/go/+/721523
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

7 weeks agocmd/compile: add tests bruteforcing limit complement
Jorropo [Wed, 26 Nov 2025 08:49:50 +0000 (09:49 +0100)]
cmd/compile: add tests bruteforcing limit complement

Change-Id: I9d8bd78a06738a8a242b6965382e61568e93dea7
Reviewed-on: https://go-review.googlesource.com/c/go/+/724620
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@google.com>
7 weeks agoos,internal/poll: don't call IsNonblock for consoles and Stdin
qmuntal [Wed, 26 Nov 2025 09:25:16 +0000 (10:25 +0100)]
os,internal/poll: don't call IsNonblock for consoles and Stdin

windows.IsNonblock can block for synchronous handles that have an
outstanding I/O operation. Console handles are always synchronous, so
we should not call IsNonblock for them. Stdin is often a pipe, and
almost always a synchronous handle, so we should not call IsNonblock for
it either. This avoids potential deadlocks during os package
initialization, which calls NewFile(syscall.Stdin).

Fixes #75949
Updates #76391

Cq-Include-Trybots: luci.golang.try:gotip-windows-amd64-longtest,gotip-windows-amd64-race,gotip-windows-arm64
Change-Id: I1603932b0a99823019aa0cad960f94cee9996505
Reviewed-on: https://go-review.googlesource.com/c/go/+/724640
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
7 weeks agocrypto/internal/fips140/aes: optimize ctrBlocks8Asm on amd64
Boris Nagaev [Wed, 26 Nov 2025 08:26:49 +0000 (08:26 +0000)]
crypto/internal/fips140/aes: optimize ctrBlocks8Asm on amd64

Implement overflow-aware optimization in ctrBlocks8Asm: make a fast branch
in case when there is no overflow. One branch per 8 blocks is faster than
7 increments in general purpose registers and transfers from them to XMM.

Added AES-192 and AES-256 modes to the AES-CTR benchmark.

Added a correctness test in ctr_test.go for the overflow optimization.

This improves performance, especially in AES-128 mode.

goos: windows
goarch: amd64
pkg: crypto/cipher
cpu: AMD Ryzen 7 5800H with Radeon Graphics
 │     B/s      │     B/s       vs base
AESCTR/128/50-16   1.377Gi ± 0%   1.384Gi ± 0%   +0.51% (p=0.028 n=20)
AESCTR/128/1K-16   6.164Gi ± 0%   6.892Gi ± 1%  +11.81% (p=0.000 n=20)
AESCTR/128/8K-16   7.372Gi ± 0%   8.768Gi ± 1%  +18.95% (p=0.000 n=20)
AESCTR/192/50-16   1.289Gi ± 0%   1.279Gi ± 0%   -0.75% (p=0.001 n=20)
AESCTR/192/1K-16   5.734Gi ± 0%   6.011Gi ± 0%   +4.83% (p=0.000 n=20)
AESCTR/192/8K-16   6.889Gi ± 1%   7.437Gi ± 0%   +7.96% (p=0.000 n=20)
AESCTR/256/50-16   1.170Gi ± 0%   1.163Gi ± 0%   -0.54% (p=0.005 n=20)
AESCTR/256/1K-16   5.235Gi ± 0%   5.391Gi ± 0%   +2.98% (p=0.000 n=20)
AESCTR/256/8K-16   6.361Gi ± 0%   6.676Gi ± 0%   +4.94% (p=0.000 n=20)
geomean            3.681Gi        3.882Gi        +5.46%

The slight slowdown on 50-byte workloads is unrelated to this change,
because such workloads never use ctrBlocks8Asm.

Updates #76061

Change-Id: Idfd628ac8bb282d9c73c6adf048eb12274a41379
GitHub-Last-Rev: 5aadd39351806fbbf5201e07511aac05bdcb0529
GitHub-Pull-Request: golang/go#76059
Reviewed-on: https://go-review.googlesource.com/c/go/+/714361
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: AHMAD ابو وليد <mizommz@gmail.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>

7 weeks agocmd/compile: add tests bruteforcing limit negation and improve limit addition
Jorropo [Wed, 26 Nov 2025 08:27:45 +0000 (09:27 +0100)]
cmd/compile: add tests bruteforcing limit negation and improve limit addition

I had to improve addition to make the tests pass.

Change-Id: I4daba2ee0f24a0dbc3929bf9afadd2116e16efae
Reviewed-on: https://go-review.googlesource.com/c/go/+/724600
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
7 weeks agocmd/compile,internal/bytealg: add MemEq intrinsic for runtime.memequal
Alexander Musman [Sat, 5 Jul 2025 20:16:36 +0000 (23:16 +0300)]
cmd/compile,internal/bytealg: add MemEq intrinsic for runtime.memequal

Introduce a new MemEq SSA operation for runtime.memequal. The operation
is initially implemented for arm64. The change adds opt rules (following
existing rules for call to runtime.memequal), working with MemEq, and a
later op version LoweredMemEq which may be lowered differently for more
constant size cases in future (for other targets as well as for arm64).
The new MemEq SSA operation does not have memory result, allowing cse of
loads operations around it.

Code size difference (for arm64 linux):

Executable            Old .text  New .text     Change
-------------------------------------------------------
asm                     1970420    1969668     -0.04%
cgo                     1741220    1740212     -0.06%
compile                 8956756    8959428     +0.03%
cover                   1879332    1878772     -0.03%
link                    2574116    2572660     -0.06%
preprofile               867124     866820     -0.04%
vet                     2890404    2888596     -0.06%

Change-Id: I6ab507929b861884d17d5818cfbd152cf7879751
Reviewed-on: https://go-review.googlesource.com/c/go/+/686655
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
7 weeks agocmd/go: remove final references to modfetch.Fetcher_
Ian Alexander [Tue, 25 Nov 2025 01:24:51 +0000 (20:24 -0500)]
cmd/go: remove final references to modfetch.Fetcher_

This commit removes the final references to the global Fetcher_ variable from
the modfetch and modload packages.

This completes the removal of global state from the modfetch package.

Change-Id: Ibb5309acdc7d05f1a7591ddcf890b44b6cc4cb2f
Reviewed-on: https://go-review.googlesource.com/c/go/+/724249
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

7 weeks agocmd/go/internal/toolchain: remove references to modfetch.Fetcher_
Ian Alexander [Mon, 24 Nov 2025 23:48:32 +0000 (18:48 -0500)]
cmd/go/internal/toolchain: remove references to modfetch.Fetcher_

This commit removes references to the global modfetch.Fetcher_
variable from the toolchain package.

Change-Id: Id366bec88e5904098b90371ec103f92d402174d5
Reviewed-on: https://go-review.googlesource.com/c/go/+/724248
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

7 weeks agocmd/go/internal/modget: remove references to modfetch.Fetcher_
Ian Alexander [Mon, 24 Nov 2025 23:39:53 +0000 (18:39 -0500)]
cmd/go/internal/modget: remove references to modfetch.Fetcher_

This commit removes references to the global modfetch.Fetcher_
variable from the modget package.

Change-Id: I62dfcc0e9cf9722a6706bbdf7b6e561130ed82d1
Reviewed-on: https://go-review.googlesource.com/c/go/+/724247
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
7 weeks agocmd/go/internal/load: remove references to modfetch.Fetcher_
Ian Alexander [Mon, 24 Nov 2025 23:38:13 +0000 (18:38 -0500)]
cmd/go/internal/load: remove references to modfetch.Fetcher_

This commit removes references to the global modfetch.Fetcher_
variable from the load package.

Change-Id: Ic579743079252afd4d2d12e5118de09d86340267
Reviewed-on: https://go-review.googlesource.com/c/go/+/724246
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
7 weeks agocmd/go/internal/modcmd: remove references to modfetch.Fetcher_
Ian Alexander [Mon, 24 Nov 2025 23:36:07 +0000 (18:36 -0500)]
cmd/go/internal/modcmd: remove references to modfetch.Fetcher_

This commit removes references to the global modfetch.Fetcher_
variable from the modcmd package.

Change-Id: Ie2966401d1f6964e21ddede65d39ff53fea6e867
Reviewed-on: https://go-review.googlesource.com/c/go/+/724245
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
7 weeks agocmd/compile: adjust start heap size
David Chase [Mon, 17 Nov 2025 18:53:58 +0000 (13:53 -0500)]
cmd/compile: adjust start heap size

TLDR
- not-huge increase to default starting heap boost,
- small improvement in build performance,
- remove concurrency dependence of starting heap,
- aligns RSS behavior with GOMEMLIMIT,
- adds a gcflags=-d=gcstart=N (N -> N MiB) flag for
  people who want to trade a lot of memory for a
  little build performance improvement.

This removes concurrency (-c flag) sensitivity and increases the
nominal default to 128MiB.

Refactored the startheap code into a separate file, to make it
easier to extract and reuse.

Added sensitivity to concurrency=1 and GOMEMLIMIT!="" (in addition
to existing GOGC!=""), those disable the default starting heap boost
because the compiler-invoker has indicated either a desire to control
the GC or a desire to run in minimum memory(or both).

Adds a -d flag gcstart=N (N is number of MiB) for
tinkering/experiments. This always enables the starting heap.
(`GOGC=XXX` and `-d=gcstart=YYY` will use `GOGC=XXX` after starting
heap size is achieved.)

Derated the "boost" obtained by a factor of .70 so that
`-d=gcstart=2000` yields the same RSS as `GOMEMLIMIT=2000MiB`

(Actually adjusts the boost with a high-low breakpoint.)

The parent, with concurrency sensitivity, provided 64MB of plain
boost.  Derating reduces the effects of boosting the starting heap
slightly.  The benchmark here shows that maintaining 64MB results in
a minor regression, while increasing it to 128MB produces a slight
improvement, and does not grow the RSS versus 64MB.

```
        │   parent    │                sh64                │               sh128                │              sh1024               │
        │   sec/op    │   sec/op     vs base               │   sec/op     vs base               │   sec/op    vs base               │
std       10.164 ± 1%   10.527 ± 1%  +3.57% (p=0.000 n=50)   10.084 ± 1%  -0.79% (p=0.000 n=50)   9.631 ± 1%  -5.24% (p=0.000 n=50)
compile    21.05 ± 1%    20.78 ± 0%  -1.28% (p=0.000 n=50)    20.74 ± 1%  -1.46% (p=0.000 n=50)   20.77 ± 0%  -1.32% (p=0.001 n=50)
ast        20.45 ± 1%    20.39 ± 1%       ~ (p=0.334 n=50)    20.44 ± 0%       ~ (p=0.818 n=50)   20.11 ± 1%  -1.65% (p=0.000 n=50)
geomean    16.35         16.46       +0.65%                   16.23       -0.76%                  15.90       -2.75%

        │   parent    │                sh64                │               sh128                │               sh1024               │
        │ user-sec/op │ user-sec/op  vs base               │ user-sec/op  vs base               │ user-sec/op  vs base               │
std        66.06 ± 0%    69.74 ± 0%  +5.56% (p=0.000 n=50)    64.68 ± 0%  -2.09% (p=0.000 n=50)    59.51 ± 0%  -9.91% (p=0.000 n=50)
compile    84.69 ± 1%    82.54 ± 0%  -2.53% (p=0.000 n=50)    82.63 ± 0%  -2.43% (p=0.000 n=50)    82.66 ± 1%  -2.40% (p=0.000 n=50)
ast        59.41 ± 0%    58.84 ± 1%  -0.95% (p=0.011 n=50)    59.48 ± 1%       ~ (p=0.341 n=50)    57.13 ± 1%  -3.83% (p=0.000 n=50)
geomean    69.27         69.71       +0.63%                   68.25       -1.47%                   65.50       -5.44%

        │   parent   │                sh64                │               sh128               │              sh1024               │
        │ sys-sec/op │ sys-sec/op   vs base               │ sys-sec/op  vs base               │ sys-sec/op  vs base               │
std       9.599 ± 1%   10.031 ± 1%  +4.50% (p=0.000 n=50)   9.513 ± 1%  -0.90% (p=0.014 n=50)   9.359 ± 1%  -2.50% (p=0.000 n=50)
compile   6.813 ± 1%    6.740 ± 1%  -1.08% (p=0.017 n=50)   6.716 ± 1%  -1.42% (p=0.006 n=50)   6.696 ± 1%  -1.72% (p=0.000 n=50)
ast       4.315 ± 1%    4.291 ± 1%       ~ (p=0.781 n=50)   4.296 ± 1%       ~ (p=0.792 n=50)   4.279 ± 2%       ~ (p=0.124 n=50)
geomean   6.559         6.620       +0.93%                  6.499       -0.92%                  6.449       -1.68%

        │     parent     │                 sh64                  │                 sh128                 │                 sh1024                  │
        │ peak-RSS-bytes │ peak-RSS-bytes  vs base               │ peak-RSS-bytes  vs base               │ peak-RSS-bytes  vs base                 │
std         257.1Mi ± 1%     257.2Mi ± 1%       ~ (p=0.754 n=50)     257.0Mi ± 0%       ~ (p=0.570 n=50)     605.6Mi ± 0%  +135.59% (p=0.000 n=50)
compile    1007.2Mi ± 1%    1004.3Mi ± 0%       ~ (p=0.064 n=50)    1007.4Mi ± 0%       ~ (p=0.348 n=50)    1009.4Mi ± 1%         ~ (p=0.598 n=50)
ast         1.848Gi ± 0%     1.842Gi ± 0%       ~ (p=0.079 n=50)     1.824Gi ± 0%  -1.25% (p=0.000 n=50)     1.856Gi ± 0%    +0.47% (p=0.000 n=50)
geomean     788.3Mi          786.8Mi       -0.19%                    785.0Mi       -0.41%                    1.027Gi        +33.37%
```

Updates #73044

Change-Id: I6359642a94b396e696dd57e64ed1f2c4cf178475
Reviewed-on: https://go-review.googlesource.com/c/go/+/724441
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

7 weeks agointernal/trace: support event constructor for testing
Felix Geisendörfer [Wed, 2 Jul 2025 09:26:17 +0000 (11:26 +0200)]
internal/trace: support event constructor for testing

Implement the new APIs described in #74826.

Closes #74826

Change-Id: I6a6a6964229548e9d54e7af95185011e183ee50b
Reviewed-on: https://go-review.googlesource.com/c/go/+/691815
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

7 weeks agoruntime: panic if cleanup function closes over cleanup pointer
Ian Lance Taylor [Fri, 22 Aug 2025 20:47:42 +0000 (13:47 -0700)]
runtime: panic if cleanup function closes over cleanup pointer

This would catch problems like https://go.dev/cl/696295.

Benchmark effect with this CL plus CL 697535:

goos: linux
goarch: amd64
pkg: runtime
cpu: 12th Gen Intel(R) Core(TM) i7-1260P
                     │ /tmp/foo.1  │             /tmp/foo.2             │
                     │   sec/op    │   sec/op     vs base               │
AddCleanupAndStop-16   81.93n ± 1%   82.87n ± 1%  +1.14% (p=0.041 n=10)

For #75066

Change-Id: Ia41d0d6b88baebf6055cb7e5d42bc8210b31630f
Reviewed-on: https://go-review.googlesource.com/c/go/+/714000
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>