]> git.feebdaed.xyz Git - 0xmirror/go.git/log
0xmirror/go.git
2 weeks agoruntime: only run TestNotInGoMetricCallback when building with cgo
Michael Anthony Knyszek [Mon, 8 Dec 2025 16:17:15 +0000 (16:17 +0000)]
runtime: only run TestNotInGoMetricCallback when building with cgo

It seems like some platforms don't build with cgo at all, like
linux/ppc64.

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

2 weeks agoruntime: disable TestNotInGoMetricCallback on FreeBSD + race
Michael Anthony Knyszek [Mon, 8 Dec 2025 16:05:53 +0000 (16:05 +0000)]
runtime: disable TestNotInGoMetricCallback on FreeBSD + race

cgo + race is not supported on FreeBSD.

Change-Id: I38abeccaaabfcc104d1d5a077fb99646dc4be792
Reviewed-on: https://go-review.googlesource.com/c/go/+/728120
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2 weeks agoruntime: use atomic C types with atomic C functions
Joel Sing [Mon, 8 Dec 2025 13:11:55 +0000 (00:11 +1100)]
runtime: use atomic C types with atomic C functions

Mark types as _Atomic - fixes breakage introduced in CL 726964
across most LLVM based platforms/builders.

Change-Id: I5e64b9ccb0cf5244977a787a52ee124bc03c10de
Reviewed-on: https://go-review.googlesource.com/c/go/+/728040
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2 weeks agoruntime: deflake TestProfBufWakeup
Nick Ripley [Sat, 6 Dec 2025 15:09:38 +0000 (10:09 -0500)]
runtime: deflake TestProfBufWakeup

If CI infrastructure is oversubscribed, the profile buffer reader can be
blocked long enough for the status in the traceback to be something like
"[syscall, 3 minutes]", rather than the "[syscall]" we are looking for.
Tweak the regexp to look for the expected state at the beginning of the
status in the brackets.

While we're here, clarify the possible "race" in the test, which has
more to do with failing to catch a buggy implementation rather than
failing for a correct implementation. Ideally if the implementation is
buggy, we should see the t.Errorf at least some of the time, even if we
don't see it in every run.

Change-Id: Iebd5229d338dc3f973349cea6dd84c506a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/727660
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2 weeks agoruntime: mark getfp as nosplit
khr@golang.org [Mon, 8 Dec 2025 14:21:39 +0000 (09:21 -0500)]
runtime: mark getfp as nosplit

When compiling with -l, we can't take a stack split here.

Fixes #76702

Change-Id: Ieab1225c6259c7f16bb5188aa84bff615d9db2e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/728060
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@google.com>
3 weeks agotest/codegen: test negation with add/sub on riscv64
Meng Zhuo [Thu, 13 Nov 2025 08:13:31 +0000 (16:13 +0800)]
test/codegen: test negation with add/sub on riscv64

Change-Id: Ic0eca86d3c93707ebd7c716e774ebda55af4f196
Reviewed-on: https://go-review.googlesource.com/c/go/+/703755
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Julian Zhu <jz531210@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Joel Sing <joel@sing.id.au>
3 weeks agocmd/go: convert some more tests to script tests
matloob [Fri, 5 Dec 2025 20:25:42 +0000 (15:25 -0500)]
cmd/go: convert some more tests to script tests

Convert more tests to script tests so they can run in parallel with the
rest of the script tests. This CL converts
TestPackageMainTestCompilerFlags, TestGoListTest,
TestListTemplateContextFunction, and TestIssue22588.

Change-Id: I4f8410e85d4811e82d85d884d28a2a0d6a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/727420
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
3 weeks agocmd/go/internal/vet: skip -fix on pkgs from vendor or non-main mod
Alan Donovan [Fri, 5 Dec 2025 17:41:21 +0000 (12:41 -0500)]
cmd/go/internal/vet: skip -fix on pkgs from vendor or non-main mod

This change causes go fix (and go vet -fix) to skip applying fixes
to any package in the vendor/ tree, including the GOROOT vendor
packages that are part of std, and to any package from a non-main
module (since these usually come from the readonly module cache).

+ test

Fixes golang/go#76479

Change-Id: Ifdb73e09fbe413b4d99a92e5081b8ea43460be0b
Reviewed-on: https://go-review.googlesource.com/c/go/+/727300
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>
Auto-Submit: Alan Donovan <adonovan@google.com>

3 weeks agoruntime: don't count nGsyscallNoP for extra Ms in C
Michael Anthony Knyszek [Thu, 4 Dec 2025 23:27:03 +0000 (23:27 +0000)]
runtime: don't count nGsyscallNoP for extra Ms in C

In #76435, it turns out that the new metric
/sched/goroutines/not-in-go:goroutines counts C threads that have called
into Go before (on Linux) as not-in-go goroutines. The reason for this
is that the M is still attached to the C thread on Linux as an
optimization, so we don't go through all the trouble of detaching the M
and, of course, decrementing nGsyscallNoP.

There's an easy fix to this accounting issue. The flag on the M,
isExtraInC, says whether a thread with an extra M attached no longer has
any Go on its (logical) stack. When we take the P from an M in this
state, we simply just don't increment nGsyscallNoP. When it calls back
into Go, we similarly skip the decrement to nGsyscallNoP.

This is more efficient than alternatives, like always updating
nGsyscallNoP in cgocallbackg, since that would add a new
read-modify-write atomic onto that fast path. It does mean we count
threads in C with a P still attached as not-in-go, but this transient in
most real programs, assuming the thread indeed does not call back into
Go any time soon.

Fixes #76435.

Change-Id: Id05563bacbe35d3fae17d67fb5ed45fa43fa0548
Reviewed-on: https://go-review.googlesource.com/c/go/+/726964
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
3 weeks agocmd/go: fix race applying fixes in fix and vet -fix modes
Alan Donovan [Thu, 4 Dec 2025 20:29:49 +0000 (15:29 -0500)]
cmd/go: fix race applying fixes in fix and vet -fix modes

Previously, the cmd/fix tool, which is analogous to a compiler
in a "go fix" or "go vet -fix" build, applied its fixes directly
to source files during the build. However, this led to races
since the edits may in some cases occur concurrently with other
build steps that are still reading those source file.

This change separates the computation of the fixes, which
happens during the build, and applying the fixes, which happens
in a phase after the build.

The unitchecker now accepts a FixArchive file name (see CL 726940).
If it is non-empty, the unitchecker will write the fixed files
into an archive instead of updating them directly.

The vet build sets this option, then reads the produced zip
files in the second phase. The files are saved in the cache;
some care is required to sequence the various cache operations
so that a cache hit has all-or-nothing semantics.

The tweak to vet_basic.txt is a sign that there was a latent
bug, inadvertently fixed by this change: because the old approach
relied on side effects of cmd/fix to mutate files, rather than
the current pure-functional approach of computing fixes which
are then applied as a second pass, a cache hit would cause some
edits not to be applied. Now they are applied.

Fixes golang/go#71859

Change-Id: Ib8e70644ec246dcdb20a90794c11ea6fd420247d
Reviewed-on: https://go-review.googlesource.com/c/go/+/727000
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@google.com>
3 weeks agoruntime: expand Pinner documentation
Michael Anthony Knyszek [Wed, 3 Dec 2025 23:07:26 +0000 (23:07 +0000)]
runtime: expand Pinner documentation

This change expands the Pinner documentation based on a few points of
feedback.
- We need a note that the Pinner has a finalizer.
- We need a note that the Pinner is safe to reuse.

I also added a note that the zero value is ready to use, and expanded
upon the use-cases of a Pinner.

Fixes #76431.

Change-Id: I312385557e67a815db05def02c1b1d7dcaa9d764
Reviewed-on: https://go-review.googlesource.com/c/go/+/726641
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
3 weeks agocmd/go/testdata/script: skip vet_cache in short mode
Michael Matloob [Thu, 4 Dec 2025 20:32:53 +0000 (15:32 -0500)]
cmd/go/testdata/script: skip vet_cache in short mode

vet_cache uses a clean cache

Change-Id: I68e9f32e60ad228785e9bf28f1c3a42e6a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/726961
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Matloob <matloob@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Michael Matloob <matloob@google.com>
3 weeks agoruntime: skip TestArenaCollision if we run out of hints
Michael Anthony Knyszek [Wed, 3 Dec 2025 23:22:18 +0000 (23:22 +0000)]
runtime: skip TestArenaCollision if we run out of hints

This seems failure mode seems to have become more common on Windows. I
suspect the randomized heap base address has something to do with it,
but I'm not 100% sure.

What's definitely certain is that we're running out of hints, since
we're seeing failures that mheap_.arenaHints is nil and GetNextArenaHint
doesn't actually check that.

At the very least we can check that and skip. We know that in this case
there's not that much we can do.

Fixes #76566.

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

3 weeks agoruntime: relax threadsSlack in TestReadMetricsSched
Michael Anthony Knyszek [Wed, 3 Dec 2025 23:13:36 +0000 (23:13 +0000)]
runtime: relax threadsSlack in TestReadMetricsSched

runtime.GC is called in the test and may spin up GOMAXPROCS
(proportional to the initial count) new threads. We need to be robust to
this, and it happens relatively frequently on some platforms.

We didn't notice this earlier since the heap is so miniscule that
runtime.GC essentially finished instantly without all the threads
getting spun up.

Fixes #76613.

Change-Id: I2af02cb090d5c1c952e4db53ad35895b6f23f638
Reviewed-on: https://go-review.googlesource.com/c/go/+/726642
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
3 weeks agoruntime: skip mayMoreStackMove in goroutine leak tests
Michael Anthony Knyszek [Wed, 3 Dec 2025 22:52:45 +0000 (22:52 +0000)]
runtime: skip mayMoreStackMove in goroutine leak tests

mayMoreStackMove may introduce more scheduler chaos because of all the
stack movement (not as much as mayMoreStackPreempt) so let's disable the
tests here too, since we have evidence that they can produce false
negatives under this configuration. Though we're not 100% sure why this
is happening yet, let's at least stop the flow of flaky failures.

For #75729.

Change-Id: I16d13dba9a61fbd47563b21cbf188e4754f58213
Reviewed-on: https://go-review.googlesource.com/c/go/+/726526
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
3 weeks agoruntime/race: set missing argument frame for ppc64x atomic And/Or wrappers
Jayanth Krishnamurthy jayanth.krishnamurthy@ibm.com [Thu, 6 Nov 2025 19:43:45 +0000 (13:43 -0600)]
runtime/race: set missing argument frame for ppc64x atomic And/Or wrappers

The ppc64x TSAN wrappers for atomic And/Or did not initialize R6 with the Go argument frame before calling racecallatomic. Since racecallatomic expects R6 to point to the argument list and dereferences it unconditionally, this led to a nil-pointer dereference under -race.

Other atomic TSAN wrappers (Load/Store/Add/Swap/CAS) already set up R6 in the expected way. This change aligns the And/Or wrappers with the rest by adding the missing R6 initialisation.

This keeps the behavior consistent across all atomic operations on ppc64x.

Fixes #76051.
Change-Id: Iaf578449a6171a0c6f7c33ec6f64c1251297ae6d
Cq-Include-Trybots: luci.golang.try:gotip-linux-ppc64_power10,gotip-linux-ppc64_power8,gotip-linux-ppc64le_power8,gotip-linux-ppc64le_power9,gotip-linux-ppc64le_power10
Reviewed-on: https://go-review.googlesource.com/c/go/+/718560
Reviewed-by: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Paul Murphy <paumurph@redhat.com>
3 weeks agoruntime: reject any goroutine leak test failure that failed to execute
Michael Anthony Knyszek [Wed, 3 Dec 2025 22:29:19 +0000 (22:29 +0000)]
runtime: reject any goroutine leak test failure that failed to execute

This is far more general than the regexp, which was necessary only
because runTestProg doesn't return the error. This change makes
runTestProg a wrapper function around a function that *does* return the
error.

For #76526.

Change-Id: Ib3daa75eb0fe314a28a7a368474943ba470d0d4d
Reviewed-on: https://go-review.googlesource.com/c/go/+/726525
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
3 weeks agoruntime: print output in case of segfault in goroutine leak tests
Michael Anthony Knyszek [Wed, 3 Dec 2025 22:21:07 +0000 (22:21 +0000)]
runtime: print output in case of segfault in goroutine leak tests

For #76526.

Change-Id: I017e5d4c06e5de23cccc59c4c347599fecdece03
Reviewed-on: https://go-review.googlesource.com/c/go/+/726524
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>

3 weeks agoruntime: don't specify GOEXPERIMENT=greenteagc in goroutine leak tests
Michael Anthony Knyszek [Wed, 3 Dec 2025 22:18:27 +0000 (22:18 +0000)]
runtime: don't specify GOEXPERIMENT=greenteagc in goroutine leak tests

It's enabled by default, and redundant. It'll just break when we remove
the GOEXPERIMENT.

Change-Id: Ic6e6a04fc2fe59b3632788c4505dd8f5305813da
Reviewed-on: https://go-review.googlesource.com/c/go/+/726523
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
3 weeks agocrypto/subtle: add speculation barrier after DIT
Roland Shoemaker [Thu, 4 Dec 2025 21:26:52 +0000 (13:26 -0800)]
crypto/subtle: add speculation barrier after DIT

When enabling DIT on ARM64, add speculation barrier instructions to
ensure that subsequent instructions are executed using the updated
DIT state.

See https://developer.apple.com/documentation/xcode/writing-arm64-code-for-apple-platforms#Enable-DIT-for-constant-time-cryptographic-operations
which recommends doing this. The Arm documentation for DIT doesn't tell
you to do this, but it seems prudent.

Change-Id: Idbc87b332650a77b8cb3509c11377bf5c724f3cf
Reviewed-on: https://go-review.googlesource.com/c/go/+/726980
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
3 weeks agocmd/compile: fix mis-infer bounds in slice len/cap calculations
Cuong Manh Le [Fri, 5 Dec 2025 14:49:53 +0000 (21:49 +0700)]
cmd/compile: fix mis-infer bounds in slice len/cap calculations

CL 704875 enhanced prove to infer bounds when index have a relationship
with len(A) - K. However, the change incorrectly infer "K - len(A)" case,
causing wrong bounds information.

Fixing this by matching exactly "len(A) - K" case.

Fixes #76709

Change-Id: Ibeedff55520658401af5bd3aa7e98cc1bcf38fd6
Reviewed-on: https://go-review.googlesource.com/c/go/+/727180
Reviewed-by: Cherry Mui <cherryyz@google.com>
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: Jakub Ciolek <jakub@ciolek.dev>
Reviewed-by: David Chase <drchase@google.com>
3 weeks agoall: fix some comment issues
cuishuang [Thu, 4 Dec 2025 03:39:53 +0000 (11:39 +0800)]
all: fix some comment issues

Change-Id: I5dec35b1432705b3a52859c38e758220282226af
Reviewed-on: https://go-review.googlesource.com/c/go/+/726700
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
3 weeks agointernal/runtime/maps: clarify probeSeq doc comment
Nick Ripley [Thu, 4 Dec 2025 15:01:21 +0000 (10:01 -0500)]
internal/runtime/maps: clarify probeSeq doc comment

The probeSeq doc comment describes the probe sequence as triangular and
gives the formula for terms in the sequence. This formula isn't actually
used in the code, though. List the first few terms of the sequence
explicitly so the connection between the description and the code is
more clear.

Change-Id: I6a6a69648bc94e15df436815c16128ebef3c6eb8
Reviewed-on: https://go-review.googlesource.com/c/go/+/726820
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
3 weeks agoall: update vendored x/tools
Dmitri Shuralyov [Thu, 4 Dec 2025 22:57:40 +0000 (17:57 -0500)]
all: update vendored x/tools

Pull in the following x/tools changes:

- CL 726000: go/analysis/passes/modernize: omitzero: suppress on kubebuilder
- CL 726621: internal/refactor/inline: built-ins may affect inference
- CL 727041: go/analysis/passes/modernize: fix stringscut false positives
- CL 727040: go/analysis/unitchecker: write fixed files to an archive

Fixes #76649.
Fixes #76287.
Fixes #76687.
For #71859.

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

Change-Id: I0a369ad85b06adab3a977c2c523b8214fb53271a
Reviewed-on: https://go-review.googlesource.com/c/go/+/727022
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
3 weeks agocmd/internal/fuzztest: move fuzz tests out of cmd/go test suite
Michael Matloob [Thu, 4 Dec 2025 19:21:44 +0000 (14:21 -0500)]
cmd/internal/fuzztest: move fuzz tests out of cmd/go test suite

They are very slow: taking them out of the cmd/go test suite makes the
go command tests go from about 80 seconds to run on my system, to about
50 seconds to run.

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

3 weeks agocrypto: use rand.IsDefaultReader instead of comparing to boring.RandReader
qmuntal [Wed, 3 Dec 2025 10:20:41 +0000 (11:20 +0100)]
crypto: use rand.IsDefaultReader instead of comparing to boring.RandReader

Several crypto functions accepting a rand parameter skip calling
boringcrypto when the rand is not boring.RandReader.

The new crypto/internal/rand package currently defines its own Reader
that wraps boring.RandReader. That will unintentionally bypass
boringcrypto when used with the aforementioned functions.

Fixes #76672

Change-Id: Ie0c1345530c734a23815f9593590b5d32604f54d
Reviewed-on: https://go-review.googlesource.com/c/go/+/726220
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

3 weeks agocmd/compile: use isUnsignedPowerOfTwo rather than isPowerOfTwo for unsigneds
Jorropo [Thu, 4 Dec 2025 03:17:58 +0000 (04:17 +0100)]
cmd/compile: use isUnsignedPowerOfTwo rather than isPowerOfTwo for unsigneds

Fixes #76688

Change-Id: Icb8dab54a5ce7d83b656d50d5ea605d2a62b96f8
Reviewed-on: https://go-review.googlesource.com/c/go/+/726680
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
3 weeks agoall: REVERSE MERGE dev.simd (9ac524a) into master
David Chase [Wed, 3 Dec 2025 21:24:03 +0000 (16:24 -0500)]
all: REVERSE MERGE dev.simd (9ac524a) into master

This commit is a REVERSE MERGE.
It merges dev.simd back into its parent branch, master.

Merge List:

+ 2025-12-03 9ac524ab70 [dev.simd] all: merge master (5945fc0) into dev.simd
+ 2025-12-03 8b41e841be [dev.simd] internal/buildcfg: default-disable simd experiment, for merge w/ master
+ 2025-12-03 608dba4308 [dev.simd] simd: make "best" instruction choice also depend on commutativity
+ 2025-11-25 f3a306527c [dev.simd] simd, cmd/compile: add float -> float conversions
+ 2025-11-25 d6564ed088 [dev.simd] simd, cmd/compile: add int -> fp conversions
+ 2025-11-25 86cd9b5c90 [dev.simd] simd, cmd/compile: add float -> int conversions
+ 2025-11-24 1265ebfe27 [dev.simd] internal/buildcfg: turn GOEXPERIMENT=simd back on

Change-Id: I05a1eedc406ba6e7668ff2101917a0adef656452

3 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

3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>

3 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>

3 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>
3 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>

3 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>
3 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>

3 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>

3 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>

3 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>

3 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>

3 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>
3 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>

3 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>
3 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>

3 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>

3 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>

3 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>
3 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>
3 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>
3 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>

3 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>
3 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>
3 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>
3 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>
3 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>

3 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>
4 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>

4 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>

4 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>
4 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>
4 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>
4 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>

4 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>

4 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>
4 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>
4 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>
4 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>

4 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>
4 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>
4 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>

4 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>
4 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>
4 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>

4 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>

4 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>
4 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>

4 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>
4 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>
4 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>
4 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>
4 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>
4 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>

4 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>
4 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>

4 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>

4 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>

4 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>
4 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>
4 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>
4 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>
4 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>
4 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>

4 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>

4 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>