Compare commits

...

1597 commits

Author SHA1 Message Date
Meng Zhuo
0d0d5c9a82 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>
2025-12-05 17:31:30 -08:00
matloob
2e509e61ef 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>
2025-12-05 15:17:12 -08:00
Alan Donovan
c270e71835 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>
2025-12-05 14:29:25 -08:00
Michael Anthony Knyszek
745349712e 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>
2025-12-05 13:48:24 -08:00
Alan Donovan
f3d572d96a 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>
2025-12-05 13:41:05 -08:00
Michael Anthony Knyszek
76345533f7 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>
2025-12-05 13:32:23 -08:00
Michael Matloob
b133524c0f 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>
2025-12-05 11:51:56 -08:00
Michael Anthony Knyszek
96e142ba2b 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>
2025-12-05 11:37:02 -08:00
Michael Anthony Knyszek
fe4952f116 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>
2025-12-05 11:36:56 -08:00
Michael Anthony Knyszek
8947f092a8 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>
2025-12-05 11:35:47 -08:00
Jayanth Krishnamurthy jayanth.krishnamurthy@ibm.com
44cb82449e 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>
2025-12-05 11:22:36 -08:00
Michael Anthony Knyszek
435e61c801 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>
2025-12-05 10:38:31 -08:00
Michael Anthony Knyszek
54e5540014 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>
2025-12-05 10:38:28 -08:00
Michael Anthony Knyszek
9616c33295 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>
2025-12-05 10:34:02 -08:00
Roland Shoemaker
2244bd7eeb 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>
2025-12-05 10:22:34 -08:00
Cuong Manh Le
f84f8d86be 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>
2025-12-05 08:02:02 -08:00
cuishuang
a70addd3b3 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>
2025-12-05 07:30:36 -08:00
Nick Ripley
93b49f773d 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>
2025-12-05 07:01:07 -08:00
Dmitri Shuralyov
91267f0a70 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>
2025-12-04 17:35:46 -08:00
Michael Matloob
a753a9ed54 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>
2025-12-04 15:05:53 -08:00
qmuntal
1681c3b67f 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>
2025-12-04 08:39:49 -08:00
Jorropo
7b67b68a0d 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>
2025-12-04 08:13:28 -08:00
David Chase
2b62144069 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
2025-12-03 16:24:48 -05:00
David Chase
9ac524ab70 [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@bff14c5256
+ 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
2025-12-03 15:43:11 -05:00
David Chase
8b41e841be [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>
2025-12-03 11:51:45 -08:00
David Chase
608dba4308 [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>
2025-12-03 11:12:10 -08:00
Gopher Robot
5945fc02fc 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>
2025-12-03 09:37:54 -08:00
Gopher Robot
dcc5fe0c62 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>
2025-12-03 08:36:36 -08:00
qmuntal
7991da1161 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>
2025-12-03 08:23:24 -08:00
Will Faught
2729e87aa5 doc/next: pluralize 'result'
Change-Id: Id53ee875ee31b43a6d7bd3f180260276ddd4f8b9
GitHub-Last-Rev: c90e386967
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>
2025-12-03 08:04:02 -08:00
Alan Donovan
6e72f526cd 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>
2025-12-03 07:26:36 -08:00
Alan Donovan
fa30b68767 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>
2025-12-03 06:50:50 -08:00
Ian Lance Taylor
32a9804c7b 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>
2025-12-03 00:22:35 -08:00
Cuong Manh Le
509ddf3868 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>
2025-12-02 16:56:58 -08:00
Robert Griesemer
7cab1b1b26 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>
2025-12-02 16:18:09 -08:00
Robert Griesemer
1a64db3a4b 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>
2025-12-02 15:07:19 -08:00
Michael Anthony Knyszek
2e06fa6b68 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>
2025-12-02 14:44:07 -08:00
Michael Anthony Knyszek
77c795011b 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>
2025-12-02 14:43:44 -08:00
Keith Randall
6e4abe8cef 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>
2025-12-02 14:43:05 -08:00
Michael Anthony Knyszek
88c24de8b5 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>
2025-12-02 13:55:43 -08:00
Devon Mar
043b9de658 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: 77900cc1a6
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>
2025-12-02 12:42:13 -08:00
khr@golang.org
e432b4f3a1 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>
2025-12-02 12:32:35 -08:00
Nicholas S. Husin
c1acdcb345 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>
2025-12-02 12:22:04 -08:00
Robert Griesemer
8ae5d408ed 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>
2025-12-02 10:02:53 -08:00
matloob@golang.org
c5c05a0e43 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>
2025-12-02 07:16:57 -08:00
Michael Pratt
f22d37d574 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>
2025-12-01 14:59:40 -08:00
Damien Neil
8b5db48db1 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>
2025-12-01 13:35:16 -08:00
Michael Pratt
94616dad42 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>
2025-12-01 13:27:40 -08:00
胡玮文
67851547d8 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>
2025-12-01 12:31:06 -08:00
Michael Pratt
ac3e0ae51a 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>
2025-12-01 11:56:35 -08:00
Ian Lance Taylor
42e03bbd27 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>
2025-12-01 09:41:50 -08:00
Brad Fitzpatrick
18015e8c36 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>
2025-12-01 09:41:45 -08:00
Dmitri Shuralyov
4be545115c 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>
2025-12-01 09:15:40 -08:00
Lin Lin
16c0f7e152 cmd/compile: run go generate for internal/ir
Updates #70954

Change-Id: I00ddb37650d27a98da921f04570d33535865622c
GitHub-Last-Rev: 69d52f3d72
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>
2025-12-01 09:01:58 -08:00
Dmitri Shuralyov
dc913c316a 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>
2025-12-01 08:23:28 -08:00
Alan Donovan
1555fad47d 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>
2025-12-01 08:00:02 -08:00
Aditya Sirish A Yelgundhalli
eec1afeb28 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: f264915ca2
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>
2025-12-01 07:29:29 -08:00
Joel Sing
3f94f3d4b2 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>
2025-11-28 15:26:25 -08:00
Cuong Manh Le
2ac1f9cbc3 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>
2025-11-28 15:18:43 -08:00
Daniel Morsing
de456450e7 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>
2025-11-28 06:15:02 -08:00
Alan Donovan
67d4a28707 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>
2025-11-27 19:54:18 -08:00
Daniel Morsing
c079dd13c0 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>
2025-11-27 05:54:25 -08:00
Filippo Valsorda
2947cb0469 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>
2025-11-27 05:53:03 -08:00
胡玮文
cead111a77 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>
2025-11-26 22:29:49 -08:00
胡玮文
c2af9f14b4 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>
2025-11-26 22:09:55 -08:00
胡玮文
6be5de4bc4 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>
2025-11-26 21:51:52 -08:00
thepudds
481c6df7b9 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>
2025-11-26 20:45:34 -08:00
Dave Vasilevsky
cec4d4303f 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: 8f83d009ef
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>
2025-11-26 20:42:22 -08:00
Ian Lance Taylor
f1bbc66a10 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>
2025-11-26 20:29:52 -08:00
Ian Lance Taylor
003f52407a 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>
2025-11-26 20:29:49 -08:00
Ian Lance Taylor
21b6ab57d5 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>
2025-11-26 20:29:46 -08:00
Ian Lance Taylor
c03e25a263 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>
2025-11-26 20:10:06 -08:00
Ian Lance Taylor
9f5cd43fe6 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>
2025-11-26 20:07:41 -08:00
Ian Lance Taylor
43cfd785e7 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>
2025-11-26 20:06:46 -08:00
Ian Lance Taylor
312b2034a4 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>
2025-11-26 20:05:21 -08:00
Ian Lance Taylor
b437d5bf36 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>
2025-11-26 20:04:57 -08:00
Ian Lance Taylor
4bc3410b6c 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>
2025-11-26 20:03:00 -08:00
Ian Lance Taylor
b0c278be40 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>
2025-11-26 20:00:38 -08:00
Ian Lance Taylor
0ff323143d 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>
2025-11-26 19:59:55 -08:00
thepudds
4879151d1d 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>
2025-11-26 19:04:05 -08:00
limeidan
d8269ab0d5 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>
2025-11-26 18:59:35 -08:00
Xiaolin Zhao
c6d64f8556 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>
2025-11-26 16:46:52 -08:00
Mark Freeman
c048a9a11f 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>
2025-11-26 16:20:21 -08:00
Mark Freeman
ff2fd6327e 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>
2025-11-26 16:17:55 -08:00
Mark Freeman
3531ac23d4 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>
2025-11-26 16:15:28 -08:00
Filippo Valsorda
2b8dbb35b0 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>
2025-11-26 16:01:17 -08:00
matloob
21ebed0ac0 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>
2025-11-26 15:58:19 -08:00
Daniel Morsing
a3fb92a710 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>
2025-11-26 15:42:52 -08:00
Alan Donovan
0c747b7aa7 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>
2025-11-26 15:36:05 -08:00
Alan Donovan
0f6397384b 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>
2025-11-26 15:35:27 -08:00
Filippo Valsorda
992ad55e3d 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>
2025-11-26 15:17:42 -08:00
Junyang Shao
3fd9cb1895 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>
2025-11-26 14:46:13 -08:00
matloob
3353c100bb 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>
2025-11-26 14:44:25 -08:00
Dmitri Shuralyov
301d9f9b52 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>
2025-11-26 14:43:11 -08:00
Cherry Mui
de39282332 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>
2025-11-26 14:28:50 -08:00
Daniel Morsing
86bbea0cfa crypto/fips140: add WithoutEnforcement
WithoutEnforcement lets programs running under GODEBUG=fips140=only
selectively opt out of strict enforcement. This is especially helpful
for non-critical uses of cryptography routines like SHA-1 for content
addressable storage backends (E.g. git).

Fixes #74630

Change-Id: Iabba1f5eb63498db98047aca45e09c5dccf2fbdf
Reviewed-on: https://go-review.googlesource.com/c/go/+/723720
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
2025-11-26 14:26:06 -08:00
Roland Shoemaker
e2cae9ecdf crypto/x509: add ExtKeyUsage.OID method
And OIDFromASN1OID for converting between asn1.ObjectIdentifier and OID.

Fixes #75325

Change-Id: I3b84dce54346d88aab731ffe30d0fef07b014f04
Reviewed-on: https://go-review.googlesource.com/c/go/+/724761
Reviewed-by: Neal Patel <nealpatel@google.com>
Auto-Submit: Roland Shoemaker <roland@golang.org>
Commit-Queue: Neal Patel <nealpatel@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-26 14:21:13 -08:00
Michael Matloob
623ef28135 cmd/go: limit total compile -c backend concurrency using a pool
Previously we limited the value we passed in to compile -c (which set
the number of SSA compile goroutines that run at one time) to 4. This CL
allows the -c value to go up to GOMAXPROCS, while limiting the total
number of backend SSA compile goroutines to still be less than the
previous worst case of 4*GOMAXPROCS (actually four times the value of
the -p flag, but the default is GOMAXPROCS). We do that by keeping a
pool of tokens to represent the total number of SSA compile goroutines
(with some buffer to allow us to run out of tokens and not exceed
4*GOMAXPROCS). Each time a compile requests a -c value, we'll hand out
half of the remaining tokens (with the number handed otu capped at
GOMAXPROCS) until we run out of tokens, in wich case we'll set -c to
one.

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

Change-Id: Ib1ec843fee57f0fb8d36a507162317276a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/724142
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@google.com>
2025-11-26 13:48:13 -08:00
Keith Randall
3c6bf6fbf3 cmd/compile: handle loops better during stack allocation of slices
Don't use the move2heap optimization if the move2heap is inside
a loop deeper than the declaration of the slice. We really only want
to do the move2heap operation once.

Change-Id: I4a68d01609c2c9d4e0abe4580839e70059393a81
Reviewed-on: https://go-review.googlesource.com/c/go/+/722440
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-26 13:33:51 -08:00
Robert Griesemer
efe9ad501d go/types, types2: improve printing of []*operand lists (debugging support)
Special-case an sprintf argument of []*operand type, similar to what
we do for other lists. As a result a list of operands is printed as
[a, b, c] rather than [a b c] (default formatting for slices).

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

Change-Id: Iea4fc6ea375dd9618316b7317a77b57b4e35544d
Reviewed-on: https://go-review.googlesource.com/c/go/+/724500
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
2025-11-26 12:38:54 -08:00
Jorropo
ac3369242d runtime: merge all the linux 32 and 64 bits files into one for each
Change-Id: I57067c9724dad2fba518b900d6f6a049cc32099e
Reviewed-on: https://go-review.googlesource.com/c/go/+/714081
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-11-26 12:36:16 -08:00
Junyang Shao
fb5156a098 testing: fix bloop doc
This CL deletes the compiler detail part from bloop documentation.

Change-Id: I73933707a593d4958e2300416d15e7213f001c3a
Reviewed-on: https://go-review.googlesource.com/c/go/+/724800
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-11-26 12:22:05 -08:00
qmuntal
b194f5d24a os,internal/syscall/windows: support O_* flags in Root.OpenFile
These file flags are supported by os.OpenFile since CL 699415.

Closes #73676

Change-Id: Ib37102a565f538d394d2a94bd605d6c6004f3028
Reviewed-on: https://go-review.googlesource.com/c/go/+/724621
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-11-26 11:56:54 -08:00
Guoqi Chen
e0a4dffb0c cmd/internal/obj/loong64: add {,x}vmadd series instructions support
Go asm syntax:
	  VMADD{B, H, W, V}                         V1, V2, V3
	  VMSUB{B, H, W, V}                         V1, V2, V3
	 XVMADD{B, H, W, V}                         X1, X2, X3
	 XVMSUB{B, H, W, V}                         X1, X2, X3
	 VMADDWEV{HB, WH, VW,QV}{,U}                V1, V2, V3
	 VMADDWOD{HB, WH, VW,QV}{,U}                V1, V2, V3
	XVMADDWEV{HB, WH, VW,QV}{,U}                X1, X2, X3
	XVMADDWOD{HB, WH, VW,QV}{,U}                X1, X2, X3
	 VMADDWEV{HBUB, WHUH, VWUW, QVUV}           V1, V2, V3
	 VMADDWOD{HBUB, WHUH, VWUW, QVUV}           V1, V2, V3
	XVMADDWEV{HBUB, WHUH, VWUW, QVUV}           X1, X2, X3
	XVMADDWOD{HBUB, WHUH, VWUW, QVUV}           X1, X2, X3

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

Change-Id: I2f4aae51045e1596d4744e525a1589586065cf8e
Reviewed-on: https://go-review.googlesource.com/c/go/+/724200
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: abner chenc <chenguoqi@loongson.cn>
2025-11-26 10:40:28 -08:00
Xiaolin Zhao
c0f02c11ff cmd/internal/obj/loong64: add aliases to 32-bit arithmetic instructions
Both the MULW and MUL instructions point to the mul.w instruction
in the loong64 ISA. Previously, MULW was not encoded; now it is
encoded and used as an alias for MUL.
The same applies to the following instructions: ADD, SUB, DIV.
For consistency, we have added additional aliases for DIVU, REM and REMU.

Change-Id: Iba201a3c4c2893ff7d301ef877fad9c81e54291b
Reviewed-on: https://go-review.googlesource.com/c/go/+/721523
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-26 10:40:20 -08:00
Jorropo
37ce4adcd4 cmd/compile: add tests bruteforcing limit complement
Change-Id: I9d8bd78a06738a8a242b6965382e61568e93dea7
Reviewed-on: https://go-review.googlesource.com/c/go/+/724620
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@google.com>
2025-11-26 10:19:21 -08:00
qmuntal
437d2362ce os,internal/poll: don't call IsNonblock for consoles and Stdin
windows.IsNonblock can block for synchronous handles that have an
outstanding I/O operation. Console handles are always synchronous, so
we should not call IsNonblock for them. Stdin is often a pipe, and
almost always a synchronous handle, so we should not call IsNonblock for
it either. This avoids potential deadlocks during os package
initialization, which calls NewFile(syscall.Stdin).

Fixes #75949
Updates #76391

Cq-Include-Trybots: luci.golang.try:gotip-windows-amd64-longtest,gotip-windows-amd64-race,gotip-windows-arm64
Change-Id: I1603932b0a99823019aa0cad960f94cee9996505
Reviewed-on: https://go-review.googlesource.com/c/go/+/724640
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-11-26 10:18:02 -08:00
Boris Nagaev
71f8f031b2 crypto/internal/fips140/aes: optimize ctrBlocks8Asm on amd64
Implement overflow-aware optimization in ctrBlocks8Asm: make a fast branch
in case when there is no overflow. One branch per 8 blocks is faster than
7 increments in general purpose registers and transfers from them to XMM.

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

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

This improves performance, especially in AES-128 mode.

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

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

Updates #76061

Change-Id: Idfd628ac8bb282d9c73c6adf048eb12274a41379
GitHub-Last-Rev: 5aadd39351
GitHub-Pull-Request: golang/go#76059
Reviewed-on: https://go-review.googlesource.com/c/go/+/714361
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: AHMAD ابو وليد <mizommz@gmail.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
2025-11-26 10:11:50 -08:00
Jorropo
03fcb33c0e cmd/compile: add tests bruteforcing limit negation and improve limit addition
I had to improve addition to make the tests pass.

Change-Id: I4daba2ee0f24a0dbc3929bf9afadd2116e16efae
Reviewed-on: https://go-review.googlesource.com/c/go/+/724600
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2025-11-26 10:09:27 -08:00
Alexander Musman
dda7c8253d cmd/compile,internal/bytealg: add MemEq intrinsic for runtime.memequal
Introduce a new MemEq SSA operation for runtime.memequal. The operation
is initially implemented for arm64. The change adds opt rules (following
existing rules for call to runtime.memequal), working with MemEq, and a
later op version LoweredMemEq which may be lowered differently for more
constant size cases in future (for other targets as well as for arm64).
The new MemEq SSA operation does not have memory result, allowing cse of
loads operations around it.

Code size difference (for arm64 linux):

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

Change-Id: I6ab507929b861884d17d5818cfbd152cf7879751
Reviewed-on: https://go-review.googlesource.com/c/go/+/686655
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2025-11-26 09:58:51 -08:00
Ian Alexander
4976606a2f cmd/go: remove final references to modfetch.Fetcher_
This commit removes the final references to the global Fetcher_ variable from
the modfetch and modload packages.

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

Change-Id: Ibb5309acdc7d05f1a7591ddcf890b44b6cc4cb2f
Reviewed-on: https://go-review.googlesource.com/c/go/+/724249
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-26 09:32:51 -08:00
Ian Alexander
08bf23cb97 cmd/go/internal/toolchain: remove references to modfetch.Fetcher_
This commit removes references to the global modfetch.Fetcher_
variable from the toolchain package.

Change-Id: Id366bec88e5904098b90371ec103f92d402174d5
Reviewed-on: https://go-review.googlesource.com/c/go/+/724248
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-26 09:32:25 -08:00
Ian Alexander
46d5e3ea0e cmd/go/internal/modget: remove references to modfetch.Fetcher_
This commit removes references to the global modfetch.Fetcher_
variable from the modget package.

Change-Id: I62dfcc0e9cf9722a6706bbdf7b6e561130ed82d1
Reviewed-on: https://go-review.googlesource.com/c/go/+/724247
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2025-11-26 09:32:08 -08:00
Ian Alexander
a3a6c9f62a cmd/go/internal/load: remove references to modfetch.Fetcher_
This commit removes references to the global modfetch.Fetcher_
variable from the load package.

Change-Id: Ic579743079252afd4d2d12e5118de09d86340267
Reviewed-on: https://go-review.googlesource.com/c/go/+/724246
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
2025-11-26 09:31:15 -08:00
Ian Alexander
c1ef3d5881 cmd/go/internal/modcmd: remove references to modfetch.Fetcher_
This commit removes references to the global modfetch.Fetcher_
variable from the modcmd package.

Change-Id: Ie2966401d1f6964e21ddede65d39ff53fea6e867
Reviewed-on: https://go-review.googlesource.com/c/go/+/724245
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
2025-11-26 09:30:54 -08:00
David Chase
ab2829ec06 cmd/compile: adjust start heap size
TLDR
- not-huge increase to default starting heap boost,
- small improvement in build performance,
- remove concurrency dependence of starting heap,
- aligns RSS behavior with GOMEMLIMIT,
- adds a gcflags=-d=gcstart=N (N -> N MiB) flag for
  people who want to trade a lot of memory for a
  little build performance improvement.

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

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

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

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

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

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

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

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

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

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

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

Updates #73044

Change-Id: I6359642a94b396e696dd57e64ed1f2c4cf178475
Reviewed-on: https://go-review.googlesource.com/c/go/+/724441
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-26 08:40:35 -08:00
Felix Geisendörfer
54b82e944e internal/trace: support event constructor for testing
Implement the new APIs described in #74826.

Closes #74826

Change-Id: I6a6a6964229548e9d54e7af95185011e183ee50b
Reviewed-on: https://go-review.googlesource.com/c/go/+/691815
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-26 02:31:15 -08:00
Ian Lance Taylor
eb63ef9d66 runtime: panic if cleanup function closes over cleanup pointer
This would catch problems like https://go.dev/cl/696295.

Benchmark effect with this CL plus CL 697535:

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

For #75066

Change-Id: Ia41d0d6b88baebf6055cb7e5d42bc8210b31630f
Reviewed-on: https://go-review.googlesource.com/c/go/+/714000
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-25 22:10:16 -08:00
Ian Lance Taylor
06412288cf runtime: panic on AddCleanup with self pointer
For #75066

Change-Id: Ifd555586fb448e7510fed16372648bdd7ec0ab4a
Reviewed-on: https://go-review.googlesource.com/c/go/+/697535
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: 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>
2025-11-25 22:09:03 -08:00
Ian Alexander
03f499ec46 cmd/go/internal/modfetch: remove references to Fetcher_ in test file
This commit removes references to the global Fetcher_ variable from
the zip sum test file.

Change-Id: I622587f7809f4c6bcd4afbb35312912149b7a3ea
Reviewed-on: https://go-review.googlesource.com/c/go/+/724244
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2025-11-25 19:17:11 -08:00
Ian Alexander
da31fd4177 cmd/go/internal/modload: replace references to modfetch.Fetcher_
This commit replaces references of modfetch.Fetcher_ with
modload.State.Fetcher() in the modload package.  Note that the
constructor `NewState` still intentionally references the global
variable.  This will be refactored in a later commit.

Change-Id: Ia8cfb41a81b0e29043694bc0f0f33f5a2f4920c6
Reviewed-on: https://go-review.googlesource.com/c/go/+/724243
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-25 19:16:43 -08:00
Ian Alexander
07b10e97d6 cmd/go/internal/modcmd: inject modfetch.Fetcher_ into DownloadModule
This commit continues the injection of the global Fetcher_ variable into
the various function calls that make use of it.  The purpose is to
prepare for the eventual removal of the global Fetcher_ variable and
eliminate global state within the modfetch package.

[git-generate]
cd src/cmd/go/internal/modcmd
rf '
 inject modfetch.Fetcher_ DownloadModule
'
cd ../modfetch
rf '
  add downloadZip:/f, err := tempFile.*/+0 _ = f \
    file, err := tempFile(ctx, filepath.Dir(zipfile), filepath.Base(zipfile), 0o666) \
    _ = file
'
rf '
  add downloadZip:/f.Close\(\)/+0 file.Close()
  rm downloadZip:/file.Close\(\)/-1
  add downloadZip:/os.Remove\(f.Name\(\)\)/+0 os.Remove(file.Name())
  rm downloadZip:/os.Remove\(file.Name\(\)\)/-1
'
sed -i '
  s/ f, err := tempFile(ctx, filepath.Dir(zipfile), filepath.Base(zipfile), 0o666)/file, err := tempFile(ctx, filepath.Dir(zipfile), filepath.Base(zipfile), 0o666)/
  s/err := repo.Zip(ctx, f, mod.Version)/err := repo.Zip(ctx, file, mod.Version)/
  s/if _, err := f.Seek(0, io.SeekStart); err != nil {/if _, err := file.Seek(0, io.SeekStart); err != nil {/
  s/if err := f.Truncate(0); err != nil {/if err := file.Truncate(0); err != nil {/
  s/fi, err := f.Stat()/fi, err := file.Stat()/
  s/z, err := zip.NewReader(f, fi.Size())/z, err := zip.NewReader(file, fi.Size())/
  s/for _, f := range z.File {/for _, zf := range z.File {/
  s/if !strings.HasPrefix(f.Name, prefix) {/if !strings.HasPrefix(zf.Name, prefix) {/
  s/return fmt.Errorf("zip for %s has unexpected file %s", prefix\[:len(prefix)-1\], f.Name)/return fmt.Errorf("zip for %s has unexpected file %s", prefix[:len(prefix)-1], zf.Name)/
  s/if err := f.Close(); err != nil {/if err := file.Close(); err != nil {/
  s/if err := hashZip(fetcher_, mod, f.Name(), ziphashfile); err != nil {/if err := hashZip(fetcher_, mod, file.Name(), ziphashfile); err != nil {/
  s/if err := os.Rename(f.Name(), zipfile); err != nil {/if err := os.Rename(file.Name(), zipfile); err != nil {/
' fetch.go
rf '
  rm downloadZip:/_ = file/-3 downloadZip:/_ = file/-2 downloadZip:/file, err := tempFile\(ctx, filepath.Dir\(zipfile\), filepath.Base\(zipfile\), 0o666\)/+1
'
rf '
  mv InfoFile.fetcher_ InfoFile.f
  mv InfoFile Fetcher.InfoFile
  mv GoModFile.fetcher_ GoModFile.f
  mv GoModFile Fetcher.GoModFile
  mv GoModSum.fetcher_ GoModSum.f
  mv GoModSum Fetcher.GoModSum
  mv Download.fetcher_ Download.f
  mv Download Fetcher.Download
  mv download.fetcher_ download.f
  mv download Fetcher.download
  mv DownloadZip.fetcher_ DownloadZip.f
  mv DownloadZip Fetcher.DownloadZip
  mv downloadZip.fetcher_ downloadZip.f
  mv downloadZip Fetcher.downloadZip
  mv checkMod.fetcher_ checkMod.f
  mv checkMod Fetcher.checkMod
  mv hashZip.fetcher_ hashZip.f
'

Change-Id: I1d2e09b8523f5ef2be04b91d858d98fb79c0a771
Reviewed-on: https://go-review.googlesource.com/c/go/+/724242
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2025-11-25 19:16:23 -08:00
Ian Alexander
e96094402d cmd/go/internal/modload: inject modfetch.Fetcher_ into commitRequirements
This commit continues the injection of the global Fetcher_ variable into
the various function calls that make use of it.  The purpose is to
prepare for the eventual removal of the global Fetcher_ variable and
eliminate global state within the modfetch package.

[git-generate]
cd src/cmd/go/internal/modload
rf '
  inject modfetch.Fetcher_ commitRequirements
  mv readModGraph.fetcher_ readModGraph.f
'

cd ../modfetch
sed -i '
  s/for _, f := range fetcher_.workspaceGoSumFiles {/for _, fn := range fetcher_.workspaceGoSumFiles {/
  s/fetcher_.sumState.w\[f\] = make(map\[module.Version\]\[\]string)/fetcher_.sumState.w[fn] = make(map[module.Version][]string)/
  s/_, err := readGoSumFile(fetcher_.sumState.w\[f\], f)/_, err := readGoSumFile(fetcher_.sumState.w[fn], fn)/
' fetch.go
rf '
  mv GoMod.fetcher_ GoMod.f
  mv GoMod Fetcher.GoMod
  mv readDiskGoMod.fetcher_ readDiskGoMod.f
  mv readDiskGoMod Fetcher.readDiskGoMod
  mv initGoSum.fetcher_ initGoSum.f
  mv initGoSum Fetcher.initGoSum
  mv HaveSum.fetcher_ HaveSum.f
  mv checkGoMod.fetcher_ checkGoMod.f
  mv checkModSum.fetcher_ checkModSum.f
  mv WriteGoSum.fetcher_ WriteGoSum.f
  mv WriteGoSum Fetcher.WriteGoSum
  mv Lookup.fetcher_ Lookup.f
  mv Lookup Fetcher.Lookup
'

Change-Id: Ifbe7d6b90b93fd65a7443434035921e6b42dea1c
Reviewed-on: https://go-review.googlesource.com/c/go/+/724241
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>
2025-11-25 19:15:56 -08:00
Ian Alexander
47baf48890 cmd/go/internal/modfetch: inject Fetcher_ into TidyGoSum
This commit begins the injection of the global Fetcher_ variable into
the various function calls that make use of it.  The purpose is to
prepare for the eventual removal of the global Fetcher_ variable and
eliminate global state.

[git-generate]
cd src/cmd/go/internal/modfetch
rf '
  inject Fetcher_ TidyGoSum
  mv haveModSumLocked.fetcher_ haveModSumLocked.f
  mv addModSumLocked.fetcher_ addModSumLocked.f
  mv tidyGoSum.fetcher_ tidyGoSum.f
  mv sumInWorkspaceModulesLocked.fetcher_ sumInWorkspaceModulesLocked.f
'

Change-Id: Iecf736f17d6e63c856355284d09b7982dc9e16b6
Reviewed-on: https://go-review.googlesource.com/c/go/+/724240
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>
2025-11-25 19:15:16 -08:00
Filippo Valsorda
272df5f6ba crypto/internal/fips140/aes/gcm: add more GCM nonce modes
First, this adds a GCM mode for QUIC, and a generic TLS 1.3/QUIC-like
XOR'd counter mode. QUIC constructs nonces exactly like TLS 1.3, but the
counter does not reset to zero on a key update, so the mask must be
provided explicitly (or we will panic well before running out of
counters because the wrong value is XOR'd out). See the analysis at
https://github.com/quic-go/quic-go/issues/5077#issuecomment-3570352683
for the details of QUIC and FIPS 140-3 compliance (including a
workaround for the key update issue).

Second, this coalesces all the compliance modes around two schemes:
fixed || counter, and fixed XOR counter. The former is used in TLS 1.2
and SSH, and the latter is used in TLS 1.3 and QUIC.

This would not be a backwards compatible change if these were public
APIs, but we only need different versions of the FIPS 140-3 module to be
source-compatible with the standard library, and the callers of these
NewGCMFor* functions only care that the return value implements
cipher.AEAD, at least for now.

This exposes no new public APIs, but lets us get started validating
these functions in v2.0.0 of the FIPS 140-3 module.

Updates #73110

Change-Id: I3d86cf8a3c4a96caf361c29f0db5f9706a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/723760
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-25 18:07:13 -08:00
Filippo Valsorda
1768cb40b8 crypto/tls: add SecP256r1/SecP384r1MLKEM1024 hybrid post-quantum key exchanges
Fixes #71206

Change-Id: If3cf75261c56828b87ae6805bd2913f56a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/722140
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-25 17:25:00 -08:00
Guoqi Chen
a9093067ee cmd/internal/obj/loong64: add {,X}V{ADD,SUB}W{EV,OD}.{H.B,W.H,D.W,Q.D}{,U} instructions support
Go asm syntax:
	 VADDWEV{HB, WH, VW, QV}{,U}        V1, V2, V3
	 VSUBWEV{HB, WH, VW, QV}{,U}        V1, V2, V3
	 VADDWOD{HB, WH, VW, QV}{,U}        V1, V2, V3
	 VSUBWOD{HB, WH, VW, QV}{,U}        V1, V2, V3
	XVADDWEV{HB, WH, VW, QV}{,U}        X1, X2, X3
	XVSUBWEV{HB, WH, VW, QV}{,U}        X1, X2, X3
	XVADDWOD{HB, WH, VW, QV}{,U}        X1, X2, X3
	XVSUBWOD{HB, WH, VW, QV}{,U}        X1, X2, X3

Equivalent platform assembler syntax:
	 vaddwev.{h.b, w.h, d.w, q.d}{,u}   V3, V2, V1
	 vsubwev.{h.b, w.h, d.w, q.d}{,u}   V3, V2, V1
	 vaddwod.{h.b, w.h, d.w, q.d}{,u}   V3, V2, V1
	 vsubwod.{h.b, w.h, d.w, q.d}{,u}   V3, V2, V1
	xvaddwev.{h.b, w.h, d.w, q.d}{,u}   X3, X2, X1
	xvsubwev.{h.b, w.h, d.w, q.d}{,u}   X3, X2, X1
	xvaddwod.{h.b, w.h, d.w, q.d}{,u}   X3, X2, X1
	xvsubwod.{h.b, w.h, d.w, q.d}{,u}   X3, X2, X1

Change-Id: I407dc65b32b89844fd303e265a99d8aafdf922ec
Reviewed-on: https://go-review.googlesource.com/c/go/+/723620
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
2025-11-25 16:50:48 -08:00
Junyang Shao
f3a306527c [dev.simd] simd, cmd/compile: add float -> float conversions
This should mark the end of the conversion table, except for float16
which does not exist on Go yet.

The rounding logic documentation of float64 -> float32 is based on
abi-internal default MXCSR:
| RC | 14/13 | 0 (RN) | Round to nearest |

Change-Id: I27a86560e8d74d20f21350bf78314b4eada20ec0
Reviewed-on: https://go-review.googlesource.com/c/go/+/724440
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-11-25 15:19:18 -08:00
Junyang Shao
d6564ed088 [dev.simd] simd, cmd/compile: add int -> fp conversions
Change-Id: Iadfa2dd982d7156d60fb6977ed9afb7894d6e8a0
Reviewed-on: https://go-review.googlesource.com/c/go/+/724321
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-11-25 15:19:12 -08:00
Junyang Shao
86cd9b5c90 [dev.simd] simd, cmd/compile: add float -> int conversions
This CL also fixed some documentation errors in existing APIs.

Go defaults MXCSR to mask exceptions, the documentation is based on this
fact.

Change-Id: I745083b82b4bef93126a4b4e41f8698956963704
Reviewed-on: https://go-review.googlesource.com/c/go/+/724320
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-11-25 15:19:08 -08:00
Ian Alexander
7b904c25a2 cmd/go/internal/modfetch: move global goSum to Fetcher_
[git-generate]
cd src/cmd/go/internal/modfetch
rf '
  add Fetcher.sumState mu sync.Mutex
  ex {
      goSum.mu -> Fetcher_.mu
      goSum.m -> Fetcher_.sumState.m
      goSum.w -> Fetcher_.sumState.w
      goSum.status -> Fetcher_.sumState.status
      goSum.overwrite -> Fetcher_.sumState.overwrite
      goSum.enabled -> Fetcher_.sumState.enabled
      goSum.sumState -> Fetcher_.sumState
    }
    rm goSum
'

Change-Id: I3693905d5bed19f7bae60f5bc1ec5097354c9427
Reviewed-on: https://go-review.googlesource.com/c/go/+/722582
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2025-11-25 15:17:42 -08:00
Ian Alexander
e7358c6cf4 cmd/go: remove fips140 dependency on global Fetcher_
This commit makes Unzip a method on the *Fetcher type, and updates
fips140 initialization to use a new Fetcher instance instead of the
global Fetcher_ variable.

Change-Id: Iea8d9ee4dd6e6a2be43520c144aaec6e75c9cd63
Reviewed-on: https://go-review.googlesource.com/c/go/+/722581
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@google.com>
2025-11-25 15:17:20 -08:00
Russ Cox
89f6dba7e6 internal/strconv: add testbase tests
Add ability to test against inputs chosen by from the stress
tests computed by Vern Paxson's testbase program.

Checked that 'go test -testbase' passes.

Change-Id: I81057e55df6cd369b40ce623a59884e6ead0ed76
Reviewed-on: https://go-review.googlesource.com/c/go/+/719620
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-25 13:44:38 -08:00
Russ Cox
6954be0baa internal/strconv: delete ftoaryu
CL 700075 made this dead code.

Benchmarks below for CL 700075, testing Dragonbox vs the old Ryu being deleted.
The "Fixed" benchmarks are unchanged, which gives a sense of the noise level.

benchmark \ host                  linux-amd64       s7  linux-arm64    local  linux-386  s7:GOARCH=386  linux-arm
                                      vs base  vs base      vs base  vs base    vs base        vs base    vs base
AppendFloat/Decimal                    -2.68%   +2.76%       +4.99%   -7.44%    +11.93%        +10.51%    +21.84%
AppendFloat/Float                     -21.98%  -13.32%      -16.50%  -11.54%    -33.37%        -28.66%    -15.64%
AppendFloat/Exp                       -32.44%  -25.54%      -28.85%  -31.79%    -39.60%        -35.92%    -20.89%
AppendFloat/NegExp                    -33.31%  -25.91%      -28.90%  -31.29%    -41.17%        -35.52%    -21.32%
AppendFloat/LongExp                   -19.35%   -9.51%      -15.29%  -12.36%    -30.46%        -25.10%    -10.18%
AppendFloat/Big                       -24.40%  -15.84%      -22.56%  -24.05%    -43.23%        -36.28%    -26.45%
AppendFloat/BinaryExp                  -0.52%   -1.20%            ~        ~          ~         +0.96%     +1.94%
AppendFloat/32Integer                 -14.24%   -7.01%      -12.82%  -18.99%    -12.12%        -10.85%     -0.32%
AppendFloat/32ExactFraction           -34.53%  -28.47%      -34.50%  -30.50%    -43.75%        -38.73%    -25.44%
AppendFloat/32Point                   -25.83%  -18.54%      -23.52%  -21.26%    -36.74%        -33.11%    -20.72%
AppendFloat/32Exp                     -37.55%  -33.36%      -37.74%  -39.06%    -51.37%        -44.53%    -31.76%
AppendFloat/32NegExp                  -35.99%  -31.96%      -36.02%  -37.13%    -44.62%        -39.03%    -26.91%
AppendFloat/32Shortest                -23.25%  -18.02%      -21.41%  -23.07%    -35.56%        -32.89%    -20.13%
AppendFloat/32Fixed8Hard               +1.09%   -1.94%            ~        ~     -2.33%         -1.36%     -0.10%
AppendFloat/32Fixed9Hard               +1.45%   -2.10%       +0.10%        ~     -4.20%         -0.72%     +1.31%
AppendFloat/64Fixed1                   +0.45%        ~            ~   -1.66%     -3.74%         -2.13%          ~
AppendFloat/64Fixed2                   +0.32%   -0.92%       +0.53%   -1.75%     -2.69%              ~     -0.49%
AppendFloat/64Fixed2.5                 +0.38%   -0.38%            ~        ~     -5.14%         -1.15%     -0.97%
AppendFloat/64Fixed3                   +0.97%   -0.53%            ~   +0.23%     -3.57%         -4.04%     -0.27%
AppendFloat/64Fixed4                   +0.95%   -2.77%       +0.45%   -1.57%     -3.99%         -2.58%     -0.91%
AppendFloat/64Fixed5Hard               +0.52%   -1.22%            ~   -0.87%     -3.20%         -1.60%     +0.49%
AppendFloat/64Fixed12                  +1.15%   -0.62%            ~        ~     -3.37%         -1.43%     -0.72%
AppendFloat/64Fixed16                  +1.13%        ~       -0.21%   -0.59%     -3.65%              ~     +0.74%
AppendFloat/64Fixed12Hard              +0.78%   -1.26%            ~   -0.95%     -4.82%         -2.98%     +0.26%
AppendFloat/64Fixed17Hard                   ~        ~       -0.32%   -6.34%     -2.44%         -2.19%     +1.00%
AppendFloat/64Fixed18Hard                   ~        ~            ~        ~          ~              ~     +0.06%
AppendFloat/64FixedF1                  +0.44%        ~       +0.43%   -1.87%     -2.75%              ~     -1.24%
AppendFloat/64FixedF2                  +1.35%   -1.04%       +0.81%   +1.26%     -2.21%         -2.36%          ~
AppendFloat/64FixedF3                       ~   -1.14%       +0.39%   -1.58%     -3.46%              ~     -1.08%
AppendFloat/Slowpath64                -15.51%   -7.05%      -14.59%   -7.86%    -22.54%        -19.63%     -5.90%
AppendFloat/SlowpathDenormal64        -15.10%   -8.19%      -14.62%   -9.36%    -26.86%        -23.10%    -14.48%

host: linux-amd64
goos: linux
goarch: amd64
pkg: internal/strconv
cpu: Intel(R) Xeon(R) CPU @ 2.30GHz
                                     │ 3c26aef8fb  │             8a958b0d9c1             │
                                     │    sec/op    │   sec/op     vs base                │
AppendFloat/Decimal-16                  63.37n ± 0%   61.67n ± 0%   -2.68% (p=0.000 n=20)
AppendFloat/Float-16                    92.83n ± 0%   72.43n ± 0%  -21.98% (p=0.000 n=20)
AppendFloat/Exp-16                      98.60n ± 0%   66.61n ± 0%  -32.44% (p=0.000 n=20)
AppendFloat/NegExp-16                  100.15n ± 0%   66.79n ± 0%  -33.31% (p=0.000 n=20)
AppendFloat/LongExp-16                 105.35n ± 0%   84.96n ± 0%  -19.35% (p=0.000 n=20)
AppendFloat/Big-16                     108.50n ± 0%   82.03n ± 0%  -24.40% (p=0.000 n=20)
AppendFloat/BinaryExp-16                47.27n ± 0%   47.03n ± 0%   -0.52% (p=0.000 n=20)
AppendFloat/32Integer-16                63.29n ± 0%   54.28n ± 0%  -14.24% (p=0.000 n=20)
AppendFloat/32ExactFraction-16          89.72n ± 0%   58.74n ± 0%  -34.53% (p=0.000 n=20)
AppendFloat/32Point-16                  87.32n ± 0%   64.77n ± 0%  -25.83% (p=0.000 n=20)
AppendFloat/32Exp-16                    94.89n ± 0%   59.26n ± 0%  -37.55% (p=0.000 n=20)
AppendFloat/32NegExp-16                 92.68n ± 0%   59.32n ± 0%  -35.99% (p=0.000 n=20)
AppendFloat/32Shortest-16               82.12n ± 0%   63.04n ± 0%  -23.25% (p=0.000 n=20)
AppendFloat/32Fixed8Hard-16             57.76n ± 0%   58.38n ± 0%   +1.09% (p=0.000 n=20)
AppendFloat/32Fixed9Hard-16             66.44n ± 0%   67.41n ± 0%   +1.45% (p=0.000 n=20)
AppendFloat/64Fixed1-16                 51.00n ± 0%   51.24n ± 0%   +0.45% (p=0.000 n=20)
AppendFloat/64Fixed2-16                 50.86n ± 0%   51.03n ± 0%   +0.32% (p=0.000 n=20)
AppendFloat/64Fixed2.5-16               49.31n ± 0%   49.49n ± 0%   +0.38% (p=0.000 n=20)
AppendFloat/64Fixed3-16                 51.98n ± 0%   52.48n ± 0%   +0.97% (p=0.000 n=20)
AppendFloat/64Fixed4-16                 50.05n ± 0%   50.52n ± 0%   +0.95% (p=0.000 n=20)
AppendFloat/64Fixed5Hard-16             58.01n ± 0%   58.31n ± 0%   +0.52% (p=0.000 n=20)
AppendFloat/64Fixed12-16                82.81n ± 0%   83.77n ± 0%   +1.15% (p=0.000 n=20)
AppendFloat/64Fixed16-16                70.66n ± 0%   71.46n ± 0%   +1.13% (p=0.000 n=20)
AppendFloat/64Fixed12Hard-16            68.25n ± 0%   68.79n ± 0%   +0.78% (p=0.000 n=20)
AppendFloat/64Fixed17Hard-16            79.78n ± 0%   79.82n ± 0%        ~ (p=0.136 n=20)
AppendFloat/64Fixed18Hard-16            4.881µ ± 0%   4.876µ ± 0%        ~ (p=0.432 n=20)
AppendFloat/64FixedF1-16                68.74n ± 0%   69.04n ± 0%   +0.44% (p=0.000 n=20)
AppendFloat/64FixedF2-16                57.36n ± 0%   58.13n ± 0%   +1.35% (p=0.000 n=20)
AppendFloat/64FixedF3-16                52.59n ± 0%   52.77n ± 0%        ~ (p=0.001 n=20)
AppendFloat/Slowpath64-16               99.56n ± 0%   84.12n ± 0%  -15.51% (p=0.000 n=20)
AppendFloat/SlowpathDenormal64-16       97.35n ± 0%   82.65n ± 0%  -15.10% (p=0.000 n=20)
AppendFloat/ShorterIntervalCase32-16                  56.27n ± 0%
AppendFloat/ShorterIntervalCase64-16                  57.42n ± 0%
geomean                                 82.53n        71.80n       -11.68%

host: s7
cpu: AMD Ryzen 9 7950X 16-Core Processor
                                     │ 3c26aef8fb │             8a958b0d9c1             │
                                     │   sec/op    │   sec/op     vs base                │
AppendFloat/Decimal-32                 22.30n ± 0%   22.91n ± 0%   +2.76% (p=0.000 n=20)
AppendFloat/Float-32                   34.54n ± 0%   29.94n ± 0%  -13.32% (p=0.000 n=20)
AppendFloat/Exp-32                     34.55n ± 0%   25.72n ± 0%  -25.54% (p=0.000 n=20)
AppendFloat/NegExp-32                  35.08n ± 0%   25.99n ± 1%  -25.91% (p=0.000 n=20)
AppendFloat/LongExp-32                 36.85n ± 0%   33.35n ± 1%   -9.51% (p=0.000 n=20)
AppendFloat/Big-32                     38.28n ± 0%   32.21n ± 1%  -15.84% (p=0.000 n=20)
AppendFloat/BinaryExp-32               17.52n ± 0%   17.30n ± 0%   -1.20% (p=0.000 n=20)
AppendFloat/32Integer-32               22.31n ± 0%   20.75n ± 0%   -7.01% (p=0.000 n=20)
AppendFloat/32ExactFraction-32         32.74n ± 1%   23.41n ± 1%  -28.47% (p=0.000 n=20)
AppendFloat/32Point-32                 32.88n ± 0%   26.79n ± 0%  -18.54% (p=0.000 n=20)
AppendFloat/32Exp-32                   34.10n ± 0%   22.72n ± 1%  -33.36% (p=0.000 n=20)
AppendFloat/32NegExp-32                33.17n ± 1%   22.57n ± 0%  -31.96% (p=0.000 n=20)
AppendFloat/32Shortest-32              29.85n ± 1%   24.47n ± 0%  -18.02% (p=0.000 n=20)
AppendFloat/32Fixed8Hard-32            22.62n ± 1%   22.19n ± 1%   -1.94% (p=0.000 n=20)
AppendFloat/32Fixed9Hard-32            25.75n ± 1%   25.21n ± 0%   -2.10% (p=0.000 n=20)
AppendFloat/64Fixed1-32                19.02n ± 1%   18.98n ± 0%        ~ (p=0.351 n=20)
AppendFloat/64Fixed2-32                18.94n ± 0%   18.76n ± 0%   -0.92% (p=0.000 n=20)
AppendFloat/64Fixed2.5-32              18.23n ± 0%   18.16n ± 0%   -0.38% (p=0.001 n=20)
AppendFloat/64Fixed3-32                19.79n ± 0%   19.68n ± 0%   -0.53% (p=0.000 n=20)
AppendFloat/64Fixed4-32                18.93n ± 0%   18.40n ± 1%   -2.77% (p=0.000 n=20)
AppendFloat/64Fixed5Hard-32            21.81n ± 0%   21.54n ± 1%   -1.22% (p=0.000 n=20)
AppendFloat/64Fixed12-32               30.58n ± 1%   30.39n ± 0%   -0.62% (p=0.000 n=20)
AppendFloat/64Fixed16-32               26.98n ± 1%   26.80n ± 1%        ~ (p=0.010 n=20)
AppendFloat/64Fixed12Hard-32           26.20n ± 0%   25.86n ± 1%   -1.26% (p=0.000 n=20)
AppendFloat/64Fixed17Hard-32           30.01n ± 1%   30.10n ± 1%        ~ (p=0.112 n=20)
AppendFloat/64Fixed18Hard-32           1.809µ ± 1%   1.806µ ± 0%        ~ (p=0.713 n=20)
AppendFloat/64FixedF1-32               26.78n ± 1%   26.59n ± 0%        ~ (p=0.005 n=20)
AppendFloat/64FixedF2-32               20.24n ± 1%   20.03n ± 0%   -1.04% (p=0.000 n=20)
AppendFloat/64FixedF3-32               18.88n ± 0%   18.67n ± 0%   -1.14% (p=0.000 n=20)
AppendFloat/Slowpath64-32              35.37n ± 0%   32.88n ± 1%   -7.05% (p=0.000 n=20)
AppendFloat/SlowpathDenormal64-32      35.17n ± 0%   32.29n ± 1%   -8.19% (p=0.000 n=20)
AppendFloat/ShorterIntervalCase32-32                 21.76n ± 0%
AppendFloat/ShorterIntervalCase64-32                 22.11n ± 0%
geomean                                30.34n        27.23n        -8.96%

host: linux-arm64
goarch: arm64
cpu: unknown
                                    │ 3c26aef8fb  │             8a958b0d9c1             │
                                    │    sec/op    │   sec/op     vs base                │
AppendFloat/Decimal-8                  60.08n ± 0%   63.07n ± 0%   +4.99% (p=0.000 n=20)
AppendFloat/Float-8                    88.53n ± 0%   73.92n ± 0%  -16.50% (p=0.000 n=20)
AppendFloat/Exp-8                      93.07n ± 0%   66.22n ± 0%  -28.85% (p=0.000 n=20)
AppendFloat/NegExp-8                   93.35n ± 0%   66.38n ± 0%  -28.90% (p=0.000 n=20)
AppendFloat/LongExp-8                 100.15n ± 0%   84.84n ± 0%  -15.29% (p=0.000 n=20)
AppendFloat/Big-8                     103.80n ± 0%   80.38n ± 0%  -22.56% (p=0.000 n=20)
AppendFloat/BinaryExp-8                47.36n ± 0%   47.34n ± 0%        ~ (p=0.033 n=20)
AppendFloat/32Integer-8                60.28n ± 0%   52.55n ± 0%  -12.82% (p=0.000 n=20)
AppendFloat/32ExactFraction-8          86.11n ± 0%   56.40n ± 0%  -34.50% (p=0.000 n=20)
AppendFloat/32Point-8                  82.88n ± 0%   63.39n ± 0%  -23.52% (p=0.000 n=20)
AppendFloat/32Exp-8                    89.33n ± 0%   55.62n ± 0%  -37.74% (p=0.000 n=20)
AppendFloat/32NegExp-8                 87.48n ± 0%   55.97n ± 0%  -36.02% (p=0.000 n=20)
AppendFloat/32Shortest-8               76.31n ± 0%   59.97n ± 0%  -21.41% (p=0.000 n=20)
AppendFloat/32Fixed8Hard-8             52.83n ± 0%   52.82n ± 0%        ~ (p=0.370 n=20)
AppendFloat/32Fixed9Hard-8             60.90n ± 0%   60.96n ± 0%   +0.10% (p=0.000 n=20)
AppendFloat/64Fixed1-8                 46.96n ± 0%   46.95n ± 0%        ~ (p=0.702 n=20)
AppendFloat/64Fixed2-8                 46.96n ± 0%   47.21n ± 0%   +0.53% (p=0.000 n=20)
AppendFloat/64Fixed2.5-8               44.24n ± 0%   44.29n ± 0%        ~ (p=0.006 n=20)
AppendFloat/64Fixed3-8                 47.73n ± 0%   47.78n ± 0%        ~ (p=0.020 n=20)
AppendFloat/64Fixed4-8                 44.40n ± 0%   44.60n ± 0%   +0.45% (p=0.000 n=20)
AppendFloat/64Fixed5Hard-8             52.52n ± 0%   52.50n ± 0%        ~ (p=0.722 n=20)
AppendFloat/64Fixed12-8                78.57n ± 0%   78.56n ± 0%        ~ (p=0.222 n=20)
AppendFloat/64Fixed16-8                65.36n ± 0%   65.22n ± 0%   -0.21% (p=0.000 n=20)
AppendFloat/64Fixed12Hard-8            62.04n ± 0%   61.97n ± 0%        ~ (p=0.004 n=20)
AppendFloat/64Fixed17Hard-8            74.30n ± 0%   74.06n ± 0%   -0.32% (p=0.000 n=20)
AppendFloat/64Fixed18Hard-8            4.282µ ± 0%   4.284µ ± 0%        ~ (p=0.296 n=20)
AppendFloat/64FixedF1-8                66.05n ± 0%   66.33n ± 0%   +0.43% (p=0.000 n=20)
AppendFloat/64FixedF2-8                53.67n ± 0%   54.11n ± 0%   +0.81% (p=0.000 n=20)
AppendFloat/64FixedF3-8                47.41n ± 0%   47.59n ± 0%   +0.39% (p=0.000 n=20)
AppendFloat/Slowpath64-8               97.42n ± 0%   83.21n ± 0%  -14.59% (p=0.000 n=20)
AppendFloat/SlowpathDenormal64-8       94.74n ± 0%   80.88n ± 0%  -14.62% (p=0.000 n=20)
AppendFloat/ShorterIntervalCase32-8                  53.77n ± 0%
AppendFloat/ShorterIntervalCase64-8                  55.22n ± 0%
geomean                                77.14n        67.89n       -10.73%

host: local
goos: darwin
cpu: Apple M3 Pro
                                     │ 3c26aef8fb │             8a958b0d9c1             │
                                     │   sec/op    │   sec/op     vs base                │
AppendFloat/Decimal-12                 21.09n ± 0%   19.52n ± 0%   -7.44% (p=0.000 n=20)
AppendFloat/Float-12                   32.36n ± 0%   28.63n ± 1%  -11.54% (p=0.000 n=20)
AppendFloat/Exp-12                     31.77n ± 0%   21.67n ± 0%  -31.79% (p=0.000 n=20)
AppendFloat/NegExp-12                  31.56n ± 1%   21.68n ± 0%  -31.29% (p=0.000 n=20)
AppendFloat/LongExp-12                 33.33n ± 0%   29.21n ± 0%  -12.36% (p=0.000 n=20)
AppendFloat/Big-12                     35.24n ± 1%   26.77n ± 0%  -24.05% (p=0.000 n=20)
AppendFloat/BinaryExp-12               18.88n ± 1%   19.38n ± 2%        ~ (p=0.031 n=20)
AppendFloat/32Integer-12               21.32n ± 1%   17.27n ± 0%  -18.99% (p=0.000 n=20)
AppendFloat/32ExactFraction-12         30.85n ± 1%   21.44n ± 0%  -30.50% (p=0.000 n=20)
AppendFloat/32Point-12                 31.02n ± 1%   24.42n ± 0%  -21.26% (p=0.000 n=20)
AppendFloat/32Exp-12                   31.55n ± 0%   19.23n ± 0%  -39.06% (p=0.000 n=20)
AppendFloat/32NegExp-12                30.32n ± 1%   19.06n ± 0%  -37.13% (p=0.000 n=20)
AppendFloat/32Shortest-12              26.68n ± 0%   20.52n ± 0%  -23.07% (p=0.000 n=20)
AppendFloat/32Fixed8Hard-12            17.34n ± 1%   17.24n ± 0%        ~ (p=0.017 n=20)
AppendFloat/32Fixed9Hard-12            19.05n ± 1%   19.25n ± 1%        ~ (p=0.155 n=20)
AppendFloat/64Fixed1-12                15.66n ± 0%   15.40n ± 0%   -1.66% (p=0.000 n=20)
AppendFloat/64Fixed2-12                15.39n ± 0%   15.12n ± 0%   -1.75% (p=0.000 n=20)
AppendFloat/64Fixed2.5-12              15.14n ± 0%   15.14n ± 0%        ~ (p=0.645 n=20)
AppendFloat/64Fixed3-12                15.53n ± 0%   15.56n ± 0%   +0.23% (p=0.000 n=20)
AppendFloat/64Fixed4-12                15.28n ± 0%   15.04n ± 0%   -1.57% (p=0.000 n=20)
AppendFloat/64Fixed5Hard-12            18.32n ± 0%   18.16n ± 0%   -0.87% (p=0.000 n=20)
AppendFloat/64Fixed12-12               25.51n ± 1%   25.48n ± 0%        ~ (p=0.256 n=20)
AppendFloat/64Fixed16-12               21.32n ± 0%   21.20n ± 0%   -0.59% (p=0.000 n=20)
AppendFloat/64Fixed12Hard-12           21.11n ± 1%   20.91n ± 1%   -0.95% (p=0.001 n=20)
AppendFloat/64Fixed17Hard-12           26.89n ± 1%   25.18n ± 3%   -6.34% (p=0.000 n=20)
AppendFloat/64Fixed18Hard-12           2.057µ ± 6%   2.065µ ± 1%        ~ (p=0.856 n=20)
AppendFloat/64FixedF1-12               24.65n ± 0%   24.19n ± 0%   -1.87% (p=0.000 n=20)
AppendFloat/64FixedF2-12               20.68n ± 0%   20.94n ± 0%   +1.26% (p=0.000 n=20)
AppendFloat/64FixedF3-12               16.44n ± 0%   16.18n ± 0%   -1.58% (p=0.000 n=20)
AppendFloat/Slowpath64-12              31.68n ± 0%   29.18n ± 0%   -7.86% (p=0.000 n=20)
AppendFloat/SlowpathDenormal64-12      29.92n ± 1%   27.12n ± 0%   -9.36% (p=0.000 n=20)
AppendFloat/ShorterIntervalCase32-12                 18.44n ± 1%
AppendFloat/ShorterIntervalCase64-12                 18.57n ± 0%
geomean                                26.90n        23.50n       -11.27%

host: linux-386
goos: linux
goarch: 386
cpu: Intel(R) Xeon(R) CPU @ 2.30GHz
                                     │ 3c26aef8fb │             8a958b0d9c1             │
                                     │   sec/op    │   sec/op     vs base                │
AppendFloat/Decimal-16                 128.2n ± 0%   143.5n ± 0%  +11.93% (p=0.000 n=20)
AppendFloat/Float-16                   236.3n ± 0%   157.5n ± 0%  -33.37% (p=0.000 n=20)
AppendFloat/Exp-16                     245.3n ± 0%   148.2n ± 0%  -39.60% (p=0.000 n=20)
AppendFloat/NegExp-16                  251.2n ± 0%   147.8n ± 0%  -41.17% (p=0.000 n=20)
AppendFloat/LongExp-16                 253.2n ± 0%   176.0n ± 0%  -30.46% (p=0.000 n=20)
AppendFloat/Big-16                     278.6n ± 0%   158.1n ± 0%  -43.23% (p=0.000 n=20)
AppendFloat/BinaryExp-16               89.72n ± 0%   89.47n ± 0%        ~ (p=0.155 n=20)
AppendFloat/32Integer-16               127.1n ± 0%   111.7n ± 0%  -12.12% (p=0.000 n=20)
AppendFloat/32ExactFraction-16         206.9n ± 1%   116.3n ± 1%  -43.75% (p=0.000 n=20)
AppendFloat/32Point-16                 196.9n ± 0%   124.5n ± 1%  -36.74% (p=0.000 n=20)
AppendFloat/32Exp-16                   235.1n ± 1%   114.3n ± 0%  -51.37% (p=0.000 n=20)
AppendFloat/32NegExp-16                206.4n ± 0%   114.3n ± 1%  -44.62% (p=0.000 n=20)
AppendFloat/32Shortest-16              189.7n ± 0%   122.3n ± 0%  -35.56% (p=0.000 n=20)
AppendFloat/32Fixed8Hard-16            137.2n ± 0%   134.0n ± 0%   -2.33% (p=0.000 n=20)
AppendFloat/32Fixed9Hard-16            160.8n ± 0%   154.0n ± 0%   -4.20% (p=0.000 n=20)
AppendFloat/64Fixed1-16                140.2n ± 0%   135.0n ± 0%   -3.74% (p=0.000 n=20)
AppendFloat/64Fixed2-16                135.5n ± 0%   131.8n ± 0%   -2.69% (p=0.000 n=20)
AppendFloat/64Fixed2.5-16              133.3n ± 0%   126.5n ± 0%   -5.14% (p=0.000 n=20)
AppendFloat/64Fixed3-16                135.8n ± 0%   130.9n ± 0%   -3.57% (p=0.000 n=20)
AppendFloat/64Fixed4-16                127.9n ± 0%   122.8n ± 0%   -3.99% (p=0.000 n=20)
AppendFloat/64Fixed5Hard-16            140.7n ± 0%   136.2n ± 0%   -3.20% (p=0.000 n=20)
AppendFloat/64Fixed12-16               166.1n ± 0%   160.5n ± 0%   -3.37% (p=0.000 n=20)
AppendFloat/64Fixed16-16               160.1n ± 0%   154.2n ± 0%   -3.65% (p=0.000 n=20)
AppendFloat/64Fixed12Hard-16           156.6n ± 0%   149.0n ± 0%   -4.82% (p=0.000 n=20)
AppendFloat/64Fixed17Hard-16           173.9n ± 1%   169.6n ± 0%   -2.44% (p=0.000 n=20)
AppendFloat/64Fixed18Hard-16           10.59µ ± 1%   10.60µ ± 0%        ~ (p=0.664 n=20)
AppendFloat/64FixedF1-16               158.5n ± 0%   154.1n ± 0%   -2.75% (p=0.000 n=20)
AppendFloat/64FixedF2-16               147.1n ± 0%   143.8n ± 0%   -2.21% (p=0.000 n=20)
AppendFloat/64FixedF3-16               135.8n ± 0%   131.1n ± 0%   -3.46% (p=0.000 n=20)
AppendFloat/Slowpath64-16              244.9n ± 0%   189.7n ± 0%  -22.54% (p=0.000 n=20)
AppendFloat/SlowpathDenormal64-16      241.8n ± 0%   176.9n ± 0%  -26.86% (p=0.000 n=20)
AppendFloat/ShorterIntervalCase32-16                 114.9n ± 0%
AppendFloat/ShorterIntervalCase64-16                 130.6n ± 0%
geomean                                195.7n        157.4n       -18.30%

host: s7:GOARCH=386
cpu: AMD Ryzen 9 7950X 16-Core Processor
                                     │ 3c26aef8fb │             8a958b0d9c1             │
                                     │   sec/op    │   sec/op     vs base                │
AppendFloat/Decimal-32                 42.76n ± 0%   47.25n ± 0%  +10.51% (p=0.000 n=20)
AppendFloat/Float-32                   71.44n ± 1%   50.97n ± 0%  -28.66% (p=0.000 n=20)
AppendFloat/Exp-32                     75.51n ± 0%   48.39n ± 1%  -35.92% (p=0.000 n=20)
AppendFloat/NegExp-32                  74.70n ± 0%   48.17n ± 1%  -35.52% (p=0.000 n=20)
AppendFloat/LongExp-32                 76.52n ± 0%   57.32n ± 1%  -25.10% (p=0.000 n=20)
AppendFloat/Big-32                     83.05n ± 0%   52.92n ± 1%  -36.28% (p=0.000 n=20)
AppendFloat/BinaryExp-32               31.92n ± 1%   32.22n ± 0%   +0.96% (p=0.000 n=20)
AppendFloat/32Integer-32               41.29n ± 1%   36.81n ± 0%  -10.85% (p=0.000 n=20)
AppendFloat/32ExactFraction-32         62.29n ± 1%   38.16n ± 0%  -38.73% (p=0.000 n=20)
AppendFloat/32Point-32                 60.45n ± 1%   40.44n ± 1%  -33.11% (p=0.000 n=20)
AppendFloat/32Exp-32                   69.32n ± 1%   38.45n ± 1%  -44.53% (p=0.000 n=20)
AppendFloat/32NegExp-32                63.39n ± 0%   38.64n ± 1%  -39.03% (p=0.000 n=20)
AppendFloat/32Shortest-32              58.90n ± 1%   39.53n ± 0%  -32.89% (p=0.000 n=20)
AppendFloat/32Fixed8Hard-32            43.30n ± 0%   42.70n ± 1%   -1.36% (p=0.000 n=20)
AppendFloat/32Fixed9Hard-32            49.96n ± 1%   49.60n ± 0%   -0.72% (p=0.000 n=20)
AppendFloat/64Fixed1-32                42.99n ± 1%   42.08n ± 0%   -2.13% (p=0.000 n=20)
AppendFloat/64Fixed2-32                41.58n ± 0%   41.42n ± 1%        ~ (p=0.077 n=20)
AppendFloat/64Fixed2.5-32              40.47n ± 1%   40.00n ± 1%   -1.15% (p=0.000 n=20)
AppendFloat/64Fixed3-32                43.43n ± 1%   41.67n ± 0%   -4.04% (p=0.000 n=20)
AppendFloat/64Fixed4-32                40.44n ± 0%   39.40n ± 0%   -2.58% (p=0.000 n=20)
AppendFloat/64Fixed5Hard-32            43.41n ± 0%   42.72n ± 0%   -1.60% (p=0.000 n=20)
AppendFloat/64Fixed12-32               52.00n ± 0%   51.26n ± 0%   -1.43% (p=0.000 n=20)
AppendFloat/64Fixed16-32               50.62n ± 1%   50.55n ± 0%        ~ (p=0.234 n=20)
AppendFloat/64Fixed12Hard-32           49.36n ± 0%   47.89n ± 0%   -2.98% (p=0.000 n=20)
AppendFloat/64Fixed17Hard-32           56.91n ± 0%   55.66n ± 1%   -2.19% (p=0.000 n=20)
AppendFloat/64Fixed18Hard-32           3.983µ ± 0%   3.964µ ± 0%        ~ (p=0.014 n=20)
AppendFloat/64FixedF1-32               49.31n ± 1%   49.10n ± 1%        ~ (p=0.005 n=20)
AppendFloat/64FixedF2-32               45.06n ± 0%   44.00n ± 1%   -2.36% (p=0.000 n=20)
AppendFloat/64FixedF3-32               42.22n ± 0%   42.20n ± 1%        ~ (p=0.644 n=20)
AppendFloat/Slowpath64-32              75.77n ± 0%   60.89n ± 1%  -19.63% (p=0.000 n=20)
AppendFloat/SlowpathDenormal64-32      74.88n ± 1%   57.59n ± 1%  -23.10% (p=0.000 n=20)
AppendFloat/ShorterIntervalCase32-32                 37.66n ± 1%
AppendFloat/ShorterIntervalCase64-32                 42.49n ± 1%
geomean                                61.34n        51.27n       -15.08%

host: linux-arm
goarch: arm
cpu: ARMv8 Processor rev 1 (v8l)
                                    │ 3c26aef8fb │             8a958b0d9c1             │
                                    │   sec/op    │   sec/op     vs base                │
AppendFloat/Decimal-4                 110.8n ± 0%   135.0n ± 0%  +21.84% (p=0.000 n=20)
AppendFloat/Float-4                   172.0n ± 0%   145.1n ± 0%  -15.64% (p=0.000 n=20)
AppendFloat/Exp-4                     172.1n ± 0%   136.2n ± 0%  -20.89% (p=0.000 n=20)
AppendFloat/NegExp-4                  172.6n ± 0%   135.8n ± 0%  -21.32% (p=0.000 n=20)
AppendFloat/LongExp-4                 180.2n ± 0%   161.9n ± 0%  -10.18% (p=0.000 n=20)
AppendFloat/Big-4                     195.5n ± 0%   143.8n ± 0%  -26.45% (p=0.000 n=20)
AppendFloat/BinaryExp-4               84.75n ± 0%   86.40n ± 0%   +1.94% (p=0.000 n=20)
AppendFloat/32Integer-4               110.4n ± 0%   110.0n ± 0%   -0.32% (p=0.000 n=20)
AppendFloat/32ExactFraction-4         152.9n ± 0%   114.0n ± 0%  -25.44% (p=0.000 n=20)
AppendFloat/32Point-4                 151.5n ± 0%   120.1n ± 0%  -20.72% (p=0.000 n=20)
AppendFloat/32Exp-4                   163.1n ± 0%   111.3n ± 0%  -31.76% (p=0.000 n=20)
AppendFloat/32NegExp-4                152.0n ± 0%   111.1n ± 0%  -26.91% (p=0.000 n=20)
AppendFloat/32Shortest-4              145.8n ± 0%   116.5n ± 0%  -20.13% (p=0.000 n=20)
AppendFloat/32Fixed8Hard-4            104.1n ± 0%   104.0n ± 0%   -0.10% (p=0.000 n=20)
AppendFloat/32Fixed9Hard-4            114.2n ± 0%   115.7n ± 0%   +1.31% (p=0.000 n=20)
AppendFloat/64Fixed1-4                97.35n ± 0%   97.31n ± 0%        ~ (p=0.357 n=20)
AppendFloat/64Fixed2-4                95.74n ± 0%   95.28n ± 0%   -0.49% (p=0.000 n=20)
AppendFloat/64Fixed2.5-4              94.24n ± 0%   93.32n ± 0%   -0.97% (p=0.000 n=20)
AppendFloat/64Fixed3-4                95.56n ± 0%   95.30n ± 0%   -0.27% (p=0.000 n=20)
AppendFloat/64Fixed4-4                92.36n ± 0%   91.52n ± 0%   -0.91% (p=0.000 n=20)
AppendFloat/64Fixed5Hard-4            101.5n ± 0%   102.0n ± 0%   +0.49% (p=0.000 n=20)
AppendFloat/64Fixed12-4               125.5n ± 0%   124.6n ± 0%   -0.72% (p=0.000 n=20)
AppendFloat/64Fixed16-4               121.8n ± 0%   122.7n ± 0%   +0.74% (p=0.000 n=20)
AppendFloat/64Fixed12Hard-4           116.1n ± 0%   116.4n ± 0%   +0.26% (p=0.000 n=20)
AppendFloat/64Fixed17Hard-4           129.8n ± 0%   131.1n ± 0%   +1.00% (p=0.000 n=20)
AppendFloat/64Fixed18Hard-4           7.945µ ± 0%   7.950µ ± 0%   +0.06% (p=0.000 n=20)
AppendFloat/64FixedF1-4               112.8n ± 0%   111.4n ± 0%   -1.24% (p=0.000 n=20)
AppendFloat/64FixedF2-4               100.6n ± 0%   100.5n ± 0%        ~ (p=0.066 n=20)
AppendFloat/64FixedF3-4               96.45n ± 0%   95.41n ± 0%   -1.08% (p=0.000 n=20)
AppendFloat/Slowpath64-4              176.3n ± 0%   165.9n ± 0%   -5.90% (p=0.000 n=20)
AppendFloat/SlowpathDenormal64-4      178.2n ± 0%   152.4n ± 0%  -14.48% (p=0.000 n=20)
AppendFloat/ShorterIntervalCase32-4                 112.8n ± 0%
AppendFloat/ShorterIntervalCase64-4                 119.0n ± 0%
geomean                               144.6n        132.1n        -7.84%

Change-Id: I1eb3c7b8756ad6cf938bc9b81180e01fd8a4cd9e
Reviewed-on: https://go-review.googlesource.com/c/go/+/723861
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Russ Cox <rsc@golang.org>
2025-11-25 13:43:27 -08:00
Ian Lance Taylor
8d6d14f5d6 compress/flate: move big non-pointer arrays to end of compressor
The compressor type is fairly large: 656616 bytes on amd64.
Before this patch, it had fields of slice and interface type
near the end of the struct. As those types always contain pointers,
the ptrBytes value in the type descriptor was quite large.
That forces the garbage collector to do extra work scanning for pointers,
and wastes a bit of executable space recording the gcmask for the type.

This patch moves the arrays to the end of the type,
fixing those minor issues.

Change-Id: I849a75a19cc61137c8797a1ea5a4c97e0f69b4db
Reviewed-on: https://go-review.googlesource.com/c/go/+/707596
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
2025-11-25 12:28:05 -08:00
Mark Ryan
4ca048cc32 cmd/internal/obj/riscv: document compressed instructions
We update the RISC-V assembler documentation to describe how
the RISC-V compressed instruction set is implemented by the
assembler and how compressed instructions can be disabled.

Change-Id: Ic7b1cb1586e6906af78adb8ff5fa10f5fbfde292
Reviewed-on: https://go-review.googlesource.com/c/go/+/719221
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Joel Sing <joel@sing.id.au>
Auto-Submit: Joel Sing <joel@sing.id.au>
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
2025-11-25 12:25:24 -08:00
Louis Nyffenegger
a572d571fa path: add more examples for path.Clean
Clarify that the function path.Clean only normalises paths and does not
protect against directory-traversal attacks.

Change-Id: I66f1267ac15900ac0cb6011ace0c79aabaebc68b
GitHub-Last-Rev: d669e1edf6
GitHub-Pull-Request: golang/go#74397
Reviewed-on: https://go-review.googlesource.com/c/go/+/684376
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Sean Liao <sean@liao.dev>
Auto-Submit: Sean Liao <sean@liao.dev>
2025-11-25 12:25:10 -08:00
guoguangwu
eec40aae45 maps: use strings.EqualFold in example
Change-Id: I40a9684a9465e844ff1de46601edf23de7b637e3
GitHub-Last-Rev: 15ef023853
GitHub-Pull-Request: golang/go#65541
Reviewed-on: https://go-review.googlesource.com/c/go/+/561855
Auto-Submit: Sean Liao <sean@liao.dev>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-11-25 12:24:47 -08:00
Taichi Maeda
113eb42efc strconv: replace Ryu ftoa with Dragonbox
Dragonbox is a faster ftoa algorithm that provides the same guarantees
as Ryu: round-trip conversion, shortest length, and correct rounding.
Dragonbox only supports shortest-precision conversion, so we continue to
use Ryu-printf for fixed precision.

The new implementation has been fuzz-tested against the current
Ryu implementation in addition to the existing test suite.
Benchmarks show at least ~15-20% performance improvement.

The following shows the relevant output from benchstat. Full benchmark
results and plots are available at:
https://github.com/taichimaeda/dragonbox-bench/

goos: darwin
goarch: arm64
pkg: strconv
cpu: Apple M1
                                    │   old.txt    │               new.txt                │
                                    │    sec/op    │    sec/op     vs base                │
FormatFloat/Decimal-8                 32.71n ± 14%   31.89n ± 12%        ~ (p=0.165 n=10)
FormatFloat/Float-8                   45.54n ±  1%   42.48n ±  0%   -6.70% (p=0.000 n=10)
FormatFloat/Exp-8                     50.06n ±  0%   32.27n ±  1%  -35.54% (p=0.000 n=10)
FormatFloat/NegExp-8                  47.15n ±  1%   31.33n ±  0%  -33.56% (p=0.000 n=10)
FormatFloat/LongExp-8                 46.15n ±  1%   43.66n ±  0%   -5.38% (p=0.000 n=10)
FormatFloat/Big-8                     50.02n ±  0%   39.36n ±  0%  -21.31% (p=0.000 n=10)
FormatFloat/BinaryExp-8               27.89n ±  0%   27.88n ±  1%        ~ (p=0.798 n=10)
FormatFloat/32Integer-8               31.41n ±  0%   23.00n ±  3%  -26.79% (p=0.000 n=10)
FormatFloat/32ExactFraction-8         44.93n ±  1%   29.91n ±  0%  -33.43% (p=0.000 n=10)
FormatFloat/32Point-8                 43.22n ±  1%   33.82n ±  0%  -21.74% (p=0.000 n=10)
FormatFloat/32Exp-8                   45.91n ±  0%   25.48n ±  0%  -44.50% (p=0.000 n=10)
FormatFloat/32NegExp-8                44.66n ±  0%   25.12n ±  0%  -43.76% (p=0.000 n=10)
FormatFloat/32Shortest-8              37.96n ±  0%   27.83n ±  1%  -26.68% (p=0.000 n=10)
FormatFloat/Slowpath64-8              47.74n ±  2%   45.85n ±  0%   -3.96% (p=0.000 n=10)
FormatFloat/SlowpathDenormal64-8      42.78n ±  1%   41.46n ±  0%   -3.07% (p=0.000 n=10)
FormatFloat/ShorterIntervalCase32-8                  25.49n ±  2%
FormatFloat/ShorterIntervalCase64-8                  27.72n ±  1%
geomean                               41.95n         31.89n        -22.11%

Fixes #74886

Co-authored-by: Junekey Jeon <j6jeon@ucsd.edu>

Change-Id: I923f7259c9cecd0896b2340a43d1041cc2ed7787
GitHub-Last-Rev: fd735db0b1
GitHub-Pull-Request: golang/go#75195
Reviewed-on: https://go-review.googlesource.com/c/go/+/700075
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
TryBot-Bypass: Russ Cox <rsc@golang.org>
2025-11-25 11:31:06 -08:00
Neal Patel
6e5cfe94b0 crypto: fix dead links and correct SHA-512 algorithm comment
Change-Id: I71d63b0b78a9fc4895574f6df465e22c9585e77c
Reviewed-on: https://go-review.googlesource.com/c/go/+/710196
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>
2025-11-25 11:18:36 -08:00
Neal Patel
2c7c62b972 crypto/internal/fips140/sha512: interleave scheduling with rounds for 10.3% speed-up
goos: linux
goarch: amd64
pkg: crypto/sha512
cpu: AMD EPYC 7B13
                    │   before    │               after                │
                    │   sec/op    │   sec/op     vs base               │
Hash8Bytes/New        486.7n ± 1%   440.3n ± 0%   -9.53% (p=0.001 n=7)
Hash8Bytes/New-2      487.3n ± 1%   442.6n ± 1%   -9.17% (p=0.001 n=7)
Hash8Bytes/New-4      488.0n ± 1%   442.3n ± 0%   -9.36% (p=0.001 n=7)
Hash8Bytes/Sum384     495.1n ± 0%   451.2n ± 1%   -8.87% (p=0.001 n=7)
Hash8Bytes/Sum384-2   495.0n ± 1%   450.8n ± 1%   -8.93% (p=0.001 n=7)
Hash8Bytes/Sum384-4   500.2n ± 2%   453.6n ± 2%   -9.32% (p=0.001 n=7)
Hash8Bytes/Sum512     497.3n ± 1%   452.1n ± 0%   -9.09% (p=0.001 n=7)
Hash8Bytes/Sum512-2   496.0n ± 1%   453.5n ± 0%   -8.57% (p=0.001 n=7)
Hash8Bytes/Sum512-4   498.5n ± 0%   452.3n ± 1%   -9.27% (p=0.001 n=7)
Hash1K/New            3.985µ ± 1%   3.543µ ± 1%  -11.09% (p=0.001 n=7)
Hash1K/New-2          4.004µ ± 2%   3.558µ ± 1%  -11.14% (p=0.001 n=7)
Hash1K/New-4          3.997µ ± 0%   3.563µ ± 1%  -10.86% (p=0.001 n=7)
Hash1K/Sum384         3.996µ ± 1%   3.560µ ± 1%  -10.91% (p=0.001 n=7)
Hash1K/Sum384-2       4.011µ ± 1%   3.576µ ± 1%  -10.85% (p=0.001 n=7)
Hash1K/Sum384-4       4.004µ ± 0%   3.564µ ± 0%  -10.99% (p=0.001 n=7)
Hash1K/Sum512         3.998µ ± 1%   3.555µ ± 1%  -11.08% (p=0.001 n=7)
Hash1K/Sum512-2       3.996µ ± 0%   3.560µ ± 1%  -10.91% (p=0.001 n=7)
Hash1K/Sum512-4       4.004µ ± 1%   3.573µ ± 1%  -10.76% (p=0.001 n=7)
Hash8K/New            28.34µ ± 1%   25.29µ ± 1%  -10.77% (p=0.001 n=7)
Hash8K/New-2          28.45µ ± 1%   25.48µ ± 1%  -10.44% (p=0.001 n=7)
Hash8K/New-4          28.42µ ± 1%   25.37µ ± 1%  -10.71% (p=0.001 n=7)
Hash8K/Sum384         28.38µ ± 0%   25.18µ ± 0%  -11.28% (p=0.001 n=7)
Hash8K/Sum384-2       28.50µ ± 1%   25.35µ ± 1%  -11.07% (p=0.001 n=7)
Hash8K/Sum384-4       28.51µ ± 1%   25.35µ ± 0%  -11.07% (p=0.001 n=7)
Hash8K/Sum512         28.34µ ± 1%   25.23µ ± 0%  -10.96% (p=0.001 n=7)
Hash8K/Sum512-2       28.33µ ± 1%   25.23µ ± 1%  -10.95% (p=0.001 n=7)
Hash8K/Sum512-4       28.48µ ± 1%   25.31µ ± 1%  -11.13% (p=0.001 n=7)
geomean               3.828µ        3.433µ       -10.34%

                    │    before    │                after                │
                    │     B/s      │     B/s       vs base               │
Hash8Bytes/New        15.68Mi ± 1%   17.33Mi ± 0%  +10.52% (p=0.001 n=7)
Hash8Bytes/New-2      15.66Mi ± 1%   17.23Mi ± 1%  +10.05% (p=0.001 n=7)
Hash8Bytes/New-4      15.63Mi ± 0%   17.25Mi ± 0%  +10.37% (p=0.001 n=7)
Hash8Bytes/Sum384     15.41Mi ± 0%   16.91Mi ± 1%   +9.72% (p=0.001 n=7)
Hash8Bytes/Sum384-2   15.41Mi ± 1%   16.93Mi ± 1%   +9.84% (p=0.001 n=7)
Hash8Bytes/Sum384-4   15.25Mi ± 2%   16.82Mi ± 2%  +10.32% (p=0.001 n=7)
Hash8Bytes/Sum512     15.34Mi ± 1%   16.87Mi ± 0%   +9.94% (p=0.001 n=7)
Hash8Bytes/Sum512-2   15.38Mi ± 1%   16.82Mi ± 0%   +9.36% (p=0.001 n=7)
Hash8Bytes/Sum512-4   15.31Mi ± 0%   16.87Mi ± 1%  +10.22% (p=0.001 n=7)
Hash1K/New            245.0Mi ± 1%   275.6Mi ± 1%  +12.47% (p=0.001 n=7)
Hash1K/New-2          243.9Mi ± 2%   274.5Mi ± 1%  +12.55% (p=0.001 n=7)
Hash1K/New-4          244.3Mi ± 0%   274.1Mi ± 1%  +12.21% (p=0.001 n=7)
Hash1K/Sum384         244.4Mi ± 0%   274.3Mi ± 1%  +12.24% (p=0.001 n=7)
Hash1K/Sum384-2       243.5Mi ± 1%   273.1Mi ± 1%  +12.16% (p=0.001 n=7)
Hash1K/Sum384-4       243.9Mi ± 0%   274.0Mi ± 0%  +12.35% (p=0.001 n=7)
Hash1K/Sum512         244.3Mi ± 1%   274.7Mi ± 1%  +12.46% (p=0.001 n=7)
Hash1K/Sum512-2       244.4Mi ± 0%   274.3Mi ± 1%  +12.25% (p=0.001 n=7)
Hash1K/Sum512-4       243.9Mi ± 1%   273.3Mi ± 1%  +12.08% (p=0.001 n=7)
Hash8K/New            275.7Mi ± 1%   309.0Mi ± 1%  +12.07% (p=0.001 n=7)
Hash8K/New-2          274.6Mi ± 1%   306.6Mi ± 1%  +11.67% (p=0.001 n=7)
Hash8K/New-4          274.9Mi ± 1%   307.9Mi ± 1%  +11.99% (p=0.001 n=7)
Hash8K/Sum384         275.3Mi ± 0%   310.3Mi ± 0%  +12.71% (p=0.001 n=7)
Hash8K/Sum384-2       274.1Mi ± 1%   308.2Mi ± 1%  +12.45% (p=0.001 n=7)
Hash8K/Sum384-4       274.1Mi ± 1%   308.2Mi ± 0%  +12.44% (p=0.001 n=7)
Hash8K/Sum512         275.7Mi ± 1%   309.6Mi ± 0%  +12.31% (p=0.001 n=7)
Hash8K/Sum512-2       275.8Mi ± 1%   309.7Mi ± 1%  +12.29% (p=0.001 n=7)
Hash8K/Sum512-4       274.3Mi ± 1%   308.7Mi ± 1%  +12.52% (p=0.001 n=7)
geomean               101.2Mi        112.9Mi       +11.53%

                    │    before    │               after                │
                    │     B/op     │    B/op     vs base                │
Hash8Bytes/New        0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/New-2      0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/New-4      0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/Sum384     0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/Sum384-2   0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/Sum384-4   0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/Sum512     0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/Sum512-2   0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/Sum512-4   0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/New            0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/New-2          0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/New-4          0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/Sum384         0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/Sum384-2       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/Sum384-4       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/Sum512         0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/Sum512-2       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/Sum512-4       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/New            0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/New-2          0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/New-4          0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/Sum384         0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/Sum384-2       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/Sum384-4       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/Sum512         0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/Sum512-2       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/Sum512-4       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
geomean                          ²               +0.00%               ²
¹ all samples are equal
² summaries must be >0 to compute geomean

                    │    before    │               after                │
                    │  allocs/op   │ allocs/op   vs base                │
Hash8Bytes/New        0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/New-2      0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/New-4      0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/Sum384     0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/Sum384-2   0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/Sum384-4   0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/Sum512     0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/Sum512-2   0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/Sum512-4   0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/New            0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/New-2          0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/New-4          0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/Sum384         0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/Sum384-2       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/Sum384-4       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/Sum512         0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/Sum512-2       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/Sum512-4       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/New            0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/New-2          0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/New-4          0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/Sum384         0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/Sum384-2       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/Sum384-4       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/Sum512         0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/Sum512-2       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/Sum512-4       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
geomean                          ²               +0.00%               ²
¹ all samples are equal
² summaries must be >0 to compute geomean

Change-Id: I3791244b3f69e093203f6aa46dc59428afcb9223
Reviewed-on: https://go-review.googlesource.com/c/go/+/711844
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
2025-11-25 11:14:35 -08:00
Neal Patel
5b34354bd3 crypto/internal/fips140/sha256: interleave scheduling and rounds for 11.2% speed-up
goos: linux
goarch: amd64
pkg: crypto/sha256
cpu: AMD EPYC 7B13
                    │   before    │               after                │
                    │   sec/op    │   sec/op     vs base               │
Hash8Bytes/New        384.4n ± 2%   347.2n ± 0%   -9.68% (p=0.001 n=7)
Hash8Bytes/New-2      386.3n ± 2%   348.3n ± 1%   -9.84% (p=0.001 n=7)
Hash8Bytes/New-4      386.7n ± 1%   347.9n ± 1%  -10.03% (p=0.001 n=7)
Hash8Bytes/Sum224     406.9n ± 2%   358.8n ± 3%  -11.82% (p=0.001 n=7)
Hash8Bytes/Sum224-2   404.1n ± 1%   359.8n ± 1%  -10.96% (p=0.001 n=7)
Hash8Bytes/Sum224-4   409.5n ± 1%   360.9n ± 1%  -11.87% (p=0.001 n=7)
Hash8Bytes/Sum256     401.3n ± 1%   352.4n ± 0%  -12.19% (p=0.001 n=7)
Hash8Bytes/Sum256-2   402.0n ± 1%   354.2n ± 1%  -11.89% (p=0.001 n=7)
Hash8Bytes/Sum256-4   403.7n ± 1%   353.5n ± 1%  -12.43% (p=0.001 n=7)
Hash1K/New            5.836µ ± 1%   5.180µ ± 2%  -11.24% (p=0.001 n=7)
Hash1K/New-2          5.855µ ± 1%   5.177µ ± 5%  -11.58% (p=0.001 n=7)
Hash1K/New-4          5.878µ ± 0%   5.215µ ± 3%  -11.28% (p=0.001 n=7)
Hash1K/Sum224         5.860µ ± 1%   5.225µ ± 1%  -10.84% (p=0.001 n=7)
Hash1K/Sum224-2       5.852µ ± 1%   5.198µ ± 1%  -11.18% (p=0.001 n=7)
Hash1K/Sum224-4       5.867µ ± 1%   5.226µ ± 4%  -10.93% (p=0.001 n=7)
Hash1K/Sum256         5.851µ ± 0%   5.246µ ± 1%  -10.34% (p=0.001 n=7)
Hash1K/Sum256-2       5.863µ ± 1%   5.237µ ± 2%  -10.68% (p=0.001 n=7)
Hash1K/Sum256-4       5.873µ ± 1%   5.191µ ± 1%  -11.61% (p=0.001 n=7)
Hash8K/New            44.06µ ± 0%   38.93µ ± 1%  -11.63% (p=0.001 n=7)
Hash8K/New-2          44.23µ ± 0%   39.14µ ± 1%  -11.50% (p=0.001 n=7)
Hash8K/New-4          44.25µ ± 1%   39.04µ ± 1%  -11.77% (p=0.001 n=7)
Hash8K/Sum224         43.98µ ± 1%   40.47µ ± 2%   -7.98% (p=0.001 n=7)
Hash8K/Sum224-2       44.31µ ± 1%   39.54µ ± 3%  -10.76% (p=0.001 n=7)
Hash8K/Sum224-4       44.45µ ± 1%   39.04µ ± 2%  -12.16% (p=0.001 n=7)
Hash8K/Sum256         43.95µ ± 0%   39.23µ ± 0%  -10.75% (p=0.001 n=7)
Hash8K/Sum256-2       44.19µ ± 1%   39.39µ ± 2%  -10.87% (p=0.001 n=7)
Hash8K/Sum256-4       44.19µ ± 1%   39.27µ ± 1%  -11.13% (p=0.001 n=7)
Hash256K/New          1.397m ± 1%   1.238m ± 1%  -11.39% (p=0.001 n=7)
Hash256K/New-2        1.404m ± 1%   1.242m ± 1%  -11.53% (p=0.001 n=7)
Hash256K/New-4        1.402m ± 1%   1.243m ± 1%  -11.31% (p=0.001 n=7)
Hash256K/Sum224       1.398m ± 0%   1.237m ± 1%  -11.48% (p=0.001 n=7)
Hash256K/Sum224-2     1.402m ± 1%   1.239m ± 1%  -11.59% (p=0.001 n=7)
Hash256K/Sum224-4     1.409m ± 1%   1.245m ± 1%  -11.61% (p=0.001 n=7)
Hash256K/Sum256       1.402m ± 1%   1.242m ± 1%  -11.38% (p=0.001 n=7)
Hash256K/Sum256-2     1.397m ± 1%   1.240m ± 1%  -11.22% (p=0.001 n=7)
Hash256K/Sum256-4     1.404m ± 1%   1.250m ± 1%  -10.97% (p=0.001 n=7)
Hash1M/New            5.584m ± 2%   4.944m ± 1%  -11.46% (p=0.001 n=7)
Hash1M/New-2          5.609m ± 1%   4.974m ± 1%  -11.33% (p=0.001 n=7)
Hash1M/New-4          5.625m ± 2%   4.984m ± 2%  -11.40% (p=0.001 n=7)
Hash1M/Sum224         5.578m ± 0%   4.949m ± 0%  -11.28% (p=0.001 n=7)
Hash1M/Sum224-2       5.603m ± 1%   4.985m ± 1%  -11.02% (p=0.001 n=7)
Hash1M/Sum224-4       5.619m ± 1%   4.976m ± 1%  -11.44% (p=0.001 n=7)
Hash1M/Sum256         5.589m ± 1%   4.940m ± 0%  -11.61% (p=0.001 n=7)
Hash1M/Sum256-2       5.581m ± 1%   4.981m ± 1%  -10.75% (p=0.001 n=7)
Hash1M/Sum256-4       5.618m ± 3%   4.966m ± 1%  -11.59% (p=0.001 n=7)
geomean               60.48µ        53.71µ       -11.19%

                    │    before    │                after                │
                    │     B/s      │     B/s       vs base               │
Hash8Bytes/New        19.85Mi ± 2%   21.97Mi ± 0%  +10.72% (p=0.001 n=7)
Hash8Bytes/New-2      19.75Mi ± 2%   21.91Mi ± 1%  +10.91% (p=0.001 n=7)
Hash8Bytes/New-4      19.73Mi ± 1%   21.93Mi ± 1%  +11.16% (p=0.001 n=7)
Hash8Bytes/Sum224     18.75Mi ± 2%   21.27Mi ± 3%  +13.43% (p=0.001 n=7)
Hash8Bytes/Sum224-2   18.88Mi ± 1%   21.20Mi ± 1%  +12.27% (p=0.001 n=7)
Hash8Bytes/Sum224-4   18.63Mi ± 1%   21.14Mi ± 1%  +13.46% (p=0.001 n=7)
Hash8Bytes/Sum256     19.01Mi ± 1%   21.65Mi ± 0%  +13.90% (p=0.001 n=7)
Hash8Bytes/Sum256-2   18.98Mi ± 1%   21.54Mi ± 1%  +13.52% (p=0.001 n=7)
Hash8Bytes/Sum256-4   18.90Mi ± 1%   21.58Mi ± 1%  +14.18% (p=0.001 n=7)
Hash1K/New            167.4Mi ± 1%   188.5Mi ± 2%  +12.65% (p=0.001 n=7)
Hash1K/New-2          166.8Mi ± 1%   188.6Mi ± 5%  +13.11% (p=0.001 n=7)
Hash1K/New-4          166.1Mi ± 0%   187.3Mi ± 3%  +12.71% (p=0.001 n=7)
Hash1K/Sum224         166.7Mi ± 1%   186.9Mi ± 1%  +12.14% (p=0.001 n=7)
Hash1K/Sum224-2       166.9Mi ± 1%   187.9Mi ± 1%  +12.59% (p=0.001 n=7)
Hash1K/Sum224-4       166.5Mi ± 1%   186.9Mi ± 4%  +12.27% (p=0.001 n=7)
Hash1K/Sum256         166.9Mi ± 0%   186.1Mi ± 1%  +11.51% (p=0.001 n=7)
Hash1K/Sum256-2       166.6Mi ± 1%   186.5Mi ± 2%  +11.94% (p=0.001 n=7)
Hash1K/Sum256-4       166.3Mi ± 1%   188.1Mi ± 1%  +13.15% (p=0.001 n=7)
Hash8K/New            177.3Mi ± 0%   200.7Mi ± 1%  +13.17% (p=0.001 n=7)
Hash8K/New-2          176.6Mi ± 0%   199.6Mi ± 1%  +13.00% (p=0.001 n=7)
Hash8K/New-4          176.6Mi ± 1%   200.1Mi ± 1%  +13.34% (p=0.001 n=7)
Hash8K/Sum224         177.6Mi ± 1%   193.0Mi ± 2%   +8.67% (p=0.001 n=7)
Hash8K/Sum224-2       176.3Mi ± 1%   197.6Mi ± 3%  +12.06% (p=0.001 n=7)
Hash8K/Sum224-4       175.8Mi ± 1%   200.1Mi ± 2%  +13.84% (p=0.001 n=7)
Hash8K/Sum256         177.8Mi ± 0%   199.2Mi ± 0%  +12.04% (p=0.001 n=7)
Hash8K/Sum256-2       176.8Mi ± 1%   198.4Mi ± 2%  +12.20% (p=0.001 n=7)
Hash8K/Sum256-4       176.8Mi ± 1%   198.9Mi ± 1%  +12.52% (p=0.001 n=7)
Hash256K/New          179.0Mi ± 1%   202.0Mi ± 1%  +12.86% (p=0.001 n=7)
Hash256K/New-2        178.1Mi ± 1%   201.3Mi ± 1%  +13.03% (p=0.001 n=7)
Hash256K/New-4        178.4Mi ± 1%   201.1Mi ± 1%  +12.76% (p=0.001 n=7)
Hash256K/Sum224       178.8Mi ± 0%   202.0Mi ± 1%  +12.97% (p=0.001 n=7)
Hash256K/Sum224-2     178.3Mi ± 1%   201.7Mi ± 1%  +13.11% (p=0.001 n=7)
Hash256K/Sum224-4     177.5Mi ± 1%   200.8Mi ± 1%  +13.13% (p=0.001 n=7)
Hash256K/Sum256       178.3Mi ± 1%   201.2Mi ± 1%  +12.83% (p=0.001 n=7)
Hash256K/Sum256-2     179.0Mi ± 1%   201.6Mi ± 1%  +12.64% (p=0.001 n=7)
Hash256K/Sum256-4     178.0Mi ± 1%   200.0Mi ± 1%  +12.33% (p=0.001 n=7)
Hash1M/New            179.1Mi ± 2%   202.3Mi ± 1%  +12.94% (p=0.001 n=7)
Hash1M/New-2          178.3Mi ± 1%   201.1Mi ± 1%  +12.78% (p=0.001 n=7)
Hash1M/New-4          177.8Mi ± 2%   200.6Mi ± 2%  +12.87% (p=0.001 n=7)
Hash1M/Sum224         179.3Mi ± 0%   202.1Mi ± 0%  +12.71% (p=0.001 n=7)
Hash1M/Sum224-2       178.5Mi ± 1%   200.6Mi ± 1%  +12.39% (p=0.001 n=7)
Hash1M/Sum224-4       178.0Mi ± 1%   201.0Mi ± 1%  +12.92% (p=0.001 n=7)
Hash1M/Sum256         178.9Mi ± 1%   202.4Mi ± 0%  +13.13% (p=0.001 n=7)
Hash1M/Sum256-2       179.2Mi ± 1%   200.8Mi ± 1%  +12.04% (p=0.001 n=7)
Hash1M/Sum256-4       178.0Mi ± 3%   201.3Mi ± 1%  +13.12% (p=0.001 n=7)
geomean               112.5Mi        126.6Mi       +12.60%

                    │    before    │               after                │
                    │     B/op     │    B/op     vs base                │
Hash8Bytes/New        0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/New-2      0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/New-4      0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/Sum224     0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/Sum224-2   0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/Sum224-4   0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/Sum256     0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/Sum256-2   0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/Sum256-4   0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/New            0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/New-2          0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/New-4          0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/Sum224         0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/Sum224-2       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/Sum224-4       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/Sum256         0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/Sum256-2       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/Sum256-4       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/New            0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/New-2          0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/New-4          0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/Sum224         0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/Sum224-2       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/Sum224-4       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/Sum256         0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/Sum256-2       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/Sum256-4       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash256K/New          0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash256K/New-2        0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash256K/New-4        0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash256K/Sum224       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash256K/Sum224-2     0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash256K/Sum224-4     0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash256K/Sum256       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash256K/Sum256-2     0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash256K/Sum256-4     0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1M/New            0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1M/New-2          0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1M/New-4          0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1M/Sum224         0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1M/Sum224-2       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1M/Sum224-4       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1M/Sum256         0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1M/Sum256-2       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1M/Sum256-4       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
geomean                          ²               +0.00%               ²
¹ all samples are equal
² summaries must be >0 to compute geomean

                    │    before    │               after                │
                    │  allocs/op   │ allocs/op   vs base                │
Hash8Bytes/New        0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/New-2      0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/New-4      0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/Sum224     0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/Sum224-2   0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/Sum224-4   0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/Sum256     0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/Sum256-2   0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/Sum256-4   0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/New            0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/New-2          0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/New-4          0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/Sum224         0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/Sum224-2       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/Sum224-4       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/Sum256         0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/Sum256-2       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/Sum256-4       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/New            0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/New-2          0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/New-4          0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/Sum224         0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/Sum224-2       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/Sum224-4       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/Sum256         0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/Sum256-2       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/Sum256-4       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash256K/New          0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash256K/New-2        0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash256K/New-4        0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash256K/Sum224       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash256K/Sum224-2     0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash256K/Sum224-4     0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash256K/Sum256       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash256K/Sum256-2     0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash256K/Sum256-4     0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1M/New            0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1M/New-2          0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1M/New-4          0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1M/Sum224         0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1M/Sum224-2       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1M/Sum224-4       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1M/Sum256         0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1M/Sum256-2       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1M/Sum256-4       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
geomean                          ²               +0.00%               ²
¹ all samples are equal
² summaries must be >0 to compute geomean

Change-Id: I705f024221690532b2e891ab8e508d07eefe295b
Reviewed-on: https://go-review.googlesource.com/c/go/+/711843
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>
2025-11-25 11:14:27 -08:00
胡玮文
1cc1337f0a internal/runtime/cgroup: allow more tests to run on all OSes
Move non-Linux specific part out of _linux.go. The parsing code itself
doesn't depend anything Linux specific, even if it the format is Linux
specific.

This should benefit developers working on non-Linux OSes.

Change-Id: I1692978d583c3dd9a57ff269c97e8fca53a7a057
Reviewed-on: https://go-review.googlesource.com/c/go/+/723240
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Carrillo Rodriguez <carrillorodriguez672@gmail.com>
2025-11-25 10:51:12 -08:00
kmvijay
6e4a0d8e44 crypto/internal/fips140/bigmod: vector implementation of addMulVVWx on s390x
addMulVVWx assembly routine is used to multiply bignum multiplicand with a 64-bit multiplier.
The new implementation for s390x architecture uses an algorithm based on vector instructions,
with a significant performance improvement.

Note: z13 is the minimum architecture for Go, which already has VX support.

The performance improvement is as below:

goos: linux
goarch: s390x
pkg: crypto/internal/fips140/bigmod
                  Orig.txt       Vector_Patch.txt
                   sec/op             sec/op          vs base
ModAdd          164.1n ± 0%   159.7n ± 0%      -2.7% (p=0.000 n=10)
ModSub          152.3n ± 1%   147.3n ± 0%      -3.25 (p=0.000 n=10)
MontgomeryRepr  4.806µ ± 3% 1.829µ ± 0%    -61.94% (p=0.000 n=10)
MontgomeryMul   4.812µ ± 5% 1.834µ ± 0%    -61.90% (p=0.000 n=10)
ModMul          9.646µ ± 3% 3.698µ ± 0%    -61.67% (p=0.000 n=10)
ExpBig          11.28m ± 0%   11.28m ± 0%      +0.04 (p=0.035 n=10)
Exp             12.284m ± 5%  5.004m ± 1%    -59.26  (p=0.000 n=10)
geomean         18.61µ        10.74µ         -42.2

Change-Id: I679944c9dac9f43f1626b018f72efa6da0d2442d
Cq-Include-Trybots: luci.golang.try:gotip-linux-s390x
Reviewed-on: https://go-review.googlesource.com/c/go/+/716480
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Vishwanatha HD <vishwanatha.hd@ibm.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Srinivas Pokala <Pokala.Srinivas@ibm.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-25 10:46:14 -08:00
José Joaquín Atria
657b331ff5 net/url: fix example of Values.Encode
Calling url.Values.Encode generates a query string with the
values sorted by key. However, in the example in the documentation
this behaviour is not reflected. This change corrects this.

Change-Id: Id95a5d79b57dc20c3bff1f0c6975c76dcd8412b1
Reviewed-on: https://go-review.googlesource.com/c/go/+/723960
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Florian Lehner <lehner.florian86@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Sean Liao <sean@liao.dev>
2025-11-25 10:41:33 -08:00
Tom Thorogood
bd9222b525 crypto/sha3: reduce cSHAKE allocations
Consider a hypothetical SumCSHAKE256 function:

	func SumCSHAKE256(N, S, data []byte, length int) []byte {
		out := make([]byte, 64)
		return sumCSHAKE256(out, N, S, data, length)
	}

	func sumCSHAKE256(out, N, S, data []byte, length int) []byte {
		if len(out) < length {
			out = make([]byte, length)
		} else {
			out = out[:length]
		}
		h := sha3.NewCSHAKE256(N, S)
		h.Write(data)
		h.Read(out)
		return out
	}

Currently this has 4 allocations:
- one for out (unless stack allocated),
- one for the SHAKE result of crypto/internal/fips140/sha3.newCShake,
- one for the initBlock allocation in crypto/internal/fips140/sha3.newCShake,
- one for the result of crypto/internal/fips140/sha3.bytepad.

We eliminate the SHAKE allocation by outlining the SHAKE allocation in
crypto/internal/fips140/sha3.NewCSHAKE128 and NewCSHAKE256. As
crypto/sha3.NewCSHAKE128 and NewCSHAKE256 immediately de-reference this
result, this allocation is eliminated.

We eliminate the bytepad allocation by instead writing the various
values directly with SHAKE.Write. Values passed to Write don't escape
and, with the exception of data (which is initBlock), all our Writes are
of fixed size allocations. We can't simply modify bytepad to return a
fixed size byte-slice as the length of data is not constant nor does it
have a reasonable upper bound.

We're stuck with the initBlock allocation because of the API (Reset and
the various marshallers), but we still net a substantial improvement.

benchstat output using the following benchmark:

        func BenchmarkSumCSHAKE256(b *testing.B) {
                N := []byte("N")
                S := []byte("S")
                data := []byte("testdata")

                b.SetBytes(64)

                for b.Loop() {
                        SumCSHAKE256(N, S, data, 64)
                }
        }

name             old time/op    new time/op    delta
SumCSHAKE256-12    1.09µs ±20%    0.79µs ± 1%  -27.41%  (p=0.000 n=10+9)

name             old speed      new speed      delta
SumCSHAKE256-12  59.8MB/s ±18%  81.0MB/s ± 1%  +35.33%  (p=0.000 n=10+9)

name             old alloc/op   new alloc/op   delta
SumCSHAKE256-12      536B ± 0%       88B ± 0%  -83.58%  (p=0.000 n=10+10)

name             old allocs/op  new allocs/op  delta
SumCSHAKE256-12      4.00 ± 0%      2.00 ± 0%  -50.00%  (p=0.000 n=10+10)

Updates #69982

Change-Id: If426ea8127c58f5ef062cf74712ec70fd26a7372
Reviewed-on: https://go-review.googlesource.com/c/go/+/636255
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
2025-11-25 10:36:14 -08:00
Filippo Valsorda
e3088d6eb8 crypto/hpke: expose crypto/internal/hpke
Fixes #75300

Change-Id: I6a83e0d040dba3366819d2afff704f886a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/723560
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
TryBot-Bypass: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
2025-11-25 10:35:07 -08:00
Filippo Valsorda
a5ebc6b67c crypto/ecdsa: clean up ECDSA parsing and serialization paths
Check for invalid encodings and keys more systematically in
ParseRawPrivateKey/PrivateKey.Bytes,
ParseUncompressedPublicKey/PublicKey.Bytes, and
fips140/ecdsa.NewPrivateKey/NewPublicKey.

Also, use these functions throughout the codebase.

This should not change any observable behavior, because there were
multiple layers of checks and every path would hit at least one.

Change-Id: I6a6a46566c95de871a5a37996835a0e51495f1d8
Reviewed-on: https://go-review.googlesource.com/c/go/+/724000
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-11-25 10:29:31 -08:00
Quentin Quaadgras
e8fdfeb72b reflect: add iterator equivalents for NumField, NumIn, NumOut and NumMethod
The new methods are Type.Fields, Type.Methods, Type.Ins, Type.Outs,
Value.Fields and Value.Methods.

These methods have been introduced into the reflect package (as well
as tests) replacing three-clause for loops where possible.

Fixes #66631

Change-Id: Iab346e52c0eadd7817afae96d9ef73a35db65fd2
GitHub-Last-Rev: 8768ef71b9
GitHub-Pull-Request: golang/go#75646
Reviewed-on: https://go-review.googlesource.com/c/go/+/707356
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
2025-11-25 09:18:42 -08:00
Roland Shoemaker
12d437c09a crypto/x509: sub-quadratic name constraint checking
Previously, we implemented ~quadratic name constraint checking, wherein
we would check every SAN against every respective constraint in the
chain. This is the technique _basically everyone_ implements, because
it's easy, but it requires also capping the total number of constraint
checking operations to prevent denial of service.

Instead, this change implements a log-linear checking technique, as
originally described by davidben@google.com with some minor
modifications. The comment at the top of crypto/x509/constraints.go
describes this technique in detail.

This technique is faster than the existing quadratic approach in all but
one specific case, where there are a large number of constraints but
only a single name, since our previous algorithm resolves to linear in
that case.

Change-Id: Icb761f5f9898c04e266c0d0c2b07ab2637f03418
Reviewed-on: https://go-review.googlesource.com/c/go/+/711421
Reviewed-by: Nicholas Husin <nsh@golang.org>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Roland Shoemaker <roland@golang.org>
Reviewed-by: Nicholas Husin <husin@google.com>
2025-11-25 08:54:23 -08:00
Roland Shoemaker
ed4deb157e crypto/x509: cleanup name constraint tests
Make TestConstraintCases a bit clearer by adding actual subtest names,
mostly taken from the old comments. Also add a handful of extra test
cases.

Change-Id: Ie759d1ea85a353aeacab267bb6e175a90f20702c
Reviewed-on: https://go-review.googlesource.com/c/go/+/722481
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Auto-Submit: Roland Shoemaker <roland@golang.org>
Reviewed-by: Nicholas Husin <husin@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Nicholas Husin <nsh@golang.org>
2025-11-25 08:53:09 -08:00
Andrey Pshenkin
0d2baa808c crypto/rsa: add EncryptOAEPWithOptions
Co-authored-by: Filippo Valsorda <filippo@golang.org>
Change-Id: I78968794d609a7b343e5affc141d8ba96a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/722260
Reviewed-by: Roland Shoemaker <roland@golang.org>
TryBot-Bypass: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
2025-11-25 08:22:22 -08:00
guoguangwu
09e377b599 internal/poll: replace t.Sub(time.Now()) with time.Until in test
Change-Id: Ia383d4d322008901cd1e57b05fb522db44076fa2
GitHub-Last-Rev: 5c7cbeb737
GitHub-Pull-Request: golang/go#66375
Reviewed-on: https://go-review.googlesource.com/c/go/+/572178
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Sean Liao <sean@liao.dev>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Sean Liao <sean@liao.dev>
2025-11-25 08:02:14 -08:00
Daniel McCarney
4fb7e083a8 crypto/tls: expose HelloRetryRequest state
This commit adds fields to the ClientHelloInfo and ConnectionState
structures to represent hello retry request state information.

ClientHelloInfo gains a new HelloRetryRequest bool field that indicates
if the client hello was sent in response to a TLS 1.3 hello retry
request message previously emitted by the server.

ConnectionState gains a new HelloRetryRequest bool field that indicates
(depending on the connection role) whether the client received a TLS 1.3
hello retry request message from the server, or whether the server sent
such a message to a client.

Fixes #74425

Change-Id: Ic1a5290b8a4ba1568da1d2c2cf9f148150955fa5
Reviewed-on: https://go-review.googlesource.com/c/go/+/717440
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Daniel McCarney <daniel@binaryparadox.net>
2025-11-25 07:40:46 -08:00
Sean Liao
31d373534e doc: pre-announce removal of 1.23 and earlier crypto GODEBUGs
For #75316

Change-Id: Ife391b8c3e7fd2fec0e53b296d47b4756a787001
Reviewed-on: https://go-review.googlesource.com/c/go/+/723100
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-11-24 23:09:37 -08:00
Sean Liao
aa093eed83 crypto/fips140: add Version
Fixes #75301

Change-Id: If953b4382499570d5437491036f91cbe4fec7c01
Reviewed-on: https://go-review.googlesource.com/c/go/+/723101
Reviewed-by: Roland Shoemaker <roland@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>
2025-11-24 23:09:27 -08:00
Ian Alexander
1dc1505d4a cmd/go/internal/modfetch: rename State to Fetcher
This change renames the type State to Fetcher to better reflect its
purpose.  The global variable ModuleFetchState is also renamed to
Fetcher_, which will continue to be gradually eliminated as with all
global state in the modfetch package.

[git-generate]
cd src/cmd/go/internal/modfetch
rf '
  mv State Fetcher
  mv ModuleFetchState Fetcher_
  mv NewState NewFetcher

  mv Fetcher.GoSumFile GoSumFile
  mv GoSumFile.s GoSumFile.f
  mv GoSumFile Fetcher.GoSumFile

  mv Fetcher.SetGoSumFile SetGoSumFile
  mv SetGoSumFile.s SetGoSumFile.f
  mv SetGoSumFile Fetcher.SetGoSumFile

  mv Fetcher.AddWorkspaceGoSumFile AddWorkspaceGoSumFile
  mv AddWorkspaceGoSumFile.s AddWorkspaceGoSumFile.f
  mv AddWorkspaceGoSumFile Fetcher.AddWorkspaceGoSumFile
'
rf '
  add NewFetcher:+0 f := new(Fetcher) \
  f.lookupCache = new(par.Cache[lookupCacheKey, Repo]) \
  f.downloadCache = new(par.ErrCache[module.Version, string]) \
  return f
'
rf 'rm NewFetcher:+5,8'
cd ../modload
rf '
  mv State.modfetchState State.fetcher
'

Change-Id: I7cb6c945ea0f1d2119e1615064f041e88c81c689
Reviewed-on: https://go-review.googlesource.com/c/go/+/721740
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
2025-11-24 20:44:29 -08:00
Ian Alexander
d3e11b3f90 cmd/go/internal/modload: make State.modfetchState a pointer
This change aligns modfetch.State with modload.State by using pointer
parameters and receivers.

[git-generate]
cd src/cmd/go/internal/modload
sed -i '
  s/oldState/old/
  s/old := State{/old = \&State{/
  s/func (s \*State) setState(new State) State {/func (s *State) setState(new *State) (old *State) {/
  s/setState(State{})/setState(NewState())/
' init.go
cd ../modfetch
sed -i '
  s/oldState = State{/oldState = \&State{/
  s/func SetState(newState State) (oldState State) {/func SetState(newState *State) (oldState *State) {/
  s/SetState(State{})/SetState(NewState())/
' fetch.go
cd ../modload
sed -i '
  s/old.modfetchState = modfetch.SetState(new.modfetchState)/_ = modfetch.SetState(\&new.modfetchState)/
' init.go
rf '
  #
  # Prepare to swap the existing modfetchState field for a pointer type
  #
  mv State.modfetchState State.modfetchState_
  add State:/modfetchState_/+0 modfetchState *modfetch.State
  #
  # Update State.setState to set & restore additional values
  #
  add State.setState:/s\.requirements,/+0 workFilePath: s.workFilePath,
  add State.setState:/s\.workFilePath,/+0 modfetchState: s.modfetchState,
  #
  # Swap the existing modfetchState field for a pointer type
  #
  add init.go:/.* = modfetch.SetState\(.*\)/-0 s.modfetchState = new.modfetchState
  add init.go:/.* = modfetch.SetState\(.*\)/-0 old.modfetchState = modfetch.SetState(s.modfetchState) // TODO(jitsu): remove after completing global state elimination
  rm init.go:/_ = modfetch.SetState\(.*\)/
  rm State.modfetchState_
'
sed -i '
  s/return &State{}/s := new(State)\ns.modfetchState = modfetch.NewState()\nreturn s/
' init.go
go fmt

Change-Id: I0602ecf976fd3ee93844e77989291d729ad71595
Reviewed-on: https://go-review.googlesource.com/c/go/+/720900
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
2025-11-24 20:43:56 -08:00
Ian Alexander
2f7fd5714f cmd/go: add setters for critical State fields
This commit unexports critical State fields and provides setter
methods to update their values.

[git-generate]
cd src/cmd/go/internal/modfetch
rf '
  add fetch.go:490 var jitsu int = 0 // rf marker
  mv State.GoSumFile State.GoSumFile_
  mv State.WorkspaceGoSumFiles State.WorkspaceGoSumFiles_
  add jitsu \
    func (s *State) GoSumFile() string { \
      return ""
    } \
    \
    func (s *State) SetGoSumFile(str string) { \
    } \
    \
    func (s *State) AddWorkspaceGoSumFile(file string) { \
        s.WorkspaceGoSumFiles_ = append(s.WorkspaceGoSumFiles_, file) \
    }
    \

  ex {
    var s *State
    var x string
    s.GoSumFile_ = x -> s.SetGoSumFile(x)
  }

  rm jitsu
'

cd ../modload
sed -i '
  s/modfetch.ModuleFetchState.WorkspaceGoSumFiles_ = append(modfetch.ModuleFetchState.WorkspaceGoSumFiles_, sumFile)/modfetch.ModuleFetchState.AddWorkspaceGoSumFile(sumFile)/
' init.go

for dir in modcmd modload ; do
 cd ../${dir}
 rf '
   ex {
     import "cmd/go/internal/modfetch"
     var s *modfetch.State
     var x string
     s.GoSumFile_ = x -> s.SetGoSumFile(x)
   }
 '
done

cd ../modfetch
rf '
 mv State.GoSumFile_ State.goSumFile
 mv State.WorkspaceGoSumFiles_ State.workspaceGoSumFiles
 add State.GoSumFile: return s.goSumFile
 rm State.GoSumFile://+1
 add State.SetGoSumFile: s.goSumFile = str
'

Change-Id: Iff694aad7ad1cc62d2096c210dbaa3cce2b4061d
Reviewed-on: https://go-review.googlesource.com/c/go/+/720840
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-24 20:43:38 -08:00
David Finkel
6851795fb6 runtime: add GODEBUG=tracebacklabels=1 to include pprof labels in tracebacks
Copy LabelSet to an internal package as label.Set, and include (escaped)
labels within goroutine stack dumps.

Labels are added to the goroutine header as quoted key:value pairs, so
the line may get long if there are a lot of labels.

To handle escaping, we add a printescaped function to the
runtime and hook it up to the print function in the compiler with a new
runtime.quoted type that's a sibling to runtime.hex. (in fact, we
leverage some of the machinery from printhex to generate escape
sequences).

The escaping can be improved for printable runes outside basic ASCII
(particularly for languages using non-latin stripts). Additionally,
invalid UTF-8 can be improved.

So we can experiment with the output format make this opt-in via a
a new tracebacklabels GODEBUG var.

Updates #23458
Updates #76349

Change-Id: I08e78a40c55839a809236fff593ef2090c13c036
Reviewed-on: https://go-review.googlesource.com/c/go/+/694119
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
2025-11-24 20:07:56 -08:00
Damien Neil
0921e1db83 net/http: add Transport.NewClientConn
For #75772

Change-Id: Iad7607b40636bab1faf8653455e92e9700309003
Reviewed-on: https://go-review.googlesource.com/c/go/+/722223
Reviewed-by: Nicholas Husin <nsh@golang.org>
Reviewed-by: Nicholas Husin <husin@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-24 17:26:36 -08:00
Damien Neil
6465818435 all: update to x/net@bff14c5256
This brings in CL 722200 which adds necessary HTTP/2 support for
net/http.Transport.NewClientConn.

For #75772

Change-Id: I5489232401096982ed21002f293dd0f87fe2fba6
Reviewed-on: https://go-review.googlesource.com/c/go/+/723901
Reviewed-by: Nicholas Husin <nsh@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Nicholas Husin <husin@google.com>
2025-11-24 17:25:21 -08:00
Damien Neil
1a53ce9734 context: don't return the wrong error when Cause races cancellation
Check to see if a context is canceled at all
before checking for the cancellaion cause.
If we can't find a cause, use the original error.

Avoids a data race where we look for a cause,
find none (because the context is not canceled),
the context is canceled,
and we then return ctx.Err() (even though there is now a cause).

Fixes #73390

Change-Id: I97f44aef25c6b02871d987970abfb4c215c5c80e
Reviewed-on: https://go-review.googlesource.com/c/go/+/679835
Reviewed-by: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-11-24 17:02:35 -08:00
Filippo Valsorda
c6f882f6c5 crypto/x509: add ExtKeyUsage.String and KeyUsage.String methods
Fixes #56866

Change-Id: Icc8f067820f5d74e0d5073bce160429e6a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/723360
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Roland Shoemaker <roland@golang.org>
2025-11-24 16:19:47 -08:00
Daniel McCarney
97d5295f6f crypto/internal/fips140test: add ML-DSA coverage
This commit integrates ML-DSA ACVP test coverage, describing the
capabilities of the crypto/internal/fips140/mldsa package and
adding the required command handlers to our ACVP module wrapper.

Change-Id: I2aee6f169752a6c6fec3a68591dde33e4f308081
Reviewed-on: https://go-review.googlesource.com/c/go/+/719703
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Auto-Submit: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
2025-11-24 16:19:41 -08:00
David Chase
62cd044a79 cmd/compile: add cases for StringLen to prove
Tricky index-offset logic had been added for slices,
but not for strings.  This fixes that, and also adds
tests for same behavior in string/slice cases, and adds
a new test for code in prove that had been added but not
explicitly tested.

Fixes #76270.

Change-Id: Ibd92b89e944d86b7f30b4486a9008e6f1ac6af7d
Reviewed-on: https://go-review.googlesource.com/c/go/+/723980
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2025-11-24 15:49:12 -08:00
Jes Cok
f1e376f342 cmd/go/internal/auth: fix typo
Change-Id: Ic113d59144aa2d37c8988559fbc086f5c29c0b69
GitHub-Last-Rev: e2623be0a0
GitHub-Pull-Request: golang/go#76397
Reviewed-on: https://go-review.googlesource.com/c/go/+/722861
Reviewed-by: Michael Matloob <matloob@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-24 15:15:19 -08:00
Cherry Mui
1265ebfe27 [dev.simd] internal/buildcfg: turn GOEXPERIMENT=simd back on
Turn the experiment back on by default on the dev.simd branch, for
the ease of experimenting and development.

Change-Id: I5f7e945d55d9d2163e2730b15aea471270599550
Reviewed-on: https://go-review.googlesource.com/c/go/+/723942
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-24 14:13:57 -08:00
Michael Anthony Knyszek
7fbd141de5 runtime: use m.profStack in traceStack
Turns out we spend a few percent of the trace event writing path in just
zero-initializing the stack space for pcBuf. We don't need zero
initialization, since we're going to write over whatever we actually
use. Use m.profStack instead, which is already sized correctly.

A side-effect of this change is that trace stacks now obey the GODEBUG
profstackdepth where they previously ignored it. The name clearly
doesn't match, but this is a positive: there's no reason the maximum
stack depth shouldn't apply to every diagnostic.

Change-Id: Ia654d3d708f15cbb2e1d95af196ae10b07a65df2
Reviewed-on: https://go-review.googlesource.com/c/go/+/723062
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>
2025-11-24 13:20:13 -08:00
Michael Anthony Knyszek
0bc192368a runtime: don't write unique string to trace if it's length zero
While we're here, document that ID 0 is implicitly assigned to an empty
set of data for both stacks and strings.

Change-Id: Ic52ff3a1132abc5a8f6f6c4e4357e31e6e7799fc
Reviewed-on: https://go-review.googlesource.com/c/go/+/723061
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>
2025-11-24 13:20:09 -08:00
Cherry Mui
d4f5650cc5 all: REVERSE MERGE dev.simd (7d65463) into master
This commit is a REVERSE MERGE.
It merges dev.simd back into its parent branch, master.
The development of simd will continue on (only) dev.simd,
and it will be merged to the master branch when necessary.

Merge List:

+ 2025-11-24 7d65463a54 [dev.simd] all: merge master (e704b09) into dev.simd
+ 2025-11-24 afd1721fc5 [dev.simd] all: merge master (02d1f3a) into dev.simd
+ 2025-11-24 a9914886da [dev.simd] internal/buildcfg: don't enable SIMD experiment by default
+ 2025-11-24 61a5a6b016 [dev.simd] simd: add goexperiment tag to generate.go
+ 2025-11-24 f045ed4110 [dev.simd] go/doc/comment: don't include experimental packages in std list
+ 2025-11-24 220d73cc44 [dev.simd] all: merge master (8dd5b13) into dev.simd
+ 2025-11-24 0c69e77343 Revert "[dev.simd] internal/runtime/gc: add simd package based greentea kernels"
+ 2025-11-21 da92168ec8 [dev.simd] internal/runtime/gc: add simd package based greentea kernels
+ 2025-11-21 3fdd183aef [dev.simd] cmd/compile, simd: update conversion API names
+ 2025-11-21 d3a0321dba [dev.simd] cmd/compile: fix incorrect mapping of SHA256MSG2128
+ 2025-11-20 74ebdd28d1 [dev.simd] simd, cmd/compile: add more element types for Select128FromPair
+ 2025-11-20 4d26d66a49 [dev.simd] simd: fix signatures for PermuteConstant* methods
+ 2025-11-20 e3d4645693 [dev.simd] all: merge master (ca37d24) into dev.simd
+ 2025-11-20 95b4ad525f [dev.simd] simd: reorganize internal tests so that simd does not import testing
+ 2025-11-18 3fe246ae0f [dev.simd] simd: make 'go generate' generate everything
+ 2025-11-18 cf45adf140 [dev.simd] simd: move template code generator into _gen
+ 2025-11-18 19b4a30899 [dev.simd] simd/_gen/simdgen: remove outdated asm.yaml.toy
+ 2025-11-18 9461db5c59 [dev.simd] simd: fix comment in file generator
+ 2025-11-18 4004ff3523 [dev.simd] simd: remove FlattenedTranspose from exports
+ 2025-11-18 896f293a25 [dev.simd] cmd/compile, simd: change DotProductQuadruple and add peepholes
+ 2025-11-18 be9c50c6a0 [dev.simd] cmd/compile, simd: change SHA ops names and types
+ 2025-11-17 0978935a99 [dev.simd] cmd/compile, simd: change AES op names and add missing size
+ 2025-11-17 95871e4a00 [dev.simd] cmd/compile, simd: add VPALIGNR
+ 2025-11-17 934dbcea1a [dev.simd] simd: update CPU feature APIs
+ 2025-11-17 e4d9484220 [dev.simd] cmd/compile: fix unstable output
+ 2025-11-13 d7a0c45642 [dev.simd] all: merge master (57362e9) into dev.simd
+ 2025-11-11 86b4fe31d9 [dev.simd] cmd/compile: add masked merging ops and optimizations
+ 2025-11-10 771a1dc216 [dev.simd] cmd/compile: add peepholes for all masked ops and bug fixes
+ 2025-11-10 972732b245 [dev.simd] simd, cmd/compile: remove move from API
+ 2025-11-10 bf77323efa [dev.simd] simd: put unexported methods to another file
+ 2025-11-04 fe040658b2 [dev.simd] simd/_gen: fix sorting ops slices
+ 2025-10-29 e452f4ac7d [dev.simd] cmd/compile: enhance inlining for closure-of-SIMD
+ 2025-10-27 ca1264ac50 [dev.simd] test: add some trickier cases to ternary-boolean simd test
+ 2025-10-24 f6b4711095 [dev.simd] cmd/compile, simd: add rewrite to convert logical expression trees into TERNLOG instructions
+ 2025-10-24 cf7c1a4cbb [dev.simd] cmd/compile, simd: add SHA features
+ 2025-10-24 2b8eded4f4 [dev.simd] simd/_gen: parse SHA features from XED
+ 2025-10-24 c75965b666 [dev.simd] simd: added String() method to SIMD vectors.
+ 2025-10-22 d03634f807 [dev.simd] cmd/compile, simd: add definitions for VPTERNLOG[DQ]
+ 2025-10-20 20b3339542 [dev.simd] simd: add AES feature check
+ 2025-10-14 fc3bc49337 [dev.simd] simd: clean up mask load comments
+ 2025-10-14 416332dba2 [dev.simd] cmd/compile, simd: update DotProd to DotProduct
+ 2025-10-14 647c790143 [dev.simd] cmd/compile: peephole simd mask load/stores from bits
+ 2025-10-14 2e71cf1a2a [dev.simd] cmd/compile, simd: remove mask load and stores
+ 2025-10-13 c4fbf3b4cf [dev.simd] simd/_gen: add mem peephole with feat mismatches
+ 2025-10-13 ba72ee0f30 [dev.simd] cmd/compile: more support for cpufeatures
+ 2025-10-09 be57d94c4c [dev.simd] simd: add emulated Not method
+ 2025-10-07 d2270bccbd [dev.simd] cmd/compile: track which CPU features are in scope
+ 2025-10-03 48756abd3a [dev.simd] cmd/compile: inliner tweaks to favor simd-handling functions
+ 2025-10-03 fb1749a3fe [dev.simd] all: merge master (adce7f1) into dev.simd
+ 2025-09-30 703a5fbaad [dev.simd] cmd/compile, simd: add AES instructions
+ 2025-09-29 1c961c2fb2 [dev.simd] simd: use new data movement instructions to do "fast" transposes
+ 2025-09-26 fe4af1c067 [dev.simd] simd: repair broken comments in generated ops_amd64.go
+ 2025-09-26 ea3b2ecd28 [dev.simd] cmd/compile, simd: add 64-bit select-from-pair methods
+ 2025-09-26 25c36b95d1 [dev.simd] simd, cmd/compile: add 128 bit select-from-pair
+ 2025-09-26 f0e281e693 [dev.simd] cmd/compile: don't require single use for SIMD load/store folding
+ 2025-09-26 b4d1e018a8 [dev.simd] cmd/compile: remove unnecessary code from early simd prototype
+ 2025-09-26 578777bf7c [dev.simd] cmd/compile: make condtion of CanSSA smarter for SIMD fields
+ 2025-09-26 c28b2a0ca1 [dev.simd] simd: generalize select-float32-from-pair
+ 2025-09-25 a693ae1e9a [dev.simd] all: merge master (d70ad4e) into dev.simd
+ 2025-09-25 5a78e1a4a1 [dev.simd] simd, cmd/compile: mark simd vectors uncomparable
+ 2025-09-23 bf00f5dfd6 [dev.simd] simd, cmd/compile: added simd methods for VSHUFP[DS]
+ 2025-09-23 8e60feeb41 [dev.simd] cmd/compile: improve slicemask removal
+ 2025-09-23 2b50ffe172 [dev.simd] cmd/compile: remove stores to unread parameters
+ 2025-09-23 2d8cb80d7c [dev.simd] all: merge master (9b2d39b) into dev.simd
+ 2025-09-22 63a09d6d3d [dev.simd] cmd/compile: fix SIMD const rematerialization condition
+ 2025-09-20 2ca96d218d [dev.simd] cmd/compile: enhance prove to infer bounds in slice len/cap calculations
+ 2025-09-19 c0f031fcc3 [dev.simd] cmd/compile: spill the correct SIMD register for morestack
+ 2025-09-19 58fa1d023e [dev.simd] cmd/compile: enhance the chunked indexing case to include reslicing
+ 2025-09-18 7ae0eb2e80 [dev.simd] cmd/compile: remove Add32x4 generic op
+ 2025-09-18 31b664d40b [dev.simd] cmd/compile: widen index for simd intrinsics jumptable
+ 2025-09-18 e34ad6de42 [dev.simd] cmd/compile: optimize VPTEST for 2-operand cases
+ 2025-09-18 f1e3651c33 [dev.simd] cmd/compile, simd: add VPTEST
+ 2025-09-18 d9751166a6 [dev.simd] cmd/compile: handle rematerialized op for incompatible reg constraint
+ 2025-09-18 4eb5c6e07b [dev.simd] cmd/compile, simd/_gen: add rewrite for const load ops
+ 2025-09-18 443b7aeddb [dev.simd] cmd/compile, simd/_gen: make rewrite rules consistent on CPU Features
+ 2025-09-16 bdd30e25ca [dev.simd] all: merge master (ca0e035) into dev.simd
+ 2025-09-16 0e590a505d [dev.simd] cmd/compile: use the right type for spill slot
+ 2025-09-15 dabe2bb4fb [dev.simd] cmd/compile: fix holes in mask peepholes
+ 2025-09-12 3ec0b25ab7 [dev.simd] cmd/compile, simd/_gen/simdgen: add const load mops
+ 2025-09-12 1e5631d4e0 [dev.simd] cmd/compile: peephole simd load
+ 2025-09-11 48f366d826 [dev.simd] cmd/compile: add memop peephole rules
+ 2025-09-11 9a349f8e72 [dev.simd] all: merge master (cf5e993) into dev.simd
+ 2025-09-11 5a0446d449 [dev.simd] simd/_gen/simdgen, cmd/compile: add memory op machine ops
+ 2025-09-08 c39b2fdd1e [dev.simd] cmd/compile, simd: add VPLZCNT[DQ]
+ 2025-09-07 832c1f76dc [dev.simd] cmd/compile: enhance prove to deal with double-offset IsInBounds checks
+ 2025-09-06 0b323350a5 [dev.simd] simd/_gen/simdgen: merge memory ops
+ 2025-09-06 f42c9261d3 [dev.simd] simd/_gen/simdgen: parse memory operands
+ 2025-09-05 356c48d8e9 [dev.simd] cmd/compile, simd: add ClearAVXUpperBits
+ 2025-09-03 7c8b9115bc [dev.simd] all: merge master (4c4cefc) into dev.simd
+ 2025-09-02 9125351583 [dev.simd] internal/cpu: report AVX1 and 2 as supported on macOS 15 Rosetta 2
+ 2025-09-02 b509516b2e [dev.simd] simd, cmd/compile: add Interleave{Hi,Lo} (VPUNPCK*)
+ 2025-09-02 6890aa2e20 [dev.simd] cmd/compile: add instructions and rewrites for scalar-> vector moves
+ 2025-08-24 5ebe2d05d5 [dev.simd] simd: correct SumAbsDiff documentation
+ 2025-08-22 a5137ec92a [dev.simd] cmd/compile: sample peephole optimization for SIMD broadcast
+ 2025-08-22 83714616aa [dev.simd] cmd/compile: remove VPADDD4
+ 2025-08-22 4a3ea146ae [dev.simd] cmd/compile: correct register mask of some AVX512 ops
+ 2025-08-22 8d874834f1 [dev.simd] cmd/compile: use X15 for zero value in AVX context
+ 2025-08-22 4c311aa38f [dev.simd] cmd/compile: ensure the whole X15 register is zeroed
+ 2025-08-22 baea0c700b [dev.simd] cmd/compile, simd: complete AVX2? u?int shuffles
+ 2025-08-22 fa1e78c9ad [dev.simd] cmd/compile, simd: make Permute 128-bit use AVX VPSHUFB
+ 2025-08-22 bc217d4170 [dev.simd] cmd/compile, simd: add packed saturated u?int conversions
+ 2025-08-22 4fa23b0d29 [dev.simd] cmd/compile, simd: add saturated u?int conversions
+ 2025-08-21 3f6bab5791 [dev.simd] simd: move tests to a subdirectory to declutter "simd"
+ 2025-08-21 aea0a5e8d7 [dev.simd] simd/_gen/unify: improve envSet doc comment
+ 2025-08-21 7fdb1da6b0 [dev.simd] cmd/compile, simd: complete truncating u?int conversions.
+ 2025-08-21 f4c41d9922 [dev.simd] cmd/compile, simd: complete u?int widening conversions
+ 2025-08-21 6af8881adb [dev.simd] simd: reorganize cvt rules
+ 2025-08-21 58cfc2a5f6 [dev.simd] cmd/compile, simd: add VPSADBW
+ 2025-08-21 f7c6fa709e [dev.simd] simd/_gen/unify: fix some missing environments
+ 2025-08-20 7c84e984e6 [dev.simd] cmd/compile: rewrite to elide Slicemask from len==c>0 slicing
+ 2025-08-20 cf31b15635 [dev.simd] simd, cmd/compile: added .Masked() peephole opt for many operations.
+ 2025-08-20 1334285862 [dev.simd] simd: template field name cleanup in genfiles
+ 2025-08-20 af6475df73 [dev.simd] simd: add testing hooks for size-changing conversions
+ 2025-08-20 ede64cf0d8 [dev.simd] simd, cmd/compile: sample peephole optimization for .Masked()
+ 2025-08-20 103b6e39ca [dev.simd] all: merge master (9de69f6) into dev.simd
+ 2025-08-20 728ac3e050 [dev.simd] simd: tweaks to improve test disassembly
+ 2025-08-20 4fce49b86c [dev.simd] simd, cmd/compile: add widening unsigned converts 8->16->32
+ 2025-08-19 0f660d675f [dev.simd] simd: make OpMasked machine ops only
+ 2025-08-19 a034826e26 [dev.simd] simd, cmd/compile: implement ToMask, unexport asMask.
+ 2025-08-18 8ccd6c2034 [dev.simd] simd, cmd/compile: mark BLEND instructions as not-zero-mask
+ 2025-08-18 9a934d5080 [dev.simd] cmd/compile, simd: added methods for "float" GetElem
+ 2025-08-15 7380213a4e [dev.simd] cmd/compile: make move/load/store dependent only on reg and width
+ 2025-08-15 908e3e8166 [dev.simd] cmd/compile: make (most) move/load/store lowering use reg and width only
+ 2025-08-14 9783f86bc8 [dev.simd] cmd/compile: accounts rematerialize ops's output reginfo
+ 2025-08-14 a4ad41708d [dev.simd] all: merge master (924fe98) into dev.simd
+ 2025-08-13 8b90d48d8c [dev.simd] simd/_gen/simdgen: rewrite etetest.sh
+ 2025-08-13 b7c8698549 [dev.simd] simd/_gen: migrate simdgen from x/arch
+ 2025-08-13 257c1356ec [dev.simd] go/types: exclude simd/_gen module from TestStdlib
+ 2025-08-13 858a8d2276 [dev.simd] simd: reorganize/rename generated emulation files
+ 2025-08-13 2080415aa2 [dev.simd] simd: add emulations for missing AVX2 comparisons
+ 2025-08-13 ddb689c7bb [dev.simd] simd, cmd/compile: generated code for Broadcast
+ 2025-08-13 e001300cf2 [dev.simd] cmd/compile: fix LoadReg so it is aware of register target
+ 2025-08-13 d5dea86993 [dev.simd] cmd/compile: fix isIntrinsic for methods; fix fp <-> gp moves
+ 2025-08-13 08ab8e24a3 [dev.simd] cmd/compile: generated code from 'fix generated rules for shifts'
+ 2025-08-11 702ee2d51e [dev.simd] cmd/compile, simd: update generated files
+ 2025-08-11 e33eb1a7a5 [dev.simd] cmd/compile, simd: update generated files
+ 2025-08-11 667add4f1c [dev.simd] cmd/compile, simd: update generated files
+ 2025-08-11 1755c2909d [dev.simd] cmd/compile, simd: update generated files
+ 2025-08-11 2fd49d8f30 [dev.simd] simd: imm doc improve
+ 2025-08-11 ce0e803ab9 [dev.simd] cmd/compile: keep track of multiple rule file names in ssa/_gen
+ 2025-08-11 38b76bf2a3 [dev.simd] cmd/compile, simd: jump table for imm ops
+ 2025-08-08 94d72355f6 [dev.simd] simd: add emulations for bitwise ops and for mask/merge methods
+ 2025-08-07 8eb5f6020e [dev.simd] cmd/compile, simd: API interface fixes
+ 2025-08-07 b226bcc4a9 [dev.simd] cmd/compile, simd: add value conversion ToBits for mask
+ 2025-08-06 5b0ef7fcdc [dev.simd] cmd/compile, simd: add Expand
+ 2025-08-06 d3cf582f8a [dev.simd] cmd/compile, simd: (Set|Get)(Lo|Hi)
+ 2025-08-05 7ca34599ec [dev.simd] simd, cmd/compile: generated files to add 'blend' and 'blendMasked'
+ 2025-08-05 82d056ddd7 [dev.simd] cmd/compile: add ShiftAll immediate variant
+ 2025-08-04 775fb52745 [dev.simd] all: merge master (7a1679d) into dev.simd
+ 2025-08-04 6b9b59e144 [dev.simd] simd, cmd/compile: rename some methods
+ 2025-08-04 d375b95357 [dev.simd] simd: move lots of slice functions and methods to generated code
+ 2025-08-04 3f92aa1eca [dev.simd] cmd/compile, simd: make bitwise logic ops available to all u?int vectors
+ 2025-08-04 c2d775d401 [dev.simd] cmd/compile, simd: change PairDotProdAccumulate to AddDotProd
+ 2025-08-04 2c25f3e846 [dev.simd] cmd/compile, simd: change Shift*AndFillUpperFrom to Shift*Concat
+ 2025-08-01 c25e5c86b2 [dev.simd] cmd/compile: generated code for K-mask-register slice load/stores
+ 2025-08-01 1ac5f3533f [dev.simd] cmd/compile: opcodes and rules and code generation to enable AVX512 masked loads/stores
+ 2025-08-01 f39711a03d [dev.simd] cmd/compile: test for int-to-mask conversion
+ 2025-08-01 08bec02907 [dev.simd] cmd/compile: add register-to-mask moves, other simd glue
+ 2025-08-01 09ff25e350 [dev.simd] simd: add tests for simd conversions to Int32/Uint32.
+ 2025-08-01 a24ffe3379 [dev.simd] simd: modify test generation to make it more flexible
+ 2025-08-01 ec5c20ba5a [dev.simd] cmd/compile: generated simd code to add some conversions
+ 2025-08-01 e62e377ed6 [dev.simd] cmd/compile, simd: generated code from repaired simdgen sort
+ 2025-08-01 761894d4a5 [dev.simd] simd: add partial slice load/store for 32/64-bits on AVX2
+ 2025-08-01 acc1492b7d [dev.simd] cmd/compile: Generated code for AVX2 SIMD masked load/store
+ 2025-08-01 a0b87a7478 [dev.simd] cmd/compile: changes for AVX2 SIMD masked load/store
+ 2025-08-01 88568519b4 [dev.simd] simd: move test generation into Go repo
+ 2025-07-31 6f7a1164e7 [dev.simd] cmd/compile, simd: support store to bits for mask
+ 2025-07-21 41054cdb1c [dev.simd] simd, internal/cpu: support more AVX CPU Feature checks
+ 2025-07-21 957f06c410 [dev.simd] cmd/compile, simd: support load from bits for mask
+ 2025-07-21 f0e9dc0975 [dev.simd] cmd/compile: fix opLen(2|3)Imm8_2I intrinsic function
+ 2025-07-17 03a3887f31 [dev.simd] simd: clean up masked op doc
+ 2025-07-17 c61743e4f0 [dev.simd] cmd/compile, simd: reorder PairDotProdAccumulate
+ 2025-07-15 ef5f6cc921 [dev.simd] cmd/compile: adjust param order for AndNot
+ 2025-07-15 6d10680141 [dev.simd] cmd/compile, simd: add Compress
+ 2025-07-15 17baae72db [dev.simd] simd: default mask param's name to mask
+ 2025-07-15 01f7f57025 [dev.simd] cmd/compile, simd: add variable Permute
+ 2025-07-14 f5f42753ab [dev.simd] cmd/compile, simd: add VDPPS
+ 2025-07-14 08ffd66ab2 [dev.simd] simd: updates CPU Feature in doc
+ 2025-07-14 3f789721d6 [dev.simd] cmd/compile: mark SIMD types non-fat
+ 2025-07-11 b69622b83e [dev.simd] cmd/compile, simd: adjust Shift.* operations
+ 2025-07-11 4993a91ae1 [dev.simd] simd: change imm param name to constant
+ 2025-07-11 bbb6dccd84 [dev.simd] simd: fix documentations
+ 2025-07-11 1440ff7036 [dev.simd] cmd/compile: exclude simd vars from merge local
+ 2025-07-11 ccb43dcec7 [dev.simd] cmd/compile: add VZEROUPPER and VZEROALL inst
+ 2025-07-11 21596f2f75 [dev.simd] all: merge master (88cf0c5) into dev.simd
+ 2025-07-10 ab7f839280 [dev.simd] cmd/compile: fix maskreg/simdreg chaos
+ 2025-07-09 47b07a87a6 [dev.simd] cmd/compile, simd: fix Int64x2 Greater output type to mask
+ 2025-07-09 08cd62e9f5 [dev.simd] cmd/compile: remove X15 from register mask
+ 2025-07-09 9ea33ed538 [dev.simd] cmd/compile: output of simd generator, more ... rewrite rules
+ 2025-07-09 aab8b173a9 [dev.simd] cmd/compile, simd: Int64x2 Greater and Uint* Equal
+ 2025-07-09 8db7f41674 [dev.simd] cmd/compile: use upper registers for AVX512 simd ops
+ 2025-07-09 574854fd86 [dev.simd] runtime: save Z16-Z31 registers in async preempt
+ 2025-07-09 5429328b0c [dev.simd] cmd/compile: change register mask names for simd ops
+ 2025-07-09 029d7ec3e9 [dev.simd] cmd/compile, simd: rename Masked$OP to $(OP)Masked.
+ 2025-07-09 983e81ce57 [dev.simd] simd: rename stubs_amd64.go to ops_amd64.go
+ 2025-07-08 56ca67682b [dev.simd] cmd/compile, simd: remove FP bitwise logic operations.
+ 2025-07-08 0870ed04a3 [dev.simd] cmd/compile: make compares between NaNs all false.
+ 2025-07-08 24f2b8ae2e [dev.simd] simd: {Int,Uint}{8x{16,32},16x{8,16}} subvector loads/stores from slices.
+ 2025-07-08 2bb45cb8a5 [dev.simd] cmd/compile: minor tweak for race detector
+ 2025-07-07 43a61aef56 [dev.simd] cmd/compile: add EXTRACT[IF]128 instructions
+ 2025-07-07 292db9b676 [dev.simd] cmd/compile: add INSERT[IF]128 instructions
+ 2025-07-07 d8fa853b37 [dev.simd] cmd/compile: make regalloc simd aware on copy
+ 2025-07-07 dfd75f82d4 [dev.simd] cmd/compile: output of simdgen with invariant type order
+ 2025-07-04 72c39ef834 [dev.simd] cmd/compile: fix the "always panic" code to actually panic
+ 2025-07-01 1ee72a15a3 [dev.simd] internal/cpu: add GFNI feature check
+ 2025-06-30 0710cce6eb [dev.simd] runtime: remove write barrier in xRegRestore
+ 2025-06-30 59846af331 [dev.simd] cmd/compile, simd: cleanup operations and documentations
+ 2025-06-30 f849225b3b [dev.simd] all: merge master (740857f) into dev.simd
+ 2025-06-30 9eeb1e7a9a [dev.simd] runtime: save AVX2 and AVX-512 state on asynchronous preemption
+ 2025-06-30 426cf36b4d [dev.simd] runtime: save scalar registers off stack in amd64 async preemption
+ 2025-06-30 ead249a2e2 [dev.simd] cmd/compile: reorder operands for some simd operations
+ 2025-06-30 55665e1e37 [dev.simd] cmd/compile: undoes reorder transform in prior commit, changes names
+ 2025-06-26 10c9621936 [dev.simd] cmd/compile, simd: add galois field operations
+ 2025-06-26 e61ebfce56 [dev.simd] cmd/compile, simd: add shift operations
+ 2025-06-26 35b8cf7fed [dev.simd] cmd/compile: tweak sort order in generator
+ 2025-06-26 7fadfa9638 [dev.simd] cmd/compile: add simd VPEXTRA*
+ 2025-06-26 0d8cb89f5c [dev.simd] cmd/compile: support simd(imm,fp) returns gp
+ 2025-06-25 f4a7c124cc [dev.simd] all: merge master (f8ccda2) into dev.simd
+ 2025-06-25 4fda27c0cc [dev.simd] cmd/compile: glue codes for Shift and Rotate
+ 2025-06-24 61c1183342 [dev.simd] simd: add test wrappers
+ 2025-06-23 e32488003d [dev.simd] cmd/compile: make simd regmask naming more like existing conventions
+ 2025-06-23 1fa4bcfcda [dev.simd] simd, cmd/compile: generated code for VPINSR[BWDQ], and test
+ 2025-06-23 dd63b7aa0e [dev.simd] simd: add AVX512 aggregated check
+ 2025-06-23 0cdb2697d1 [dev.simd] simd: add tests for intrinsic used as a func value and via reflection
+ 2025-06-23 88c013d6ff [dev.simd] cmd/compile: generate function body for bodyless intrinsics
+ 2025-06-20 a8669c78f5 [dev.simd] sync: correct the type of runtime_StoreReluintptr
+ 2025-06-20 7c6ac35275 [dev.simd] cmd/compile: add simdFp1gp1fp1Imm8 helper to amd64 code generation
+ 2025-06-20 4150372a5d [dev.simd] cmd/compile: don't treat devel compiler as a released compiler
+ 2025-06-18 1b87d52549 [dev.simd] cmd/compile: add fp1gp1fp1 register mask for AMD64
+ 2025-06-18 1313521f75 [dev.simd] cmd/compile: remove fused mul/add/sub shapes.
+ 2025-06-17 1be5eb2686 [dev.simd] cmd/compile: fix signature error of PairDotProdAccumulate.
+ 2025-06-17 3a4d10bfca [dev.simd] cmd/compile: removed a map iteration from generator; tweaked type order
+ 2025-06-17 21d6573154 [dev.simd] cmd/compile: alphabetize SIMD intrinsics
+ 2025-06-16 ee1d9f3f85 [dev.simd] cmd/compile: reorder stubs
+ 2025-06-13 6c50c8b892 [dev.simd] cmd/compile: move simd helpers into compiler, out of generated code
+ 2025-06-13 7392dfd43e [dev.simd] cmd/compile: generated simd*ops files weren't up to date
+ 2025-06-13 00a8dacbe4 [dev.simd] cmd/compile: remove unused simd intrinsics "helpers"
+ 2025-06-13 b9a548775f cmd/compile: add up-to-date test for generated files
+ 2025-06-13 ca01eab9c7 [dev.simd] cmd/compile: add fused mul add sub ops
+ 2025-06-13 ded6e0ac71 [dev.simd] cmd/compile: add more dot products
+ 2025-06-13 3df41c856e [dev.simd] simd: update documentations
+ 2025-06-13 9ba7db36b5 [dev.simd] cmd/compile: add dot product ops
+ 2025-06-13 34a9cdef87 [dev.simd] cmd/compile: add round simd ops
+ 2025-06-13 5289e0f24e [dev.simd] cmd/compile: updates simd ordering and docs
+ 2025-06-13 c81cb05e3e [dev.simd] cmd/compile: add simdGen prog writer
+ 2025-06-13 9b9af3d638 [dev.simd] internal/cpu: add AVX-512-CD and DQ, and derived "basic AVX-512"
+ 2025-06-13 dfa6c74263 [dev.simd] runtime: eliminate global state in mkpreempt.go
+ 2025-06-10 b2e8ddba3c [dev.simd] all: merge master (773701a) into dev.simd
+ 2025-06-09 884f646966 [dev.simd] cmd/compile: add fp3m1fp1 shape to regalloc
+ 2025-06-09 6bc3505773 [dev.simd] cmd/compile: add fp3fp1 regsiter shape
+ 2025-06-05 2eaa5a0703 [dev.simd] simd: add functions+methods to load-from/store-to slices
+ 2025-06-05 8ecbd59ebb [dev.simd] cmd/compile: generated codes for amd64 SIMD
+ 2025-06-02 baa72c25f1 [dev.simd] all: merge master (711ff94) into dev.simd
+ 2025-05-30 0ff18a9cca [dev.simd] cmd/compile: disable intrinsics test for new simd stuff
+ 2025-05-30 7800f3813c [dev.simd] cmd/compile: flip sense of intrinsics test for SIMD
+ 2025-05-29 eba2430c16 [dev.simd] simd, cmd/compile, go build, go/doc: test tweaks
+ 2025-05-29 71c0e550cd [dev.simd] cmd/dist: disable API check on dev branch
+ 2025-05-29 62e1fccfb9 [dev.simd] internal: delete unused internal/simd directory
+ 2025-05-29 1161228bf1 [dev.simd] cmd/compile: add a fp1m1fp1 register shape to amd64
+ 2025-05-28 fdb067d946 [dev.simd] simd: initialize directory to make it suitable for testing SIMD
+ 2025-05-28 11d2b28bff [dev.simd] cmd/compile: add and fix k register supports
+ 2025-05-28 04b1030ae4 [dev.simd] cmd/compile: adapters for simd
+ 2025-05-27 2ef7106881 [dev.simd] internal/buildcfg: enable SIMD GOEXPERIMENT for amd64
+ 2025-05-22 4d2c71ebf9 [dev.simd] internal/goexperiment: add SIMD goexperiment
+ 2025-05-22 3ac5f2f962 [dev.simd] codereview.cfg: set up dev.simd branch

Change-Id: I60f2cd2ea055384a3788097738c6989630207871
2025-11-24 16:02:08 -05:00
Cherry Mui
7d65463a54 [dev.simd] all: merge master (e704b09) into dev.simd
Merge List:

+ 2025-11-24 e704b0993b go/types, types2: shorten object map assertion

Change-Id: Ie45f971d2872c6b7f8f62d61e4d307ccf52a6546
2025-11-24 15:48:07 -05:00
Mark Freeman
e704b0993b go/types, types2: shorten object map assertion
It's a fairly well-known invariant that each object must exist in the
object map and cannot be nil. This change just shortens a check of
that invariant.

Change-Id: Id15c158c3a9ad91cdc230fb0b84eb69b2451cbdc
Reviewed-on: https://go-review.googlesource.com/c/go/+/722061
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Mark Freeman <markfreeman@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
2025-11-24 12:34:51 -08:00
Cherry Mui
afd1721fc5 [dev.simd] all: merge master (02d1f3a) into dev.simd
Merge List:

+ 2025-11-24 02d1f3a06b runtime: respect GOTRACEBACK for user-triggered runtime panics
+ 2025-11-24 a593ca9d65 runtime/cgo: add support for `any` param and return type
+ 2025-11-24 89552911b3 cmd/compile, internal/buildcfg: enable regABI on s390x, and add s390x
+ 2025-11-24 2fe0ba8d52 internal/bytealg: port bytealg functions to reg ABI on s390x
+ 2025-11-24 4529c8fba6 runtime: port memmove, memclr to register ABI on s390x
+ 2025-11-24 58a48a3e3b internal/runtime/syscall: Syscall changes for s390x regabi
+ 2025-11-24 2a185fae7e reflect, runtime: add reflect support for regabi on s390x
+ 2025-11-24 e92d2964fa runtime: mark race functions on s390x as ABIInternal
+ 2025-11-24 41af98eb83 runtime: add runtime changes for register ABI on s390x
+ 2025-11-24 85e6080089 cmd/internal/obj: set morestack arg spilling and regabi prologue on s390x
+ 2025-11-24 24697419c5 cmd/compile: update s390x CALL* ops
+ 2025-11-24 81242d034c cmd/compile/internal/s390x: add initial spill support
+ 2025-11-24 73b6aa0fec cmd/compile/internal: add register ABI information for s390x
+ 2025-11-24 1036f6f485 internal/abi: define s390x ABI constants
+ 2025-11-24 2e5d12a277 cmd/compile: document register-based ABI for s390x

Change-Id: I57b4ae6f9b65d99958b9fe5974205770e18f7788
2025-11-24 15:29:37 -05:00
Joe Tsai
02d1f3a06b runtime: respect GOTRACEBACK for user-triggered runtime panics
The documentation for GOTRACEBACK says that "single" is the default
where the stack trace for only a single routine is printed except
that it prints all stack traces if:

	there is no current goroutine or
	the failure is internal to the run-time.

In the runtime, there are two types of panics:
throwTypeUser and throwTypeRuntime.
The latter more clearly corresponds to a
"failure [that] is internal to the run-time",
while the former corresponds to a
problem trigger due to a user mistake.

Thus, a user-triggered panic (e.g., concurrent map access)
should not result in a dump of all stack traces.

Fixes #68019

Change-Id: I9b02f82535ddb9fd666f7158e2e4ee10f235646a
Reviewed-on: https://go-review.googlesource.com/c/go/+/649535
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-11-24 12:21:26 -08:00
Cherry Mui
a9914886da [dev.simd] internal/buildcfg: don't enable SIMD experiment by default
Preparing for merge to the main branch. Will reenable on the
branch.

Change-Id: Iac77dfb90498cf6eb60f79930a53179f130b7508
Reviewed-on: https://go-review.googlesource.com/c/go/+/723940
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-24 12:09:34 -08:00
Alexandre Daubois
a593ca9d65 runtime/cgo: add support for any param and return type
When using `any` as param or return type of an exported
function, we currently have the error `unrecognized Go
type any`. `any` is an alias of `interface{}` which is
already supported.

This would avoid such change: https://github.com/php/frankenphp/pull/1976

Fixes #76340

Change-Id: I301838ff72e99ae78b035a8eff2405f6a145ed1a
GitHub-Last-Rev: 7dfbccfa58
GitHub-Pull-Request: golang/go#76325
Reviewed-on: https://go-review.googlesource.com/c/go/+/720960
Reviewed-by: Mark Freeman <markfreeman@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-24 11:58:55 -08:00
Cherry Mui
61a5a6b016 [dev.simd] simd: add goexperiment tag to generate.go
So the simd package does not exist, instead of existing as an
empty package, if the goexperiment is not enabled. Unfortunately
the simd package developers have to run
GOEXPERIMENT=simd go generate, especially if one is not on an
AMD64 machine. But that command is still simple enough, not too
bad.

Change-Id: I632ce92ecb72e208212e294d8b3448b43fd01eef
Reviewed-on: https://go-review.googlesource.com/c/go/+/723802
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-24 11:47:27 -08:00
Srinivas Pokala
89552911b3 cmd/compile, internal/buildcfg: enable regABI on s390x, and add s390x
in test func hasRegisterABI

```
goos: linux
goarch: s390x
shortname: minio
pkg: github.com/minio/minio/cmd
                                 │     old      │                 new
│
                                 │    sec/op    │    sec/op     vs base
│
DecodehealingTracker-128           1227.5n ± 1%   894.6n ±  1%  -27.12%
(p=0.000 n=10)
AppendMsgResyncTargetsInfo-128      8.755n ± 0%   4.942n ± 20%  -43.55%
(p=0.000 n=10)
DataUpdateTracker-128               2.075µ ± 1%   1.949µ ±  1%   -6.10%
(p=0.000 n=10)
MarshalMsgdataUsageCacheInfo-128    64.32n ± 2%   50.57n ±  6%  -21.37%
(p=0.000 n=10)
geomean                             194.6n        144.5n        -25.76%

shortname: gonum_topo
pkg: gonum.org/v1/gonum/graph/topo
                           │     old      │                 new
│
                           │    sec/op    │   sec/op     vs base
│
TarjanSCCGnp_10_tenth-128     8.733µ ± 1%   6.953µ ± 2%  -20.38%
(p=0.000 n=10)
TarjanSCCGnp_1000_half-128   101.60m ± 0%   72.79m ± 1%  -28.36%
(p=0.000 n=10)
geomean                       942.0µ        711.4µ       -24.48%

shortname: gonum_traverse
pkg: gonum.org/v1/gonum/graph/traverse
                                      │     old      │
new                 │
                                      │    sec/op    │   sec/op     vs
base                │
WalkAllBreadthFirstGnp_10_tenth-128      3.871µ ± 2%   3.242µ ± 2%
-16.25% (p=0.000 n=10)
WalkAllBreadthFirstGnp_1000_tenth-128   11.879m ± 1%   9.034m ± 1%
-23.95% (p=0.000 n=10)
geomean                                  214.4µ        171.1µ
-20.19%

hortname: ericlagergren_decimal
pkg: github.com/ericlagergren/decimal/benchmarks
                                        │     old     │
new                 │
                                        │   sec/op    │   sec/op     vs
base                │
Pi/foo=ericlagergren_(Go)/prec=100-128    181.6µ ± 0%   145.3µ ± 2%
-20.01% (p=0.000 n=10)
Pi/foo=ericlagergren_(GDA)/prec=100-128   356.4µ ± 1%   298.2µ ± 2%
-16.33% (p=0.000 n=10)
Pi/foo=shopspring/prec=100-128            426.5µ ± 2%   403.1µ ± 4%
-5.47% (p=0.000 n=10)
Pi/foo=apmckinlay/prec=100-128            4.943µ ± 0%   3.903µ ± 1%
-21.03% (p=0.000 n=10)
Pi/foo=go-inf/prec=100-128                132.1µ ± 4%   119.7µ ± 3%
-9.37% (p=0.000 n=10)
Pi/foo=float64/prec=100-128               4.210µ ± 0%   4.210µ ± 0%
~ (p=0.269 n=10)
geomean                                   65.07µ        57.02µ
-12.37%

shortname: uber_tally
pkg: github.com/uber-go/tally
                                 │     old      │                 new
│
                                 │    sec/op    │   sec/op     vs base
│
ScopeTaggedNoCachedSubscopes-128   3.511µ ± 12%   3.067µ ± 6%  -12.63%
(p=0.000 n=10)
HistogramAllocation-128            1.085µ ± 15%   1.011µ ± 6%   -6.87%
(p=0.001 n=10)
geomean                            1.952µ         1.760µ        -9.80%

shortname: uber_zap
pkg: go.uber.org/zap/zapcore
                                               │      old      │
new                  │
                                               │    sec/op     │
sec/op     vs base                │
BufferedWriteSyncer/write_file_with_buffer-128    119.0n ±  3%   101.7n
±  5%  -14.54% (p=0.000 n=10)
MultiWriteSyncer/2_discarder-128                 13.320n ± 34%   9.410n
± 28%  -29.35% (p=0.005 n=10)
MultiWriteSyncer/4_discarder-128                 10.830n ± 10%   8.883n
±  8%  -17.98% (p=0.000 n=10)
MultiWriteSyncer/4_discarder_with_buffer-128      119.0n ±  5%   104.1n
±  4%  -12.52% (p=0.000 n=10)
WriteSyncer/write_file_with_no_buffer-128         1.393µ ± 10%   1.409µ
±  7%        ~ (p=1.000 n=10)
ZapConsole-128                                    796.9n ± 14%   722.2n
±  7%   -9.37% (p=0.003 n=10)
JSONLogMarshalerFunc-128                          1.233µ ±  5%   1.095µ
±  8%  -11.20% (p=0.002 n=10)
ZapJSON-128                                       560.7n ±  9%   547.9n
±  6%        ~ (p=0.289 n=10)
StandardJSON-128                                  628.7n ±  7%   566.2n
±  7%   -9.95% (p=0.001 n=10)
Sampler_Check/7_keys-128                          8.068n ± 17%   8.232n
±  4%        ~ (p=0.382 n=10)
Sampler_Check/50_keys-128                         4.064n ± 13%   3.610n
± 17%        ~ (p=0.063 n=10)
Sampler_Check/100_keys-128                        6.559n ±  5%   6.386n
±  6%        ~ (p=0.063 n=10)
Sampler_CheckWithHook/7_keys-128                  40.04n ±  3%   36.82n
±  6%   -8.05% (p=0.000 n=10)
Sampler_CheckWithHook/50_keys-128                 39.48n ±  3%   36.48n
±  4%   -7.61% (p=0.000 n=10)
Sampler_CheckWithHook/100_keys-128                41.27n ±  5%   40.85n
±  9%        ~ (p=0.353 n=10)
TeeCheck-128                                      135.2n ± 11%   128.2n
± 10%        ~ (p=0.190 n=10)
geomean                                           77.98n         70.91n
-9.07%

shortname: spexs2
pkg: github.com/egonelbre/spexs2/_benchmark
               │    old     │                 new                 │
               │   sec/op   │   sec/op     vs base                │
Run/10k/1-128    21.58 ± 2%   19.68 ± 12%   -8.84% (p=0.015 n=10)
Run/10k/16-128   4.539 ± 6%   4.063 ±  7%  -10.48% (p=0.000 n=10)
geomean          9.898        8.941         -9.67%
 ```
Update #40724

Change-Id: I3c3c02e766e2f7402e385eddadbfe09361d82387
Reviewed-on: https://go-review.googlesource.com/c/go/+/719482
Reviewed-by: Vishwanatha HD <vishwanatha.hd@ibm.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-24 10:22:53 -08:00
Srinivas Pokala
2fe0ba8d52 internal/bytealg: port bytealg functions to reg ABI on s390x
This adds support for the reg ABI to the byte/string functions for
s390x. These are initially under control of the GOEXPERIMENT
macro until all changes are in.

Updates #40724

Change-Id: Ia3532523fe3a839cc0370d6fe1544972327be514
Reviewed-on: https://go-review.googlesource.com/c/go/+/719481
Reviewed-by: Vishwanatha HD <vishwanatha.hd@ibm.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
2025-11-24 10:22:43 -08:00
Srinivas Pokala
4529c8fba6 runtime: port memmove, memclr to register ABI on s390x
This allows memmove and memclr to be invoked using the new
register ABI on s390x.

Update #40724

Change-Id: I2e799aac693ddd693266c156c525d6303060796f
Reviewed-on: https://go-review.googlesource.com/c/go/+/719424
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Vishwanatha HD <vishwanatha.hd@ibm.com>
Reviewed-by: Keith Randall <khr@google.com>
2025-11-24 10:22:37 -08:00
Srinivas Pokala
58a48a3e3b internal/runtime/syscall: Syscall changes for s390x regabi
Updates #40724

Change-Id: I07a01ac1bda71214f01f4a72e15ab469ef275725
Reviewed-on: https://go-review.googlesource.com/c/go/+/719423
Reviewed-by: Vishwanatha HD <vishwanatha.hd@ibm.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-24 10:22:30 -08:00
Srinivas Pokala
2a185fae7e reflect, runtime: add reflect support for regabi on s390x
This adds the regabi support needed for reflect calls
makeFuncSub and methodValueCall. Also, It add's archFloat32FromReg
and archFloat32ToReg.

Update #40724

Change-Id: Ic4b9e30c82f292a24fd2c2b9796cd80a58cecf77
Reviewed-on: https://go-review.googlesource.com/c/go/+/719480
Reviewed-by: Vishwanatha HD <vishwanatha.hd@ibm.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-24 10:22:03 -08:00
Srinivas Pokala
e92d2964fa runtime: mark race functions on s390x as ABIInternal
This adds ABIInternal to the race function declarations.

Update #40724

Change-Id: I827f94fa08240a17a4107a39bca6b4e279dc2530
Reviewed-on: https://go-review.googlesource.com/c/go/+/719422
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Vishwanatha HD <vishwanatha.hd@ibm.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-24 10:21:56 -08:00
Srinivas Pokala
41af98eb83 runtime: add runtime changes for register ABI on s390x
This adds the changes for the register ABI in the runtime
functions for s390x platform:
- Add spill/unspill functions used by runtime
- Add ABIInternal to functions

Updates #40724

Change-Id: I6aaeec1d7293b6fec2aa489df90414937b80199e
Reviewed-on: https://go-review.googlesource.com/c/go/+/719465
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Vishwanatha HD <vishwanatha.hd@ibm.com>
2025-11-24 10:21:49 -08:00
Srinivas Pokala
85e6080089 cmd/internal/obj: set morestack arg spilling and regabi prologue on
s390x

This CL spill arg registers before calling morestack, unspill them
after morestack call. It also avoid clobbering the register that
could contain incoming argument values. Change registers on s390x to
avoid regABI arguments.

Update #40724

Change-Id: I67b20552410dd23ef0b86f14b9c5bfed9f9723a6
Reviewed-on: https://go-review.googlesource.com/c/go/+/719421
Reviewed-by: Vishwanatha HD <vishwanatha.hd@ibm.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: David Chase <drchase@google.com>
2025-11-24 10:21:41 -08:00
Srinivas Pokala
24697419c5 cmd/compile: update s390x CALL* ops
This CL allow the CALL ops to take variable no of arguments.

Update #40724

Change-Id: Ibfa2e98c5051684cae69200c396dfa1edb2878e4
Reviewed-on: https://go-review.googlesource.com/c/go/+/719464
Reviewed-by: Vishwanatha HD <vishwanatha.hd@ibm.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-24 10:21:34 -08:00
Srinivas Pokala
81242d034c cmd/compile/internal/s390x: add initial spill support
This adds some initial support for spilling and reloading registers in
the new ABI for s390x

Update #40724

Change-Id: Icc46a9375454765dea7d03fc4c8f2dbcc87f5f50
Reviewed-on: https://go-review.googlesource.com/c/go/+/719463
Reviewed-by: Vishwanatha HD <vishwanatha.hd@ibm.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
2025-11-24 10:21:27 -08:00
Srinivas Pokala
73b6aa0fec cmd/compile/internal: add register ABI information for s390x
Update #40724

Change-Id: If8f2574259560b097db29347b2aecb098acef863
Reviewed-on: https://go-review.googlesource.com/c/go/+/719462
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Vishwanatha HD <vishwanatha.hd@ibm.com>
Reviewed-by: Keith Randall <khr@google.com>
2025-11-24 10:21:19 -08:00
Srinivas Pokala
1036f6f485 internal/abi: define s390x ABI constants
Updates #40724

Change-Id: I9b6c56194b2cbc95c08441dfa1f779ed5efbadb8
Reviewed-on: https://go-review.googlesource.com/c/go/+/719461
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Vishwanatha HD <vishwanatha.hd@ibm.com>
2025-11-24 10:21:12 -08:00
Srinivas Pokala
2e5d12a277 cmd/compile: document register-based ABI for s390x
This CL adds the s390x information to the ABI doc.

Update #40724

Cq-Include-Trybots: luci.golang.try:gotip-linux-s390x
Change-Id: I1b4b25ef1003e2ab011e1b808aeb1c02288095c2
Reviewed-on: https://go-review.googlesource.com/c/go/+/719460
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Vishwanatha HD <vishwanatha.hd@ibm.com>
TryBot-Bypass: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-11-24 10:21:05 -08:00
Cherry Mui
f045ed4110 [dev.simd] go/doc/comment: don't include experimental packages in std list
go/doc/comment/std.go has a list of top-level package prefixes in
the standard library. This list can vary depending on goexperiment,
but the file is static. E.g.

GOEXPERIMENT=arenas go test -run=TestStd go/doc/comment

would fail.

Don't include experimental packages, as they are not (yet)
generally available. We could have a per-experiment list of
package prefixes. But given that experimental packages are not
intended to be used widely (yet), it is probably not worth the
complexity.

Change-Id: Ib5bc060297cbae29c01fee458aaaa29600b81e98
Reviewed-on: https://go-review.googlesource.com/c/go/+/723840
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-11-24 10:08:53 -08:00
Cherry Mui
220d73cc44 [dev.simd] all: merge master (8dd5b13) into dev.simd
Merge List:

+ 2025-11-24 8dd5b13abc cmd/compile: relax stmtline_test on amd64
+ 2025-11-23 feae743bdb cmd/compile: use 32x32->64 multiplies on loong64
+ 2025-11-23 e88be8a128 runtime: fix stale comment for mheap/malloc
+ 2025-11-23 a318843a2a cmd/internal/obj/loong64: optimize duplicate optab entries
+ 2025-11-23 a18294bb6a cmd/internal/obj/arm64, image/gif, runtime, sort: use math/bits to calculate log2
+ 2025-11-23 437323ef7b slices: fix incorrect comment in slices.Insert function documentation
+ 2025-11-23 1993dca400 doc/next: pre-announce end of support for macOS 12 in Go 1.27
+ 2025-11-22 337f7b1f5d cmd/go: update default go directive in mod or work init
+ 2025-11-21 3c26aef8fb cmd/internal/obj/riscv: improve large branch/call/jump tests
+ 2025-11-21 31aa9f800b crypto/tls: use inner hello for earlyData when using QUIC and ECH
+ 2025-11-21 d68aec8db1 runtime: replace trace seqlock with write flag
+ 2025-11-21 8d9906cd34 runtime/trace: add Log benchmark
+ 2025-11-21 6aeacdff38 cmd/go: support sha1 repos when git default is sha256
+ 2025-11-21 9570036ca5 crypto/sha3: make the zero value of SHAKE useable
+ 2025-11-21 155efbbeeb crypto/sha3: make the zero value of SHA3 useable
+ 2025-11-21 6f16669e34 database/sql: don't ignore ColumnConverter for unknown input count
+ 2025-11-21 121bc3e464 runtime/pprof: remove hard-coded sleep in CPU profile reader
+ 2025-11-21 b604148c4e runtime: fix double wakeup in CPU profile buffer
+ 2025-11-21 22f24f90b5 cmd/compile: change testing.B.Loop keep alive semantic
+ 2025-11-21 cfb9d2eb73 net: remove unused linknames
+ 2025-11-21 65ef314f89 net/http: remove unused linknames
+ 2025-11-21 0f32fbc631 net/http: populate Response.Request when using NewFileTransport
+ 2025-11-21 3e0a8e7867 net/http: preserve original path encoding in redirects
+ 2025-11-21 831af61120 net/http: use HTTP 307 redirects in ServeMux
+ 2025-11-21 87269224cb net/http: update Response.Request.URL after redirects on GOOS=js
+ 2025-11-21 7aa9ca729f net/http/cookiejar: treat localhost as secure origin
+ 2025-11-21 f870a1d398 net/url: warn that JoinPath arguments should be escaped
+ 2025-11-21 9962d95fed crypto/internal/fips140/mldsa: unroll NTT and inverseNTT
+ 2025-11-21 f821fc46c5 crypto/internal/fisp140test: update acvptool, test data
+ 2025-11-21 b59efc38a0 crypto/internal/fips140/mldsa: new package
+ 2025-11-21 62741480b8 runtime: remove linkname for gopanic
+ 2025-11-21 7db2f0bb9a crypto/internal/hpke: separate KEM and PublicKey/PrivateKey interfaces
+ 2025-11-21 e15800c0ec crypto/internal/hpke: add ML-KEM and hybrid KEMs, and SHAKE KDFs
+ 2025-11-21 7c985a2df4 crypto/internal/hpke: modularize API and support more ciphersuites
+ 2025-11-21 e7d47ac33d cmd/compile: simplify negative on multiplication
+ 2025-11-21 35d2712b32 net/http: fix typo in Transport docs
+ 2025-11-21 90c970cd0f net: remove unnecessary loop variable copies in tests
+ 2025-11-21 9772d3a690 cmd/cgo: strip top-level const qualifier from argument frame struct
+ 2025-11-21 1903782ade errors: add examples for custom Is/As matching
+ 2025-11-21 ec92bc6d63 cmd/compile: rewrite Rsh to RshU if arguments are proved positive
+ 2025-11-21 3820f94c1d cmd/compile: propagate unsigned relations for Rsh if arguments are positive
+ 2025-11-21 d474f1fd21 cmd/compile: make dse track multiple shadowed ranges
+ 2025-11-21 d0d0a72980 cmd/compile/internal/ssa: correct type of ARM64 conditional instructions
+ 2025-11-21 a9704f89ea internal/runtime/gc/scan: add AVX512 impl of filterNil.
+ 2025-11-21 ccd389036a cmd/internal/objabi: remove -V=goexperiment internal special case
+ 2025-11-21 e7787b9eca runtime: go fmt
+ 2025-11-21 17b3b98796 internal/strconv: go fmt
+ 2025-11-21 c851827c68 internal/trace: go fmt
+ 2025-11-21 f87aaec53d cmd/compile: fix integer overflow in prove pass
+ 2025-11-21 dbd2ab9992 cmd/compile/internal: fix typos
+ 2025-11-21 b9d86baae3 cmd/compile/internal/devirtualize: fix typos
+ 2025-11-20 4b0e3cc1d6 cmd/link: support loading R_LARCH_PCREL20_S2 and R_LARCH_CALL36 relocs
+ 2025-11-20 cdba82c7d6 cmd/internal/obj/loong64: add {,X}VSLT.{B/H/W/V}{,U} instructions support
+ 2025-11-20 bd2b117c2c crypto/tls: add QUICErrorEvent
+ 2025-11-20 3ad2e113fc net/http/httputil: wrap ReverseProxy's outbound request body so Close is a noop
+ 2025-11-20 d58b733646 runtime: track goroutine location until actual STW
+ 2025-11-20 1bc54868d4 cmd/vendor: update to x/tools@68724af
+ 2025-11-20 8c3195973b runtime: disable stack allocation tests on sanitizers
+ 2025-11-20 ff654ea100 net/url: permit colons in the host of postgresql:// URLs
+ 2025-11-20 a662badab9 encoding/json: remove linknames
+ 2025-11-20 5afe237d65 mime: add missing path for mime types in godoc
+ 2025-11-20 c1b7112af8 os/signal: make NotifyContext cancel the context with a cause

Change-Id: Ib93ef643be610dfbdd83ff45095a7b1ca2537b8b
2025-11-24 11:03:06 -05:00
Cherry Mui
0c69e77343 Revert "[dev.simd] internal/runtime/gc: add simd package based greentea kernels"
This reverts CL 719520.

Reason for revert: Naming is confusing. Also, this has a semantic merge
conflict with CL 722040. Let's revert, fix the naming and conflict, and
do it again.

Change-Id: I0dc0c7c58470d63d48a4f69adb38c18f95db0beb
Reviewed-on: https://go-review.googlesource.com/c/go/+/723220
Reviewed-by: Junyang Shao <shaojunyang@google.com>
TryBot-Bypass: David Chase <drchase@google.com>
2025-11-24 07:54:12 -08:00
David Chase
8dd5b13abc cmd/compile: relax stmtline_test on amd64
This platform was already the strictest, we've hit the limit
several times in the last month or so and it interferes with
getting other stuff done.  This allows 1.5% missing, 2% is
the default, so still strictest.

We do need to revisit the limit and line numbering, but other
work is also a priority.

Change-Id: Ib06f6a9bb39a38ff06bf0b6579bb4eeb0163ce96
Reviewed-on: https://go-review.googlesource.com/c/go/+/723740
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: David Chase <drchase@google.com>
2025-11-24 07:35:28 -08:00
Xiaolin Zhao
feae743bdb cmd/compile: use 32x32->64 multiplies on loong64
Gets rid of some sign extensions, like arm64.

Change-Id: I9fc37e15a82718bfcf53db8cab0c4e7baaa0a747
Reviewed-on: https://go-review.googlesource.com/c/go/+/721522
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-23 23:54:44 -08:00
Lidong Yan
e88be8a128 runtime: fix stale comment for mheap/malloc
mheap use pageAlloc to manage free/scav address space instead of
using free/scav treap. The comment on mheap states mheap uses
treaps. Update the comment to reflect the use of pageAlloc.

In the fallback code when sizeSpecializedMalloc is enabled,
heapBitsInSpan is false. Update the comment to reflect that.

Change-Id: I50d2993c84e2c0312a925ab0a33065cc4cd41c41
Reviewed-on: https://go-review.googlesource.com/c/go/+/722700
Reviewed-by: Lidong Yan <yldhome2d2@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Mark Freeman <markfreeman@google.com>
2025-11-23 09:07:32 -08:00
Xiaolin Zhao
a318843a2a cmd/internal/obj/loong64: optimize duplicate optab entries
Change-Id: I28b79d178a2ed3d304f0e61613439813c4dcf79e
Reviewed-on: https://go-review.googlesource.com/c/go/+/721600
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
2025-11-23 04:45:26 -08:00
Axel Wagner
a18294bb6a cmd/internal/obj/arm64, image/gif, runtime, sort: use math/bits to calculate log2
In several places the integer log2 is calculated using loops or similar
mechanisms. math/bits.Len* provide a simpler and more efficient
mechanisms for this.

Annoyingly, every usage has slightly different ideas of what "log2"
means and how non-positive inputs should be handled. I verified the
replacements in each case by comparing the result for inputs from 0
to 1<<16.

Change-Id: Ie962a74674802da363e0038d34c06979ccb41cf3
Reviewed-on: https://go-review.googlesource.com/c/go/+/721880
Reviewed-by: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-11-23 03:49:34 -08:00
cuishuang
437323ef7b slices: fix incorrect comment in slices.Insert function documentation
The comment previously stated that r[i+len(v)] would equal the value
originally at r[i], but it should be the value originally at s[i].

Change-Id: I635ddbdd5dc4da9c06ed426d5542bf969b7fe6dd
Reviewed-on: https://go-review.googlesource.com/c/go/+/722680
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2025-11-23 03:35:46 -08:00
Sean Liao
1993dca400 doc/next: pre-announce end of support for macOS 12 in Go 1.27
For #75836

Change-Id: I7fd515eb7fcdfb5944388ab42716fd81bc13a7b4
Reviewed-on: https://go-review.googlesource.com/c/go/+/723080
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: 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>
2025-11-23 03:30:55 -08:00
Ian Alexander
337f7b1f5d cmd/go: update default go directive in mod or work init
This commit updates the default go directive when initializing a new
module.

The current logic is to use the latest version supported by the
toolchain.  This behavior is simple, predictable, and importantly, it
can work while completely offline (i.e., no internet connection
required).

This commit changes the default version to the following behavior:

* If the current toolchain version is a stable version of Go 1.N.M,
default to go 1.(N-1).0
* If the current toolchain version is a pre-release version of Go
1.N (Release Candidate M) or a development version of Go 1.N, default
to go 1.(N-2).0

This behavior maintains the property of being able to work offline.

Fixes #74748.

Change-Id: I81f62eef29f1dd51060067c8075f61e7bcf57c20
Reviewed-on: https://go-review.googlesource.com/c/go/+/720480
Commit-Queue: Ian Alexander <jitsu@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Bypass: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
2025-11-22 06:13:24 -08:00
Joel Sing
3c26aef8fb cmd/internal/obj/riscv: improve large branch/call/jump tests
Rework these tests such that they are built on all architectures and
actually executed when run on riscv64. This increases the likelihood
of catching code generation issues, especially those that impact
relocations. Also ensure that the generated assembly includes the
instruction sequence that is expected for the large branch/call/jump.

Change-Id: I15c40a439dd1d0d4ed189ab81697e93d82c4ef4d
Reviewed-on: https://go-review.googlesource.com/c/go/+/721621
Reviewed-by: Mark Ryan <markdryan@rivosinc.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-11-21 22:38:02 -08:00
Roland Shoemaker
31aa9f800b crypto/tls: use inner hello for earlyData when using QUIC and ECH
I don't think we have good QUIC ECH tests. BoGo has some for this, but
I'm not sure how easy it would be to enable those for QUIC.

Fixes #76283

Change-Id: I0ffa535fd89a624b7f9bfd73441ce2a1683e0549
Reviewed-on: https://go-review.googlesource.com/c/go/+/720920
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Roland Shoemaker <roland@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
2025-11-21 17:50:12 -08:00
Michael Anthony Knyszek
d68aec8db1 runtime: replace trace seqlock with write flag
The runtime tracer currently uses a per-M seqlock to indicate whether a
thread is writing to a local trace buffer. The seqlock is updated with
two atomic adds, read-modify-write operations. These are quite
expensive, even though they're completely uncontended.

We can make these operations slightly cheaper by using an atomic store.
The key insight here is that only one thread ever writes to the value at
a time, so only the "write" of the read-modify-write actually matters.
At that point, it doesn't really matter that we have a monotonically
increasing counter. This is made clearer by the fact that nothing other
than basic checks make sure the counter is monotonically increasing:
everything only depends on whether the counter is even or odd.

At that point, all we really need is a flag: an atomic.Bool, which we
can update with an atomic Store, a write-only instruction.

Change-Id: I0cfe39b34c7634554c34c53c0f0e196d125bbc4a
Reviewed-on: https://go-review.googlesource.com/c/go/+/721840
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-11-21 14:04:31 -08:00
Michael Anthony Knyszek
8d9906cd34 runtime/trace: add Log benchmark
This is a pretty decent benchmark of the baseline event cost.

Change-Id: I22a7fa3411bd80be3bd8093d5933e29062cb1377
Reviewed-on: https://go-review.googlesource.com/c/go/+/723060
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-21 14:03:19 -08:00
David Finkel
6aeacdff38 cmd/go: support sha1 repos when git default is sha256
When git is recent enough (beyond 2.29), always set the --object-format
flag.

This fixes repo cloning when users have set the git configuration
init.defaultObjectFormat to sha256.

Git is planning[1] to switch the default hash function to sha256 with
the 3.0 release sometime in late 2026. (that may slip, but it's still
worth being ahead of the curve)

This change moves the version-check function from cl/698835 into
codehost/git.go so we can use it to condition setting
--object-format=sha1.

Adjust the regexp parsing git version output to handle more cases.

[1]: https://lore.kernel.org/lkml/xmqqikikk1hr.fsf@gitster.g/T/#u

Updates #68359
Change-Id: I7d59eb4e116b8afb47d3d1ca068d75eb5047d5c7
Reviewed-on: https://go-review.googlesource.com/c/go/+/720500
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2025-11-21 13:29:38 -08:00
qiulaidongfeng
9570036ca5 crypto/sha3: make the zero value of SHAKE useable
For #75154

Change-Id: Iee5a11ebea8c74b9abab4c077dc7990fe8f562dd
Reviewed-on: https://go-review.googlesource.com/c/go/+/718521
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-21 13:27:43 -08:00
qiulaidongfeng
155efbbeeb crypto/sha3: make the zero value of SHA3 useable
Fixes #75154

Change-Id: I860ab0b4bd5d64e1f58aa5dfbab19d77e2925430
Reviewed-on: https://go-review.googlesource.com/c/go/+/714120
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-11-21 13:27:36 -08:00
Jonathan Hall
6f16669e34 database/sql: don't ignore ColumnConverter for unknown input count
In the case a sql driver implements the ColumnConverter interface and also
returns -1 for NumInputs, indicating an unknown number of input arguments to
a query, the previous implementation would ignore the column converter would
not be called, leading to unexpected or invalid arguments passed to the driver.

Fixes #68342

Change-Id: Ib2ddaf040fa9be669d593eacdaa1e88ba66d7bc2
Reviewed-on: https://go-review.googlesource.com/c/go/+/597115
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-21 13:25:48 -08:00
Nick Ripley
121bc3e464 runtime/pprof: remove hard-coded sleep in CPU profile reader
The CPU profiler reader goroutine has a hard-coded 100ms sleep between
reads of the CPU profile sample buffer. This is done because waking up
the CPU profile reader is not signal-safe on some platforms. As a
consequence, stopping the profiler takes 200ms (one iteration to read
the last samples and one to see the "eof"), and on many-core systems the
reader does not wake up frequently enought to keep up with incoming
data.

This CL removes the sleep where it is safe to do so, following a
suggestion by Austin Clements in the comments on CL 445375. We let the
reader fully block, and wake up the reader when the buffer is over
half-full.

Fixes #63043
Updates #56029

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-linux-arm64-longtest,gotip-linux-386-longtest
Change-Id: I9f7e7e9918a4a6f16e80f6aaf33103126568a81f
Reviewed-on: https://go-review.googlesource.com/c/go/+/610815
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
2025-11-21 13:25:29 -08:00
Nick Ripley
b604148c4e runtime: fix double wakeup in CPU profile buffer
The profBuf.wakeupExtra method wakes up the profile reader if it's
sleeping, either when the buffer is closed or when there is a pending
overflow entry.  Unlike in profBuf.write, profBuf.wakeupExtra does not
clear the profReaderSleeping bit before doing the wakeup. As a result,
if there are two writes to a full buffer before the sleeping reader has
time to wake up, we'll see two consecutive calls to notewakeup, which is
a fatal error. This CL updates profBuf.wakeupExtra to clear the sleeping
bit before doing the wakeup.

This CL adds a unit test that demonstrates the problem. This is
theoretically possible to trigger for real programs as well, but it's
more difficult. The profBufWordCount is large enough that it takes
several CPU-seconds to fill up the buffer. So we'd need to run on a
system with lots of cores to have a chance of running into this failure,
and the reader would need to fully go to sleep before a large burst of
CPU activity.

Change-Id: I59b4fa86a12f6236890b82cd353a95706a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/722940
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
2025-11-21 13:24:46 -08:00
Junyang Shao
da92168ec8 [dev.simd] internal/runtime/gc: add simd package based greentea kernels
This CL adds a new generator to internal/runtime/gc/scan that generates expander
kernels in Go SIMD. This CL also includes a Go SIMD scan kernel and a
Go SIMD filter kernel.

This CL also includes the plumbing, it will use the Go SIMD kernels if
goexperiment.simd is on.

Benchmark results:
...
ScanSpanPacked/cache=tiny/pages=1/sizeclass=26/pct=80-88     354.8n ±  1%   272.4n ±  0%  -23.22% (p=0.002 n=6)
ScanSpanPacked/cache=tiny/pages=1/sizeclass=26/pct=90-88     375.7n ±  0%   287.1n ±  0%  -23.58% (p=0.002 n=6)
ScanSpanPacked/cache=tiny/pages=1/sizeclass=26/pct=100-88    450.0n ±  1%   327.4n ±  0%  -27.24% (p=0.002 n=6)
geomean                                                      246.5n         199.4n        -19.10%

Throughput +25%.

Change-Id: Ib85e01b7de18181db9e7b6026863209a993aa85f
Reviewed-on: https://go-review.googlesource.com/c/go/+/719520
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-11-21 13:14:21 -08:00
Junyang Shao
22f24f90b5 cmd/compile: change testing.B.Loop keep alive semantic
This CL implements this initial design of testing.B.Loop's keep variable
alive semantic:
https://github.com/golang/go/issues/61515#issuecomment-2407963248.

Fixes #73137.

Change-Id: I8060470dbcb0dda0819334f3615cc391ff0f6501
Reviewed-on: https://go-review.googlesource.com/c/go/+/716660
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-11-21 12:49:20 -08:00
Sean Liao
cfb9d2eb73 net: remove unused linknames
errNoSuchInterface:
a33349366d

defaultNS:
4a16d22398

For #67401

Change-Id: I2945bc5edf8a474315283c57259ba6c2a0b85776
Reviewed-on: https://go-review.googlesource.com/c/go/+/721161
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-21 12:48:05 -08:00
Sean Liao
65ef314f89 net/http: remove unused linknames
These were removed in:
8e2d520ba2

For #67401

Change-Id: I44898beb6fa3b6867b3d2164fc930724e143cf30
Reviewed-on: https://go-review.googlesource.com/c/go/+/721200
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
2025-11-21 12:47:59 -08:00
Sean Liao
0f32fbc631 net/http: populate Response.Request when using NewFileTransport
Fixes #51562

Change-Id: Ia6fe4728b1e3e0cf3a6462be99c1044260cadf31
Reviewed-on: https://go-review.googlesource.com/c/go/+/720822
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
2025-11-21 12:47:52 -08:00
Sean Liao
3e0a8e7867 net/http: preserve original path encoding in redirects
Fixes #70758

Change-Id: I9fc6fe98c194351557c6219513918b7593899bc1
Reviewed-on: https://go-review.googlesource.com/c/go/+/720821
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
2025-11-21 12:47:46 -08:00
Sean Liao
831af61120 net/http: use HTTP 307 redirects in ServeMux
Clients receiving an HTTP 301 Moved Permanently may conservatively
change the method of a POST request to GET.
The newer HTTP 307 Temporary Redirect and 308 Permanent Redirect
explicitly allows retrying POST requests after the redirect.
These should be safe for ServeMux as this internal redirect is generated
before user provided handlers are called.
As ServeMux is making the redirect for the user without explicit
direction, and clients may cache Permanent Redirects indefinitely,
Temporary Redirect is used in case the user adds a handler for a path,
that was previously redirected but no longer should.

Fixes #50243
Fixes #60769

Change-Id: I6c0b735bab03bb7b50f05457b3b8a8ba813badb2
Reviewed-on: https://go-review.googlesource.com/c/go/+/720820
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
2025-11-21 12:47:40 -08:00
Sean Liao
87269224cb net/http: update Response.Request.URL after redirects on GOOS=js
Fixes #71346

Change-Id: Id4053626e621faf50bb88a10ca0d540f393c8e01
Reviewed-on: https://go-review.googlesource.com/c/go/+/720860
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
2025-11-21 12:47:34 -08:00
Sean Liao
7aa9ca729f net/http/cookiejar: treat localhost as secure origin
For development purposes, browsers treat localhost
as a secure origin regardless of protocol.

Fixes #60997

https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/Cookies#restrict_access_to_cookies
https://bugzilla.mozilla.org/show_bug.cgi?id=1618113
https://issues.chromium.org/issues/40120372

Change-Id: I6d31df4e055f2872c4b93571c53ae5160923852b
Reviewed-on: https://go-review.googlesource.com/c/go/+/717860
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
2025-11-21 12:47:29 -08:00
Sean Liao
f870a1d398 net/url: warn that JoinPath arguments should be escaped
Fixes #75799

Change-Id: I483f7b1129799d8dd7f359a04e6ebc1b6a5d0b08
Reviewed-on: https://go-review.googlesource.com/c/go/+/719000
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-21 12:47:24 -08:00
Filippo Valsorda
9962d95fed crypto/internal/fips140/mldsa: unroll NTT and inverseNTT
fips140: off
goos: darwin
goarch: arm64
pkg: crypto/internal/fips140test
cpu: Apple M2
                      │ bade4ade59  │          bade4ade59-dirty          │
                      │   sec/op    │   sec/op     vs base               │
MLDSASign/ML-DSA-44-8   264.8µ ± 0%   244.5µ ± 0%  -7.68% (p=0.000 n=20)

fips140: off
goos: linux
goarch: amd64
pkg: crypto/internal/fips140test
cpu: AMD EPYC 7443P 24-Core Processor
                       │ bade4ade59  │          bade4ade59-dirty          │
                       │   sec/op    │   sec/op     vs base               │
MLDSASign/ML-DSA-44-48   408.7µ ± 3%   386.5µ ± 1%  -5.41% (p=0.000 n=20)

Change-Id: I04d38a48d5105cbcd625cba9398711b26a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/723020
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Mark Freeman <markfreeman@google.com>
2025-11-21 12:43:46 -08:00
Daniel McCarney
f821fc46c5 crypto/internal/fisp140test: update acvptool, test data
This commit updates the BoringSSL module version used for the acvptool,
as well as the module version used for the static test data used by our
CI process to avoid interacting with a live ACVP server.

Two important upstream changes of note:

1. NIST changed the ML-KEM format slightly, and the BoringSSL acvptool
   was updated in turn. We need to update the go-acvp data version to
   one where I've regenerated the corresponding vector/expected files to
   match these changes. Otherwise, we see an error from an empty dk
   value.

2. The upstream BoringSSL acvptool switched to no longer truncating MAC
   output in the subprocess handler for HMAC tests. Instead of relying on
   this, we switch our capabilities to describe the output length we
   return natively. In turn, we need to update the go-acvp data version
   to vectors generated with the updated capabilities. Otherwise, we see
   an error from the acvptool that our module wrapper returned a result
   of the wrong length.

Change-Id: I1def172585ced0aaf1611d82f2e2802ca1500390
Reviewed-on: https://go-review.googlesource.com/c/go/+/719780
Auto-Submit: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-11-21 12:43:38 -08:00
Filippo Valsorda
b59efc38a0 crypto/internal/fips140/mldsa: new package
Change-Id: I6a6a6964fabee819e62bb6eda032dee6a60d907a
Reviewed-on: https://go-review.googlesource.com/c/go/+/717781
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-11-21 12:43:34 -08:00
Sean Liao
62741480b8 runtime: remove linkname for gopanic
github.com/goplus/igop now renamed github.com/goplus/ixgo
already requires checklinkname=0, so the special case can be removed.
e0d0bfeb2d/ixgo

go.undefinedlabs.com is no longer a resolvable domain,
having been absorbed by Datadog. The original use in
https://pkg.go.dev/go.undefinedlabs.com/scopeagent@v0.4.2/reflection
probably shouldn't have qualified anyway with 0 known importers.

For #67401

Change-Id: Ida6024e014f3304d4a4190f0bd9d12746a29b40b
Reviewed-on: https://go-review.googlesource.com/c/go/+/721300
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-21 12:42:13 -08:00
Filippo Valsorda
7db2f0bb9a crypto/internal/hpke: separate KEM and PublicKey/PrivateKey interfaces
Updates #75300

Change-Id: I87ed26e8f57180d741408bdbda1696d46a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/719560
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
2025-11-21 12:42:08 -08:00
Filippo Valsorda
e15800c0ec crypto/internal/hpke: add ML-KEM and hybrid KEMs, and SHAKE KDFs
Updates #75300

Change-Id: I6a6a6964fbd45420b4001f53fa79228808e4778a
Reviewed-on: https://go-review.googlesource.com/c/go/+/705797
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-21 12:42:02 -08:00
Filippo Valsorda
7c985a2df4 crypto/internal/hpke: modularize API and support more ciphersuites
Updates #75300

Change-Id: I6a6a6964de449b36bc6f5594e08c3c47a0a2f17f
Reviewed-on: https://go-review.googlesource.com/c/go/+/701435
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-11-21 12:41:58 -08:00
Meng Zhuo
e7d47ac33d cmd/compile: simplify negative on multiplication
goos: linux
goarch: amd64
pkg: cmd/compile/internal/test
cpu: AMD EPYC 7532 32-Core Processor
               │       simplify_base │               simplify_new          │
               │       sec/op        │   sec/op     vs base                │
SimplifyNegMul           623.0n ± 0%   319.3n ± 1%  -48.75% (p=0.000 n=10)

goos: linux
goarch: riscv64
pkg: cmd/compile/internal/test
cpu: Spacemit(R) X60
               │       simplify.base │               simplify.new          │
               │       sec/op        │   sec/op     vs base                │
SimplifyNegMul          10.928µ ± 0%   6.432µ ± 0%  -41.14% (p=0.000 n=10)

Change-Id: I1d9393cd19a0b948a5d3a512d627cdc0cf0b38be
Reviewed-on: https://go-review.googlesource.com/c/go/+/721520
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2025-11-21 12:40:29 -08:00
Victor
35d2712b32 net/http: fix typo in Transport docs
Change-Id: Ifeb8d6d2e3fd4c8b0e27da62bec5cf28fe71db34
GitHub-Last-Rev: 5760fb106f
GitHub-Pull-Request: golang/go#76316
Reviewed-on: https://go-review.googlesource.com/c/go/+/720800
Auto-Submit: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Auto-Submit: Sean Liao <sean@liao.dev>
Reviewed-by: Sean Liao <sean@liao.dev>
2025-11-21 12:40:25 -08:00
Plamerdi Makela
90c970cd0f net: remove unnecessary loop variable copies in tests
Similar to CL 711640.

Change-Id: I5cd9470138c80094eeb497cf4652d6a29cd795a6
GitHub-Last-Rev: 603fb5f4d5
GitHub-Pull-Request: golang/go#76253
Reviewed-on: https://go-review.googlesource.com/c/go/+/719600
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2025-11-21 12:40:21 -08:00
Ian Lance Taylor
9772d3a690 cmd/cgo: strip top-level const qualifier from argument frame struct
Otherwise we can't assign to it.

Fixes #75751

Change-Id: Iba680db672297bca1a1d1a33912b80863da66a08
Reviewed-on: https://go-review.googlesource.com/c/go/+/717342
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-21 12:40:14 -08:00
Sean Liao
1903782ade errors: add examples for custom Is/As matching
Change-Id: Ia92dae13b6a4e9434b29d2ab3f698f6ba87b4b89
Reviewed-on: https://go-review.googlesource.com/c/go/+/713740
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Damien Neil <dneil@google.com>
2025-11-21 12:40:11 -08:00
Jorropo
ec92bc6d63 cmd/compile: rewrite Rsh to RshU if arguments are proved positive
Fixes #76332

Change-Id: I9044025d5dc599531c7f88ed2870bcf3d8b0acbd
Reviewed-on: https://go-review.googlesource.com/c/go/+/721206
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
2025-11-21 12:37:30 -08:00
Jorropo
3820f94c1d cmd/compile: propagate unsigned relations for Rsh if arguments are positive
Updates #76332

Change-Id: Ifaa4d12897138d88d56b9d4e530c53dcee70bd58
Reviewed-on: https://go-review.googlesource.com/c/go/+/721205
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Keith Randall <khr@google.com>
2025-11-21 12:37:27 -08:00
Jakub Ciolek
d474f1fd21 cmd/compile: make dse track multiple shadowed ranges
Track multiple shadowed ranges when doing DSE.

Elides zeroing for:

func nozero() (b [5]int64) {
	b[0] = 1
	b[1] = 7
	b[3] = 1
	b[4] = 1
	b[2] = 0
	return b
}

goes from:

 v28   	00003 (7)	LEAQ	main.b(SP), AX
 v5    	00004 (7)	MOVUPS	X15, (AX)
 v5    	00005 (7)	MOVUPS	X15, 16(AX)
 v5    	00006 (7)	MOVUPS	X15, 24(AX)
 v11   	00007 (8)	MOVQ	$1, main.b(SP)
 v16   	00008 (9)	MOVQ	$7, main.b+8(SP)
 v20   	00009 (10)	MOVQ	$1, main.b+24(SP)
 v24   	00010 (11)	MOVQ	$1, main.b+32(SP)
 v29   	00011 (12)	MOVQ	$0, main.b+16(SP)
 b1    	00012 (13)	RET
       	00013 (?)	END

to:

 v11   	00003 (8)	MOVQ	$1, main.b(SP)
 v16   	00004 (9)	MOVQ	$7, main.b+8(SP)
 v20   	00005 (10)	MOVQ	$1, main.b+24(SP)
 v24   	00006 (11)	MOVQ	$1, main.b+32(SP)
 v29   	00007 (12)	MOVQ	$0, main.b+16(SP)
 b1    	00008 (13)	RET
       	00009 (?)	END

regexp linux/amd64:

Find-16                                             89.17n ± ∞ ¹    83.09n ± ∞ ¹   -6.82% (p=0.008 n=5)
FindAllNoMatches-16                                 46.23n ± ∞ ¹    44.26n ± ∞ ¹   -4.26% (p=0.008 n=5)
FindString-16                                       89.77n ± ∞ ¹    82.84n ± ∞ ¹   -7.72% (p=0.008 n=5)
FindSubmatch-16                                     108.9n ± ∞ ¹    101.6n ± ∞ ¹   -6.70% (p=0.008 n=5)
FindStringSubmatch-16                              103.10n ± ∞ ¹    99.98n ± ∞ ¹   -3.03% (p=0.008 n=5)
Literal-16                                          29.61n ± ∞ ¹    29.17n ± ∞ ¹   -1.49% (p=0.008 n=5)
NotLiteral-16                                       590.0n ± ∞ ¹    566.0n ± ∞ ¹   -4.07% (p=0.008 n=5)
MatchClass-16                                       894.7n ± ∞ ¹    814.0n ± ∞ ¹   -9.02% (p=0.008 n=5)
MatchClass_InRange-16                               793.0n ± ∞ ¹    756.3n ± ∞ ¹   -4.63% (p=0.008 n=5)
ReplaceAll-16                                       513.9n ± ∞ ¹    503.6n ± ∞ ¹   -2.00% (p=0.008 n=5)
AnchoredLiteralShortNonMatch-16                     21.70n ± ∞ ¹    21.66n ± ∞ ¹        ~ (p=0.738 n=5)
AnchoredLiteralLongNonMatch-16                      21.74n ± ∞ ¹    21.65n ± ∞ ¹        ~ (p=0.286 n=5)
AnchoredShortMatch-16                               37.71n ± ∞ ¹    37.63n ± ∞ ¹        ~ (p=0.421 n=5)
AnchoredLongMatch-16                                37.75n ± ∞ ¹    37.70n ± ∞ ¹        ~ (p=0.286 n=5)
OnePassShortA-16                                    188.7n ± ∞ ¹    185.7n ± ∞ ¹   -1.59% (p=0.008 n=5)
NotOnePassShortA-16                                 188.0n ± ∞ ¹    190.7n ± ∞ ¹   +1.44% (p=0.008 n=5)
OnePassShortB-16                                    147.9n ± ∞ ¹    154.2n ± ∞ ¹   +4.26% (p=0.008 n=5)
NotOnePassShortB-16                                 141.2n ± ∞ ¹    144.1n ± ∞ ¹   +2.05% (p=0.008 n=5)
OnePassLongPrefix-16                                40.43n ± ∞ ¹    38.45n ± ∞ ¹   -4.90% (p=0.008 n=5)
OnePassLongNotPrefix-16                             100.6n ± ∞ ¹    102.5n ± ∞ ¹   +1.89% (p=0.008 n=5)
MatchParallelShared-16                              9.666n ± ∞ ¹    9.461n ± ∞ ¹        ~ (p=0.056 n=5)
MatchParallelCopied-16                              9.530n ± ∞ ¹    9.540n ± ∞ ¹        ~ (p=0.841 n=5)
QuoteMetaAll-16                                     28.60n ± ∞ ¹    29.52n ± ∞ ¹   +3.22% (p=0.016 n=5)
QuoteMetaNone-16                                    16.73n ± ∞ ¹    16.74n ± ∞ ¹        ~ (p=0.817 n=5)
Compile/Onepass-16                                  2.040µ ± ∞ ¹    2.012µ ± ∞ ¹        ~ (p=0.381 n=5)
Compile/Medium-16                                   4.652µ ± ∞ ¹    4.661µ ± ∞ ¹        ~ (p=0.341 n=5)
Compile/Hard-16                                     37.59µ ± ∞ ¹    37.93µ ± ∞ ¹        ~ (p=0.222 n=5)
Match/Easy0/16-16                                   1.848n ± ∞ ¹    1.847n ± ∞ ¹   -0.05% (p=0.048 n=5)
Match/Easy0/32-16                                   23.81n ± ∞ ¹    24.16n ± ∞ ¹   +1.47% (p=0.008 n=5)
Match/Easy0/1K-16                                   143.2n ± ∞ ¹    148.6n ± ∞ ¹   +3.77% (p=0.008 n=5)
Match/Easy0/32K-16                                  2.023µ ± ∞ ¹    2.008µ ± ∞ ¹   -0.74% (p=0.024 n=5)
Match/Easy0/1M-16                                   135.3µ ± ∞ ¹    136.8µ ± ∞ ¹   +1.10% (p=0.016 n=5)
Match/Easy0/32M-16                                  5.139m ± ∞ ¹    5.123m ± ∞ ¹   -0.29% (p=0.008 n=5)
Match/Easy0i/16-16                                  1.848n ± ∞ ¹    1.847n ± ∞ ¹        ~ (p=0.167 n=5)
Match/Easy0i/32-16                                  438.3n ± ∞ ¹    421.9n ± ∞ ¹   -3.74% (p=0.008 n=5)
Match/Easy0i/1K-16                                  12.93µ ± ∞ ¹    12.25µ ± ∞ ¹   -5.25% (p=0.008 n=5)
Match/Easy0i/32K-16                                 443.3µ ± ∞ ¹    450.6µ ± ∞ ¹   +1.64% (p=0.008 n=5)
Match/Easy0i/1M-16                                  14.26m ± ∞ ¹    14.44m ± ∞ ¹        ~ (p=0.222 n=5)
Match/Easy0i/32M-16                                 454.8m ± ∞ ¹    459.0m ± ∞ ¹        ~ (p=0.056 n=5)
Match/Easy1/16-16                                   1.848n ± ∞ ¹    1.847n ± ∞ ¹        ~ (p=0.206 n=5)
Match/Easy1/32-16                                   20.78n ± ∞ ¹    20.95n ± ∞ ¹        ~ (p=0.841 n=5)
Match/Easy1/1K-16                                   292.0n ± ∞ ¹    278.6n ± ∞ ¹   -4.59% (p=0.008 n=5)
Match/Easy1/32K-16                                  14.19µ ± ∞ ¹    14.31µ ± ∞ ¹   +0.85% (p=0.008 n=5)
Match/Easy1/1M-16                                   513.3µ ± ∞ ¹    517.0µ ± ∞ ¹   +0.72% (p=0.008 n=5)
Match/Easy1/32M-16                                  16.58m ± ∞ ¹    16.69m ± ∞ ¹   +0.64% (p=0.008 n=5)
Match/Medium/16-16                                  1.849n ± ∞ ¹    1.847n ± ∞ ¹   -0.11% (p=0.024 n=5)
Match/Medium/32-16                                  319.8n ± ∞ ¹    312.1n ± ∞ ¹   -2.41% (p=0.008 n=5)
Match/Medium/1K-16                                  12.54µ ± ∞ ¹    12.66µ ± ∞ ¹   +0.97% (p=0.008 n=5)
Match/Medium/32K-16                                 496.9µ ± ∞ ¹    496.0µ ± ∞ ¹        ~ (p=0.056 n=5)
Match/Medium/1M-16                                  16.11m ± ∞ ¹    16.00m ± ∞ ¹   -0.63% (p=0.032 n=5)
Match/Medium/32M-16                                 516.5m ± ∞ ¹    513.1m ± ∞ ¹   -0.65% (p=0.032 n=5)
Match/Hard/16-16                                    1.848n ± ∞ ¹    1.847n ± ∞ ¹        ~ (p=0.238 n=5)
Match/Hard/32-16                                    527.2n ± ∞ ¹    508.4n ± ∞ ¹   -3.57% (p=0.008 n=5)
Match/Hard/1K-16                                    15.53µ ± ∞ ¹    15.42µ ± ∞ ¹   -0.68% (p=0.008 n=5)
Match/Hard/32K-16                                   636.5µ ± ∞ ¹    665.8µ ± ∞ ¹   +4.62% (p=0.008 n=5)
Match/Hard/1M-16                                    20.45m ± ∞ ¹    21.13m ± ∞ ¹   +3.30% (p=0.008 n=5)
Match/Hard/32M-16                                   654.5m ± ∞ ¹    671.9m ± ∞ ¹   +2.66% (p=0.008 n=5)
Match/Hard1/16-16                                   1.538µ ± ∞ ¹    1.499µ ± ∞ ¹   -2.54% (p=0.008 n=5)
Match/Hard1/32-16                                   2.965µ ± ∞ ¹    2.906µ ± ∞ ¹   -1.99% (p=0.008 n=5)
Match/Hard1/1K-16                                   91.28µ ± ∞ ¹    90.09µ ± ∞ ¹   -1.29% (p=0.008 n=5)
Match/Hard1/32K-16                                  2.996m ± ∞ ¹    3.311m ± ∞ ¹  +10.50% (p=0.008 n=5)
Match/Hard1/1M-16                                   95.77m ± ∞ ¹   105.87m ± ∞ ¹  +10.54% (p=0.008 n=5)
Match/Hard1/32M-16                                   3.069 ± ∞ ¹     3.399 ± ∞ ¹  +10.74% (p=0.008 n=5)
Match_onepass_regex/16-16                           120.9n ± ∞ ¹    117.4n ± ∞ ¹   -2.89% (p=0.008 n=5)
Match_onepass_regex/32-16                           211.8n ± ∞ ¹    207.5n ± ∞ ¹   -2.03% (p=0.008 n=5)
Match_onepass_regex/1K-16                           5.602µ ± ∞ ¹    5.548µ ± ∞ ¹        ~ (p=0.421 n=5)
Match_onepass_regex/32K-16                          185.6µ ± ∞ ¹    185.1µ ± ∞ ¹        ~ (p=0.690 n=5)
Match_onepass_regex/1M-16                           5.896m ± ∞ ¹    5.808m ± ∞ ¹   -1.50% (p=0.016 n=5)
Match_onepass_regex/32M-16                          193.4m ± ∞ ¹    185.5m ± ∞ ¹   -4.10% (p=0.008 n=5)
geomean                                             3.815µ          3.796µ         -0.51%

compilecmp linux/amd64:

file                                                                 before   after    Δ       %
runtime.s                                                            673118   672419   -699    -0.104%
runtime [cmd/compile].s                                              720475   719781   -694    -0.096%
math/rand/v2.s                                                       9394     9371     -23     -0.245%
bytes.s                                                              36026    35999    -27     -0.075%
vendor/golang.org/x/net/dns/dnsmessage.s                             76433    76193    -240    -0.314%
math/rand/v2 [cmd/compile].s                                         9394     9371     -23     -0.245%
strings.s                                                            43435    43414    -21     -0.048%
syscall.s                                                            82215    82183    -32     -0.039%
html.s                                                               6010     5949     -61     -1.015%
bytes [cmd/compile].s                                                36615    36588    -27     -0.074%
regexp/syntax.s                                                      81442    81299    -143    -0.176%
syscall [cmd/compile].s                                              82215    82183    -32     -0.039%
time.s                                                               90555    90507    -48     -0.053%
regexp.s                                                             58974    58876    -98     -0.166%
reflect.s                                                            176893   176829   -64     -0.036%
context.s                                                            14298    14234    -64     -0.448%
plugin.s                                                             3879     3847     -32     -0.825%
io/fs.s                                                              29026    29009    -17     -0.059%
strings [cmd/compile].s                                              43446    43425    -21     -0.048%
html [cmd/compile].s                                                 6010     5949     -61     -1.015%
time [cmd/compile].s                                                 90555    90507    -48     -0.053%
os.s                                                                 116321   116249   -72     -0.062%
regexp/syntax [cmd/compile].s                                        81442    81299    -143    -0.176%
context [cmd/compile].s                                              14298    14234    -64     -0.448%
io/fs [cmd/compile].s                                                29026    29009    -17     -0.059%
path/filepath.s                                                      19879    19842    -37     -0.186%
cmd/cgo/internal/cgotest.s                                           1965     1932     -33     -1.679%
reflect [cmd/compile].s                                              176893   176829   -64     -0.036%
regexp [cmd/compile].s                                               58974    58876    -98     -0.166%
crypto/cipher.s                                                      21706    21660    -46     -0.212%
runtime/trace.s                                                      14644    14634    -10     -0.068%
math/big.s                                                           170782   170250   -532    -0.312%
debug/dwarf.s                                                        105214   105141   -73     -0.069%
log.s                                                                15749    15603    -146    -0.927%
encoding/json.s                                                      118965   118933   -32     -0.027%
os/user.s                                                            10367    10326    -41     -0.395%
crypto/dsa.s                                                         4988     4974     -14     -0.281%
crypto/rsa.s                                                         29486    29474    -12     -0.041%
database/sql.s                                                       99574    99403    -171    -0.172%
encoding/gob.s                                                       146507   146475   -32     -0.022%
debug/macho.s                                                        29517    29421    -96     -0.325%
crypto/ed25519.s                                                     8648     8594     -54     -0.624%
internal/goroot.s                                                    3165     3107     -58     -1.833%
testing.s                                                            123472   123438   -34     -0.028%
archive/tar.s                                                        71179    71096    -83     -0.117%
go/doc/comment.s                                                     48429    48397    -32     -0.066%
vendor/golang.org/x/crypto/cryptobyte.s                              31717    31690    -27     -0.085%
internal/cgrouptest.s                                                4760     4686     -74     -1.555%
image/png.s                                                          34484    34479    -5      -0.014%
go/constant.s                                                        29502    29297    -205    -0.695%
internal/testenv.s                                                   22396    22331    -65     -0.290%
internal/pkgbits.s                                                   19609    19598    -11     -0.056%
testing/iotest.s                                                     15070    15018    -52     -0.345%
internal/runtime/gc/internal/gen.s                                   50837    50548    -289    -0.568%
crypto/internal/cryptotest.s                                         58607    58229    -378    -0.645%
crypto/ecdsa.s                                                       43878    43658    -220    -0.501%
cmd/internal/objabi.s                                                20244    20231    -13     -0.064%
math/big/internal/asmgen.s                                           74554    74422    -132    -0.177%
log/slog.s                                                           81620    81617    -3      -0.004%
net.s                                                                299158   299080   -78     -0.026%
cmd/vendor/golang.org/x/telemetry/internal/telemetry.s               4531     4472     -59     -1.302%
testing/fstest.s                                                     73370    73286    -84     -0.114%
log/syslog.s                                                         6457     6426     -31     -0.480%
vendor/golang.org/x/net/http/httpproxy.s                             7674     7666     -8      -0.104%
cmd/vendor/golang.org/x/telemetry/internal/counter.s                 31504    31493    -11     -0.035%
cmd/internal/pkgpath.s                                               4828     4810     -18     -0.373%
internal/trace.s                                                     190495   190463   -32     -0.017%
cmd/internal/telemetry/counter.s                                     1999     1979     -20     -1.001%
net/mail.s                                                           21912    21866    -46     -0.210%
mime/multipart.s                                                     30856    30806    -50     -0.162%
internal/trace/internal/testgen.s                                    12870    12850    -20     -0.155%
go/parser.s                                                          109753   109739   -14     -0.013%
crypto/x509.s                                                        184334   183966   -368    -0.200%
cmd/internal/pgo.s                                                   7886     7850     -36     -0.457%
cmd/internal/browser.s                                               1980     1962     -18     -0.909%
cmd/covdata.s                                                        40197    40180    -17     -0.042%
internal/fuzz.s                                                      90255    90234    -21     -0.023%
go/build.s                                                           74975    74722    -253    -0.337%
cmd/distpack.s                                                       29343    29056    -287    -0.978%
cmd/cover.s                                                          53513    53412    -101    -0.189%
cmd/internal/obj.s                                                   144804   144764   -40     -0.028%
os [cmd/compile].s                                                   116325   116253   -72     -0.062%
cmd/cgo.s                                                            217917   217878   -39     -0.018%
internal/exportdata.s                                                8849     8800     -49     -0.554%
cmd/dist.s                                                           179720   179253   -467    -0.260%
cmd/compile/internal/syntax.s                                        174526   174495   -31     -0.018%
cmd/asm/internal/lex.s                                               21635    21628    -7      -0.032%
cmd/internal/obj/riscv.s                                             149150   149118   -32     -0.021%
path/filepath [cmd/compile].s                                        19879    19842    -37     -0.186%
cmd/internal/obj/wasm.s                                              83633    83569    -64     -0.077%
crypto/tls.s                                                         405459   405103   -356    -0.088%
cmd/internal/obj/loong64.s                                           117422   117392   -30     -0.026%
log [cmd/compile].s                                                  15798    15652    -146    -0.924%
crypto/cipher [cmd/compile].s                                        21706    21660    -46     -0.212%
go/types.s                                                           592053   591930   -123    -0.021%
cmd/vendor/golang.org/x/telemetry/internal/telemetry [cmd/compile].s 4531     4472     -59     -1.302%
cmd/internal/objabi [cmd/compile].s                                  20244    20231    -13     -0.064%
encoding/json [cmd/compile].s                                        119184   119152   -32     -0.027%
go/internal/srcimporter.s                                            9957     9948     -9      -0.090%
internal/goroot [cmd/compile].s                                      3165     3107     -58     -1.833%
runtime/trace [cmd/compile].s                                        14703    14693    -10     -0.068%
go/internal/gccgoimporter.s                                          47218    47189    -29     -0.061%
cmd/vendor/golang.org/x/telemetry/internal/counter [cmd/compile].s   31563    31552    -11     -0.035%
go/doc/comment [cmd/compile].s                                       48488    48456    -32     -0.066%
cmd/compile/internal/base.s                                          44391    44379    -12     -0.027%
cmd/vendor/golang.org/x/tools/internal/analysis/analyzerutil.s       3957     3925     -32     -0.809%
math/big [cmd/compile].s                                             173023   172491   -532    -0.307%
cmd/asm.s                                                            3824     3749     -75     -1.961%
cmd/vendor/golang.org/x/tools/internal/diff/lcs.s                    22413    22289    -124    -0.553%
cmd/internal/telemetry/counter [cmd/compile].s                       1999     1979     -20     -1.001%
cmd/vendor/golang.org/x/tools/go/analysis/passes/buildtag.s          8886     8877     -9      -0.101%
go/constant [cmd/compile].s                                          29673    29468    -205    -0.691%
cmd/internal/obj [cmd/compile].s                                     218137   218102   -35     -0.016%
cmd/internal/pgo [cmd/compile].s                                     7945     7909     -36     -0.453%
internal/pkgbits [cmd/compile].s                                     37142    37115    -27     -0.073%
go/parser [cmd/compile].s                                            109812   109798   -14     -0.013%
cmd/compile/internal/base [cmd/compile].s                            44607    44595    -12     -0.027%
go/build [cmd/compile].s                                             75034    74781    -253    -0.337%
cmd/vendor/golang.org/x/tools/go/analysis/internal/analysisflags.s   10379    10338    -41     -0.395%
cmd/go/internal/lockedfile.s                                         15477    15473    -4      -0.026%
cmd/internal/obj/loong64 [cmd/compile].s                             117481   117451   -30     -0.026%
cmd/internal/obj/wasm [cmd/compile].s                                83677    83613    -64     -0.076%
cmd/internal/obj/riscv [cmd/compile].s                               148985   148953   -32     -0.021%
cmd/vendor/golang.org/x/tools/internal/analysis/driverutil.s         31164    31100    -64     -0.205%
internal/exportdata [cmd/compile].s                                  8849     8800     -49     -0.554%
cmd/vendor/golang.org/x/mod/sumdb/dirhash.s                          12387    12366    -21     -0.170%
cmd/vendor/golang.org/x/tools/internal/typesinternal.s               24320    24295    -25     -0.103%
cmd/go/internal/fsys.s                                               60108    60040    -68     -0.113%
net/http.s                                                           603320   602752   -568    -0.094%
cmd/compile/internal/syntax [cmd/compile].s                          187371   187340   -31     -0.017%
cmd/cgo/internal/test.s                                              219885   219826   -59     -0.027%
net/http/httptest.s                                                  21757    21754    -3      -0.014%
cmd/compile/internal/types2.s                                        576035   575871   -164    -0.028%
net/http/cgi.s                                                       36196    36146    -50     -0.138%
net/http/httputil.s                                                  45557    45502    -55     -0.121%
cmd/compile/internal/objw.s                                          5710     5672     -38     -0.665%
net/http/pprof.s                                                     32053    32011    -42     -0.131%
internal/trace/traceviewer.s                                         34748    34695    -53     -0.153%
net/rpc.s                                                            44569    44361    -208    -0.467%
cmd/compile/internal/staticdata.s                                    21461    21446    -15     -0.070%
cmd/vendor/golang.org/x/telemetry/internal/crashmonitor.s            6104     6073     -31     -0.508%
cmd/go/internal/cfg.s                                                14419    14303    -116    -0.804%
cmd/vendor/golang.org/x/tools/go/analysis/passes/hostport.s          6834     6802     -32     -0.468%
cmd/vendor/golang.org/x/tools/go/types/objectpath.s                  19228    19118    -110    -0.572%
cmd/go/internal/imports.s                                            15978    15970    -8      -0.050%
cmd/vendor/golang.org/x/tools/internal/facts.s                       15249    15237    -12     -0.079%
cmd/vendor/golang.org/x/telemetry/internal/upload.s                  34546    33957    -589    -1.705%
cmd/vendor/golang.org/x/mod/sumdb.s                                  28991    28941    -50     -0.172%
cmd/vendor/golang.org/x/telemetry.s                                  7555     7420     -135    -1.787%
cmd/gofmt.s                                                          29924    29898    -26     -0.087%
cmd/go/internal/base.s                                               19950    19938    -12     -0.060%
cmd/vendor/golang.org/x/tools/internal/refactor/inline.s             161628   161596   -32     -0.020%
cmd/internal/script.s                                                89932    89811    -121    -0.135%
cmd/vendor/golang.org/x/tools/go/analysis/unitchecker.s              14865    14797    -68     -0.457%
cmd/vendor/golang.org/x/arch/riscv64/riscv64asm.s                    62049    62017    -32     -0.052%
cmd/vendor/golang.org/x/mod/zip.s                                    39525    39428    -97     -0.245%
cmd/compile/internal/typecheck.s                                     170567   170522   -45     -0.026%
cmd/go/internal/cache.s                                              37546    37451    -95     -0.253%
cmd/go/internal/gover.s                                              6733     6726     -7      -0.104%
cmd/vendor/golang.org/x/arch/arm/armasm.s                            30032    29991    -41     -0.137%
cmd/go/internal/auth.s                                               22485    22385    -100    -0.445%
cmd/go/internal/search.s                                             15362    15262    -100    -0.651%
cmd/vendor/golang.org/x/tools/go/analysis/passes/modernize.s         197385   196963   -422    -0.214%
cmd/go/internal/doc.s                                                62764    62590    -174    -0.277%
cmd/compile/internal/compare.s                                       10769    10758    -11     -0.102%
cmd/vendor/golang.org/x/arch/ppc64/ppc64asm.s                        208027   208005   -22     -0.011%
cmd/compile/internal/escape.s                                        72599    72560    -39     -0.054%
cmd/go/internal/mvs.s                                                30363    30339    -24     -0.079%
cmd/go/internal/vcweb.s                                              51575    51334    -241    -0.467%
cmd/go/internal/modindex.s                                           80742    80444    -298    -0.369%
cmd/vendor/golang.org/x/arch/x86/x86asm.s                            72057    72004    -53     -0.074%
cmd/compile/internal/objw [cmd/compile].s                            7408     7345     -63     -0.850%
cmd/go/internal/vcs.s                                                51661    51545    -116    -0.225%
cmd/go/internal/modfetch/codehost.s                                  110786   110689   -97     -0.088%
cmd/nm.s                                                             5055     4981     -74     -1.464%
cmd/pack.s                                                           8826     8804     -22     -0.249%
cmd/compile/internal/types2 [cmd/compile].s                          667403   667271   -132    -0.020%
cmd/internal/script/scripttest.s                                     40383    40149    -234    -0.579%
cmd/compile/internal/typecheck [cmd/compile].s                       196101   196056   -45     -0.023%
cmd/preprofile.s                                                     3127     3107     -20     -0.640%
cmd/compile/internal/staticdata [cmd/compile].s                      31032    31017    -15     -0.048%
cmd/go/internal/modfetch.s                                           134544   134056   -488    -0.363%
cmd/vendor/golang.org/x/tools/go/analysis/passes/atomic.s            2433     2408     -25     -1.028%
cmd/vendor/github.com/google/pprof/profile.s                         155233   155173   -60     -0.039%
cmd/vendor/golang.org/x/tools/go/analysis/passes/asmdecl.s           29779    29182    -597    -2.005%
cmd/link/internal/loader.s                                           91163    91116    -47     -0.052%
cmd/compile/internal/escape [cmd/compile].s                          86596    86592    -4      -0.005%
cmd/go/internal/fips140.s                                            5054     5043     -11     -0.218%
cmd/vendor/github.com/google/pprof/internal/symbolz.s                4726     4674     -52     -1.100%
cmd/vendor/golang.org/x/tools/go/analysis/passes/framepointer.s      3703     3660     -43     -1.161%
cmd/vendor/golang.org/x/tools/go/analysis/passes/loopclosure.s       6869     6844     -25     -0.364%
cmd/vendor/golang.org/x/text/language.s                              46461    46443    -18     -0.039%
cmd/vendor/golang.org/x/text/internal.s                              2514     2502     -12     -0.477%
cmd/trace.s                                                          259231   258558   -673    -0.260%
cmd/vendor/golang.org/x/tools/go/analysis/passes/ctrlflow.s          3996     3987     -9      -0.225%
cmd/vendor/golang.org/x/tools/go/analysis/passes/testinggoroutine.s  9587     9555     -32     -0.334%
cmd/vendor/golang.org/x/text/cases.s                                 38482    38463    -19     -0.049%
cmd/vendor/golang.org/x/tools/go/analysis/passes/unsafeptr.s         3150     3124     -26     -0.825%
cmd/vendor/github.com/ianlancetaylor/demangle.s                      302482   302444   -38     -0.013%
cmd/vendor/github.com/google/pprof/internal/report.s                 90542    90448    -94     -0.104%
cmd/vendor/github.com/google/pprof/internal/binutils.s               37434    37280    -154    -0.411%
cmd/vendor/rsc.io/markdown.s                                         114203   114108   -95     -0.083%
cmd/go/internal/modload.s                                            359362   358159   -1203   -0.335%
cmd/vendor/golang.org/x/build/relnote.s                              31599    31577    -22     -0.070%
cmd/vendor/github.com/google/pprof/internal/driver.s                 178419   177787   -632    -0.354%
cmd/go/internal/load.s                                               186922   186634   -288    -0.154%
cmd/link/internal/ld.s                                               643871   643415   -456    -0.071%
cmd/link/internal/riscv64.s                                          19743    19726    -17     -0.086%
cmd/go/internal/work.s                                               348917   348463   -454    -0.130%
cmd/go/internal/clean.s                                              14815    14755    -60     -0.405%
cmd/go/internal/list.s                                               29662    29630    -32     -0.108%
cmd/go/internal/tool.s                                               27842    27825    -17     -0.061%
cmd/go/internal/envcmd.s                                             49896    49872    -24     -0.048%
cmd/go/internal/test.s                                               72162    72098    -64     -0.089%
cmd/go/internal/bug.s                                                10603    10547    -56     -0.528%
cmd/go/internal/toolchain.s                                          29042    28890    -152    -0.523%
cmd/go/internal/modcmd.s                                             61916    61761    -155    -0.250%
cmd/go/internal/modget.s                                             79559    79358    -201    -0.253%
cmd/go/internal/workcmd.s                                            28612    28481    -131    -0.458%
cmd/go.s                                                             13367    13343    -24     -0.180%
cmd/compile/internal/ssa.s                                           3614387  3614418  +31     +0.001%
cmd/compile/internal/liveness.s                                      96901    96882    -19     -0.020%
cmd/compile/internal/ssa [cmd/compile].s                             3779800  3779973  +173    +0.005%
cmd/compile/internal/liveness [cmd/compile].s                        129898   129895   -3      -0.002%
cmd/compile/internal/ssagen.s                                        436780   436748   -32     -0.007%
cmd/compile/internal/ssagen [cmd/compile].s                          473190   473109   -81     -0.017%
cmd/compile/internal/walk [cmd/compile].s                            347940   347810   -130    -0.037%
cmd/compile/internal/walk.s                                          334528   334382   -146    -0.044%
cmd/compile/internal/noder.s                                         260365   260297   -68     -0.026%
cmd/compile/internal/noder [cmd/compile].s                           296865   296819   -46     -0.015%
cmd/compile/internal/gc.s                                            30442    30346    -96     -0.315%
cmd/compile/internal/gc [cmd/compile].s                              41682    41586    -96     -0.230%
total                                                                38124617 38101256 -23361  -0.061%

Change-Id: Id0b3770da69c6f666b3ff36741f75377001466c0
Reviewed-on: https://go-review.googlesource.com/c/go/+/675335
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-21 12:37:12 -08:00
Ch1n-ch1nless
d0d0a72980 cmd/compile/internal/ssa: correct type of ARM64 conditional instructions
The CCMP, CCMN, CCMPconst, and related instructions in ARM64Ops.go
were incorrectly set to type "Flag". This non-existent type caused
compilation failures during the "lower" and "late lower" passes.

Change them to the correct type, "Flags".

Change-Id: I4fbf96b8c7b051be901711948028a717ce953e5e
Reviewed-on: https://go-review.googlesource.com/c/go/+/722780
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
2025-11-21 12:36:07 -08:00
Junyang Shao
a9704f89ea internal/runtime/gc/scan: add AVX512 impl of filterNil.
Benchmark results:
ScanSpanPacked/cache=ram/pages=10368/sizeclass=25/pct=60-48          6.356Gi ± ∞ ¹    7.332Gi ± ∞ ¹        ~ (p=1.000 n=1) ²
ScanSpanPacked/cache=ram/pages=10368/sizeclass=25/pct=70-48          6.756Gi ± ∞ ¹    8.302Gi ± ∞ ¹        ~ (p=1.000 n=1) ²
ScanSpanPacked/cache=ram/pages=10368/sizeclass=25/pct=80-48          7.018Gi ± ∞ ¹    8.658Gi ± ∞ ¹        ~ (p=1.000 n=1) ²
ScanSpanPacked/cache=ram/pages=10368/sizeclass=25/pct=90-48          7.313Gi ± ∞ ¹    9.055Gi ± ∞ ¹        ~ (p=1.000 n=1) ²
ScanSpanPacked/cache=ram/pages=10368/sizeclass=25/pct=100-48         7.583Gi ± ∞ ¹    9.557Gi ± ∞ ¹        ~ (p=1.000 n=1) ²
geomean                                                              10.61Gi          14.83Gi        +39.81%

Almost a +40% on throughput.

Change-Id: I6f31a0f0202ec7f3c9d2bbffca5d6e377306fc25
Reviewed-on: https://go-review.googlesource.com/c/go/+/722040
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-21 11:45:42 -08:00
Junyang Shao
3fdd183aef [dev.simd] cmd/compile, simd: update conversion API names
This CL is to address some API audit discussion decisions.

Change-Id: Iaa206832c41852fec8fa25c23da12f65df736098
Reviewed-on: https://go-review.googlesource.com/c/go/+/721780
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-11-21 11:31:53 -08:00
Dmitri Shuralyov
ccd389036a cmd/internal/objabi: remove -V=goexperiment internal special case
This special case was added in CL 310171 for test/run.go use, as the
comment still says, but run.go (cmd/internal/testdir/testdir_test.go
by now) stopped using this in CL 310732. There don't seem to be any
other internal or external uses of this special case, so delete it.

Doing this kind of a cleanup can become harder as more time passes,
so try it as early as now and see how it goes.

Change-Id: Ib52aac51ef05166f7349cfc7d63b860a8ece7ec0
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/720620
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Michael Matloob <matloob@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-21 11:30:29 -08:00
Neal Patel
d3a0321dba [dev.simd] cmd/compile: fix incorrect mapping of SHA256MSG2128
Change-Id: Iff00fdb5cfc83c546ad564fa7618ec34d0352fdc
Reviewed-on: https://go-review.googlesource.com/c/go/+/722640
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: David Chase <drchase@google.com>
2025-11-21 11:07:17 -08:00
Michael Pratt
e7787b9eca runtime: go fmt
Change-Id: I6a6a636cf38ddb1dc6f2170361eb4093b81acdfb
Reviewed-on: https://go-review.googlesource.com/c/go/+/722521
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-11-21 11:07:05 -08:00
Michael Pratt
17b3b98796 internal/strconv: go fmt
Change-Id: I6a6a636ccd140dc5318f45bb2dc7236a5a43b1cf
Reviewed-on: https://go-review.googlesource.com/c/go/+/722523
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
2025-11-21 10:51:44 -08:00
Michael Pratt
c851827c68 internal/trace: go fmt
Change-Id: I6a6a636c8f14008d3da6c526be10fa3386d4ec32
Reviewed-on: https://go-review.googlesource.com/c/go/+/722522
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>
2025-11-21 10:51:35 -08:00
Jakub Ciolek
f87aaec53d cmd/compile: fix integer overflow in prove pass
The detectSliceLenRelation function incorrectly deduced lower bounds
for "len(s) - i" without checking if the subtraction could overflow
(e.g. when i is negative). This led to incorrect elimination of
bounds checks.

Fixes: #76355
Change-Id: I30ada0e5f1425929ddd8ae1b66e55096ec209b5b
Reviewed-on: https://go-review.googlesource.com/c/go/+/721920
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@google.com>
2025-11-21 10:34:21 -08:00
Jes Cok
dbd2ab9992 cmd/compile/internal: fix typos
Change-Id: I5974f5b460f827877f49f69aff01ce5042f511c0
GitHub-Last-Rev: 552d12c0e6
GitHub-Pull-Request: golang/go#76398
Reviewed-on: https://go-review.googlesource.com/c/go/+/722900
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@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Robert Griesemer <gri@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
2025-11-21 09:48:22 -08:00
Jes Cok
b9d86baae3 cmd/compile/internal/devirtualize: fix typos
Change-Id: I4f5a89f452a252018072d067da4cdb9a6cb0f4fe
GitHub-Last-Rev: 7eb108d387
GitHub-Pull-Request: golang/go#76396
Reviewed-on: https://go-review.googlesource.com/c/go/+/722860
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Griesemer <gri@google.com>
2025-11-21 09:33:16 -08:00
WANG Xuerui
4b0e3cc1d6 cmd/link: support loading R_LARCH_PCREL20_S2 and R_LARCH_CALL36 relocs
Host libgcc.a (among other libraries) on loong64 systems may contain
such relocs if built with the "medium" code model and/or linker
relaxation, which is increasingly the case. Make the internal linker
aware of these for cgo interopability going forward.

While at it, fix some of the comments for the loong64-specific
RelocTypes.

Fixes #75562

Change-Id: I0810969dcd229c5131ef06b0f70f51d81a3be4cd
Reviewed-on: https://go-review.googlesource.com/c/go/+/709717
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-11-20 19:04:50 -08:00
David Chase
74ebdd28d1 [dev.simd] simd, cmd/compile: add more element types for Select128FromPair
Also includes a comment cleanup pass.
Fixed NAME processing for additional documentation.

Change-Id: Ide5b60c17ddbf3c6eafd20147981c59493fc8133
Reviewed-on: https://go-review.googlesource.com/c/go/+/722180
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-20 17:48:29 -08:00
David Chase
4d26d66a49 [dev.simd] simd: fix signatures for PermuteConstant* methods
This moves the packed-immediate methods to package-private,
and adds exported versions with four parameters.

Rename PermuteConstant to PermuteScalars
Rename VPSHUFB Permute to PermuteOrZero
Rename Permute2 to ConcatPermute

Comments were repaired/enhanced.

Modified the generator to support an additional tag
"hideMaskMethods : true" to suppress method, intrinsic,
generic, and generic translation generation for said
mask-modified versions of such methods (this is already
true for exported methods).

Change-Id: I91e208c1fff1f28ebce4edb4e73d26003715018c
Reviewed-on: https://go-review.googlesource.com/c/go/+/721342
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-11-20 17:47:32 -08:00
Guoqi Chen
cdba82c7d6 cmd/internal/obj/loong64: add {,X}VSLT.{B/H/W/V}{,U} instructions support
Go asm syntax:
	 VSLT{B,H,W,V}    V1,   V2, V3
	 VSLT{B,H,W,V}U   V1,   V2, V3
	 VSLT{B,H,W,V}    $-2,  V2, V3
	 VSLT{B,H,W,V}U   $8,   V2, V3
	XVSLT{B,H,W,V}    X1,   X2, X3
	XVSLT{B,H,W,V}U   X1,   X2, X3
	XVSLT{B,H,W,V}    $-16, X2, X3
	XVSLT{B,H,W,V}U   $31,  X2, X3

  Equivalent platform assembler syntax:
	 vslt.{b,h,w,d}    v3, v2, v1
	 vslt.{b,h,w,d}u   v3, v2, v1
	 vslti.{b,h,w,d}   v3, v2, $-2
	 vslti.{b,h,w,d}u  v3, v2, $8
	xvslt.{b,h,w,d}    x3, x2, x1
	xvslt.{b,h,w,d}u   x3, x2, x1
	xvslti.{b,h,w,d}   x3, x2, $-16
	xvslti.{b,h,w,d}u  x3, x2, $31

Change-Id: Iccfb65c0c19b62d2c5ec279a077393c68e1bf7d4
Reviewed-on: https://go-review.googlesource.com/c/go/+/721620
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-20 16:57:08 -08:00
Damien Neil
bd2b117c2c crypto/tls: add QUICErrorEvent
Add a new QUICEvent type for reporting errors.
This provides a way to report errors that don't occur as a result of
QUICConn.Start, QUICConn.HandleData, or QUICConn.SendSessionTicket.

Fixes #75108

Change-Id: I941371a21f26b940e75287a66d7e0211fc0baab1
Reviewed-on: https://go-review.googlesource.com/c/go/+/719040
Auto-Submit: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
2025-11-20 15:39:14 -08:00
Nicholas S. Husin
3ad2e113fc net/http/httputil: wrap ReverseProxy's outbound request body so Close is a noop
Within ReverseProxy, we are currently sending a clone of our inbound
request (from client) as our outbound request (to upstream). However,
the clone of the request has a shallow copy of the request body. As a
result, when the outbound request body is closed, the inbound request
body (i.e. the outbound request body of the client) will also be closed.

This causes an unfortunate effect where we would infinitely hang when a
client sends a request with a 100-continue header via a ReverseProxy,
but the ReverseProxy fails to make a connection to the upstream server.

When this happens, the ReverseProxy's outbound request body would be
closed, which in turns also closes the client's request body.
Internally, when we close a request body, we would try to consume and
discard the content. Since the client has yet to actually send the body
content (due to 100-continue header) though, an infinite hang occurs.

To prevent this, we make sure that closing an outbound request body from
a ReverseProxy is a noop.

For #75933

Change-Id: I52dc7247f689f35a6e93d1f32b2d003d90e9d2c6
Reviewed-on: https://go-review.googlesource.com/c/go/+/722160
Reviewed-by: Nicholas Husin <husin@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-20 15:15:20 -08:00
Michael Pratt
d58b733646 runtime: track goroutine location until actual STW
TestTraceSTW / TestTraceGCSTW currently tracks the location (M/P) of the
target goroutines until it reaches the "start" log message, assuming the
actual STW comes immediately afterwards.

On 386 with TestTraceGCSTW, it actually tends to take >10ms after the
start log before the STW actually occurs. This is enough time for sysmon
to preempt the target goroutines and migration them to another location.

Fix this by continuing tracking all the way until the STW itself occurs.
We still keep the start log message so we can ignore any STW (if any)
before we expect.

Cq-Include-Trybots: luci.golang.try:gotip-linux-386-longtest,gotip-linux-amd64-longtest
Change-Id: I6a6a636cf2dcb18d8b33ac4ad88333cabff2eabb
Reviewed-on: https://go-review.googlesource.com/c/go/+/722520
Reviewed-by: 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>
2025-11-20 15:01:20 -08:00
Alan Donovan
1bc54868d4 cmd/vendor: update to x/tools@68724af
This causes the go1.26 vet printf analyzer to deduce printf
wrappers via interface methods (#76368).

For #76368

Change-Id: I80e6d3b21bdffb5d925a162af7c4b21b1357bb89
Reviewed-on: https://go-review.googlesource.com/c/go/+/722540
Auto-Submit: Alan Donovan <adonovan@google.com>
Commit-Queue: Alan Donovan <adonovan@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-20 14:44:01 -08:00
Keith Randall
8c3195973b runtime: disable stack allocation tests on sanitizers
CL 707755 broke the asan/msan builders.

Change-Id: Ic9738140999a9bcfc94cecfe0964a5f1bc243c56
Reviewed-on: https://go-review.googlesource.com/c/go/+/722480
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@google.com>
2025-11-20 14:42:50 -08:00
Damien Neil
ff654ea100 net/url: permit colons in the host of postgresql:// URLs
PostgreSQL's postgresql:// URL scheme permits a comma-separated list of
host:ports to appear in the host subcomponent:
https://www.postgresql.org/docs/11/libpq-connect.html#LIBPQ-MULTIPLE-HOSTS

While this is not compliant with RFC 3986, it's something we've accepted
for a long time. Continue to accept colons in the host when the URL
scheme is "postgresql".

Fixes #75859

Change-Id: Iaa2e82b0be11d8e034e10dd7f4d6070039acfa2c
Reviewed-on: https://go-review.googlesource.com/c/go/+/722300
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sean Liao <sean@liao.dev>
2025-11-20 14:25:21 -08:00
Sean Liao
a662badab9 encoding/json: remove linknames
The linknames have been removed in the latest commits:

isValidNumber, typeFields:
908af5dfaf

unquoteBytes:
8e9090a84b

For #67401

Change-Id: I30b057137932fcf267014ab5470c417298765249
Reviewed-on: https://go-review.googlesource.com/c/go/+/721160
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
2025-11-20 14:04:37 -08:00
Taichi Maeda
5afe237d65 mime: add missing path for mime types in godoc
ExtensionsByType was missing godoc for a mime.types file path
that was added in CL 236677.

Change-Id: Ia04fa90f01490fc1f063c4905aea65d240935cab
Reviewed-on: https://go-review.googlesource.com/c/go/+/721580
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Auto-Submit: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-20 13:02:54 -08:00
Filippo Valsorda
c1b7112af8 os/signal: make NotifyContext cancel the context with a cause
This is especially useful when combined with the nesting semantics of
context.Cause, and with errgroup's use of CancelCauseFunc.

For example, with the following code

	ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt)
	defer stop()
	serveGroup, ctx := errgroup.WithContext(ctx)

calling context.Cause(ctx) after serveGroup.Wait() will return either
"interrupt signal received" (if that happens first) or the error from
serveGroup.

Change-Id: Ie181f5f84269f6e39defdad2d5fd8ead6a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/721700
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Commit-Queue: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-11-20 13:01:32 -08:00
Cherry Mui
e3d4645693 [dev.simd] all: merge master (ca37d24) into dev.simd
Conflicts:

- src/cmd/compile/internal/typecheck/builtin.go

Merge List:

+ 2025-11-20 ca37d24e0b net/http: drop unused "broken" field from persistConn
+ 2025-11-20 4b740af56a cmd/internal/obj/x86: handle global reference in From3 in dynlink mode
+ 2025-11-20 790384c6c2 spec: adjust rule for type parameter on RHS of alias declaration
+ 2025-11-20 a49b0302d0 net/http: correctly close fake net.Conns
+ 2025-11-20 32f5aadd2f cmd/compile: stack allocate backing stores during append
+ 2025-11-20 a18aff8057 runtime: select GC mark workers during start-the-world
+ 2025-11-20 829779f4fe runtime: split findRunnableGCWorker in two
+ 2025-11-20 ab59569099 go/version: use "custom" as an example of a version suffix
+ 2025-11-19 c4bb9653ba cmd/compile: Implement LoweredZeroLoop with LSX Instruction on loong64
+ 2025-11-19 7f2ae21fb4 cmd/internal/obj/loong64: add MULW.D.W[U] instructions
+ 2025-11-19 a2946f2385 crypto: add Encapsulator and Decapsulator interfaces
+ 2025-11-19 6b83bd7146 crypto/ecdh: add KeyExchanger interface
+ 2025-11-19 4fef9f8b55 go/types, types2: fix object path for grouped declaration statements
+ 2025-11-19 33529db142 spec: escape double-ampersands
+ 2025-11-19 dc42565a20 cmd/compile: fix control flow for unsigned divisions proof relations
+ 2025-11-19 e64023dcbf cmd/compile: cleanup useless if statement in prove
+ 2025-11-19 2239520d1c test: go fmt prove.go tests
+ 2025-11-19 489d3dafb7 math: switch s390x math.Pow to generic implementation
+ 2025-11-18 8c41a482f9 runtime: add dlog.hexdump
+ 2025-11-18 e912618bd2 runtime: add hexdumper
+ 2025-11-18 2cf9d4b62f Revert "net/http: do not discard body content when closing it within request handlers"
+ 2025-11-18 4d0658bb08 cmd/compile: prefer fixed registers for values
+ 2025-11-18 ba634ca5c7 cmd/compile: fold boolean NOT into branches
+ 2025-11-18 8806d53c10 cmd/link: align sections, not symbols after DWARF compress
+ 2025-11-18 c93766007d runtime: do not print recovered when double panic with the same value
+ 2025-11-18 9859b43643 cmd/asm,cmd/compile,cmd/internal/obj/riscv: use compressed instructions on riscv64
+ 2025-11-17 b9ef0633f6 cmd/internal/sys,internal/goarch,runtime: enable the use of compressed instructions on riscv64
+ 2025-11-17 a087dea869 debug/elf: sync new loong64 relocation types up to LoongArch ELF psABI v20250521
+ 2025-11-17 e1a12c781f cmd/compile: use 32x32->64 multiplies on arm64
+ 2025-11-17 6caab99026 runtime: relax TestMemoryLimit on darwin a bit more
+ 2025-11-17 eda2e8c683 runtime: clear frame pointer at thread entry points
+ 2025-11-17 6919858338 runtime: rename findrunnable references to findRunnable
+ 2025-11-17 8e734ec954 go/ast: fix BasicLit.End position for raw strings containing \r
+ 2025-11-17 592775ec7d crypto/mlkem: avoid a few unnecessary inverse NTT calls
+ 2025-11-17 590cf18daf crypto/mlkem/mlkemtest: add derandomized Encapsulate768/1024
+ 2025-11-17 c12c337099 cmd/compile: teach prove about subtract idioms
+ 2025-11-17 bc15963813 cmd/compile: clean up prove pass
+ 2025-11-17 1297fae708 go/token: add (*File).End method
+ 2025-11-17 65c09eafdf runtime: hoist invariant code out of heapBitsSmallForAddrInline
+ 2025-11-17 594129b80c internal/runtime/maps: update doc for table.Clear
+ 2025-11-15 c58d075e9a crypto/rsa: deprecate PKCS#1 v1.5 encryption
+ 2025-11-14 d55ecea9e5 runtime: usleep before stealing runnext only if not in syscall
+ 2025-11-14 410ef44f00 cmd: update x/tools to 59ff18c
+ 2025-11-14 50128a2154 runtime: support runtime.freegc in size-specialized mallocs for noscan objects
+ 2025-11-14 c3708350a4 cmd/go: tests: rename git-min-vers->git-sha256
+ 2025-11-14 aea881230d std: fix printf("%q", int) mistakes
+ 2025-11-14 120f1874ef runtime: add more precise test of assist credit handling for runtime.freegc
+ 2025-11-14 fecfcaa4f6 runtime: add runtime.freegc to reduce GC work
+ 2025-11-14 5a347b775e runtime: set GOEXPERIMENT=runtimefreegc to disabled by default
+ 2025-11-14 1a03d0db3f runtime: skip tests for GOEXPERIMENT=arenas that do not handle clobberfree=1
+ 2025-11-14 cb0d9980f5 net/http: do not discard body content when closing it within request handlers
+ 2025-11-14 03ed43988f cmd/compile: allow multi-field structs to be stored directly in interfaces
+ 2025-11-14 1bb1f2bf0c runtime: put AddCleanup cleanup arguments in their own allocation
+ 2025-11-14 9fd2e44439 runtime: add AddCleanup benchmark
+ 2025-11-14 80c91eedbb runtime: ensure weak handles end up in their own allocation
+ 2025-11-14 7a8d0b5d53 runtime: add debug mode to extend _Grunning-without-P windows
+ 2025-11-14 710abf74da internal/runtime/cgobench: add Go function call benchmark for comparison
+ 2025-11-14 b24aec598b doc, cmd/internal/obj/riscv: document the riscv64 assembler
+ 2025-11-14 a0e738c657 cmd/compile/internal: remove incorrect riscv64 SLTI rule
+ 2025-11-14 2cdcc4150b cmd/compile: fold negation into multiplication
+ 2025-11-14 b57962b7c7 bytes: fix panic in bytes.Buffer.Peek
+ 2025-11-14 0a569528ea cmd/compile: optimize comparisons with single bit difference
+ 2025-11-14 1e5e6663e9 cmd/compile: remove unnecessary casts and types from riscv64 rules
+ 2025-11-14 ddd8558e61 go/types, types2: swap object.color for Checker.objPathIdx
+ 2025-11-14 9daaab305c cmd/link/internal/ld: make runtime.buildVersion with experiments valid
+ 2025-11-13 d50a571ddf test: fix tests to work with sizespecializedmalloc turned off
+ 2025-11-13 704f841eab cmd/trace: annotation proc start/stop with thread and proc always
+ 2025-11-13 17a02b9106 net/http: remove unused isLitOrSingle and isNotToken
+ 2025-11-13 ff61991aed cmd/go: fix flaky TestScript/mod_get_direct
+ 2025-11-13 129d0cb543 net/http/cgi: accept INCLUDED as protocol for server side includes
+ 2025-11-13 77c5130100 go/types: minor simplification
+ 2025-11-13 7601cd3880 go/types: generate cycles.go
+ 2025-11-13 7a372affd9 go/types, types2: rename definedType to declaredType and clarify docs

Change-Id: Ibaa9bdb982364892f80e511c1bb12661fcd5fb86
2025-11-20 14:40:43 -05:00
Damien Neil
ca37d24e0b net/http: drop unused "broken" field from persistConn
Change-Id: Ic65cf98c090c73299b5e88e642e91139315d8e52
Reviewed-on: https://go-review.googlesource.com/c/go/+/722221
Auto-Submit: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Nicholas Husin <husin@google.com>
Reviewed-by: Nicholas Husin <nsh@golang.org>
2025-11-20 11:18:50 -08:00
Cherry Mui
4b740af56a cmd/internal/obj/x86: handle global reference in From3 in dynlink mode
In dynlink mode, we rewrite reference to a global variable to
a load from the GOT. Currently this code does not handle the case
that the global reference is in From3 of a Prog. Most instructions
don't expect a memory operand in From3, but some do, like
VGF2P8AFFINEQB. Handle this case.

Change-Id: Ibb6773606e6967bcc629d9ef5dac6e050f4008ef
Reviewed-on: https://go-review.googlesource.com/c/go/+/722181
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-11-20 11:05:03 -08:00
Robert Griesemer
790384c6c2 spec: adjust rule for type parameter on RHS of alias declaration
Per discussion on issue #75885, a type parameter on the RHS of an alias
declaration must not be declared in the same declaration (but it may be
declared by an enclosing function). This relaxes the spec slightly and
allows for (pre-existing) test cases.

Add a corresponding check to the type checker (there was no check for
type parameters on the RHS of alias declarations at all, before).

Fixes #75884.
Fixes #75885.

Change-Id: I1e5675978e6423d626c068829d4bf5e90035ea82
Reviewed-on: https://go-review.googlesource.com/c/go/+/721820
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-20 10:25:17 -08:00
Damien Neil
a49b0302d0 net/http: correctly close fake net.Conns
Fix an inverted test in fakeNetConn.Close that caused closing
a connection to not break the other half of the connection.

Change-Id: I4e53f78402f8e503c749d57f294a4524abdccfb5
Reviewed-on: https://go-review.googlesource.com/c/go/+/722220
Reviewed-by: Nicholas Husin <nsh@golang.org>
Reviewed-by: Nicholas Husin <husin@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-20 10:14:05 -08:00
David Chase
95b4ad525f [dev.simd] simd: reorganize internal tests so that simd does not import testing
Change-Id: Id68835fd8f93d2252a072132ff1b8ee39f197977
Reviewed-on: https://go-review.googlesource.com/c/go/+/721940
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-11-20 09:49:05 -08:00
khr@golang.org
32f5aadd2f cmd/compile: stack allocate backing stores during append
We can already stack allocate the backing store during append if the
resulting backing store doesn't escape. See CL 664299.

This CL enables us to often stack allocate the backing store during
append *even if* the result escapes. Typically, for code like:

    func f(n int) []int {
        var r []int
        for i := range n {
            r = append(r, i)
        }
        return r
    }

the backing store for r escapes, but only by returning it.
Could we operate with r on the stack for most of its lifeime,
and only move it to the heap at the return point?

The current implementation of append will need to do an allocation
each time it calls growslice. This will happen on the 1st, 2nd, 4th,
8th, etc. append calls. The allocations done by all but the
last growslice call will then immediately be garbage.

We'd like to avoid doing some of those intermediate allocations
if possible. We rewrite the above code by introducing a move2heap
operation:

    func f(n int) []int {
        var r []int
        for i := range n {
            r = append(r, i)
        }
        r = move2heap(r)
        return r
    }

Using the move2heap runtime function, which does:

    move2heap(r):
        If r is already backed by heap storage, return r.
        Otherwise, copy r to the heap and return the copy.

Now we can treat the backing store of r allocated at the
append site as not escaping. Previous stack allocation
optimizations now apply, which can use a fixed-size
stack-allocated backing store for r when appending.

See the description in cmd/compile/internal/slice/slice.go
for how we ensure that this optimization is safe.

Change-Id: I81f36e58bade2241d07f67967d8d547fff5302b8
Reviewed-on: https://go-review.googlesource.com/c/go/+/707755
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-20 09:19:39 -08:00
Michael Pratt
a18aff8057 runtime: select GC mark workers during start-the-world
When the GC starts today, procresize and startTheWorldWithSema don't
consider the additional Ps required to run the mark workers. procresize
and startTheWorldWithSema resume only the Ps necessary to run the normal
user goroutines.

Once those Ps start, findRunnable and findRunnableGCWorker determine
that a GC worker is necessary and run the worker instead, calling wakep
to wake another P to run the original user goroutine.

This is unfortunate because it disrupts the intentional placement of Ps
on Ms that procresize does. It also has the unfortunate side effect of
slightly delaying start-the-world time, as it takes several sequential
wakeps to get all Ps started.

To address this, procresize explicitly assigns GC mark workers to Ps
before starting the world. The assignment occurs _after_ selecting
runnable Ps, so that we prefer to select Ps that were previously idle.

Note that if fewer than 25% of Ps are idle then we won't be able to
assign all dedicated workers, and some of the Ps intended for user
goroutines will convert to dedicated workers once they reach
findRunnableGCWorker.

Also note that stack scanning temporarily suspends the goroutine. Resume
occurs through ready, which will move the goroutine to the local runq of
the P that did the scan. Thus there is still a source of migration at
some point during the GC.

For #65694.

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest
Change-Id: I6a6a636c51f39f4f4bc716aa87de68f6ebe163a5
Reviewed-on: https://go-review.googlesource.com/c/go/+/721002
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-11-20 08:10:14 -08:00
Michael Pratt
829779f4fe runtime: split findRunnableGCWorker in two
The first part, assignWaitingGCWorker selects a mark worker (if any) and
assigns it to the P. The second part, findRunnableGCWorker, is
responsible for actually marking the worker as runnable and updating the
CPU limiter.

The advantage of this split is that assignWaitingGCWorker is safe to do
during STW, which will allow the next CL to make selections during
procresize.

This change is a semantic no-op in preparation for the next CL.

For #65694.

Change-Id: I6a6a636c8beb212185829946cfa1e49f706ac31a
Reviewed-on: https://go-review.googlesource.com/c/go/+/721001
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>
2025-11-20 08:08:47 -08:00
Dmitri Shuralyov
ab59569099 go/version: use "custom" as an example of a version suffix
The suffix in a non-standard toolchain version can be any string. Show
more of a middle ground example of a non-standard version suffix,
aligning it with the example used at https://go.dev/doc/toolchain#name.

For #75953.

Change-Id: I98f9c4de98316aecf76c017eb13cf25582c8939c
Reviewed-on: https://go-review.googlesource.com/c/go/+/720621
Reviewed-by: Quim Muntal <quimmuntal@gmail.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@google.com>
2025-11-20 08:02:33 -08:00
Guoqi Chen
c4bb9653ba cmd/compile: Implement LoweredZeroLoop with LSX Instruction on loong64
goos: linux
goarch: loong64
pkg: runtime
cpu: Loongson-3A6000 @ 2500.00MHz
                   |   old.txt    |               new.txt               |
                   |    sec/op    |   sec/op     vs base                |
ClearFat256           6.406n ± 0%   3.329n ± 1%  -48.03% (p=0.000 n=10)
ClearFat512          12.810n ± 0%   7.607n ± 0%  -40.62% (p=0.000 n=10)
ClearFat1024          25.62n ± 0%   14.01n ± 0%  -45.32% (p=0.000 n=10)
ClearFat1032          26.02n ± 0%   14.28n ± 0%  -45.14% (p=0.000 n=10)
ClearFat1040          26.02n ± 0%   14.41n ± 0%  -44.62% (p=0.000 n=10)
MemclrKnownSize192    4.804n ± 0%   2.827n ± 0%  -41.15% (p=0.000 n=10)
MemclrKnownSize248    6.561n ± 0%   4.371n ± 0%  -33.38% (p=0.000 n=10)
MemclrKnownSize256    6.406n ± 0%   3.335n ± 0%  -47.94% (p=0.000 n=10)
geomean               11.41n        6.453n       -43.45%

goos: linux
goarch: loong64
pkg: runtime
cpu: Loongson-3C5000 @ 2200.00MHz
                   |   old.txt    |               new.txt               |
                   |    sec/op    |   sec/op     vs base                |
ClearFat256          14.570n ± 0%   7.284n ± 0%  -50.01% (p=0.000 n=10)
ClearFat512           29.13n ± 0%   14.57n ± 0%  -49.98% (p=0.000 n=10)
ClearFat1024          58.26n ± 0%   29.15n ± 0%  -49.97% (p=0.000 n=10)
ClearFat1032          58.73n ± 0%   29.15n ± 0%  -50.36% (p=0.000 n=10)
ClearFat1040          59.18n ± 0%   29.26n ± 0%  -50.56% (p=0.000 n=10)
MemclrKnownSize192   10.930n ± 0%   5.466n ± 0%  -49.99% (p=0.000 n=10)
MemclrKnownSize248   14.110n ± 0%   6.772n ± 0%  -52.01% (p=0.000 n=10)
MemclrKnownSize256   14.570n ± 0%   7.285n ± 0%  -50.00% (p=0.000 n=10)
geomean               25.75n        12.78n       -50.36%

Change-Id: I88d7b6ae2f6fc3f095979f24fb83ff42a9d2d42e
Reviewed-on: https://go-review.googlesource.com/c/go/+/720940
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
2025-11-19 19:38:42 -08:00
Xiaolin Zhao
7f2ae21fb4 cmd/internal/obj/loong64: add MULW.D.W[U] instructions
Go asm syntax:
	MULWVW		RK, RJ, RD
	MULWVWU		RK, RJ, RD

Equivalent platform assembler syntax:
	mulw.d.w	rd, rj, rk
	mulw.d.wu	rd, rj, rk

Change-Id: Ie46a21904a4c25d04200b0663f83072c38a76c6f
Reviewed-on: https://go-review.googlesource.com/c/go/+/721521
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Keith Randall <khr@google.com>
2025-11-19 19:00:54 -08:00
Filippo Valsorda
a2946f2385 crypto: add Encapsulator and Decapsulator interfaces
Updates #75300

Change-Id: I6a6a6964a0ab36ee3132d8481515c34c86011c13
Reviewed-on: https://go-review.googlesource.com/c/go/+/705796
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-19 14:14:13 -08:00
Filippo Valsorda
6b83bd7146 crypto/ecdh: add KeyExchanger interface
Updates #75300

Change-Id: I6a6a6964bbfa1f099c74d0a3fb3f7894d7b1b832
Reviewed-on: https://go-review.googlesource.com/c/go/+/705795
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
2025-11-19 14:14:05 -08:00
Mark Freeman
4fef9f8b55 go/types, types2: fix object path for grouped declaration statements
CL 715840 deferred popping from the object path during handling of
grouped declaration statements, which leaves extra objects on the
path since this executes in a loop.

Surprisingly, no test exercised this. This change fixes this small
bug and adds a supporting test.

Fixes #76366

Change-Id: I7fc038b39d3871eea3e60855c46614b463bcfa4f
Reviewed-on: https://go-review.googlesource.com/c/go/+/722060
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-19 13:38:11 -08:00
zigo101
33529db142 spec: escape double-ampersands
Change-Id: I7ce375f975a86e4c2494d2003aeb9b4a86caff3e
GitHub-Last-Rev: a368bc0208
GitHub-Pull-Request: golang/go#76299
Reviewed-on: https://go-review.googlesource.com/c/go/+/720460
Auto-Submit: Sean Liao <sean@liao.dev>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-19 13:35:12 -08:00
Jorropo
dc42565a20 cmd/compile: fix control flow for unsigned divisions proof relations
The continue used to make sense since I first wrote this patch with a loop,
for testing the commutativity of the add.

This was refactored to just try both but I forgot to fix the continue.

Change-Id: I91466a052d5d8ee7193084a71faf69bd27e36d2a
Reviewed-on: https://go-review.googlesource.com/c/go/+/721204
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
2025-11-19 13:33:58 -08:00
Jorropo
e64023dcbf cmd/compile: cleanup useless if statement in prove
Change-Id: Icf5db366b311b5f88809dd07f22cf4bfdead516c
Reviewed-on: https://go-review.googlesource.com/c/go/+/721203
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
2025-11-19 13:33:55 -08:00
Jorropo
2239520d1c test: go fmt prove.go tests
Change-Id: Ia4c2ceffcf2bfde862e9dba02a4b38245f868692
Reviewed-on: https://go-review.googlesource.com/c/go/+/721202
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
2025-11-19 13:33:52 -08:00
Srinivas Pokala
489d3dafb7 math: switch s390x math.Pow to generic implementation
The s390x assembly implementation of math.Pow incorrectly handles
certain subnormal cases. This change switches the function to use the
generic implementation instead.

Updates #76247

Cq-Include-Trybots: luci.golang.try:gotip-linux-s390x
Change-Id: I794339080d5a7acf79bbffaeb0214809006fd30c
Reviewed-on: https://go-review.googlesource.com/c/go/+/720540
Reviewed-by: Vishwanatha HD <vishwanatha.hd@ibm.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Kiran M Vijay IBM <kiran.m.vijay@ibm.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
2025-11-19 13:32:20 -08:00
Austin Clements
3fe246ae0f [dev.simd] simd: make 'go generate' generate everything
The simd package involves quite a lot of code generation.
Currently, that's spread across a few different tools.
Bring the process together in simd/_gen/main.go and make
'go generate' in the simd package do the right thing.

Change-Id: Iba7e120987f13840a23ed32a528e2398fc7a6065
Reviewed-on: https://go-review.googlesource.com/c/go/+/721663
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Austin Clements <austin@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-18 15:13:48 -08:00
Austin Clements
cf45adf140 [dev.simd] simd: move template code generator into _gen
The XED-driven generator lives in simd/_gen, so move the other
template-driven code generator in simd/_gen as well.

Change-Id: Iedf0cc11bf9862e2808e77292d9960818976c698
Reviewed-on: https://go-review.googlesource.com/c/go/+/721662
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Austin Clements <austin@google.com>
2025-11-18 15:13:45 -08:00
Austin Clements
8c41a482f9 runtime: add dlog.hexdump
Change-Id: I8149ab9314216bb8f9bf58da55633e2587d75851
Reviewed-on: https://go-review.googlesource.com/c/go/+/681376
Auto-Submit: Austin Clements <austin@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-18 11:46:42 -08:00
Austin Clements
e912618bd2 runtime: add hexdumper
Currently, we have a simple hexdumpWords facility for debugging. It's
useful but pretty limited.

This CL adds a much more configurable and capable "hexdumper". It can
be configured for any word size (including bytes), handles unaligned
data, includes an ASCII dump, and accepts data in multiple slices. It
also has a much nicer "mark" facility for annotating the hexdump that
isn't limited to a single character per word.

We use this to improve our existing hexdumps, particularly the new
mark facility. The next CL will integrate hexdumps into debuglog,
which will make use of several other new capabilities.

Also this adds an actual test.

The output looks like:

                       7 6 5 4  3 2 1 0   f e d c  b a 9 8  0123456789abcdef
    000000c00006ef70:                    03000000 00000000          ........
    000000c00006ef80: 00000000 0053da80  000000c0 000bc380  ..S.............
                      ^ <testing.tRunner.func2+0x0>
    000000c00006ef90: 00000000 0053dac0  000000c0 000bc380  ..S.............
                      ^ <testing.tRunner.func1+0x0>
    000000c00006efa0: 000000c0 0006ef90  000000c0 0006ef80  ................
    000000c00006efb0: 000000c0 0006efd0  00000000 0053eb65  ........e.S.....
                                         ^ <testing.(*T).Run.gowrap1+0x25>
    000000c00006efc0: 000000c0 000bc380  00000000 009aaae8  ................
    000000c00006efd0: 00000000 00000000  00000000 00496b01  .........kI.....
                                         ^ <runtime.goexit+0x1>
    000000c00006efe0: 00000000 00000000  00000000 00000000  ................
    000000c00006eff0: 00000000 00000000                     ........

The header gives column labels, indicating the order of bytes within
the following words. The addresses on the left are always 16-byte
aligned so it's easy to combine that address with the column header to
determine the full address of a byte. Annotations are no longer
interleaved with the data, so the data stays in nicely aligned
columns. The annotations are also now much more flexible, including
support for multiple annotations on the same word (not shown).

Change-Id: I27e83800a1f6a7bdd3cc2c59614661a810a57d4d
Reviewed-on: https://go-review.googlesource.com/c/go/+/681375
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Austin Clements <austin@google.com>
2025-11-18 11:41:32 -08:00
Nicholas S. Husin
2cf9d4b62f Revert "net/http: do not discard body content when closing it within request handlers"
This reverts commit cb0d9980f5.

Reason for revert: the old behavior seems to be relied on by current
users, e.g.
cb2e11fb88/protocol_connect.go (L837).

For #75933

Change-Id: I996280238e5c70a8d760a0b31e3a13c6a44b8616
Reviewed-on: https://go-review.googlesource.com/c/go/+/721761
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Nicholas Husin <nsh@golang.org>
Reviewed-by: Nicholas Husin <husin@google.com>
2025-11-18 11:07:45 -08:00
Austin Clements
19b4a30899 [dev.simd] simd/_gen/simdgen: remove outdated asm.yaml.toy
Change-Id: Ic6f61498b22d8b871642e4a01fd82599bfd3e93b
Reviewed-on: https://go-review.googlesource.com/c/go/+/721661
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Auto-Submit: Austin Clements <austin@google.com>
2025-11-18 09:52:30 -08:00
Keith Randall
4d0658bb08 cmd/compile: prefer fixed registers for values
For this code:

func f() (int, int) {
	return 0, 0
}

We currently generate on arm64:

   MOVD ZR, R0
   MOVD R0, R1

This CL changes that to

   MOVD ZR, R0
   MOVD ZR, R1

Probably not a big performance difference, but it makes the generated
code clearer.

A followup-ish CL from 633075 when the zero fixed register was exposed
to the register allocator.

Change-Id: I869a92817dcbbca46c900999fab538e76e10ed05
Reviewed-on: https://go-review.googlesource.com/c/go/+/721440
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-18 09:37:02 -08:00
Keith Randall
ba634ca5c7 cmd/compile: fold boolean NOT into branches
Gets rid of an EOR $1 instruction.

Change-Id: Ib032b0cee9ac484329c978af9b1305446f8d5dac
Reviewed-on: https://go-review.googlesource.com/c/go/+/721501
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@google.com>
2025-11-18 09:31:58 -08:00
David Chase
9461db5c59 [dev.simd] simd: fix comment in file generator
the comment was accidentally updated in the generated file,
and the update was good.  So update the generator, too.

Change-Id: I6a76aa3bdb7fb78378508b95248939567bff69e4
Reviewed-on: https://go-review.googlesource.com/c/go/+/721341
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Austin Clements <austin@google.com>
2025-11-18 09:26:13 -08:00
David Chase
4004ff3523 [dev.simd] simd: remove FlattenedTranspose from exports
Change-Id: If20dc09aa9d84d5b87f16a510e6e8d7fb06114b8
Reviewed-on: https://go-review.googlesource.com/c/go/+/719963
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Austin Clements <austin@google.com>
2025-11-18 09:26:05 -08:00
Junyang Shao
896f293a25 [dev.simd] cmd/compile, simd: change DotProductQuadruple and add peepholes
This CL addressed some API change decisions in the API audit.
Instead of exposing the Intel format, we hide the add part of the
instructions under the peephole, and rename the API as
DotProdQuadruple

Change-Id: I471c0a755174bc15dd83bdc0f757d6356b92d835
Reviewed-on: https://go-review.googlesource.com/c/go/+/721420
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-18 09:02:23 -08:00
Cherry Mui
8806d53c10 cmd/link: align sections, not symbols after DWARF compress
After DWARF compression, we recompute the symbol and section
addresses. On Windows, we need to align the sections to
PEFILEALIGN. But the code actually apply the alignment to every
symbol. This works mostly fine as after compression a section
usually contains a single symbol (the compressed data). But if the
compression is not beneficial, it leaves with the original set of
symbols, which could be more than one. Applying alignment to every
symbol causing the section size too big, no longer matching the
size we computed before compression.

Fixes #76022.

Change-Id: I2246045955405997c77e54001bbb83f9ccd1ee7c
Reviewed-on: https://go-review.googlesource.com/c/go/+/721340
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-11-18 09:02:16 -08:00
Junyang Shao
be9c50c6a0 [dev.simd] cmd/compile, simd: change SHA ops names and types
This CL addressed some naming changes decided in API audit.
Before		After
SHA1Msg1	SHA1Message1, Remove signed
SHA1Msg2	SHA1Message2, Remove signed
SHA1NextE	SHA1NextE, Remove signed
SHA1Round4	SHA1FourRounds, Remove signed
SHA256Msg1	SHA256Message1, Remove signed
SHA256Msg2	SHA256Message2, Remove signed
SHA256Rounds2	SHA256TwoRounds, Remove signed

Change-Id: If2cead113f37a9044bc5c65e78fa9d124e318005
Reviewed-on: https://go-review.googlesource.com/c/go/+/721003
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-18 09:02:15 -08:00
Youlin Feng
c93766007d runtime: do not print recovered when double panic with the same value
Show the "[recovered, repanicked]" message only when it is repanicked
after recovered. For the duplicated panics that not recovered, do not
show this message.

Fixes #76099

Change-Id: I87282022ebe44c6f6efbe3239218be4a2a7b1104
Reviewed-on: https://go-review.googlesource.com/c/go/+/716020
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
2025-11-18 07:22:50 -08:00
Joel Sing
9859b43643 cmd/asm,cmd/compile,cmd/internal/obj/riscv: use compressed instructions on riscv64
Make use of compressed instructions on riscv64 - add a compress
pass to the end of the assembler, which replaces non-compressed
instructions with compressed alternatives if possible.

Provide a `compressinstructions` compiler and assembler debug
flag, such that the compression pass can be disabled via
`-asmflags=all=-d=compressinstructions=0` and
`-gcflags=all=-d=compressinstructions=0`. Note that this does
not prevent the explicit use of compressed instructions via
assembly.

Note that this does not make use of compressed control transfer
instructions - this will be implemented in later changes.

Reduces the text size of a hello world binary by ~121KB
and reduces the text size of the go binary on riscv64 by ~1.21MB
(between 8-10% in both cases).

Updates #71105

Cq-Include-Trybots: luci.golang.try:gotip-linux-riscv64
Change-Id: I24258353688554042c2a836deed4830cc673e985
Reviewed-on: https://go-review.googlesource.com/c/go/+/523478
Reviewed-by: Mark Ryan <markdryan@rivosinc.com>
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>
2025-11-18 00:58:00 -08:00
Joel Sing
b9ef0633f6 cmd/internal/sys,internal/goarch,runtime: enable the use of compressed instructions on riscv64
Enable the use of compressed instructions on riscv64 by reducing
the PC quantum to two bytes and reducing the minimum instruction
length to two bytes. Change gostartcall on riscv64 to land at
two times the PC quantum into goexit, so that we retain four byte
alignment and revise the NOP instructions in goexit to ensure that
they are never compressed. Additionally, adjust PCALIGN so that it
correctly handles two byte offsets.

Fixes #47560
Updates #71105

Cq-Include-Trybots: luci.golang.try:gotip-linux-riscv64
Change-Id: I4329a8fbfcb4de636aadaeadabb826bc22698640
Reviewed-on: https://go-review.googlesource.com/c/go/+/523477
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Ryan <markdryan@rivosinc.com>
2025-11-17 23:33:36 -08:00
WANG Xuerui
a087dea869 debug/elf: sync new loong64 relocation types up to LoongArch ELF psABI v20250521
Add several new relocation types defined in newer versions of LoongArch
ELF psABI v20250521, part of the v2.40 spec bundle. The new relocations
are seeing increased adoption because distributions are moving to newer
GNU/LLVM toolchain versions, so Go's internal linker must be prepared to
handle some of them, especially R_LARCH_CALL36 because the ecosystem is
slowly migrating to the "medium" code model by default.

The constants R_LARCH_DELETE and R_LARCH_CFA were removed in LoongArch
ELF psABI v20231102 (spec bundle v2.20), but they are already part of
the public API, so they are retained for now for upholding the go1
compatibility guarantee.

Corresponding binutils implementation:

* R_LARCH_CALL36: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=dc5f359ed6a36d2c895d89c3e4886f3a2b6d9232
* TLSDESC: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=26265e7fdf19d461563388495b6799eb3719f80a
* TLS {LD,GD,DESC} relaxation: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=ae296cc45258b95223210263d1b91115e84beb56
* TLS LE relaxation: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=775dead218e12e3fb94481c7a99aa0238d6a9138

Updates #75562

See: https://github.com/loongson/la-abi-specs/blob/v2.40/laelf.adoc
See: https://github.com/loongson-community/discussions/issues/43
Change-Id: Ib023e0b6becc0862d27afc419d3eb84c737359db
Reviewed-on: https://go-review.googlesource.com/c/go/+/709716
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn>
2025-11-17 17:00:42 -08:00
Keith Randall
e1a12c781f cmd/compile: use 32x32->64 multiplies on arm64
Gets rid of some sign extensions.

Change-Id: Ie67ef36b4ca1cd1a2cd9fa5d84578db553578a22
Reviewed-on: https://go-review.googlesource.com/c/go/+/721241
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@google.com>
2025-11-17 13:45:54 -08:00
Keith Randall
6caab99026 runtime: relax TestMemoryLimit on darwin a bit more
Add 8MB more. Covers most of the failures watchflakes has seen.

Fixes #73136

Change-Id: I593c599a9519b8b31ed0f401d4157d27ac692587
Reviewed-on: https://go-review.googlesource.com/c/go/+/708617
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Keith Randall <khr@google.com>
2025-11-17 13:45:01 -08:00
Junyang Shao
0978935a99 [dev.simd] cmd/compile, simd: change AES op names and add missing size
This CL changed AESEncryptRound and AESDecryptRound to
AESEncryptOneRound and AESDecryptOneRound.

This CL also adds the 512-bit version of some AES instructions.

Change-Id: Ia851a008cce2145b1ff193a89e172862060a725d
Reviewed-on: https://go-review.googlesource.com/c/go/+/721280
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-11-17 13:37:42 -08:00
Junyang Shao
95871e4a00 [dev.simd] cmd/compile, simd: add VPALIGNR
This CL named VPALIGNR ConcatShiftBytes[Grouped].

Change-Id: I46c6703085efb0613deefa512de9911b4fdf6bc4
Reviewed-on: https://go-review.googlesource.com/c/go/+/714440
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-17 13:37:36 -08:00
Junyang Shao
934dbcea1a [dev.simd] simd: update CPU feature APIs
This CL also updates the internal uses of these APIs.

This CL also fixed a instable output issue left by previous CLs.

Change-Id: Ibc38361d35e2af0c4943a48578f3c610b74ed14d
Reviewed-on: https://go-review.googlesource.com/c/go/+/720020
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-17 13:37:30 -08:00
Junyang Shao
e4d9484220 [dev.simd] cmd/compile: fix unstable output
This CL fixed an error left by CL 718160.

Change-Id: I442ea59bc1ff0dda2914d1858dd5ebe93e2818dc
Reviewed-on: https://go-review.googlesource.com/c/go/+/720281
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-11-17 13:37:22 -08:00
Nick Ripley
eda2e8c683 runtime: clear frame pointer at thread entry points
There are a few places in the runtime where new threads enter Go code
with a possibly invalid frame pointer. mstart is the entry point for new
Ms, and rt0_go is the entrypoint for the program. As we try to introduce
frame pointer unwinding in more places (e.g. for heap profiling in CL
540476 or for execution trace events on the system stack in CL 593835),
we see these functions on the stack. We need to ensure that they have
valid frame pointers. These functions are both considered the "top"
(first) frame frame of the call stack, so this CL sets the frame pointer
register to 0 in these functions.

Updates #63630

Change-Id: I6a6a6964a9ebc6f68ba23d2616e5fb6f19677f97
Reviewed-on: https://go-review.googlesource.com/c/go/+/721020
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
2025-11-17 12:06:42 -08:00
Michael Pratt
6919858338 runtime: rename findrunnable references to findRunnable
These cases were missed by CL 393880.

Change-Id: I6a6a636cf0d97a4efcf4b9df766002ecef48b4de
Reviewed-on: https://go-review.googlesource.com/c/go/+/721120
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-11-17 11:49:59 -08:00
Alan Donovan
8e734ec954 go/ast: fix BasicLit.End position for raw strings containing \r
This CL causes the parser to record in a new field, BasicLit.EndPos,
the actual end position of each literal token, and to use it in
BasicLit.End. Previously, the End was computed heuristically as
Pos + len(Value). This heuristic is incorrect for a multiline
raw string literal on Windows, since the scanner normalizes
\r\n to \n.

Unfortunately the actual end position is not returned by the
Scanner.Scan method, so the scanner and parser conspire
using a global variable in the go/internal/scannerhook
package to communicate.

+ test, api change, relnote

Fixes #76031

Change-Id: I57c18a44e85f7403d470ba23d41dcdcc5a9432c2
Reviewed-on: https://go-review.googlesource.com/c/go/+/720060
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-17 10:52:48 -08:00
Filippo Valsorda
592775ec7d crypto/mlkem: avoid a few unnecessary inverse NTT calls
We were mistakenly doing NTT⁻¹ inside the inner loop, on the components
of the inner product intead of the sum, leading to k² = 9 inverse NTT
calls instead of k = 3 inverse NTT.

Surprisingly large speedup as a result.

fips140: off
goos: darwin
goarch: arm64
pkg: crypto/mlkem
cpu: Apple M2
                  │ 4c285e0988  │          4c285e0988-dirty          │
                  │   sec/op    │   sec/op     vs base               │
KeyGen-2            28.95µ ± 3%   28.64µ ± 4%        ~ (p=0.699 n=6)
Encaps-2            43.13µ ± 3%   35.02µ ± 1%  -18.81% (p=0.002 n=6)
Decaps-2            43.80µ ± 1%   35.49µ ± 1%  -18.97% (p=0.002 n=6)
RoundTrip/Alice-2   77.27µ ± 7%   69.12µ ± 3%  -10.55% (p=0.002 n=6)
RoundTrip/Bob-2     43.08µ ± 2%   35.14µ ± 3%  -18.44% (p=0.002 n=6)
geomean             44.88µ        38.67µ       -13.84%

Change-Id: I6a6a69649c1378411c9aca75d473fd5b9984a609
Reviewed-on: https://go-review.googlesource.com/c/go/+/715381
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
2025-11-17 09:54:12 -08:00
Filippo Valsorda
590cf18daf crypto/mlkem/mlkemtest: add derandomized Encapsulate768/1024
Fixes #73627

Change-Id: I6a6a69649927e9b1cdff910832084fdc04ff5bc2
Reviewed-on: https://go-review.googlesource.com/c/go/+/703795
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
2025-11-17 09:54:06 -08:00
Keith Randall
c12c337099 cmd/compile: teach prove about subtract idioms
For v = x-y:
    if y >= 0 then v <= x
    if y <= x then v >= 0

(With appropriate guards against overflow/underflow.)

Fixes #76304

Change-Id: I8f8f1254156c347fa97802bd057a8379676720ae
Reviewed-on: https://go-review.googlesource.com/c/go/+/720740
Reviewed-by: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
2025-11-17 09:48:53 -08:00
Keith Randall
bc15963813 cmd/compile: clean up prove pass
flowLimit no longer needs to return whether it updated any information,
after CL 714920 which got rid of the iterate-until-done paradigm.

Change-Id: I0c5f592578ff27c27586c1f8b8a8d9071d94846d
Reviewed-on: https://go-review.googlesource.com/c/go/+/720720
Reviewed-by: Youlin Feng <fengyoulin@live.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
2025-11-17 09:48:41 -08:00
Alan Donovan
1297fae708 go/token: add (*File).End method
Also, use it in a number of places.

+ test, api, relnote

Fixes #75849

Change-Id: I44acf5b8190b964fd3975009aa407d7c82cee19b
Reviewed-on: https://go-review.googlesource.com/c/go/+/720061
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Griesemer <gri@google.com>
2025-11-17 09:47:47 -08:00
Archana Ravindar
65c09eafdf runtime: hoist invariant code out of heapBitsSmallForAddrInline
The first two instructions in heapBitsSmallForAddrInline are
invariant for a given span and object and are called in
a loop within ScanObjectsSmall which figures as a hot routine
in profiles of some benchmark runs within sweet benchmark suite
(x/benchmarks/sweet), Ideally it would have been great if the
compiler hoisted this code out of the loop, Moving it out of
inner loop manually gives gains (moving it entirely out of
nested loop does not improve performance, in some cases it
even regresses it perhaps due to the early loop exit).
Tested with AMD64, ARM64, PPC64LE and S390x

Fixes #76212

Change-Id: I49c3c826b9d7bf3125ffc42c8c174cce0ecc4cbf
Reviewed-on: https://go-review.googlesource.com/c/go/+/718680
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-17 09:29:39 -08:00
Jes Cok
594129b80c internal/runtime/maps: update doc for table.Clear
Change-Id: I9456b9fb7ed3bbf6a3c29de24951e02cf8f4635d
GitHub-Last-Rev: 2deaa11725
GitHub-Pull-Request: golang/go#76311
Reviewed-on: https://go-review.googlesource.com/c/go/+/720761
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-11-17 09:05:17 -08:00
Filippo Valsorda
c58d075e9a crypto/rsa: deprecate PKCS#1 v1.5 encryption
Fixes #75302

Change-Id: I6a6a6964c2b3b33bfb34b9677a57610b933bbfab
Reviewed-on: https://go-review.googlesource.com/c/go/+/701436
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-11-15 15:41:23 -08:00
Michael Anthony Knyszek
d55ecea9e5 runtime: usleep before stealing runnext only if not in syscall
In the scheduler's steal path, we usleep(3) before stealing a _Prunning
P's runnext slot. Before CL 646198, we would not call usleep(3) if the P
was in _Psyscall. After CL 646198, Ps with Gs in syscalls stay in
_Prunning until stolen, meaning we might unnecessarily usleep(3) where
we didn't before. This probably isn't a huge deal in most cases, but can
cause some apparent slowdowns in microbenchmarks that frequently take
the steal path while there are syscalling goroutines.

Change-Id: I5bf3df10fe61cf8d7f0e9fe9522102de66faf344
Reviewed-on: https://go-review.googlesource.com/c/go/+/720441
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-11-14 15:13:00 -08:00
Alan Donovan
410ef44f00 cmd: update x/tools to 59ff18c
$ go get golang.org/x/tools@59ff18c
	$ GOWORK=off go mod tidy
	$ GOWORK=off go mod vendor

This implies golang.org/x/sys@v0.38.0, for which I have also
updated src/go.mod for consistency.

I also upgraded x/mod@3f03020 to bring in some fixes to
code that go vet would otherwise have flagged in this CL.

This brings in a number of fixes and improvements to the analysis
tools within cmd/fix, which I will apply to std and cmd presently.

For golang/go#71859

Change-Id: I56c49e7ab28eb6ba55408a3721e9a898ee3067a1
Reviewed-on: https://go-review.googlesource.com/c/go/+/719760
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-14 15:08:26 -08:00
thepudds
50128a2154 runtime: support runtime.freegc in size-specialized mallocs for noscan objects
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 smallNoScanStub stub in malloc_stubs.go to reuse
heap objects that have been freed by runtime.freegc calls, and generates
the corresponding size-specialized code in malloc_generated.go.

This CL only adds support in the specialized mallocs for noscan
heap objects (objects without pointers). A later CL handles objects
with pointers.

While we are here, we leave a couple of breadcrumbs in mkmalloc.go on
how to do the generation.

Updates #74299

Change-Id: I2657622601a27211554ee862fce057e101767a70
Reviewed-on: https://go-review.googlesource.com/c/go/+/715761
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-11-14 14:23:16 -08:00
David Finkel
c3708350a4 cmd/go: tests: rename git-min-vers->git-sha256
Follow-up cleanup on go.dev/cl/698835. Clarify the tests by replacing
git-min-vers with a more-puposeful git-sha256 verb in the cmd tests.

Updates: #73704

Change-Id: I4361356431d567a6a3bb3a50eadfaa9e3ba37d90
Reviewed-on: https://go-review.googlesource.com/c/go/+/720481
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Michael Matloob <matloob@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2025-11-14 14:05:59 -08:00
Alan Donovan
aea881230d std: fix printf("%q", int) mistakes
For #72850

Change-Id: I07e64f05c82a34b1dadb9a72e16f5045e68cbd24
Reviewed-on: https://go-review.googlesource.com/c/go/+/720642
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: 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>
2025-11-14 14:05:53 -08:00
thepudds
120f1874ef runtime: add more precise test of assist credit handling for runtime.freegc
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 adds a better test of assist credit handling when heap objects
are being reused after a runtime.freegc call.

The main approach is bracketing alloc/free pairs with measurements
of the assist credit before and after, and hoping to see a net zero
change in the assist credit.

However, validating the desired behavior is perhaps a bit subtle.
To help stabilize the measurements, we do acquirem in the test code
to avoid being preempted during the measurements to reduce other code's
ability to adjust the assist credit while we are measuring, and
we also reduce GOMAXPROCS to 1.

This test currently does fail if we deliberately introduce bugs
in the runtime.freegc implementation such as if we:
- never adjust the assist credit when reusing an object, or
- always adjust the assist credit when reusing an object, or
- deliberately mishandle internal fragmentation.

The two main cases of current interest for testing runtime.freegc
are when over the course of our bracketed measurements gcBlackenEnable
is either true or false. The test attempts to exercise both of those
case by running the GC continually in the background (which we can see
seems effective based on logging and by how our deliberate bugs fail).

This passes ~10K test executions locally via stress.

A small note to the future: a previous incarnation of this test (circa
patchset 11 of this CL) did not do acquirem but had an approach of
ignoring certain measurements, which also was able to pass ~10K runs
via stress. The current version in this CL is simpler, but
recording the existence of the prior version here in case it is
useful in the future. (Hopefully not.)

Updates #74299

Change-Id: I46c7e0295d125f5884fee0cc3d3d31aedc7e5ff4
Reviewed-on: https://go-review.googlesource.com/c/go/+/717520
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-14 13:41:16 -08:00
thepudds
fecfcaa4f6 runtime: add runtime.freegc to reduce GC work
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 adds runtime.freegc:

 func freegc(ptr unsafe.Pointer, uintptr size, noscan bool)

Memory freed via runtime.freegc is made immediately reusable for
the next allocation in the same size class, without waiting for a
GC cycle, and hence can dramatically reduce pressure on the GC. A sample
microbenchmark included below shows strings.Builder operating roughly
2x faster.

An experimental modification to reflect to use runtime.freegc
and then using that reflect with json/v2 gave reported memory
allocation reductions of -43.7%, -32.9%, -21.9%, -22.0%, -1.0%
for the 5 official real-world unmarshalling benchmarks from
go-json-experiment/jsonbench by the authors of json/v2, covering
the CanadaGeometry through TwitterStatus datasets.

Note: there is no intent to modify the standard library to have
explicit calls to runtime.freegc, and of course such an ability
would never be exposed to end-user code.

Later CLs in this stack teach the compiler how to automatically
insert runtime.freegc calls when it can prove it is safe to do so.

(The reflect modification and other experimental changes to
the standard library were just that -- experiments. It was
very helpful while initially developing runtime.freegc to see
more complex uses and closer-to-real-world benchmark results
prior to updating the compiler.)

This CL only addresses noscan span classes (heap objects without
pointers), such as the backing memory for a []byte or string. A
follow-on CL adds support for heap objects with pointers.

If we update strings.Builder to explicitly call runtime.freegc on its
internal buf after a resize operation (but without freeing the usually
final incarnation of buf that will be returned to the user as a string),
we can see some nice benchmark results on the existing strings
benchmarks that call Builder.Write N times and then call Builder.String.
Here, the (uncommon) case of a single Builder.Write is not helped (given
it never resizes after first alloc if there is only one Write), but the
impact grows such that it is up to ~2x faster as there are more resize
operations due to more strings.Builder.Write calls:

                                               │     disabled.out │      new-free-20.txt                │
                                               │      sec/op      │   sec/op     vs base                │
BuildString_Builder/1Write_36Bytes_NoGrow-4           55.82n ± 2%   55.86n ± 2%        ~ (p=0.794 n=20)
BuildString_Builder/2Write_36Bytes_NoGrow-4           125.2n ± 2%   115.4n ± 1%   -7.86% (p=0.000 n=20)
BuildString_Builder/3Write_36Bytes_NoGrow-4           224.0n ± 1%   188.2n ± 2%  -16.00% (p=0.000 n=20)
BuildString_Builder/5Write_36Bytes_NoGrow-4           239.1n ± 9%   205.1n ± 1%  -14.20% (p=0.000 n=20)
BuildString_Builder/8Write_36Bytes_NoGrow-4           422.8n ± 3%   325.4n ± 1%  -23.04% (p=0.000 n=20)
BuildString_Builder/10Write_36Bytes_NoGrow-4          436.9n ± 2%   342.3n ± 1%  -21.64% (p=0.000 n=20)
BuildString_Builder/100Write_36Bytes_NoGrow-4         4.403µ ± 1%   2.381µ ± 2%  -45.91% (p=0.000 n=20)
BuildString_Builder/1000Write_36Bytes_NoGrow-4        48.28µ ± 2%   21.38µ ± 2%  -55.71% (p=0.000 n=20)

See the design document for more discussion of the strings.Builder case.

For testing, we add tests that attempt to exercise different aspects
of the underlying freegc and mallocgc behavior on the reuse path.
Validating the assist credit manipulations turned out to be subtle,
so a test for that is added in the next CL. There are also
invariant checks added, controlled by consts (primarily the
doubleCheckReusable const currently).

This CL also adds support in runtime.freegc for GODEBUG=clobberfree=1
to immediately overwrite freed memory with 0xdeadbeef, which
can help a higher-level test fail faster in the event of a bug,
and also the GC specifically looks for that pattern and throws
a fatal error if it unexpectedly finds it.

A later CL (currently experimental) adds GODEBUG=clobberfree=2,
which uses mprotect (or VirtualProtect on Windows) to set
freed memory to fault if read or written, until the runtime
later unprotects the memory on the mallocgc reuse path.

For the cases where a normal allocation is happening without any reuse,
some initial microbenchmarks suggest the impact of these changes could
be small to negligible (at least with GOAMD64=v3):

goos: linux
goarch: amd64
pkg: runtime
cpu: AMD EPYC 7B13
                        │ base-512M-v3.bench │   ps16-512M-goamd64-v3.bench     │
                        │        sec/op      │ sec/op     vs base               │
Malloc8-16                      11.01n ± 1%   10.94n ± 1%  -0.68% (p=0.038 n=20)
Malloc16-16                     17.15n ± 1%   17.05n ± 0%  -0.55% (p=0.007 n=20)
Malloc32-16                     18.65n ± 1%   18.42n ± 0%  -1.26% (p=0.000 n=20)
MallocTypeInfo8-16              18.63n ± 0%   18.36n ± 0%  -1.45% (p=0.000 n=20)
MallocTypeInfo16-16             22.32n ± 0%   22.65n ± 0%  +1.50% (p=0.000 n=20)
MallocTypeInfo32-16             23.37n ± 0%   23.89n ± 0%  +2.23% (p=0.000 n=20)
geomean                         18.02n        18.01n       -0.05%

These last benchmark results include the runtime updates to support
span classes with pointers (which was originally part of this CL,
but later split out for ease of review).

Updates #74299

Change-Id: Icceaa0f79f85c70cd1a718f9a4e7f0cf3d77803c
Reviewed-on: https://go-review.googlesource.com/c/go/+/673695
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-11-14 13:38:58 -08:00
thepudds
5a347b775e runtime: set GOEXPERIMENT=runtimefreegc to disabled by default
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

The plan has been for GOEXPERIMENT=runtimefreegc to be disabled
by default for Go 1.26, so here we disable it.

Also, we update the name of the GOEXPERIMENT to reflect the latest name.

Updates #74299

Change-Id: I94a34784700152e13ca93ef6711ee9b7f1769d9a
Reviewed-on: https://go-review.googlesource.com/c/go/+/720120
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-11-14 13:37:56 -08:00
thepudds
1a03d0db3f runtime: skip tests for GOEXPERIMENT=arenas that do not handle clobberfree=1
When run with GODEBUG=clobberfree=1, three out of seven of the top-level
tests in runtime/arena_test.go fail with a SIGSEGV inside the
clobberfree function where it is overwriting freed memory
with 0xdeadbeef.

This is not a new problem. For example, this crashes in Go 1.20:

  GODEBUG=clobberfree=1 go test runtime -run=TestUserArena

It would be nice for all.bash to pass with GODEBUG=clobberfree=1,
including it is useful for testing the automatic reclaiming of
dead memory via runtime.freegc in #74299.

Given the GOEXPERIMENT=arenas in #51317 is not planned to move forward
(and is hopefully slated to be replace by regions before too long),
for now we just skip those three tests in order to get all.bash
passing with GODEBUG=clobberfree=1.

Updates #74299

Change-Id: I384d96791157b30c73457d582a45dd74c5607ee0
Reviewed-on: https://go-review.googlesource.com/c/go/+/715080
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-11-14 13:37:37 -08:00
Nicholas S. Husin
cb0d9980f5 net/http: do not discard body content when closing it within request handlers
(*body).Close() internally tries to discard the content of a request
body up to 256 KB. We rely on this behavior to allow connection re-use,
by calling (*body).Close() when our request handler exits.

Unfortunately, this causes an unfortunate side-effect where we would
prematurely try to discard a body content when (*body).Close() is called
from within a request handler.

There should not be a good reason for (*body).Close() to do this when
called from within a request handler. As such, this CL modifies
(*body).Close() to not discard body contents when called from within a
request handler. Note that when a request handler exits, it will still
try to discard the body content for connection re-use.

For #75933

Change-Id: I71d2431a540579184066dd35d3da49d6c85c3daf
Reviewed-on: https://go-review.googlesource.com/c/go/+/720380
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Nicholas Husin <husin@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
2025-11-14 13:32:00 -08:00
Keith Randall
03ed43988f cmd/compile: allow multi-field structs to be stored directly in interfaces
If the struct is a bunch of 0-sized fields and one pointer field.

Merged revert-of-revert for 4 CLs.

original  revert
681937    695016
693415    694996
693615    695015
694195    694995

Fixes #74092
Update #74888
Update #74908
Update #74935
(updated issues are bugs in the last attempt at this)

Change-Id: I32246d49b8bac3bb080972dc06ab432a5480d560
Reviewed-on: https://go-review.googlesource.com/c/go/+/714421
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
2025-11-14 12:37:44 -08:00
Michael Anthony Knyszek
1bb1f2bf0c runtime: put AddCleanup cleanup arguments in their own allocation
Currently, AddCleanup just creates a simple closure that calls
`cleanup(arg)` as the actual cleanup function tracked internally.
However, the argument ends up getting its own allocation. If it's tiny,
then it can also end up sharing a tiny allocation slot with the object
we're adding the cleanup to. Since the closure is a GC root, we can end
up with cleanups that never fire.

This change refactors the AddCleanup machinery to make the storage for
the argument separate and explicit. With that in place, it explicitly
allocates 16 bytes of storage for tiny arguments to side-step the tiny
allocator.

One would think this would cause an increase in memory use and more
bytes allocated, but that's actually wrong! It turns out that the
current "simple closure" actually creates _two_ closures. By making the
argument passing explicit, we eliminate one layer of closures, so this
actually results in a slightly faster AddCleanup overall and 16 bytes
less memory allocated.

goos: linux
goarch: amd64
pkg: runtime
cpu: AMD EPYC 7B13
                     │ before.bench │            after.bench             │
                     │    sec/op    │   sec/op     vs base               │
AddCleanupAndStop-64    124.5n ± 2%   103.7n ± 2%  -16.71% (p=0.002 n=6)

                     │ before.bench │            after.bench            │
                     │     B/op     │    B/op     vs base               │
AddCleanupAndStop-64     48.00 ± 0%   32.00 ± 0%  -33.33% (p=0.002 n=6)

                     │ before.bench │            after.bench            │
                     │  allocs/op   │ allocs/op   vs base               │
AddCleanupAndStop-64     3.000 ± 0%   2.000 ± 0%  -33.33% (p=0.002 n=6)

This change does, however, does add 16 bytes of overhead to the cleanup
special itself, and makes each cleanup block entry 24 bytes instead of 8
bytes. This means the overall memory overhead delta with this change is
neutral, and we just have a faster cleanup. (Cleanup block entries are
transient, so I suspect any increase in memory overhead there is
negligible.)

Together with CL 719960, fixes #76007.

Change-Id: I81bf3e44339e71c016c30d80bb4ee151c8263d5c
Reviewed-on: https://go-review.googlesource.com/c/go/+/720321
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-14 11:25:20 -08:00
Michael Anthony Knyszek
9fd2e44439 runtime: add AddCleanup benchmark
Change-Id: Ia463a9b3b5980670bcf9297b4bddb60980ebfde5
Reviewed-on: https://go-review.googlesource.com/c/go/+/720320
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2025-11-14 11:25:17 -08:00
Michael Anthony Knyszek
80c91eedbb runtime: ensure weak handles end up in their own allocation
Currently weak handles are atomic.Uintptr values that may end up in
a tiny block which can cause all sorts of surprising leaks. See #76007
for one example.

This change pads out the underlying allocation of the atomic.Uintptr to
16 bytes to ensure we bypass the tiny allocator, and it gets its own
block. This wastes 8 bytes per weak handle. We could potentially do
better by using the 8 byte noscan size class, but this can be a
follow-up change.

For #76007.

Change-Id: I3ab74dda9bf312ea0007f167093052de28134944
Reviewed-on: https://go-review.googlesource.com/c/go/+/719960
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-14 11:15:44 -08:00
Michael Anthony Knyszek
7a8d0b5d53 runtime: add debug mode to extend _Grunning-without-P windows
This was suggested in CL 646198, and I tested with it, I forgot to push
it so it wasn't merged. I think it might be worth keeping.

Change-Id: Ibf97d969fe7d0eeb365f5f7b1fbeadea3a1076ab
Reviewed-on: https://go-review.googlesource.com/c/go/+/716580
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-14 11:15:39 -08:00
Michael Anthony Knyszek
710abf74da internal/runtime/cgobench: add Go function call benchmark for comparison
Change-Id: I0ada7fa02eb5f18a78da17bdcfc63333abbd8450
Reviewed-on: https://go-review.googlesource.com/c/go/+/713284
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
2025-11-14 11:15:35 -08:00
Mark Ryan
b24aec598b doc, cmd/internal/obj/riscv: document the riscv64 assembler
Add documentation for the riscv64 assembler with a link to the
documentation from asm.html. Architecture specific assembler
documentation is provided for the other architectures but has
been missing for riscv64 until now.

Change-Id: I62ed7e6a2a4b52e0720d869e964b29e2a980223a
Reviewed-on: https://go-review.googlesource.com/c/go/+/652717
Reviewed-by: Joel Sing <joel@sing.id.au>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
Auto-Submit: Joel Sing <joel@sing.id.au>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-14 11:09:46 -08:00
Mark Ryan
a0e738c657 cmd/compile/internal: remove incorrect riscv64 SLTI rule
The rule

(SLTI  [x] (ORI  [y] _)) && y >= 0 && int64(y) >= int64(x) => (MOVDconst [0])

is incorrect as it only generates correct code if the unknown value
being compared is >= 0. If the unknown value is < 0 the rule will
incorrectly produce a constant value of 0, whereas the code optimized
away by the rule would have produced a value of 1.

A new test that causes the faulty rule to generate incorrect code
is also added to ensure that the error does not return.

Change-Id: I69224e0776596f1b9538acf9dacf9009d305f966
Reviewed-on: https://go-review.googlesource.com/c/go/+/720220
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Joel Sing <joel@sing.id.au>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2025-11-14 11:01:26 -08:00
Meng Zhuo
2cdcc4150b cmd/compile: fold negation into multiplication
goos: linux
goarch: riscv64
pkg: cmd/compile/internal/test
cpu: Spacemit(R) X60
        │ /root/mul.base.log │          /root/mul.new.log          │
        │       sec/op       │   sec/op     vs base                │
MulNeg           6.426µ ± 0%   4.501µ ± 0%  -29.96% (p=0.000 n=10)
Mul2Neg          9.000µ ± 0%   6.431µ ± 0%  -28.54% (p=0.000 n=10)
Mul2             1.263µ ± 0%   1.263µ ± 0%        ~ (p=1.000 n=10)
MulNeg2          1.577µ ± 0%   1.577µ ± 0%        ~ (p=0.211 n=10)
geomean          3.276µ        2.756µ       -15.89%

goos: linux
goarch: amd64
pkg: cmd/compile/internal/test
cpu: AMD EPYC 7532 32-Core Processor
        │ /root/base  │              /root/new              │
        │   sec/op    │   sec/op     vs base                │
MulNeg    691.9n ± 1%   319.4n ± 0%  -53.83% (p=0.000 n=10)
Mul2Neg   630.0n ± 0%   629.6n ± 0%   -0.07% (p=0.000 n=10)
Mul2      438.1n ± 0%   438.1n ± 0%        ~ (p=0.728 n=10)
MulNeg2   439.3n ± 0%   439.4n ± 0%        ~ (p=0.656 n=10)
geomean   538.2n        443.6n       -17.58%

Change-Id: Ice8e6c8d1e8e3009ba8a0b1b689205174e199019
Reviewed-on: https://go-review.googlesource.com/c/go/+/720180
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Joel Sing <joel@sing.id.au>
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>
2025-11-14 11:01:22 -08:00
Aaron Chen
b57962b7c7 bytes: fix panic in bytes.Buffer.Peek
This change fixed the overlooked offset in bytes.Buffer.Peek.
Otherwise, it will either return wrong result or panic with
"runtime error: slice bounds out of range".

Change-Id: Ic42fd8a27fb9703c51430f298933b91cf0d45451
GitHub-Last-Rev: fb97ebc3b1
GitHub-Pull-Request: golang/go#76165
Reviewed-on: https://go-review.googlesource.com/c/go/+/717640
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: Junyang Shao <shaojunyang@google.com>
2025-11-14 11:01:17 -08:00
Michael Munday
0a569528ea cmd/compile: optimize comparisons with single bit difference
Optimize comparisons with constants that only differ by 1 bit (i.e.
a power of 2). For example:

    x == 4 || x == 6 -> x|2 == 6
    x != 1 && x != 5 -> x|4 != 5

Change-Id: Ic61719e5118446d21cf15652d9da22f7d95b2a15
Reviewed-on: https://go-review.googlesource.com/c/go/+/719420
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
2025-11-14 10:59:56 -08:00
Michael Munday
1e5e6663e9 cmd/compile: remove unnecessary casts and types from riscv64 rules
This change shouldn't have any impact on codegen. It removes some
unnecessary int8 and int64 casts from the riscv64 rewrite rules.

It also removes explicit typing where the types already match:
`(OldOp <t>) => (NewOp <t>)` is the same as `(OldOp) => (NewOp)`.

Change-Id: Ic02b65da8f548c8b9ad9ccb6627a03b7bf6f050f
Reviewed-on: https://go-review.googlesource.com/c/go/+/719220
Reviewed-by: Junyang Shao <shaojunyang@google.com>
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>
Commit-Queue: Junyang Shao <shaojunyang@google.com>
2025-11-14 10:59:53 -08:00
Mark Freeman
ddd8558e61 go/types, types2: swap object.color for Checker.objPathIdx
The type checker assigns types to objects. An object can be in
1 of 3 states, which are mapped to colors. This is stored as a
field on the object.

 - white : type not known, awaiting processing
 - grey  : type pending, in processing
 - black : type known, done processing

With the addition of Checker.objPathIdx, which maps objects to
a path index, presence in the map could signal grey coloring.
White and black coloring can be signaled by presence of
object.typ (a simple nil check).

This change removes the object.color field and its associated
methods, replacing it with an equivalent use of Checker.objPathIdx.
Checker.objPathIdx is integrated into the existing push and pop
methods, while slightly simplifying their signatures.

Note that the concept of object coloring remains the same - we
are merely changing and simplifying the mechanism which represents
the colors.

Change-Id: I91fb5e9a59dcb34c08ffc5b4ebc3f20a400094b6
Reviewed-on: https://go-review.googlesource.com/c/go/+/715840
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Mark Freeman <markfreeman@google.com>
2025-11-14 10:30:00 -08:00
matloob@golang.org
9daaab305c cmd/link/internal/ld: make runtime.buildVersion with experiments valid
Specifically if there are experiments but no nonstandard toolchain
suffix such as "-devel", the go version will not be valid according to
go/version.IsValid. To fix that, always put the X: part into the suffix,
resulting in, for example, go1.25.0-X:foo.

Fixes #75953

Change-Id: I6a6a696468f3ba9b82b6a410fb88831428e93b58
Reviewed-on: https://go-review.googlesource.com/c/go/+/719701
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2025-11-14 09:15:38 -08:00
matloob@golang.org
d50a571ddf test: fix tests to work with sizespecializedmalloc turned off
Cq-Include-Trybots: luci.golang.try:gotip-linux-386-nosizespecializedmalloc,gotip-linux-amd64-nosizespecializedmalloc,gotip-linux-arm64-nosizespecializedmalloc
Change-Id: I6a6a696465004b939c989afc058c4c3e1fb7134f
Reviewed-on: https://go-review.googlesource.com/c/go/+/720401
Auto-Submit: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@google.com>
2025-11-13 16:57:31 -08:00
Michael Anthony Knyszek
704f841eab cmd/trace: annotation proc start/stop with thread and proc always
In the proc view, the thread ID is useful. In the thread view, the proc
ID is useful. Add both in both cases forever more.

Change-Id: I9cb7bd67a21ee17d865c25d73b2049b3da7aefbc
Reviewed-on: https://go-review.googlesource.com/c/go/+/720402
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>
2025-11-13 15:16:31 -08:00
1911860538
17a02b9106 net/http: remove unused isLitOrSingle and isNotToken
isLitOrSingle and isNotToken are private and unused.

Change-Id: I07718d4496e92d5f75ed74986e174a8aa1f70a88
GitHub-Last-Rev: 722c4dccd8
GitHub-Pull-Request: golang/go#76216
Reviewed-on: https://go-review.googlesource.com/c/go/+/718700
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Sean Liao <sean@liao.dev>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-13 13:55:31 -08:00
Cherry Mui
d7a0c45642 [dev.simd] all: merge master (57362e9) into dev.simd
Conflicts:

- src/cmd/compile/internal/ir/symtab.go
- src/cmd/compile/internal/ssa/prove.go
- src/cmd/compile/internal/ssa/rewriteAMD64.go
- src/cmd/compile/internal/ssagen/intrinsics.go
- src/cmd/compile/internal/typecheck/builtin.go
- src/internal/buildcfg/exp.go
- src/internal/strconv/ftoa.go
- test/codegen/stack.go

Manually resolved some conflicts:

- Use internal/strconv for simd.String, remove internal/ftoa
- prove.go is just copied from the one on the main branch. We
  have cherry-picked the changes to prove.go to main branch, so
  our copy is identical to an old version of the one on the main
  branch. There are CLs landed after our cherry-picks. Just copy
  it over to adopt the new code.

Merge List:

+ 2025-11-13 57362e9814 go/types, types2: check for direct cycles as a separate phase
+ 2025-11-13 099e0027bd cmd/go/internal/modfetch: consolidate global vars
+ 2025-11-13 028375323f cmd/go/internal/modfetch/codehost: fix flaky TestReadZip
+ 2025-11-13 4ebf295b0b runtime: prefer to restart Ps on the same M after STW
+ 2025-11-13 625d8e9b9c runtime/pprof: fix goroutine leak profile tests for noopt
+ 2025-11-13 4684a26c26 spec: remove cycle restriction for type parameters
+ 2025-11-13 0f9c8fb29d cmd/asm,cmd/internal/obj/riscv: add support for riscv compressed instructions
+ 2025-11-13 a15d036ce2 cmd/internal/obj/riscv: implement better bit pattern encoding
+ 2025-11-12 abb241a789 cmd/internal/obj/loong64: add {,X}VS{ADD,SUB}.{B/H/W/V}{,U} instructions support
+ 2025-11-12 0929d21978 cmd/go: keep objects alive while stopping cleanups
+ 2025-11-12 f03d06ec1a runtime: fix list test memory management for mayMoreStack
+ 2025-11-12 48127f656b crypto/internal/fips140/sha3: remove outdated TODO
+ 2025-11-12 c3d1d42764 sync/atomic: amend comments for Value.{Swap,CompareAndSwap}
+ 2025-11-12 e0807ba470 cmd/compile: don't clear ptrmask in fillptrmask
+ 2025-11-12 66318d2b4b internal/abi: correctly describe result in Name.Name doc comment
+ 2025-11-12 34aef89366 cmd/compile: use FCLASSD for subnormal checks on riscv64
+ 2025-11-12 0c28789bd7 net/url: disallow raw IPv6 addresses in host
+ 2025-11-12 4e761b9a18 cmd/compile: optimize liveness in stackalloc
+ 2025-11-12 956909ff84 crypto/x509: move BetterTLS suite from crypto/tls
+ 2025-11-12 6525f46707 cmd/link: change shdr and phdr from arrays to slices
+ 2025-11-12 d3aeba1670 runtime: switch p.gcFractionalMarkTime to atomic.Int64
+ 2025-11-12 8873e8bea2 runtime,runtime/pprof: clean up goroutine leak profile writing
+ 2025-11-12 b8b84b789e cmd/go: clarify the -o testflag is only for copying the binary
+ 2025-11-12 c761b26b56 mime: parse media types that contain braces
+ 2025-11-12 65858a146e os/exec: include Cmd.Start in the list of methods that run Cmd
+ 2025-11-11 4bfc3a9d14 std,cmd: go fix -any std cmd
+ 2025-11-11 2263d4aabd runtime: doubly-linked sched.midle list
+ 2025-11-11 046dce0e54 runtime: use new list type for spanSPMCs
+ 2025-11-11 5f11275457 runtime: reusable intrusive doubly-linked list
+ 2025-11-11 951cf0501b internal/trace/testtrace: fix flag name typos
+ 2025-11-11 2750f95291 cmd/go: implement accurate pseudo-versions for Mercurial
+ 2025-11-11 b709a3e8b4 cmd/go/internal/vcweb: cache hg servers
+ 2025-11-11 426ef30ecf cmd/go: implement -reuse for Mercurial repos
+ 2025-11-10 5241d114f5 spec: more precise prose for special case of append
+ 2025-11-10 cdf64106f6 go/types, types2: first argument to append must never be be nil
+ 2025-11-10 a0eb4548cf .gitignore: ignore go test artifacts
+ 2025-11-10 bf58e7845e internal/trace: add "command" to convert text traces to raw
+ 2025-11-10 052c192a4c runtime: fix lock rank for work.spanSPMCs.lock
+ 2025-11-10 bc5ffe5c79 internal/runtime/sys,math/bits: eliminate bounds checks on len8tab
+ 2025-11-10 32f8d6486f runtime: document that tracefpunwindoff applies to some profilers
+ 2025-11-10 1c1c1942ba cmd/go: remove redundant AVX regex in security flag checks
+ 2025-11-10 3b3d6b9e5d cmd/internal/obj/arm64: shorten constant integer loads
+ 2025-11-10 5f4b5f1a19 runtime/msan: use different msan routine for copying
+ 2025-11-10 0fe6c8e8c8 runtime: tweak wording for comment of mcache.flushGen
+ 2025-11-10 95a0e5adc1 sync: don't call Done when f() panics in WaitGroup.Go
+ 2025-11-08 e8ed85d6c2 cmd/go: update goSum if necessary
+ 2025-11-08 b76103c08e cmd/go: output missing GoDebug entries
+ 2025-11-07 47a63a331d cmd/go: rewrite hgrepo1 test repo to be deterministic
+ 2025-11-07 7995751d3a cmd/go: copy git reuse and support repos to hg
+ 2025-11-07 66c7ca7fb3 cmd/go: improve TestScript/reuse_git
+ 2025-11-07 de84ac55c6 cmd/link: clean up some comments to Go standards
+ 2025-11-07 5cd1b73772 runtime: correctly print panics before fatal-ing on defer
+ 2025-11-07 91ca80f970 runtime/cgo: improve error messages after pointer panic
+ 2025-11-07 d36e88f21f runtime: tweak wording for doc
+ 2025-11-06 ad3ccd92e4 cmd/link: move pclntab out of relro section
+ 2025-11-06 43b91e7abd iter: fix a tiny doc comment bug
+ 2025-11-06 48c7fa13c6 Revert "runtime: remove the pc field of _defer struct"
+ 2025-11-05 8111104a21 cmd/internal/obj/loong64: add {,X}VSHUF.{B/H/W/V} instructions support
+ 2025-11-05 2e2072561c cmd/internal/obj/loong64: add {,X}VEXTRINS.{B,H,W,V} instruction support
+ 2025-11-05 01c29d1f0b internal/chacha8rand: replace VORV with instruction VMOVQ on loong64
+ 2025-11-05 f01a1841fd cmd/compile: fix error message on loong64
+ 2025-11-05 8cf7a0b4c9 cmd/link: support weak binding on darwin
+ 2025-11-05 2dd7e94e16 cmd/go: use go.dev instead of golang.org in flag errors
+ 2025-11-05 28f1ad5782 cmd/go: fix TestScript/govcs
+ 2025-11-05 daa220a1c9 cmd/go: silence TLS handshake errors during test
+ 2025-11-05 3ae9e95002 cmd/go: fix TestCgoPkgConfig on darwin with pkg-config installed
+ 2025-11-05 a494a26bc2 cmd/go: fix TestScript/vet_flags
+ 2025-11-05 a8fb94969c cmd/go: fix TestScript/tool_build_as_needed
+ 2025-11-05 04f05219c4 cmd/cgo: skip escape checks if call site has no argument
+ 2025-11-04 9f3a108ee0 os: ignore O_TRUNC errors on named pipes and terminal devices on Windows
+ 2025-11-04 0e1bd8b5f1 cmd/link, runtime: don't store text start in pcHeader
+ 2025-11-04 7347b54727 cmd/link: don't generate .gosymtab section
+ 2025-11-04 6914dd11c0 cmd/link: add and use new SymKind SFirstUnallocated
+ 2025-11-04 f5f14262d0 cmd/link: remove misleading comment
+ 2025-11-04 61de3a9dae cmd/link: remove unused SFILEPATH symbol kind
+ 2025-11-04 8e2bd267b5 cmd/link: add comments for SymKind values
+ 2025-11-04 16705b962e cmd/compile: faster liveness analysis in regalloc
+ 2025-11-04 a5fe6791d7 internal/syscall/windows: fix ReOpenFile sentinel error value
+ 2025-11-04 a7d174ccaa cmd/compile/internal/ssa: simplify riscv64 FCLASSD rewrite rules
+ 2025-11-04 856238615d runtime: amend doc for setPinned
+ 2025-11-04 c7ccbddf22 cmd/compile/internal/ssa: more aggressive on dead auto elim
+ 2025-11-04 75b2bb1d1a cmd/cgo: drop pre-1.18 support
+ 2025-11-04 dd839f1d00 internal/strconv: handle %f with fixedFtoa when possible
+ 2025-11-04 6e165b4d17 cmd/compile: implement Avg64u, Hmul64, Hmul64u for wasm
+ 2025-11-04 9f6590f333 encoding/pem: don't reslice in failure modes
+ 2025-11-03 34fec512ce internal/strconv: extract fixed-precision ftoa from ftoaryu.go
+ 2025-11-03 162ba6cc40 internal/strconv: add tests and benchmarks for ftoaFixed
+ 2025-11-03 9795c7ba22 internal/strconv: fix pow10 off-by-one in exponent result
+ 2025-11-03 ad5e941a45 cmd/internal/obj/loong64: using {xv,v}slli.d to perform copying between vector registers
+ 2025-11-03 dadbac0c9e cmd/internal/obj/loong64: add VPERMI.W, XVPERMI.{W,V,Q} instruction support
+ 2025-11-03 e2c6a2024c runtime: avoid append in printint, printuint
+ 2025-11-03 c93cc603cd runtime: allow Stack to traceback goroutines in syscall _Grunning window
+ 2025-11-03 b5353fd90a runtime: don't panic in castogscanstatus
+ 2025-11-03 43491f8d52 cmd/cgo: use the export'ed file/line in error messages
+ 2025-11-03 aa94fdf0cc cmd/go: link to go.dev/doc/godebug for removed GODEBUG settings
+ 2025-11-03 4d2b03d2fc crypto/tls: add BetterTLS test coverage
+ 2025-11-03 0c4444e13d cmd/internal/obj: support arm64 FMOVQ large offset encoding
+ 2025-11-03 85bec791a0 cmd/go/testdata/script: loosen list_empty_importpath for freebsd
+ 2025-11-03 17b57078ab internal/runtime/cgobench: add cgo callback benchmark
+ 2025-11-03 5f8fdb720c cmd/go: move functions to methods
+ 2025-11-03 0a95856b95 cmd/go: eliminate additional global variable
+ 2025-11-03 f93186fb44 cmd/go/internal/telemetrystats: count cgo usage
+ 2025-11-03 eaf28a27fd runtime: update outdated comments for deferprocStack
+ 2025-11-03 e12d8a90bf all: remove extra space in the comments
+ 2025-11-03 c5559344ac internal/profile: optimize Parse allocs
+ 2025-11-03 5132158ac2 bytes: add Buffer.Peek
+ 2025-11-03 361d51a6b5 runtime: remove the pc field of _defer struct
+ 2025-11-03 00ee1860ce crypto/internal/constanttime: expose intrinsics to the FIPS 140-3 packages
+ 2025-11-02 388c41c412 cmd/go: skip git sha256 tests if git < 2.29
+ 2025-11-01 385dc33250 runtime: prevent time.Timer.Reset(0) from deadlocking testing/synctest tests
+ 2025-10-31 99b724f454 cmd/go: document purego convention
+ 2025-10-31 27937289dc runtime: avoid zeroing scavenged memory
+ 2025-10-30 89dee70484 runtime: prioritize panic output over racefini
+ 2025-10-30 8683bb846d runtime: optimistically CAS atomicstatus directly in enter/exitsyscall
+ 2025-10-30 5b8e850340 runtime: don't track scheduling latency for _Grunning <-> _Gsyscall
+ 2025-10-30 251814e580 runtime: document tracer invariants explicitly
+ 2025-10-30 7244e9221f runtime: eliminate _Psyscall
+ 2025-10-30 5ef19c0d0c strconv: delete divmod1e9
+ 2025-10-30 d32b1f02c3 runtime: delete timediv
+ 2025-10-30 cbbd385cb8 strconv: remove arch-specific decision in formatBase10
+ 2025-10-30 6aca04a73a reflect: correct internal docs for uncommonType
+ 2025-10-30 235b4e729d cmd/compile/internal/ssa: model right shift more precisely
+ 2025-10-30 d44db293f9 go/token: fix a typo in a comment
+ 2025-10-30 cdc6b559ca strconv: remove hand-written divide on 32-bit systems
+ 2025-10-30 1e5bb416d8 cmd/compile: implement bits.Mul64 on 32-bit systems
+ 2025-10-30 38317c44e7 crypto/internal/fips140/aes: fix CTR generator
+ 2025-10-29 3be9a0e014 go/types, types: proceed with correct (invalid) type in case of a selector error
+ 2025-10-29 d2c5fa0814 strconv: remove &0xFF trick in formatBase10
+ 2025-10-29 9bbda7c99d cmd/compile: make prove understand div, mod better
+ 2025-10-29 915c1839fe test/codegen: simplify asmcheck pattern matching
+ 2025-10-29 32ee3f3f73 runtime: tweak example code for gorecover
+ 2025-10-29 da3fb90b23 crypto/internal/fips140/bigmod: fix extendedGCD comment
+ 2025-10-29 9035f7aea5 runtime: use internal/strconv
+ 2025-10-29 49c1da474d internal/itoa, internal/runtime/strconv: delete
+ 2025-10-29 b2a346bbd1 strconv: move all but Quote to internal/strconv
+ 2025-10-28 041f564b3e internal/runtime/gc/scan: avoid memory destination on VPCOMPRESSQ
+ 2025-10-28 81afd3a59b cmd/compile: extend ppc64 MADDLD to match const ADDconst & MULLDconst
+ 2025-10-28 ea50d61b66 cmd/compile: name change isDirect -> isDirectAndComparable
+ 2025-10-28 bd4dc413cd cmd/compile: don't optimize away a panicing interface comparison
+ 2025-10-28 30c047d0d0 cmd/compile: extend loong MOV*idx rules to match ADDshiftLLV
+ 2025-10-28 46e5e2b09a runtime: define PanicBounds in funcdata.h
+ 2025-10-28 3da0356685 crypto/internal/fips140test: collect 300M entropy samples for ESV
+ 2025-10-28 d5953185d5 runtime: amend comments a bit
+ 2025-10-28 12c8d14d94 errors: document that the target of Is must be comparable
+ 2025-10-28 1f4d14e493 go/types, types2: pull up package-level object sort to a separate phase
+ 2025-10-28 b8aa1ee442 go/types, types2: reduce locks held at once in resolveUnderlying
+ 2025-10-28 24af441437 cmd/compile: rewrite proved multiplies by 0 or 1 into CondSelect
+ 2025-10-28 2d33a456c6 cmd/compile: move branchelim supported arches to Config
+ 2025-10-27 2c91c33e88 crypto/subtle,cmd/compile: add intrinsics for ConstantTimeSelect and *Eq
+ 2025-10-27 73d7635fae cmd/compile: add generic rules to remove bool → int → bool roundtrips
+ 2025-10-27 1662d55247 cmd/compile: do not Zext bools to 64bits in amd64 CMOV generation rules
+ 2025-10-27 b8468d8c4e cmd/compile: introduce bytesizeToConst to cleanup switches in prove
+ 2025-10-27 9e25c2f6de cmd/link: internal linking support for windows/arm64
+ 2025-10-27 ff2ebf69c4 internal/runtime/gc/scan: correct size class size check
+ 2025-10-27 9a77aa4f08 cmd/compile: add position info to sccp debug messages
+ 2025-10-27 77dc138030 cmd/compile: teach prove about unsigned rounding-up divide
+ 2025-10-27 a0f33b2887 cmd/compile: change !l.nonzero() into l.maybezero()
+ 2025-10-27 5453b788fd cmd/compile: optimize Add64carry with unused carries into plain Add64
+ 2025-10-27 2ce5aab79e cmd/compile: remove 68857 ModU flowLimit workaround in prove
+ 2025-10-27 a50de4bda7 cmd/compile: remove 68857 min & max flowLimit workaround in prove
+ 2025-10-27 53be78630a cmd/compile: use topo-sort in prove to correctly learn facts while walking once
+ 2025-10-27 dec2b4c83d runtime: avoid bound check in freebsd binuptime
+ 2025-10-27 916e682d51 cmd/internal/obj, cmd/asm: reclassify the offset of memory access operations on loong64
+ 2025-10-27 2835b994fb cmd/go: remove global loader state variable
+ 2025-10-27 139f89226f cmd/go: use local state for telemetry
+ 2025-10-27 8239156571 cmd/go: use tagged switch
+ 2025-10-27 d741483a1f cmd/go: increase stmt threshold on amd64
+ 2025-10-27 a6929cf4a7 cmd/go: removed unused code in toolchain.Exec
+ 2025-10-27 180c07e2c1 go/types, types2: clarify docs for resolveUnderlying
+ 2025-10-27 d8a32f3d4b go/types, types2: wrap Named.fromRHS into Named.rhs
+ 2025-10-27 b2af92270f go/types, types2: verify stateMask transitions in debug mode
+ 2025-10-27 92decdcbaa net/url: further speed up escape and unescape
+ 2025-10-27 5f4ec3541f runtime: remove unused cgoCheckUsingType function
+ 2025-10-27 189f2c08cc time: rewrite IsZero method to use wall and ext fields
+ 2025-10-27 f619b4a00d cmd/go: reorder parameters so that context is first
+ 2025-10-27 f527994c61 sync: update comments for Once.done
+ 2025-10-26 5dcaf9a01b runtime: add GOEXPERIMENT=runtimefree
+ 2025-10-26 d7a52f9369 cmd/compile: use MOV(D|F) with const for Const(64|32)F on riscv64
+ 2025-10-26 6f04a92be3 internal/chacha8rand: provide vector implementation for riscv64
+ 2025-10-26 54e3adc533 cmd/go: use local loader state in test
+ 2025-10-26 ca379b1c56 cmd/go: remove loaderstate dependency
+ 2025-10-26 83a44bde64 cmd/go: remove unused loader state
+ 2025-10-26 7e7cd9de68 cmd/go: remove temporary rf cleanup script
+ 2025-10-26 53ad68de4b cmd/compile: allow unaligned load/store on Wasm
+ 2025-10-25 12ec09f434 cmd/go: use local state object in work.runBuild and work.runInstall
+ 2025-10-24 643f80a11f runtime: add ppc and s390 to 32 build constraints for gccgo
+ 2025-10-24 0afbeb5102 runtime: add ppc and s390 to linux 32 bits syscall build constraints for gccgo
+ 2025-10-24 7b506d106f cmd/go: use local state object in `generate.runGenerate`
+ 2025-10-24 26a8a21d7f cmd/go: use local state object in `env.runEnv`
+ 2025-10-24 f2dd3d7e31 cmd/go: use local state object in `vet.runVet`
+ 2025-10-24 784700439a cmd/go: use local state object in pkg `workcmd`
+ 2025-10-24 69673e9be2 cmd/go: use local state object in `tool.runTool`
+ 2025-10-24 2e12c5db11 cmd/go: use local state object in `test.runTest`
+ 2025-10-24 fe345ff2ae cmd/go: use local state object in `modget.runGet`
+ 2025-10-24 d312e27e8b cmd/go: use local state object in pkg `modcmd`
+ 2025-10-24 ea9cf26aa1 cmd/go: use local state object in `list.runList`
+ 2025-10-24 9926e1124e cmd/go: use local state object in `bug.runBug`
+ 2025-10-24 2c4fd7b2cd cmd/go: use local state object in `run.runRun`
+ 2025-10-24 ade9f33e1f cmd/go: add loaderstate as field on `mvsReqs`
+ 2025-10-24 ccf4192a31 cmd/go: make ImportMissingError work with local state
+ 2025-10-24 f5403f15f0 debug/pe: check for zdebug_gdb_scripts section in testDWARF
+ 2025-10-24 a26f860fa4 runtime: use 32-bit hash for maps on Wasm
+ 2025-10-24 747fe2efed encoding/json/v2: fix typo in documentation about errors.AsType
+ 2025-10-24 94f47fc03f cmd/link: remove pointless assignment in SetSymAlign
+ 2025-10-24 e6cff69051 crypto/x509: move constraint checking after chain building
+ 2025-10-24 f5f69a3de9 encoding/json/jsontext: avoid pinning application data in pools
+ 2025-10-24 a6a59f0762 encoding/json/v2: use slices.Sort directly
+ 2025-10-24 0d3dab9b1d crypto/x509: simplify candidate chain filtering
+ 2025-10-24 29046398bb cmd/go: refactor injection of modload.LoaderState
+ 2025-10-24 c18fa69e52 cmd/go: make ErrNoModRoot work with local state
+ 2025-10-24 296ecc918d cmd/go: add modload.State parameter to AllowedFunc
+ 2025-10-24 c445a61e52 cmd/go: add loaderstate as field on `QueryMatchesMainModulesError`
+ 2025-10-24 6ac40051d3 cmd/go: remove module loader state from ccompile
+ 2025-10-24 6a5a452528 cmd/go: inject vendor dir into builder struct
+ 2025-10-23 dfac972233 crypto/pbkdf2: add missing error return value in example
+ 2025-10-23 47bf8f073e unique: fix inconsistent panic prefix in canonmap cleanup path
+ 2025-10-23 03bd43e8bb go/types, types2: rename Named.resolve to unpack
+ 2025-10-23 9fcdc814b2 go/types, types2: rename loaded namedState to lazyLoaded
+ 2025-10-23 8401512a9b go/types, types2: rename complete namedState to hasMethods
+ 2025-10-23 cf826bfcb4 go/types, types2: set t.underlying exactly once in resolveUnderlying
+ 2025-10-23 c4e910895b net/url: speed up escape and unescape
+ 2025-10-23 3f6ac3a10f go/build: use slices.Equal
+ 2025-10-23 839da71f89 encoding/pem: properly calculate end indexes
+ 2025-10-23 39ed968832 cmd: update golang.org/x/arch for riscv64 disassembler
+ 2025-10-23 ca448191c9 all: replace Split in loops with more efficient SplitSeq
+ 2025-10-23 107fcb70de internal/goroot: replace HasPrefix+TrimPrefix with CutPrefix
+ 2025-10-23 8378276d66 strconv: optimize int-to-decimal and use consistently
+ 2025-10-23 e5688d0bdd cmd/internal/obj/riscv: simplify validation and encoding of raw instructions
+ 2025-10-22 77fc27972a doc/next: improve new(expr) release note
+ 2025-10-22 d94a8c56ad runtime: cleanup pagetrace
+ 2025-10-22 02728a2846 crypto/internal/fips140test: add entropy SHA2-384 testing
+ 2025-10-22 f92e01c117 runtime/cgo: fix cgoCheckArg description
+ 2025-10-22 50586182ab runtime: use backoff and ISB instruction to reduce contention in (*lfstack).pop and (*spanSet).pop on arm64
+ 2025-10-22 1ff59f3dd3 strconv: clean up powers-of-10 table, tests
+ 2025-10-22 7c9fa4d5e9 cmd/go: check if build output should overwrite files with renames
+ 2025-10-22 557b4d6e0f comment: change slice to string in function comment/help
+ 2025-10-22 d09a8c8ef4 go/types, types2: simplify locking in Named.resolveUnderlying
+ 2025-10-22 5a42af7f6c go/types, types2: in resolveUnderlying, only compute path when needed
+ 2025-10-22 4bdb55b5b8 go/types, types2: rename Named.under to Named.resolveUnderlying
+ 2025-10-21 29d43df8ab go/build, cmd/go: use ast.ParseDirective for go:embed
+ 2025-10-21 4e695dd634 go/ast: add ParseDirective for parsing directive comments
+ 2025-10-21 06e57e60a7 go/types, types2: only report version errors if new(expr) is ok otherwise
+ 2025-10-21 6c3d0d259f path/filepath: reword documentation for Rel
+ 2025-10-21 39fd61ddb0 go/types, types2: guard Named.underlying with Named.mu
+ 2025-10-21 4a0115c886 runtime,syscall: implement and use syscalln on darwin
+ 2025-10-21 261c561f5a all: gofmt -w
+ 2025-10-21 c9c78c06ef strconv: embed testdata in test
+ 2025-10-21 8f74f9daf4 sync: re-enable race even when panicking
+ 2025-10-21 8a6c64f4fe syscall: use rawSyscall6 to call ptrace in forkAndExecInChild
+ 2025-10-21 4620db72d2 runtime: use timer_settime64 on 32-bit Linux
+ 2025-10-21 b31dc77cea os: support deleting read-only files in RemoveAll on older Windows versions
+ 2025-10-21 46cc532900 cmd/compile/internal/ssa: fix typo in comment
+ 2025-10-21 2163a58021 crypto/internal/fips140/entropy: increase AllocsPerRun iterations
+ 2025-10-21 306eacbc11 cmd/go/testdata/script: disable list_empty_importpath test on Windows
+ 2025-10-21 a5a249d6a6 all: eliminate unnecessary type conversions
+ 2025-10-21 694182d77b cmd/internal/obj/ppc64: improve large prologue generation
+ 2025-10-21 b0dcb95542 cmd/compile: leave the horses alone
+ 2025-10-21 9a5a1202f4 runtime: clean dead architectures from go:build constraint
+ 2025-10-21 8539691d0c crypto/internal/fips140/entropy: move to crypto/internal/entropy/v1.0.0
+ 2025-10-20 99cf4d671c runtime: save lasx and lsx registers in loong64 async preemption
+ 2025-10-20 79ae97fe9b runtime: make procyieldAsm no longer loop infinitely if passed 0
+ 2025-10-20 f838faffe2 runtime: wrap procyield assembly and check for 0
+ 2025-10-20 ee4d2c312d runtime/trace: dump test traces on validation failure
+ 2025-10-20 7b81a1e107 net/url: reduce allocs in Encode
+ 2025-10-20 e425176843 cmd/asm: fix typo in comment
+ 2025-10-20 dc9a3e2a65 runtime: fix generation skew with trace reentrancy
+ 2025-10-20 df33c17091 runtime: add _Gdeadextra status
+ 2025-10-20 7503856d40 cmd/go: inject loaderstate into matcher function
+ 2025-10-20 d57c3fd743 cmd/go: inject State parameter into `work.runInstall`
+ 2025-10-20 e94a5008f6 cmd/go: inject State parameter into `work.runBuild`
+ 2025-10-20 d9e6f95450 cmd/go: inject State parameter into `workcmd.runSync`
+ 2025-10-20 9769a61e64 cmd/go: inject State parameter into `modget.runGet`
+ 2025-10-20 f859799ccf cmd/go: inject State parameter into `modcmd.runVerify`
+ 2025-10-20 0f820aca29 cmd/go: inject State parameter into `modcmd.runVendor`
+ 2025-10-20 92aa3e9e98 cmd/go: inject State parameter into `modcmd.runInit`
+ 2025-10-20 e176dff41c cmd/go: inject State parameter into `modcmd.runDownload`
+ 2025-10-20 e7c66a58d5 cmd/go: inject State parameter into `toolchain.Select`
+ 2025-10-20 4dc3dd9a86 cmd/go: add loaderstate to Switcher
+ 2025-10-20 bcf7da1595 cmd/go: convert functions to methods
+ 2025-10-20 0d3044f965 cmd/go: make Reset work with any State instance
+ 2025-10-20 386d81151d cmd/go: make setState work with any State instance
+ 2025-10-20 a420aa221e cmd/go: inject State parameter into `tool.runTool`
+ 2025-10-20 441e7194a4 cmd/go: inject State parameter into `test.runTest`
+ 2025-10-20 35e8309be2 cmd/go: inject State parameter into `list.runList`
+ 2025-10-20 29a81624f7 cmd/go: inject state parameter into `fmtcmd.runFmt`
+ 2025-10-20 f7eaea02fd cmd/go: inject state parameter into `clean.runClean`
+ 2025-10-20 58a8fdb6cf cmd/go: inject State parameter into `bug.runBug`
+ 2025-10-20 8d0bef7ffe runtime: add linkname documentation and guidance
+ 2025-10-20 3e43f48cb6 encoding/asn1: use reflect.TypeAssert to improve performance
+ 2025-10-20 4ad5585c2c runtime: fix _rt0_ppc64x_lib on aix
+ 2025-10-17 a5f55a441e cmd/fix: add modernize and inline analyzers
+ 2025-10-17 80876f4b42 cmd/go/internal/vet: tweak help doc
+ 2025-10-17 b5aefe07e5 all: remove unnecessary loop variable copies in tests
+ 2025-10-17 5137c473b6 go/types, types2: remove references to under function in comments
+ 2025-10-17 dbbb1bfc91 all: correct name for comments
+ 2025-10-17 0983090171 encoding/pem: properly decode strange PEM data
+ 2025-10-17 36863d6194 runtime: unify riscv64 library entry point
+ 2025-10-16 0c14000f87 go/types, types2: remove under(Type) in favor of Type.Underlying()
+ 2025-10-16 1099436f1b go/types, types2: change and enforce lifecycle of Named.fromRHS and Named.underlying fields
+ 2025-10-16 41f5659347 go/types, types2: remove superfluous unalias call (minor cleanup)
+ 2025-10-16 e7351c03c8 runtime: use DC ZVA instead of its encoding in WORD in arm64 memclr
+ 2025-10-16 6cbe0920c4 cmd: update to x/tools@7d9453cc
+ 2025-10-15 45eee553e2 cmd/internal/obj: move ARM64RegisterExtension from cmd/asm/internal/arch
+ 2025-10-15 27f9a6705c runtime: increase repeat count for alloc test
+ 2025-10-15 b68cebd809 net/http/httptest: record failed ResponseWriter writes
+ 2025-10-15 f1fed742eb cmd: fix three printf problems reported by newest vet
+ 2025-10-15 0984dcd757 cmd/compile: fix an error in comments
+ 2025-10-15 31f82877e8 go/types, types2: fix misleading internal comment
+ 2025-10-15 6346349f56 cmd/compile: replace angle brackets with square
+ 2025-10-15 284379cdfc cmd/compile: remove rematerializable values from live set across calls
+ 2025-10-15 519ae514ab cmd/compile: eliminate bound check for slices of the same length
+ 2025-10-15 b5a29cca48 cmd/distpack: add fix tool to inventory
+ 2025-10-15 bb5eb51715 runtime/pprof: fix errors in pprof_test
+ 2025-10-15 5c9a26c7f8 cmd/compile: use arm64 neon in LoweredMemmove/LoweredMemmoveLoop
+ 2025-10-15 61d1ff61ad cmd/compile: use block starting position for phi line number
+ 2025-10-15 5b29875c8e cmd/go: inject State parameter into `run.runRun`
+ 2025-10-15 5113496805 runtime/pprof: skip flaky test TestProfilerStackDepth/heap for now
+ 2025-10-15 36086e85f8 cmd/go: create temporary cleanup script
+ 2025-10-14 7056c71d32 cmd/compile: disable use of new saturating float-to-int conversions
+ 2025-10-14 6d5b13793f Revert "cmd/compile: make 386 float-to-int conversions match amd64"
+ 2025-10-14 bb2a14252b Revert "runtime: adjust softfloat corner cases to match amd64/arm64"
+ 2025-10-14 3bc9d9fa83 Revert "cmd/compile: make wasm match other platforms for FP->int32/64 conversions"
+ 2025-10-14 ee5af46172 encoding/json: avoid misleading errors under goexperiment.jsonv2
+ 2025-10-14 11d3d2f77d cmd/internal/obj/arm64: add support for PAC instructions
+ 2025-10-14 4dbf1a5a4c cmd/compile/internal/devirtualize: do not track assignments to non-PAUTO
+ 2025-10-14 0ddb5ed465 cmd/compile/internal/devirtualize: use FatalfAt instead of Fatalf where possible
+ 2025-10-14 0a239bcc99 Revert "net/url: disallow raw IPv6 addresses in host"
+ 2025-10-14 5a9ef44bc0 cmd/compile/internal/devirtualize: fix OCONVNOP assertion
+ 2025-10-14 3765758b96 go/types, types2: minor cleanup (remove TODO)
+ 2025-10-14 f6b9d56aff crypto/internal/fips140/entropy: fix benign race
+ 2025-10-14 60f6d2f623 crypto/internal/fips140/entropy: support SHA-384 sizes for ACVP tests
+ 2025-10-13 6fd8e88d07 encoding/json/v2: restrict presence of default options
+ 2025-10-13 1abc6b0204 go/types, types2: permit type cycles through type parameter lists
+ 2025-10-13 9fdd6904da strconv: add tests that Java once mishandled
+ 2025-10-13 9b8742f2e7 cmd/compile: don't depend on arch-dependent conversions in the compiler
+ 2025-10-13 0e64ee1286 encoding/json/v2: report EOF for top-level values in UnmarshalDecode
+ 2025-10-13 6bcd97d9f4 all: replace calls to errors.As with errors.AsType
+ 2025-10-11 1cd71689f2 crypto/x509: rework fix for CVE-2025-58187
+ 2025-10-11 8aa1efa223 cmd/link: in TestFallocate, only check number of blocks on Darwin
+ 2025-10-10 b497a29d25 encoding/json: fix regression in quoted numbers under goexperiment.jsonv2
+ 2025-10-10 48bb7a6114 cmd/compile: repair bisection behavior for float-to-unsigned conversion
+ 2025-10-10 e8a53538b4 runtime: fail TestGoroutineLeakProfile on data race
+ 2025-10-10 e3be2d1b2b net/url: disallow raw IPv6 addresses in host
+ 2025-10-10 aced4c79a2 net/http: strip request body headers on POST to GET redirects
+ 2025-10-10 584a89fe74 all: omit unnecessary reassignment
+ 2025-10-10 69e8279632 net/http: set cookie host to Request.Host when available
+ 2025-10-10 6f4c63ba63 cmd/go: unify "go fix" and "go vet"
+ 2025-10-10 955a5a0dc5 runtime: support arm64 Neon in async preemption
+ 2025-10-10 5368e77429 net/http: run TestRequestWriteTransport with fake time to avoid flakes
+ 2025-10-09 c53cb642de internal/buildcfg: enable greenteagc experiment for loong64
+ 2025-10-09 954fdcc51a cmd/compile: declare no output register for loong64 LoweredAtomic{And,Or}32 ops
+ 2025-10-09 19a30ea3f2 cmd/compile: call generated size-specialized malloc functions directly
+ 2025-10-09 80f3bb5516 reflect: remove timeout in TestChanOfGC
+ 2025-10-09 9db7e30bb4 net/url: allow IP-literals with IPv4-mapped IPv6 addresses
+ 2025-10-09 8d810286b3 cmd/compile: make wasm match other platforms for FP->int32/64 conversions
+ 2025-10-09 b9f3accdcf runtime: adjust softfloat corner cases to match amd64/arm64
+ 2025-10-09 78d75b3799 cmd/compile: make 386 float-to-int conversions match amd64
+ 2025-10-09 0e466a8d1d cmd/compile: modify float-to-[u]int so that amd64 and arm64 match
+ 2025-10-08 4837fbe414 net/http/httptest: check whether response bodies are allowed
+ 2025-10-08 ee163197a8 path/filepath: return cleaned path from Rel
+ 2025-10-08 de9da0de30 cmd/compile/internal/devirtualize: improve concrete type analysis
+ 2025-10-08 ae094a1397 crypto/internal/fips140test: make entropy file pair names match
+ 2025-10-08 941e5917c1 runtime: cleanup comments from asm_ppc64x.s improvements
+ 2025-10-08 d945600d06 cmd/gofmt: change -d to exit 1 if diffs exist
+ 2025-10-08 d4830c6130 cmd/internal/obj: fix Link.Diag printf errors
+ 2025-10-08 e1ca1de123 net/http: format pprof.go
+ 2025-10-08 e5d004c7a8 net/http: update HTTP/2 documentation to reference new config features
+ 2025-10-08 97fd6bdecc cmd/compile: fuse NaN checks with other comparisons
+ 2025-10-07 78b43037dc cmd/go: refactor usage of `workFilePath`
+ 2025-10-07 bb1ca7ae81 cmd/go, testing: add TB.ArtifactDir and -artifacts flag
+ 2025-10-07 1623927730 cmd/go: refactor usage of `requirements`
+ 2025-10-07 a1661e776f Revert "crypto/internal/fips140/subtle: add assembly implementation of xorBytes for mips64x"
+ 2025-10-07 cb81270113 Revert "crypto/internal/fips140/subtle: add assembly implementation of xorBytes for mipsx"
+ 2025-10-07 f2d0d05d28 cmd/go: refactor usage of `MainModules`
+ 2025-10-07 f7a68d3804 archive/tar: set a limit on the size of GNU sparse file 1.0 regions
+ 2025-10-07 463165699d net/mail: avoid quadratic behavior in mail address parsing
+ 2025-10-07 5ede095649 net/textproto: avoid quadratic complexity in Reader.ReadResponse
+ 2025-10-07 5ce8cd16f3 encoding/pem: make Decode complexity linear
+ 2025-10-07 f6f4e8b3ef net/url: enforce stricter parsing of bracketed IPv6 hostnames
+ 2025-10-07 7dd54e1fd7 runtime: make work.spanSPMCs.all doubly-linked
+ 2025-10-07 3ee761739b runtime: free spanQueue on P destroy
+ 2025-10-07 8709a41d5e encoding/asn1: prevent memory exhaustion when parsing using internal/saferio
+ 2025-10-07 9b9d02c5a0 net/http: add httpcookiemaxnum GODEBUG option to limit number of cookies parsed
+ 2025-10-07 3fc4c79fdb crypto/x509: improve domain name verification
+ 2025-10-07 6e4007e8cf crypto/x509: mitigate DoS vector when intermediate certificate contains DSA public key
+ 2025-10-07 6f7926589d cmd/go: refactor usage of `modRoots`
+ 2025-10-07 11d5484190 runtime: fix self-deadlock on sbrk platforms
+ 2025-10-07 2e52060084 cmd/go: refactor usage of `RootMode`
+ 2025-10-07 f86ddb54b5 cmd/go: refactor usage of `ForceUseModules`
+ 2025-10-07 c938051dd0 Revert "cmd/compile: redo arm64 LR/FP save and restore"
+ 2025-10-07 6469954203 runtime: assert p.destroy runs with GC not running
+ 2025-10-06 4c0fd3a2b4 internal/goexperiment: remove the synctest GOEXPERIMENT
+ 2025-10-06 c1e6e49d5d fmt: reduce Errorf("x") allocations to match errors.New("x")
+ 2025-10-06 7fbf54bfeb internal/buildcfg: enable greenteagc experiment by default
+ 2025-10-06 7bfeb43509 cmd/go: refactor usage of `initialized`
+ 2025-10-06 1d62e92567 test/codegen: make sure assignment results are used.
+ 2025-10-06 4fca79833f runtime: delete redundant code in the page allocator
+ 2025-10-06 719dfcf8a8 cmd/compile: redo arm64 LR/FP save and restore
+ 2025-10-06 f3312124c2 runtime: remove batching from spanSPMC free
+ 2025-10-06 24416458c2 cmd/go: export type State
+ 2025-10-06 c2fb15164b testing/synctest: remove Run
+ 2025-10-06 ac2ec82172 runtime: bump thread count slack for TestReadMetricsSched
+ 2025-10-06 e74b224b7c crypto/tls: streamline BoGo testing w/ -bogo-local-dir
+ 2025-10-06 3a05e7b032 spec: close tag
+ 2025-10-03 2a71af11fc net/url: improve URL docs
+ 2025-10-03 ee5369b003 cmd/link: add LIBRARY statement only with -buildmode=cshared
+ 2025-10-03 1bca4c1673 cmd/compile: improve slicemask removal
+ 2025-10-03 38b26f29f1 cmd/compile: remove stores to unread parameters
+ 2025-10-03 003b5ce1bc cmd/compile: fix SIMD const rematerialization condition
+ 2025-10-03 d91148c7a8 cmd/compile: enhance prove to infer bounds in slice len/cap calculations
+ 2025-10-03 20c9377e47 cmd/compile: enhance the chunked indexing case to include reslicing
+ 2025-10-03 ad3db2562e cmd/compile: handle rematerialized op for incompatible reg constraint
+ 2025-10-03 18cd4a1fc7 cmd/compile: use the right type for spill slot
+ 2025-10-03 1caa95acfa cmd/compile: enhance prove to deal with double-offset IsInBounds checks
+ 2025-10-03 ec70d19023 cmd/compile: rewrite to elide Slicemask from len==c>0 slicing
+ 2025-10-03 10e7968849 cmd/compile: accounts rematerialize ops's output reginfo
+ 2025-10-03 ab043953cb cmd/compile: minor tweak for race detector
+ 2025-10-03 ebb72bef44 cmd/compile: don't treat devel compiler as a released compiler
+ 2025-10-03 c54dc1418b runtime: support valgrind (but not asan) in specialized malloc functions
+ 2025-10-03 a7917eed70 internal/buildcfg: enable specializedmalloc experiment
+ 2025-10-03 630799c6c9 crypto/tls: add flag to render HTML BoGo report

Change-Id: I6bf904c523a77ee7d3dea9c8ae72292f8a5f2ba5
2025-11-13 16:54:07 -05:00
Russ Cox
ff61991aed cmd/go: fix flaky TestScript/mod_get_direct
Use our local git server instead of cloud.google.com/go,
which may go down or otherwise reject our traffic.

I built and installed git 2.23.0 and confirmed that this
updated test still fails if CL 196961 is rolled back.
So the test is still accurate at detecting the problem.

Change-Id: I58011f6cc62af2f21fbbcc526ba5401f4186eeaf
Reviewed-on: https://go-review.googlesource.com/c/go/+/720322
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>
2025-11-13 13:48:15 -08:00
Peter Beard
129d0cb543 net/http/cgi: accept INCLUDED as protocol for server side includes
The existing protocol check for fcgi/cgi requests did not properly
account for Apache SSI (Server-Side Includes) SERVER_PROTOCOL value of
INCLUDED.

Added check for well-known INCLUDED value for proper implementation of
the CGI Spec as specified in RFC 3875 - section 4.1.16.

The SERVER_PROTOCOL section of the specification is outlined at
https://www.rfc-editor.org/rfc/rfc3875.html#section-4.1.16

Fixes #70416

Change-Id: I129e606147e16d1daefb49ed6c13a561a88ddeb6
Reviewed-on: https://go-review.googlesource.com/c/go/+/715680
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Auto-Submit: Sean Liao <sean@liao.dev>
2025-11-13 13:44:03 -08:00
Mark Freeman
77c5130100 go/types: minor simplification
Change-Id: Ia315cef2022197ec740023b67827bc810219b868
Reviewed-on: https://go-review.googlesource.com/c/go/+/715361
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-13 13:14:22 -08:00
Mark Freeman
7601cd3880 go/types: generate cycles.go
Change-Id: I09a31a1ccec082f5538736c48b211e4d567ee80c
Reviewed-on: https://go-review.googlesource.com/c/go/+/715420
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>
2025-11-13 13:13:03 -08:00
Mark Freeman
7a372affd9 go/types, types2: rename definedType to declaredType and clarify docs
declaredType seems a better name for this function because it is reached
when processing a (Named or Alias) type declaration. In both cases, the
fromRHS field (rather than the underlying field) will be set.

Change-Id: Ibb1cc338e3b0632dc63f9cf2fd9d64cef6f1aaa5
Reviewed-on: https://go-review.googlesource.com/c/go/+/695955
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>
2025-11-13 12:54:47 -08:00
Robert Griesemer
57362e9814 go/types, types2: check for direct cycles as a separate phase
A direct cycle is the most basic form of cycle, where no type literal or
predeclared type is reached. It is formed by a series of only TypeNames.

To illustrate, type T T is a direct cycle, but type T [1]T and type T *T
are not. Likewise, the below is also a direct cycle:

  type A B
  type B C
  type C = A

Direct cycles are handled explicitly as part of resolveUnderlying, since
they are the only cycle which can prevent reaching an underlying type.
If we move this check to an earlier compiler phase, we can simplify
resolveUnderlying.

This is the first of (hopefully) several cycle kinds to be moved into a
preliminary phase, with the goal of simplifying the main type-checking
pass. For that reason, the bulk of the logic is placed in cycles.go.

CL based on an earlier version by Mark Freeman.

Change-Id: I3044c383278deb6acb8767c498d8cb68099ba8ef
Reviewed-on: https://go-review.googlesource.com/c/go/+/717343
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: 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>
2025-11-13 11:39:17 -08:00
Ian Alexander
099e0027bd cmd/go/internal/modfetch: consolidate global vars
This commit conslidates global variables represeting the current
modfetch state into a single variable in preparation for injection via
the rsc.io/rf tool.

This commit is part of the larger effort to eliminate global module
loader state.

[git-generate]
cd src/cmd/go/internal/modfetch
rf '
  add State func NewState() *State {\
    s := new(State)\
    s.lookupCache = new(par.Cache[lookupCacheKey, Repo])\
    s.downloadCache = new(par.ErrCache[module.Version, string])\
    return s\
  }

  add State var ModuleFetchState *State = NewState()

  mv State.goSumFile State.GoSumFile
  add State:/^[[:space:]]*GoSumFile /-0 // path to go.sum; set by package modload
  ex {
    GoSumFile -> ModuleFetchState.GoSumFile
  }

  mv State.workspaceGoSumFiles State.WorkspaceGoSumFiles
  add State:/^[[:space:]]*WorkspaceGoSumFiles /-0 // path to module go.sums in workspace; set by package modload
  ex {
    WorkspaceGoSumFiles -> ModuleFetchState.WorkspaceGoSumFiles
  }

  add State:/^[[:space:]]*lookupCache /-0 // The Lookup cache is used cache the work done by Lookup.\
      // It is important that the global functions of this package that access it do not\
      // do so after they return.
  add State:/^[[:space:]]*downloadCache /-0 // The downloadCache is used to cache the operation of downloading a module to disk\
      // (if it'\\\''s not already downloaded) and getting the directory it was downloaded to.\
      // It is important that downloadCache must not be accessed by any of the exported\
      // functions of this package after they return, because it can be modified by the\
      // non-thread-safe SetState function.
  add State:/^[[:space:]]*downloadCache.*$/ // version → directory;
  ex {
    lookupCache -> ModuleFetchState.lookupCache
    downloadCache -> ModuleFetchState.downloadCache
  }
  rm 'lookupCache'
  rm 'downloadCache'
'

for dir in modload ; do
  cd ../${dir}
  rf '
    ex {
      import "cmd/go/internal/modfetch"
      modfetch.GoSumFile -> modfetch.ModuleFetchState.GoSumFile
      modfetch.WorkspaceGoSumFiles -> modfetch.ModuleFetchState.WorkspaceGoSumFiles
    }
  '
done

cd ../modfetch
rf '
  rm GoSumFile
  rm WorkspaceGoSumFiles
'

Change-Id: Iaa0f8a40192127457a539120eb94337940cb8d4a
Reviewed-on: https://go-review.googlesource.com/c/go/+/719700
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-13 09:54:28 -08:00
Russ Cox
028375323f cmd/go/internal/modfetch/codehost: fix flaky TestReadZip
In normal use by the go command, ReadZip always happens after Stat,
which makes sure that the relevant revision has been fetched to
local disk. But TestReadZip calls ReadZip directly, and ReadZip was not
ensuring that fetch had happened.

This made 'go test' pass (because other earlier tests had done Stat of
the hg test repo) but 'go test -run=ReadZip' fail by itself.
And on big enough machines, the tests that were doing the Stat
were running in parallel with ReadZip, causing non-deterministic
failures depending on whether the Stat completed before ReadZip started.

Fix the race by calling Stat directly in ReadZip, like we already do in ReadFile.

Fixes longtest builder flake.

Change-Id: Ib42f64876b7ef51d8148c616539b412b42f8b24e
Reviewed-on: https://go-review.googlesource.com/c/go/+/720280
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-13 09:27:58 -08:00
Michael Pratt
4ebf295b0b runtime: prefer to restart Ps on the same M after STW
Today, Ps jump around arbitrarily across STW. Instead, try to keep the P
on the previous M it ran on. In the future, we'll likely want to try to
expand this beyond STW to create a more general affinity for specific
Ms.

For this to be useful, the Ps need to have runnable Gs. Today, STW
preemption goes through goschedImpl, which places the G on the global
run queue. If that was the only G then the P won't have runnable
goroutines anymore.

It makes more sense to keep the G with its P across STW anyway, so add a
special case to goschedImpl for that.

On my machine, this CL reduces the error rate in TestTraceSTW from 99.8%
to 1.9%.

As a nearly 2% error rate shows, there are still cases where this best
effort scheduling doesn't work. The most obvious is that while
procresize assigns Ps back to their original M, startTheWorldWithSema
calls wakep to start a spinning M. The spinning M may steal a goroutine
from another P if that P is too slow to start.

For #65694.

Change-Id: I6a6a636c0969c587d039b68bc68ea16c74ff1fc9
Reviewed-on: https://go-review.googlesource.com/c/go/+/714801
Reviewed-by: 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>
2025-11-13 07:44:41 -08:00
Michael Anthony Knyszek
625d8e9b9c runtime/pprof: fix goroutine leak profile tests for noopt
The goroutine leak profile tests currently rely on a function being
inlined, which results in a slightly different representation in the
pprof proto. This function is not inlined on the noopt builder.

Disable inlining of the one function which could be inlined to align but
the regular and noopt builder versions of this test. We're not
interested in testing the inlining functionality of profiles with this
test, we care about certain stack frames appearing in a certain order.

This also simplifies a bunch of the checking in the test.

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-noopt
Change-Id: I28902cc4c9fae32d1e3fa41b93b00c3be4d6074a
Reviewed-on: https://go-review.googlesource.com/c/go/+/720100
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-13 07:23:03 -08:00
Robert Griesemer
4684a26c26 spec: remove cycle restriction for type parameters
Fixes #75883.

Change-Id: I708c0594ef3182d3aca37a6358aa0a0ef89809b6
Reviewed-on: https://go-review.googlesource.com/c/go/+/711422
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-13 06:26:25 -08:00
Joel Sing
0f9c8fb29d cmd/asm,cmd/internal/obj/riscv: add support for riscv compressed instructions
Add support for compressed instructions in the RISC-V assembler. This
implements instruction validation and encoding for all instructions in
the "C" extension.

It is worth noting that the validation and encoding of these instructions
is far more convoluted then the typical instruction validation and
encoding. While the current model has been followed for now, it would be
worth revisiting this in the future and potentially switching to a table
based or even per-instruction implementation.

Additionally, the current instruction encoding is lacking some of the bits
needed for compressed instructions - this is solved by compressedEncoding,
which provides the missing information. This will also be addressed in the
future, likely by changing the instruction encoding format.

Updates #71105

Change-Id: I0f9359d63f93ebbdc6e708e79429b2d61eae220d
Reviewed-on: https://go-review.googlesource.com/c/go/+/713020
Reviewed-by: Mark Ryan <markdryan@rivosinc.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
2025-11-13 04:17:37 -08:00
Joel Sing
a15d036ce2 cmd/internal/obj/riscv: implement better bit pattern encoding
Replace the extractBitAndShift function with an encodeBitPattern function.
This allows the caller to specify a slice of bits that are to be extracted
and encoded, rather than making multiple function calls and combining the
results.

Change-Id: I3d51caa10ecf714f2ad2fb66d38376202c4e0628
Reviewed-on: https://go-review.googlesource.com/c/go/+/702397
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Ryan <markdryan@rivosinc.com>
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-11-13 04:15:10 -08:00
Guoqi Chen
abb241a789 cmd/internal/obj/loong64: add {,X}VS{ADD,SUB}.{B/H/W/V}{,U} instructions support
Go asm syntax:
	 VSADD{B,H,W,V}     V1, V2, V3
	 VSADD{B,H,W,V}U    V1, V2, V3
	 VSSUB{B,H,W,V}     V1, V2, V3
	 VSSUB{B,H,W,V}U    V1, V2, V3
	XVSADD{B,H,W,V}     X1, X2, X3
	XVSADD{B,H,W,V}U    X1, X2, X3
	XVSSUB{B,H,W,V}     X1, X2, X3
	XVSSUB{B,H,W,V}U    X1, X2, X3

Equivalent platform assembler syntax:
	 vsadd.{b,h,w,d}    v3, v2, v1
	 vsadd.{b,h,w,d}u   v3, v2, v1
	 vssub.{b,h,w,d}    v3, v2, v1
	 vssub.{b,h,w,d}u   v3, v2, v1
	xvsadd.{b,h,w,d}    x3, x2, x1
	xvsadd.{b,h,w,d}u   x3, x2, x1
	xvssub.{b,h,w,d}    x3, x2, x1
	xvssub.{b,h,w,d}u   x3, x2, x1

Change-Id: Iab8c1a9bdc4940598936f3beac846466e913ffa2
Reviewed-on: https://go-review.googlesource.com/c/go/+/719200
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-11-12 22:16:07 -08:00
Michael Anthony Knyszek
0929d21978 cmd/go: keep objects alive while stopping cleanups
There are two places in cmd/go where cleanups are stopped before they
fire, and where the objects the cleanups are attached to may be dead
while we call Stop. This is essentially a race between Stop and the
cleanup being called. This can be fine, but these cleanups are used as
a way to check some invariants, so just panic if they're executed. As a
result, if they fire erroneously, they'll take down the whole process,
even if no invariant was actually violated.

The runtime.Cleanup.Stop documentation explains that users of Stop need
to hold the object alive across the call to Stop if they want to be sure
that Stop succeeds, so do that here by adding an explicit
runtime.KeepAlive call.

Kudos to Michael Pratt for finding the issue.

Fixes #74780.

Change-Id: I22e6f4642ac68f727ca3781f5d39a85015047925
Reviewed-on: https://go-review.googlesource.com/c/go/+/719961
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2025-11-12 16:14:30 -08:00
Michael Pratt
f03d06ec1a runtime: fix list test memory management for mayMoreStack
The NIH tests simply failed to allocate the nodes outside the heap at
all. The Manual tests failed to keep the nodes alive, allowing the GC to
collect them.

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest
Change-Id: I6a6a636c434bb703d6888383d32dbf95fb0a15ea
Reviewed-on: https://go-review.googlesource.com/c/go/+/719962
TryBot-Bypass: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-11-12 13:54:59 -08:00
Filippo Valsorda
48127f656b crypto/internal/fips140/sha3: remove outdated TODO
Change-Id: I6a6a6964725fed48b55ce72a24a8f9bd3044ae16
Reviewed-on: https://go-review.googlesource.com/c/go/+/719940
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: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-11-12 10:03:55 -08:00
Jes Cok
c3d1d42764 sync/atomic: amend comments for Value.{Swap,CompareAndSwap}
Related to CL 241661, CL 403094.

Change-Id: I86877d9a013b05b1a97f9aa1333cd96ce98469cb
GitHub-Last-Rev: 7fedca5848
GitHub-Pull-Request: golang/go#76259
Reviewed-on: https://go-review.googlesource.com/c/go/+/719660
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-11-12 10:03:52 -08:00
Ian Lance Taylor
e0807ba470 cmd/compile: don't clear ptrmask in fillptrmask
It is only ever called with a newly allocated slice.

This clearing code dates back to the C version of the compiler,
in which the function started like this:

static void
gengcmask(Type *t, uint8 gcmask[16])
{
	...

	memset(gcmask, 0, 16);
	if(!haspointers(t))
		return;

That memset was required for C, but not for Go.

Change-Id: I6fceb99b2dc8682685dca2e4289fcd58e2e5a0e0
Reviewed-on: https://go-review.googlesource.com/c/go/+/718340
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-11-12 10:03:49 -08:00
Ian Lance Taylor
66318d2b4b internal/abi: correctly describe result in Name.Name doc comment
Change-Id: I3d0b138a4b5fbdd6a6c7a26984f8ce5d3ea4c7ec
Reviewed-on: https://go-review.googlesource.com/c/go/+/718320
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-12 10:03:46 -08:00
Michael Munday
34aef89366 cmd/compile: use FCLASSD for subnormal checks on riscv64
Only implemented for 64 bit floating point operations for now.

goos: linux
goarch: riscv64
pkg: math
cpu: Spacemit(R) X60
                    │       sec/op        │   sec/op     vs base                │
Acos                          154.1n ± 0%   154.1n ± 0%        ~ (p=0.303 n=10)
Acosh                         215.8n ± 6%   226.7n ± 0%        ~ (p=0.439 n=10)
Asin                          149.2n ± 1%   149.2n ± 0%        ~ (p=0.700 n=10)
Asinh                         262.1n ± 0%   258.5n ± 0%   -1.37% (p=0.000 n=10)
Atan                          99.48n ± 0%   99.49n ± 0%        ~ (p=0.836 n=10)
Atanh                         244.9n ± 0%   243.8n ± 0%   -0.43% (p=0.002 n=10)
Atan2                         158.2n ± 1%   153.3n ± 0%   -3.10% (p=0.000 n=10)
Cbrt                          186.8n ± 0%   181.1n ± 0%   -3.03% (p=0.000 n=10)
Ceil                          36.71n ± 1%   36.71n ± 0%        ~ (p=0.434 n=10)
Copysign                      6.531n ± 1%   6.526n ± 0%        ~ (p=0.268 n=10)
Cos                           98.19n ± 0%   95.40n ± 0%   -2.84% (p=0.000 n=10)
Cosh                          233.1n ± 0%   222.6n ± 0%   -4.50% (p=0.000 n=10)
Erf                           122.5n ± 0%   114.2n ± 0%   -6.78% (p=0.000 n=10)
Erfc                          126.0n ± 1%   116.6n ± 0%   -7.46% (p=0.000 n=10)
Erfinv                        138.8n ± 0%   138.6n ± 0%        ~ (p=0.082 n=10)
Erfcinv                       140.0n ± 0%   139.7n ± 0%        ~ (p=0.359 n=10)
Exp                           193.3n ± 0%   184.2n ± 0%   -4.68% (p=0.000 n=10)
ExpGo                         204.8n ± 0%   194.5n ± 0%   -5.03% (p=0.000 n=10)
Expm1                         152.5n ± 1%   145.0n ± 0%   -4.92% (p=0.000 n=10)
Exp2                          174.5n ± 0%   164.2n ± 0%   -5.85% (p=0.000 n=10)
Exp2Go                        184.4n ± 1%   175.4n ± 0%   -4.88% (p=0.000 n=10)
Abs                           4.912n ± 0%   4.914n ± 0%        ~ (p=0.283 n=10)
Dim                           15.50n ± 1%   15.52n ± 1%        ~ (p=0.331 n=10)
Floor                         36.89n ± 1%   36.76n ± 1%        ~ (p=0.325 n=10)
Max                           31.05n ± 1%   31.17n ± 1%        ~ (p=0.628 n=10)
Min                           31.01n ± 0%   31.06n ± 0%        ~ (p=0.767 n=10)
Mod                           294.1n ± 0%   245.6n ± 0%  -16.52% (p=0.000 n=10)
Frexp                         44.86n ± 1%   35.20n ± 0%  -21.53% (p=0.000 n=10)
Gamma                         195.8n ± 0%   185.4n ± 1%   -5.29% (p=0.000 n=10)
Hypot                         84.91n ± 0%   84.54n ± 1%   -0.43% (p=0.006 n=10)
HypotGo                       96.70n ± 0%   95.42n ± 1%   -1.32% (p=0.000 n=10)
Ilogb                         45.03n ± 0%   35.07n ± 1%  -22.10% (p=0.000 n=10)
J0                            634.5n ± 0%   627.2n ± 0%   -1.16% (p=0.000 n=10)
J1                            644.5n ± 0%   636.9n ± 0%   -1.18% (p=0.000 n=10)
Jn                            1.357µ ± 0%   1.344µ ± 0%   -0.92% (p=0.000 n=10)
Ldexp                         49.89n ± 0%   39.96n ± 0%  -19.90% (p=0.000 n=10)
Lgamma                        186.6n ± 0%   184.3n ± 0%   -1.21% (p=0.000 n=10)
Log                           150.4n ± 0%   141.1n ± 0%   -6.15% (p=0.000 n=10)
Logb                          46.70n ± 0%   35.89n ± 0%  -23.15% (p=0.000 n=10)
Log1p                         164.1n ± 0%   163.9n ± 0%        ~ (p=0.122 n=10)
Log10                         153.1n ± 0%   143.5n ± 0%   -6.24% (p=0.000 n=10)
Log2                          58.83n ± 0%   49.75n ± 0%  -15.43% (p=0.000 n=10)
Modf                          40.82n ± 1%   40.78n ± 0%        ~ (p=0.239 n=10)
Nextafter32                   49.15n ± 0%   48.93n ± 0%   -0.44% (p=0.011 n=10)
Nextafter64                   43.33n ± 0%   43.23n ± 0%        ~ (p=0.228 n=10)
PowInt                        269.4n ± 0%   243.8n ± 0%   -9.49% (p=0.000 n=10)
PowFrac                       618.0n ± 0%   571.7n ± 0%   -7.48% (p=0.000 n=10)
Pow10Pos                      13.09n ± 0%   13.05n ± 0%   -0.31% (p=0.003 n=10)
Pow10Neg                      30.99n ± 1%   30.99n ± 0%        ~ (p=0.173 n=10)
Round                         23.73n ± 0%   23.65n ± 0%   -0.36% (p=0.011 n=10)
RoundToEven                   27.87n ± 0%   27.73n ± 0%   -0.48% (p=0.003 n=10)
Remainder                     282.1n ± 0%   249.6n ± 0%  -11.52% (p=0.000 n=10)
Signbit                       11.46n ± 0%   11.42n ± 0%   -0.39% (p=0.003 n=10)
Sin                           115.2n ± 0%   113.2n ± 0%   -1.74% (p=0.000 n=10)
Sincos                        140.6n ± 0%   138.6n ± 0%   -1.39% (p=0.000 n=10)
Sinh                          252.0n ± 0%   241.4n ± 0%   -4.21% (p=0.000 n=10)
SqrtIndirect                  4.909n ± 0%   4.893n ± 0%   -0.34% (p=0.021 n=10)
SqrtLatency                   19.57n ± 1%   19.57n ± 0%        ~ (p=0.087 n=10)
SqrtIndirectLatency           19.64n ± 0%   19.57n ± 0%   -0.36% (p=0.025 n=10)
SqrtGoLatency                 198.1n ± 0%   197.4n ± 0%   -0.35% (p=0.014 n=10)
SqrtPrime                     5.733µ ± 0%   5.725µ ± 0%        ~ (p=0.116 n=10)
Tan                           149.1n ± 0%   146.8n ± 0%   -1.54% (p=0.000 n=10)
Tanh                          248.2n ± 1%   238.1n ± 0%   -4.05% (p=0.000 n=10)
Trunc                         36.86n ± 0%   36.70n ± 0%   -0.43% (p=0.029 n=10)
Y0                            638.2n ± 0%   633.6n ± 0%   -0.71% (p=0.000 n=10)
Y1                            641.8n ± 0%   636.1n ± 0%   -0.87% (p=0.000 n=10)
Yn                            1.358µ ± 0%   1.345µ ± 0%   -0.92% (p=0.000 n=10)
Float64bits                   5.721n ± 0%   5.709n ± 0%   -0.22% (p=0.044 n=10)
Float64frombits               4.905n ± 0%   4.893n ± 0%        ~ (p=0.266 n=10)
Float32bits                   12.27n ± 0%   12.23n ± 0%        ~ (p=0.122 n=10)
Float32frombits               4.909n ± 0%   4.893n ± 0%   -0.32% (p=0.024 n=10)
FMA                           6.556n ± 0%   6.526n ± 0%        ~ (p=0.283 n=10)
geomean                       86.82n        83.75n        -3.54%

Change-Id: I522297a79646d76543d516accce291f5a3cea337
Reviewed-on: https://go-review.googlesource.com/c/go/+/717560
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-11-12 10:03:41 -08:00
Sean Liao
0c28789bd7 net/url: disallow raw IPv6 addresses in host
RFC 3986 requires square brackets around IPv6 addresses.
Parse's acceptance of raw IPv6 addresses is non compliant,
and complicates splitting out a port.

This is a resubmission of CL 710176 after the revert in CL 711800,
this time with a new urlstrictipv6 godebug to control the behavior.

Fixes #31024
Fixes #75223

Change-Id: I4cbe5bb84266b3efe9c98cf4300421ddf1df7291
Reviewed-on: https://go-review.googlesource.com/c/go/+/712840
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-12 10:02:50 -08:00
Daniel Morsing
4e761b9a18 cmd/compile: optimize liveness in stackalloc
The stackalloc code needs to run a liveness pass to build the
interference graph between stack slots. Because the values that we need
liveness over is so sparse, we can optimize the analysis by using a path
exploration algorithm rather than a iterative dataflow one

In local testing, this cuts 74.05 ms of CPU time off a build of cmd/compile.

Change-Id: I765ace87d5e8aae177e65eb63da482e3d698bea7
Reviewed-on: https://go-review.googlesource.com/c/go/+/718540
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
2025-11-12 10:02:27 -08:00
Roland Shoemaker
956909ff84 crypto/x509: move BetterTLS suite from crypto/tls
Move the BetterTLS test suite from crypto/tls to crypto/x509. Despite
the name, the test suites we care about are actually related to X.509
path building and name constraint checking. As such it makes more sense
to include these in the crypto/x509 package, so we are more likely to
catch breaking behaviors during local testing.

Change-Id: I5237903dcc9d9f60d6c7070db3c996ceb643b04c
Reviewed-on: https://go-review.googlesource.com/c/go/+/719120
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Auto-Submit: Roland Shoemaker <roland@golang.org>
2025-11-12 09:59:31 -08:00
Ian Lance Taylor
6525f46707 cmd/link: change shdr and phdr from arrays to slices
Removes an arbitrary and unnecessary limit.

Change-Id: Iba04568ed5e6b1a8f8f23369f51f068e830f1059
Reviewed-on: https://go-review.googlesource.com/c/go/+/718600
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-11-12 09:58:02 -08:00
Michael Pratt
d3aeba1670 runtime: switch p.gcFractionalMarkTime to atomic.Int64
atomic.Int64 automatically maintains proper alignment, avoiding the need
to manually adjust alignment back and forth as fields above change.

Change-Id: I6a6a636c4c3c366353f6dc8ecac473c075dd5cd9
Reviewed-on: https://go-review.googlesource.com/c/go/+/716700
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
2025-11-12 08:26:55 -08:00
Vlad Saioc
8873e8bea2 runtime,runtime/pprof: clean up goroutine leak profile writing
Cleaned up goroutine leak profile extraction:
- removed the acquisition of goroutineProfile semaphore
- inlined the call to saveg when recording stacks instead of using
doRecordGoroutineProfile, which had side-effects over
goroutineProfile fields.

Added regression tests for goroutine leak profiling frontend for binary
and debug=1 profile formats.
Added stress tests for concurrent goroutine and goroutine leak profile requests.

Change-Id: I55c1bcef11e9a7fb7699b4c5a2353e594d3e7173
GitHub-Last-Rev: 5e9eb3b1d8
GitHub-Pull-Request: golang/go#76045
Reviewed-on: https://go-review.googlesource.com/c/go/+/714580
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-11-12 08:08:34 -08:00
Sean Liao
b8b84b789e cmd/go: clarify the -o testflag is only for copying the binary
Fixes #74769

Change-Id: Iebbaea8fb1a25e30a541a827815def9e269a8135
Reviewed-on: https://go-review.googlesource.com/c/go/+/709255
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Ian Alexander <jitsu@google.com>
Reviewed-by: Michael Matloob <matloob@google.com>
2025-11-12 08:01:00 -08:00
Julien Cretel
c761b26b56 mime: parse media types that contain braces
This CL fixes a bug introduced by CL 666655: isTokenChar would no longer
(but should) report true for '{' and '}'.

Fixes #76236

Change-Id: Ifc0953c30d7cae7bfba9bc4b6bb6951a83c52576
GitHub-Last-Rev: c91a75c2c8
GitHub-Pull-Request: golang/go#76243
Reviewed-on: https://go-review.googlesource.com/c/go/+/719380
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-12 08:00:45 -08:00
Sean Liao
65858a146e os/exec: include Cmd.Start in the list of methods that run Cmd
Fixes #76265

Change-Id: I451271c5662dd3bcdeec07b55761b15f64c00dcd
Reviewed-on: https://go-review.googlesource.com/c/go/+/719860
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
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@google.com>
2025-11-12 07:27:58 -08:00
Alan Donovan
4bfc3a9d14 std,cmd: go fix -any std cmd
This change mechanically replaces all occurrences of interface{}
by 'any' (where deemed safe by the 'any' modernizer) throughout
std and cmd, minus their vendor trees.

Since this fix is relatively numerous, it gets its own CL.

Also, 'go generate go/types'.

Change-Id: I14a6b52856c3291c1d27935409bca8d5fd4242a2
Reviewed-on: https://go-review.googlesource.com/c/go/+/719702
Commit-Queue: Alan Donovan <adonovan@google.com>
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>
Auto-Submit: Alan Donovan <adonovan@google.com>
2025-11-11 19:59:40 -08:00
Junyang Shao
86b4fe31d9 [dev.simd] cmd/compile: add masked merging ops and optimizations
This CL generates optimizations for masked variant of AVX512
instructions for patterns:

x.Op(y).Merge(z, mask) => OpMasked(z, x, y mask), where OpMasked is
resultInArg0.

Change-Id: Ife7ccc9ddbf76ae921a085bd6a42b965da9bc179
Reviewed-on: https://go-review.googlesource.com/c/go/+/718160
Reviewed-by: David Chase <drchase@google.com>
TryBot-Bypass: Junyang Shao <shaojunyang@google.com>
2025-11-11 13:34:39 -08:00
Michael Pratt
2263d4aabd runtime: doubly-linked sched.midle list
This will be used by CL 714801 to remove Ms from the middle of the list.

We could simply convert schedlink to the doubly-linked list, bringing
along all other uses of schedlink.

However, CL 714801 removes Ms from the middle of the midle list. It
would be an easy mistake to make to accidentally remove an M from
schedlink, assuming that it is on the midle list when it is actually on
a completely different list. Using separate a list node makes this
impossible.

For #65694.

Change-Id: I6a6a636c223d925fdc30c0c648460cbf5c2af4d6
Reviewed-on: https://go-review.googlesource.com/c/go/+/714800
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>
2025-11-11 13:29:58 -08:00
Michael Pratt
046dce0e54 runtime: use new list type for spanSPMCs
Now that we have a reusable list type, use it to replace the custom
linked list code for spanSPMCs.

Change-Id: I6a6a636ca54f2ba4b5c7dddba607c94ebf3c3ac8
Reviewed-on: https://go-review.googlesource.com/c/go/+/714021
Reviewed-by: 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>
2025-11-11 13:29:54 -08:00
Michael Pratt
5f11275457 runtime: reusable intrusive doubly-linked list
Unfortunately we have two nearly identical types. One for standard types
and one for sys.NotInHeap types or cases that must avoid write barriers.
The latter must use uintptr fields, as assignment to unsafe.Pointer
fields generates a write barrier.

Change-Id: I6a6a636c62d83fa93b991033c7108d3b934412ac
Reviewed-on: https://go-review.googlesource.com/c/go/+/714020
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Commit-Queue: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
2025-11-11 13:08:45 -08:00
Michael Pratt
951cf0501b internal/trace/testtrace: fix flag name typos
Change-Id: I6a6a636cd82a3e22a482ea2b2ab1004c45e2c304
Reviewed-on: https://go-review.googlesource.com/c/go/+/719400
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-11 12:50:08 -08:00
Russ Cox
2750f95291 cmd/go: implement accurate pseudo-versions for Mercurial
This is CL 124515 (which only did Git) but for Mercurial,
quite a few years late. I'm not sure why we didn't do it
at the time - probably Mercurial blindness. Do it now.

Change-Id: I28f448a19143f7ce3de337cd1891bae86023b499
Reviewed-on: https://go-review.googlesource.com/c/go/+/718502
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-11 07:26:31 -08:00
Russ Cox
b709a3e8b4 cmd/go/internal/vcweb: cache hg servers
Cuts TestScript/reuse_hg from 73s to 47s.
(Python startup is slow! What's left is all Python too!)

Change-Id: Ia7124d4819286b3820355e4f427ffcfdc125491b
Reviewed-on: https://go-review.googlesource.com/c/go/+/718501
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>
Auto-Submit: Russ Cox <rsc@golang.org>
2025-11-11 07:26:28 -08:00
Russ Cox
426ef30ecf cmd/go: implement -reuse for Mercurial repos
When we added -reuse in CL 411398, we only handled Git repos.
This was partly because we were focused on Git traffic,
partly because Git is the dominant module VCS, and
partly because I couldn't see how to retrieve the metadata needed
in other version control systems.

This CL adds -reuse support for Mercurial, the second
most popular VCS for modules, now that I see how to
implement it. Although the Mercurial command line does
not have sufficient information, the Mercurial Python API does,
so we ship and invoke a Mercurial extension written in Python
that can compute a hash of the remote repo without downloading
it entirely, as well as resolve a remote name to a hash or check
the continued existence of a hash. Then we can avoid
downloading the repo at all if it hasn't changed since the last check
or if the specific reference we need still resolves or exists.

Fixes #75119.

Change-Id: Ia47d89b15c1091c44efef9d325270fc400a412c4
Reviewed-on: https://go-review.googlesource.com/c/go/+/718382
Auto-Submit: Russ Cox <rsc@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-11 07:21:02 -08:00
Robert Griesemer
5241d114f5 spec: more precise prose for special case of append
As written, the special case for append may be interpreted
such that any first argument that is assignable to []byte
is permissible, including nil. This change makes makes it
clear that a slice argument is required.

Not a language change. The compiler always expected a slice
argument.

Fixes #76226.

Change-Id: I73a1725d10096690335d6edf5793beb5de73578f
Reviewed-on: https://go-review.googlesource.com/c/go/+/718880
Reviewed-by: Junyang Shao <shaojunyang@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>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2025-11-10 12:48:05 -08:00
Robert Griesemer
cdf64106f6 go/types, types2: first argument to append must never be be nil
The current implementation followed the spec faithfully for
the special case for append. Per the spec:

As a special case, append also accepts a first argument assignable to
type []byte with a second argument of string type followed by ... .

As it happens, nil is assignable to []byte, so append(nil, ""...)
didn't get an error message but a subsequent assertion failed.

This CL ensures that the first argument to append is never nil and
always a slice. We should make the spec more precise (separate CL).

Fixes #76220.

Change-Id: I581d11827a75afbb257077814beea813d4fe2441
Reviewed-on: https://go-review.googlesource.com/c/go/+/718860
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Brett Howell <devbrett90@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-10 12:48:02 -08:00
Michael Pratt
a0eb4548cf .gitignore: ignore go test artifacts
go test -artifacts writes artifacts to _artifacts. These are outputs
from a specific test and are never intended to be commited.

Change-Id: I6a6a636cd7689e5e664b190c83ccb93060f26d4e
Reviewed-on: https://go-review.googlesource.com/c/go/+/717521
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
2025-11-10 12:41:03 -08:00
Michael Pratt
bf58e7845e internal/trace: add "command" to convert text traces to raw
This is primarily helpful for parsing traces dumped via CI.

cmd/dist doesn't like commands in std which are not actually part of the
Go distribution. So rather than using a real command, this is actually a
test which does the conversion.

Change-Id: I6a6a636c829a4acc0bce8cf7548105ad59d83c67
Reviewed-on: https://go-review.googlesource.com/c/go/+/716882
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-10 12:21:57 -08:00
Michael Anthony Knyszek
052c192a4c runtime: fix lock rank for work.spanSPMCs.lock
Currently this lock is treated like a leaf lock, but it's not one. It
can acquire the globalAlloc lock via fixalloc and persistentalloc.

This means we need to figure out where it can be acquired. In general,
it can be acquired by any write barrier, which is already incredibly
broad. AFAICT, it can't be acquired directly otherwise, except when
destroying a spanSPMC during procresize, in which case we'll be holding
sched.lock.

Fixes #75916.

Change-Id: I2da1f5b82c750bf4e8d6a8a562046b9a17fd44be
Reviewed-on: https://go-review.googlesource.com/c/go/+/717500
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-10 09:55:57 -08:00
Junyang Shao
771a1dc216 [dev.simd] cmd/compile: add peepholes for all masked ops and bug fixes
For 512-bits they are unchanged. This CL adds the optimization rules for
128/256-bits under feature check.

This CL also fixed a bug for masked load variant of instructions and
make them zeroing by default as well.

Change-Id: I6fe395541c0cd509984a81841420e71c3af732f2
Reviewed-on: https://go-review.googlesource.com/c/go/+/717822
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-10 09:53:24 -08:00
Junyang Shao
972732b245 [dev.simd] simd, cmd/compile: remove move from API
These should really be machine ops only.

Change-Id: Idcc611719eff068153d88c5162dd2e0883e5e0ca
Reviewed-on: https://go-review.googlesource.com/c/go/+/717821
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-10 09:53:20 -08:00
Junyang Shao
bf77323efa [dev.simd] simd: put unexported methods to another file
This CL is just a cleanup.

Change-Id: I429f2d211828e17faca03a02f40e9f544b94844d
Reviewed-on: https://go-review.googlesource.com/c/go/+/717820
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-10 09:53:16 -08:00
Joel Sing
bc5ffe5c79 internal/runtime/sys,math/bits: eliminate bounds checks on len8tab
The compiler cannot currently determine that the accesses to len8tab
are within bounds. Cast to uint8 to avoid unnecessary bounds checks.

Fixes #76166

Change-Id: I1fd930bba2b20d3998252c476308642e08ce00b4
Reviewed-on: https://go-review.googlesource.com/c/go/+/718040
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Auto-Submit: Joel Sing <joel@sing.id.au>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-10 09:48:20 -08:00
Nick Ripley
32f8d6486f runtime: document that tracefpunwindoff applies to some profilers
The tracefpunwindoff GODEBUG applies to all the places where we use
frame pointer unwinding. Originally that was just the execution tracer,
but now we also use it for the block and mutex profilers.

Change-Id: I6a6a69641fede668d96335582dba6d43e62f6a51
Reviewed-on: https://go-review.googlesource.com/c/go/+/718522
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Nick Ripley <nick.ripley@datadoghq.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-11-10 09:47:02 -08:00
mohanson
1c1c1942ba cmd/go: remove redundant AVX regex in security flag checks
Remove "-m(no-)?avx[0-9a-z]*" from validCompilerFlags in security.go,
because "-m(no-)?avx[0-9a-z.]*" (see line 108) already covers its
matching range.

Change-Id: Ic86a45eefa7639ed3a8cdee95f08021d9515678e
Reviewed-on: https://go-review.googlesource.com/c/go/+/717740
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-11-10 09:46:57 -08:00
Keith Randall
3b3d6b9e5d cmd/internal/obj/arm64: shorten constant integer loads
Large integer constants can take up to 4 instructions to encode.

We can encode some large constants with a single instruction, namely
those which are bit patterns (repetitions of certain runs of 0s and 1s).

Often the constants we want to encode are *close* to those bit patterns,
but don't exactly match. For those, we can use 2 instructions, one to
load the close-by bit pattern and one to fix up any mismatches.

The constants we use to strength reduce divides often fit this pattern.
For unsigned divides by 1 through 15, this CL applies to the constant
for N=3,5,6,10,12,15.

Triggers 17 times in hello world.

Change-Id: I623abf32961fb3e74d0a163f6822f0647cd94499
Reviewed-on: https://go-review.googlesource.com/c/go/+/717900
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@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-11-10 09:34:13 -08:00
khr@golang.org
5f4b5f1a19 runtime/msan: use different msan routine for copying
__msan_memmove records the fact that we're copying memory, and
actually does the copy. Use instead __msan_copy_shadow, which
records the fact that we're copying memory, but doesn't actually
do the copy itself.

We're doing the copy ourselves, so we don't need msan to do it also.

More importantly, msan doing the copy clobbers the target before
we issue the write barrier, which causes pointers to get lost.

Fixes #76138

Change-Id: I17aea739f9444de21fac2bbfd81e48534a39481d
Reviewed-on: https://go-review.googlesource.com/c/go/+/719020
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: t hepudds <thepudds1460@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Radu Berinde <radu@cockroachlabs.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2025-11-10 08:07:42 -08:00
Jes Cok
0fe6c8e8c8 runtime: tweak wording for comment of mcache.flushGen
Change-Id: I5f59b2a2d18a7657892ae4c042a1b013cf8f9736
GitHub-Last-Rev: d5b5bb3e19
GitHub-Pull-Request: golang/go#76215
Reviewed-on: https://go-review.googlesource.com/c/go/+/718461
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2025-11-10 08:03:37 -08:00
Jes Cok
95a0e5adc1 sync: don't call Done when f() panics in WaitGroup.Go
This change is based on
https://github.com/golang/go/issues/76126#issuecomment-3473417226
by adonovan.

Fixes #76126
Fixes #74702

Change-Id: Ie404d8204be8917fa8a7b414bb6d319238267c83
GitHub-Last-Rev: b1beddcd72
GitHub-Pull-Request: golang/go#76172
Reviewed-on: https://go-review.googlesource.com/c/go/+/717760
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mateusz Poliwczak <mpoliwczak34@gmail.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-11-10 07:49:54 -08:00
Ian Alexander
e8ed85d6c2 cmd/go: update goSum if necessary
During investigation into #74691, we found a case where the hash was
missing from the goSum global var.  This change updates DownloadZip to
update the goSum hash if necessary when both the zipfile and
ziphashfile are already present.

For #74691

Change-Id: I904b7265f667256d0c60b66503a7954b467c6454
Reviewed-on: https://go-review.googlesource.com/c/go/+/705215
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>
2025-11-08 04:26:29 -08:00
Ian Alexander
b76103c08e cmd/go: output missing GoDebug entries
The `go help mod edit` command references the GoDebug struct, but `go
mod edit -json` was not displaying them when appropriate.

Fixes #75105

Change-Id: Iec987882941e01b0cf4d4fe31dda9e7a6e2dde87
Reviewed-on: https://go-review.googlesource.com/c/go/+/706757
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2025-11-08 04:25:35 -08:00
Russ Cox
47a63a331d cmd/go: rewrite hgrepo1 test repo to be deterministic
The use of git convert made it non-determinstic.
Build it up by hand using hg commands instead.

Change-Id: Iaa9c0925864a7003ea61e5bf2a9196ff3e0a662b
Reviewed-on: https://go-review.googlesource.com/c/go/+/718520
Auto-Submit: Russ Cox <rsc@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2025-11-07 16:59:40 -08:00
Russ Cox
7995751d3a cmd/go: copy git reuse and support repos to hg
The reuse_hg.txt is reuse_git.txt with a skip at the top
and a global substitute of git->hg and fetch->pull.

The prefixtagtests.txt and tagtests.txt are straight
copies of the git equivalents.

This is to set up a readable diff in the followup CL
that turns it into a reuse test for hg.

For #75119.

Change-Id: I50c7f5559ee6479f8328ed54c14eafcc7f1ecc1f
Reviewed-on: https://go-review.googlesource.com/c/go/+/718381
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-07 14:16:34 -08:00
Russ Cox
66c7ca7fb3 cmd/go: improve TestScript/reuse_git
Most reuse origin info in git should not list RepoSum; check that.

Also add tests of go list -reuse, which were omitted entirely
in CL 411398.

Also be extra sure there is no repo left in module cache during reuse tests.

For #75119.

Change-Id: Ia1436b8d9e17db49664d24f1d43c448ac7cd00d2
Reviewed-on: https://go-review.googlesource.com/c/go/+/718380
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2025-11-07 14:16:18 -08:00
Ian Lance Taylor
de84ac55c6 cmd/link: clean up some comments to Go standards
Also drop a couple of unused names.

Change-Id: I0f09775a276c34ece7809cf5d3f7c6b8cd1fa487
Reviewed-on: https://go-review.googlesource.com/c/go/+/718580
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-07 13:39:21 -08:00
qiulaidongfeng
5cd1b73772 runtime: correctly print panics before fatal-ing on defer
Fixes #67792

Change-Id: I93d16580cb31e54cee7c8490212404e4d0dec446
Reviewed-on: https://go-review.googlesource.com/c/go/+/613757
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Keith Randall <khr@golang.org>
2025-11-07 12:55:37 -08:00
Ariel Otilibili
91ca80f970 runtime/cgo: improve error messages after pointer panic
This CL improves the error messages after panics due to the
sharing of an unpinned Go pointer (or a pointer to an unpinned Go
pointer) between Go and C.

This occurs when it is:
1. returned from Go to C (through cgoCheckResult)
2. passed as argument to a C function (through cgoCheckPointer).

An unpinned Go pointer refers to a memory location that might be moved or
freed by the garbage collector.

Therefore:

- change the signature of cgoCheckArg (it does the real work behind
  cgoCheckResult and cgoCheckPointer)
- change the signature of cgoCheckUnknownPointer (called by cgoCheckArg
  for checking unexpected pointers)
- introduce cgoFormatErr (it is called by cgoCheckArg and
  cgoCheckUnknownPointer to format panic error messages)
- update the cgo pointer tests (add new tests, and a field errTextRegexp
  to the struct ptrTest)
- remove a loop variable in TestPointerChecks (similar to CL 711640).

1. cgoCheckResult

When an unpinned Go pointer (or a pointer to an unpinned Go pointer) is
returned from Go to C,

     1  package main
     2
     3  /*
     4     #include <stdio.h>
     5
     6     extern void* GoFoo();
     7
     8     static void CFoo() { GoFoo();}
     9   */
    10  import (
    11          "C"
    12  )
    13
    14  //export GoFoo
    15  func GoFoo() map[int]int {
    16          return map[int]int{0: 1,}
    17  }
    18
    19  func main() {
    20          C.CFoo();
    21  }

This error shows up at runtime:

    panic: runtime error: cgo result is unpinned Go pointer or points to unpinned Go pointer

    goroutine 1 [running]:
    main._Cfunc_CFoo()
            _cgo_gotypes.go:46 +0x3a
    main.main()
            /mnt/tmp/parse.go:20 +0xf
    exit status 2

GoFoo is the faulty Go function; it is not mentioned in the error message.

Moreover the error does not say which kind of pointer caused the panic; for
instance, a Go map.

Retrieve name and file/line of the Go function, as well as the kind of
pointer; use them in the error message:

    panic: runtime error: /mnt/tmp/parse.go:15: result of Go function GoFoo called from cgo is unpinned Go map or points to unpinned Go map

    goroutine 1 [running]:
    main._Cfunc_CFoo()
            _cgo_gotypes.go:46 +0x3a
    main.main()
            /mnt/tmp/parse.go:20 +0xf
    exit status 2

2. cgoCheckPointer

When a pointer to an unpinned Go pointer is passed to a C function,

     1  package main
     2
     3  /*
     4  #include <stdio.h>
     5  void foo(void *bar) {}
     6  */
     7  import "C"
     8  import "unsafe"
     9
    10  func main() {
    11          m := map[int]int{0: 1,}
    12          C.foo(unsafe.Pointer(&m))
    13  }

This error shows up at runtime:

    panic: runtime error: cgo argument has Go pointer to unpinned Go pointer

    goroutine 1 [running]:
    main.main.func1(...)
            /mnt/tmp/cgomap.go:12
    main.main()
            /mnt/tmp/cgomap.go:12 +0x91
    exit status 2

Retrieve kind of pointer; use it in the error message.

    panic: runtime error: argument of cgo function has Go pointer to unpinned Go map

    goroutine 1 [running]:
    main.main.func1(...)
            /mnt/tmp/cgomap.go:12
    main.main()
            /mnt/tmp/cgomap.go:12 +0x9b
    exit status 2

Link: https://pkg.go.dev/cmd/cgo#hdr-Passing_pointers
Suggested-by: Ian Lance Taylor <iant@golang.org>
Fixes #75856

Change-Id: Ia72f01df016feeae0cddb2558ced51a1b07e4486
GitHub-Last-Rev: 76257c7dd7
GitHub-Pull-Request: golang/go#75894
Reviewed-on: https://go-review.googlesource.com/c/go/+/711801
Reviewed-by: Funda Secgin <fundasecgin73@gmail.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
2025-11-07 12:55:16 -08:00
Jes Cok
d36e88f21f runtime: tweak wording for doc
Change-Id: Id0be4b8744ded98cd28f94d89898d8cbac0f543e
GitHub-Last-Rev: e8a610e10a
GitHub-Pull-Request: golang/go#76197
Reviewed-on: https://go-review.googlesource.com/c/go/+/718420
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
2025-11-07 12:50:32 -08:00
Ian Lance Taylor
ad3ccd92e4 cmd/link: move pclntab out of relro section
The .gopclntab section should not have any relocations.
Move it out of relro to regular rodata.

Note that this is tested by tests like TestNoTextrel in
cmd/cgo/internal/testshared.

The existing test TestMachoSectionsReadOnly looks for sections in a
Mach-O file that are read-only after relocations are applied
(this is marked by a segment with a flags field set to 0x10).
We remove the __gopclntab section, as that section is now read-only
at all times, not only after relocating.

For #76038

Change-Id: I7f837e423bf1e802509277f5dc7fdd1ed0228e32
Reviewed-on: https://go-review.googlesource.com/c/go/+/718065
Reviewed-by: Russ Cox <rsc@golang.org>
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>
2025-11-06 09:58:44 -08:00
Bob Glickstein
43b91e7abd iter: fix a tiny doc comment bug
Use the right name for method Pos.Value in a sample doc comment in the package overview.

Fixes #76187.

Change-Id: Id1f5b0ca4ea39493b10140bc304c57c081c805ee
GitHub-Last-Rev: 7bf5d07747
GitHub-Pull-Request: golang/go#76195
Reviewed-on: https://go-review.googlesource.com/c/go/+/718321
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-06 09:34:49 -08:00
Keith Randall
48c7fa13c6 Revert "runtime: remove the pc field of _defer struct"
This reverts commit 361d51a6b5.

Reason for revert: Breaks some tests inside Google (on arm64?)

Change-Id: Iaea45fdcf9b4f9d36553687ca7f479750fe559da
Reviewed-on: https://go-review.googlesource.com/c/go/+/718066
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Youlin Feng <fengyoulin@live.com>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-11-06 05:00:27 -08:00
Guoqi Chen
8111104a21 cmd/internal/obj/loong64: add {,X}VSHUF.{B/H/W/V} instructions support
Go asm syntax:
         VSHUFB             V1, V2, V3, V4
        XVSHUFB             X1, X2, X3, X4
         VSHUF{H/W/V}       V1, V2, V3
        XVSHUF{H/W/V}       X1, X2, X3

Equivalent platform assembler syntax:
         vshuf.b            v4, v3, v2, v1
        xvshuf.b            x4, x3, x2, x1
         vshuf.{h/w/d}      v3, v2, v1
        xvshuf.{h/w/d}      x3, x2, x1

Change-Id: I8983467495f587cf46083fd81cb024400c7dc2a7
Reviewed-on: https://go-review.googlesource.com/c/go/+/716804
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn>
2025-11-05 16:43:22 -08:00
Guoqi Chen
2e2072561c cmd/internal/obj/loong64: add {,X}VEXTRINS.{B,H,W,V} instruction support
Go asm syntax:
	 VEXTRINS{B,H,W,V}	$0x1b, vj,vd
	XVEXTRINS{B,H,W,V}	$0x1b, vj,vd

Equivalent platform assembler syntax:
         vextrins.{b,h,w,d}     vd, vj, $0x1b
        xvextrins.{b,h,w,d}     xd, xj, $0x1b

Change-Id: Ibc0bf926befaa2f810cfedd9a40f7ad9a6a9d7fc
Reviewed-on: https://go-review.googlesource.com/c/go/+/716803
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-11-05 16:43:11 -08:00
Guoqi Chen
01c29d1f0b internal/chacha8rand: replace VORV with instruction VMOVQ on loong64
Change-Id: Id67623f403abfca54a04fc4c47792cd5b6d5ab73
Reviewed-on: https://go-review.googlesource.com/c/go/+/716802
Reviewed-by: 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>
Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
2025-11-05 16:43:01 -08:00
Guoqi Chen
f01a1841fd cmd/compile: fix error message on loong64
Change-Id: I90428330b17ab9f93ae94a77cefc24464e225df5
Reviewed-on: https://go-review.googlesource.com/c/go/+/717700
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-11-05 16:42:47 -08:00
qmuntal
8cf7a0b4c9 cmd/link: support weak binding on darwin
Symbols loaded from host files can have the N_WEAK_REF bit set,
which is used to instruct the loader to not fail if that symbol
can't be resolved.

The Go internal linker should honor this information by setting the
BIND_SYMBOL_FLAGS_WEAK_IMPORT flag in the corresponding bind table
entry.

Fixes #76023

Cq-Include-Trybots: luci.golang.try:gotip-darwin-amd64-longtest,gotip-darwin-amd64_12,gotip-darwin-arm64_12,gotip-darwin-arm64_15,gotip-darwin-arm64-longtest,gotip-darwin-amd64_14
Change-Id: Id2cef247ec7a9cb08455844f3c30ff874772bb7b
Reviewed-on: https://go-review.googlesource.com/c/go/+/713760
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-05 12:38:57 -08:00
Russ Cox
2dd7e94e16 cmd/go: use go.dev instead of golang.org in flag errors
Also add the URL to the one possible error that didn't have it.
It looks like CL 93836 just missed the third error case when
adding the URL.

Change-Id: I837f8a730b25adb42909c9dfbde0dad2f664fec5
Reviewed-on: https://go-review.googlesource.com/c/go/+/718220
Reviewed-by: Michael Matloob <matloob@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2025-11-05 12:36:38 -08:00
Russ Cox
28f1ad5782 cmd/go: fix TestScript/govcs
On my Mac, TestScript/govcs was failing because hg prints a URL
using 1.0.0.127.in-addr.arpa instead of 127.0.0.1, and my Mac
cannot resolve that name back into an IP address.

% host 127.0.0.1
1.0.0.127.in-addr.arpa domain name pointer localhost.
% host 1.0.0.127.in-addr.arpa
%

Change-Id: Ia0762342d5926d13d786fe66de40590dc8977ff5
Reviewed-on: https://go-review.googlesource.com/c/go/+/718184
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-05 12:36:35 -08:00
Russ Cox
daa220a1c9 cmd/go: silence TLS handshake errors during test
We don't need to see messages like "TLS handshake error: EOF"
during go test.

Change-Id: If6bf51e655119914f337b9e61448c99485af34f2
Reviewed-on: https://go-review.googlesource.com/c/go/+/718183
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
2025-11-05 12:36:32 -08:00
Russ Cox
3ae9e95002 cmd/go: fix TestCgoPkgConfig on darwin with pkg-config installed
Most darwin systems don't have pkg-config installed and skip this test.
(And it doesn't run in all.bash because it is skipped during -short.)

But for those systems that have pkg-config and run the non-short tests,
it fails because the code was not writing out the bar.pc on darwin and
then expecting pkg-config to be able to tell us about the bar package.
Change the code to write out the bar entry always.

Fixes one failing case in 'go test cmd/go' on my Mac.

Change-Id: Ibc4e9826a652ce2e7c609b905b159ccf2d5a6444
Reviewed-on: https://go-review.googlesource.com/c/go/+/718182
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-05 12:36:29 -08:00
Russ Cox
a494a26bc2 cmd/go: fix TestScript/vet_flags
Test caching can cause an incorrect test failure when the vet step result
is reused, leading to not printing a vet command line at all.
Avoid that with -a (we are also using -n so no real work is done).

Fixes one failing case in 'go test cmd/go' on my Mac.

Change-Id: I028284436b1ecc77145c886db902845b524f4b97
Reviewed-on: https://go-review.googlesource.com/c/go/+/718181
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: Russ Cox <rsc@golang.org>
2025-11-05 12:30:31 -08:00
Russ Cox
a8fb94969c cmd/go: fix TestScript/tool_build_as_needed
This test assumes that changing GOOS/GOARCH results in an
unrunnable binary, but that's not true if the user has
go_GOOS_GOARCH_exec programs in their path (like I do).
This test was timing out waiting to create a gomote to run
a windows/amd64 binary.

Rewrite the test not to assume that alternate GOOS/GOARCH
binaries are unrunnable.

Fixes one failing case in 'go test cmd/go' on my Mac.

Change-Id: Ib5f721f91e10d285820efb5995a3a9bc29833214
Reviewed-on: https://go-review.googlesource.com/c/go/+/718180
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: Russ Cox <rsc@golang.org>
2025-11-05 12:30:28 -08:00
Ariel Otilibili
04f05219c4 cmd/cgo: skip escape checks if call site has no argument
This CL improves on CL 579955.

When the call site has no argument,

     1  package main
     2
     3  /*
     4     #include <stdio.h>
     5     void foo() {printf("Hello from C\n");}
     6  */
     7  import "C"
     8
     9  func main() {
    10          C.foo()
    11  }

Escape checks are not needed,

    $ go tool cgo -objdir dir cgonoargs.go
    $ cat -n dir/_cgo_gotypes.go | sed -n '43,$p'
        43  func _Cfunc_foo() (r1 _Ctype_void) {
        44          _cgo_runtime_cgocall(_cgo_c8ba2f813f11_Cfunc_foo, uintptr(unsafe.Pointer(&r1)))
        45          if _Cgo_always_false {
        46          }
        47          return
        48  }

Skip escape checks if call site has no argument.

    $ cat -n dir/_cgo_gotypes.go | sed -n '43,$p'
        43  func _Cfunc_foo() (r1 _Ctype_void) {
        44          _cgo_runtime_cgocall(_cgo_c8ba2f813f11_Cfunc_foo, uintptr(unsafe.Pointer(&r1)))
        45          return
        46  }

For #75856

Change-Id: I9aac0b6fb2985f6833976099e7eead1f28971bee
GitHub-Last-Rev: 1aacde448c
GitHub-Pull-Request: golang/go#76186
Reviewed-on: https://go-review.googlesource.com/c/go/+/718060
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
2025-11-05 12:28:56 -08:00
qmuntal
9f3a108ee0 os: ignore O_TRUNC errors on named pipes and terminal devices on Windows
Prior to Go 1.24, os.OpenFile used to support O_TRUNC on named pipes and
terminal devices, even when the truncation was really ignored. This
behavior was consistent with Unix semantics.

CL 618836 changed the implementation of os.OpenFile on Windows and
unintentionally started returning an error when O_TRUNC was used on such
files.

Fixes #76071

Change-Id: Id10d3d8120ae9aa0548ef05423a172ff4e502ff9
Reviewed-on: https://go-review.googlesource.com/c/go/+/716420
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-11-04 23:31:35 -08:00
Ian Lance Taylor
0e1bd8b5f1 cmd/link, runtime: don't store text start in pcHeader
The textStart field requires a relocation, the only relocation in pclntab.
And nothing uses it. So remove it. Replace it with a zero,
which can itself be removed at some point in coordination with Delve.

For #76038

Change-Id: I35675c0868c5d957bb375e40b804c516ae0300ca
Reviewed-on: https://go-review.googlesource.com/c/go/+/717240
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
2025-11-04 16:38:08 -08:00
Ian Lance Taylor
7347b54727 cmd/link: don't generate .gosymtab section
Since Go 1.2 the section is always empty.

Also remove the code looking for .gosymtab in cmd/internal/objfile.

For #76038

Change-Id: Icd34c870ed0c6da8001e8d32305f79905ee2b066
Reviewed-on: https://go-review.googlesource.com/c/go/+/717200
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Commit-Queue: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-11-04 16:38:05 -08:00
Ian Lance Taylor
6914dd11c0 cmd/link: add and use new SymKind SFirstUnallocated
The linker sources in several places used SXREF to mark the first
SymKind which is not allocated in memory. This is cryptic.
Instead use SFirstUnallocated, following the example of the
existing SFirstWritable.

Change-Id: If326ad63027402699094bcc49ef860db3772f82a
Reviewed-on: https://go-review.googlesource.com/c/go/+/715623
Reviewed-by: Than McIntosh <thanm@golang.org>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-04 16:32:28 -08:00
Ian Lance Taylor
f5f14262d0 cmd/link: remove misleading comment
The comment suggests that the text section is briefly writable.
That is not the case. As the earlier part of the comment explains,
part of the text section is mapped twice, once r-x and once rw-.
It is never the case that there is writable executable memory.

Change-Id: I56841e19a8a08f2515f29752536a5c8f180ac8c9
Reviewed-on: https://go-review.googlesource.com/c/go/+/715622
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-04 16:32:25 -08:00
Ian Lance Taylor
61de3a9dae cmd/link: remove unused SFILEPATH symbol kind
Last reference appears to have been removed in CL 227759.

Change-Id: Ieb9da0a69a8beb96dcb5309ca43cf1df61d39bce
Reviewed-on: https://go-review.googlesource.com/c/go/+/715541
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-11-04 16:32:21 -08:00
Ian Lance Taylor
8e2bd267b5 cmd/link: add comments for SymKind values
Change-Id: Ie297a19a59362e0f32eae20e511e298a0a87ab6b
Reviewed-on: https://go-review.googlesource.com/c/go/+/715540
Reviewed-by: Than McIntosh <thanm@golang.org>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-11-04 16:27:36 -08:00
Daniel Morsing
16705b962e cmd/compile: faster liveness analysis in regalloc
Instead of iterating until dataflow stabilization, fill in values known to be
live at the beginning of loop headers. This reduces the number of passes
over the CFG from the depth of the loopnest to just 2.

In a test instrumented version of this change, run against
cmd/compile/internal/ssa, it brought the time spent in liveness analysis
down to 150.52ms from 225.49ms on my machine.

Change-Id: Ic72762eedfd1f10b1ba74c430ed62ab4ebd3ec5c
Reviewed-on: https://go-review.googlesource.com/c/go/+/695255
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
2025-11-04 13:57:19 -08:00
qmuntal
a5fe6791d7 internal/syscall/windows: fix ReOpenFile sentinel error value
ReOpenFile is documented to return INVALID_HANDLE_VALUE on error,
but the previous definition was checking for 0 instead.

Change-Id: Idec5e75e40b9f6c409e068d63a9b606781e80a46
Reviewed-on: https://go-review.googlesource.com/c/go/+/717320
Auto-Submit: Quim Muntal <quimmuntal@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-11-04 12:50:33 -08:00
Michael Munday
a7d174ccaa cmd/compile/internal/ssa: simplify riscv64 FCLASSD rewrite rules
We don't need to check that the bit patterns of the constants
match, it is sufficient to just check the constant is equal to the
given value.

While we're here also change the FCLASSD rules to use a bit pattern
for the mask. I think this improves readability, particularly as
more uses of FCLASSD get added (e.g. CL 717560).

These changes should not affect codegen.

Change-Id: I92a6338dc71e6a71e04306f67d7d86016c6e9c47
Reviewed-on: https://go-review.googlesource.com/c/go/+/717580
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2025-11-04 12:47:42 -08:00
Jes Cok
856238615d runtime: amend doc for setPinned
Change-Id: I9c5a8f8a031e368bda312c830dc266f5986e8b1a
GitHub-Last-Rev: 23145e8fdb
GitHub-Pull-Request: golang/go#76160
Reviewed-on: https://go-review.googlesource.com/c/go/+/717341
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-11-04 12:46:24 -08:00
Youlin Feng
c7ccbddf22 cmd/compile/internal/ssa: more aggressive on dead auto elim
Propagate "unread" across OpMoves. If the addr of this auto is only used
by an OpMove as its source arg, and the OpMove's target arg is the addr
of another auto. If the 2nd auto can be eliminated, this one can also be
eliminated.

This CL eliminates unnecessary memory copies and makes the frame smaller
in the following code snippet:

func contains(m map[string][16]int, k string) bool {
        _, ok := m[k]
        return ok
}

These are the benchmark results followed by the benchmark code:

goos: linux
goarch: amd64
cpu: Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz
                │   old.txt   │              new.txt                │
                │   sec/op    │   sec/op     vs base                │
Map1Access2Ok-8   9.582n ± 2%   9.226n ± 0%   -3.72% (p=0.000 n=20)
Map2Access2Ok-8   13.79n ± 1%   10.24n ± 1%  -25.77% (p=0.000 n=20)
Map3Access2Ok-8   68.68n ± 1%   12.65n ± 1%  -81.58% (p=0.000 n=20)

package main_test

import "testing"

var (
        m1 = map[int]int{}
        m2 = map[int][16]int{}
        m3 = map[int][256]int{}
)

func init() {
        for i := range 1000 {
                m1[i] = i
                m2[i] = [16]int{15:i}
                m3[i] = [256]int{255:i}
        }
}

func BenchmarkMap1Access2Ok(b *testing.B) {
        for i := range b.N {
                _, ok := m1[i%1000]
                if !ok {
                        b.Errorf("%d not found", i)
                }
        }
}

func BenchmarkMap2Access2Ok(b *testing.B) {
        for i := range b.N {
                _, ok := m2[i%1000]
                if !ok {
                        b.Errorf("%d not found", i)
                }
        }
}

func BenchmarkMap3Access2Ok(b *testing.B) {
        for i := range b.N {
                _, ok := m3[i%1000]
                if !ok {
                        b.Errorf("%d not found", i)
                }
        }
}

Fixes #75398

Change-Id: If75e9caaa50d460efc31a94565b9ba28c8158771
Reviewed-on: https://go-review.googlesource.com/c/go/+/702875
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-11-04 12:46:15 -08:00
Ian Lance Taylor
75b2bb1d1a cmd/cgo: drop pre-1.18 support
Now that the bootstrap compiler is 1.24, it's no longer needed.

Change-Id: I9b3d6b7176af10fbc580173d50130120b542e7f9
Reviewed-on: https://go-review.googlesource.com/c/go/+/717060
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-04 12:41:19 -08:00
Russ Cox
dd839f1d00 internal/strconv: handle %f with fixedFtoa when possible
Everyone writes papers about fast shortest-output formatting.
Eventually we also sped up fixed-length formatting %e and %g.
But we've neglected %f, which falls back to the slow general code
even for relatively trivial things like %.2f on 1.23.

This CL uses the fast path fixedFtoa for %f when possible by
estimating the number of digits needed.

benchmark \ host                  linux-arm64    local  linux-amd64       s7  linux-386  s7:GOARCH=386
                                      vs base  vs base      vs base  vs base    vs base        vs base
AppendFloat/Decimal                         ~        ~            ~   +0.30%          ~              ~
AppendFloat/Float                      -0.45%        ~       -2.20%        ~     -2.19%              ~
AppendFloat/Exp                        +0.12%        ~       +4.11%        ~          ~              ~
AppendFloat/NegExp                     +0.53%        ~            ~        ~          ~              ~
AppendFloat/LongExp                    +0.41%   -1.42%       +4.50%        ~          ~              ~
AppendFloat/Big                             ~   -1.25%       +3.69%        ~          ~              ~
AppendFloat/BinaryExp                  +0.38%   +1.68%            ~        ~     +2.65%         +0.97%
AppendFloat/32Integer                       ~        ~            ~        ~          ~              ~
AppendFloat/32ExactFraction                 ~        ~       -2.61%        ~          ~              ~
AppendFloat/32Point                    -0.41%        ~       -2.65%        ~          ~              ~
AppendFloat/32Exp                           ~        ~       +5.35%        ~     +1.44%         +0.39%
AppendFloat/32NegExp                   +0.30%        ~       +2.31%        ~          ~         +0.82%
AppendFloat/32Shortest                 +0.28%   -0.85%            ~        ~     -3.20%              ~
AppendFloat/32Fixed8Hard               -0.29%        ~            ~   -1.75%          ~         +4.30%
AppendFloat/32Fixed9Hard                    ~        ~            ~        ~          ~         +1.52%
AppendFloat/64Fixed1                   +0.61%   -2.03%            ~        ~          ~         +4.36%
AppendFloat/64Fixed2                        ~   -3.43%            ~        ~          ~         +1.03%
AppendFloat/64Fixed2.5                 +0.57%   -2.23%            ~        ~          ~         +2.66%
AppendFloat/64Fixed3                        ~   -1.64%            ~   +0.31%     +2.32%         +2.10%
AppendFloat/64Fixed4                   +0.15%   -2.11%            ~        ~     +1.48%         +1.58%
AppendFloat/64Fixed5Hard               +0.45%        ~       +1.58%        ~          ~         +1.73%
AppendFloat/64Fixed12                  -0.16%        ~       +1.63%   -1.23%     +3.93%         +2.42%
AppendFloat/64Fixed16                  -0.33%   -0.49%            ~        ~     +3.67%         +2.33%
AppendFloat/64Fixed12Hard              -0.58%        ~            ~        ~     +4.98%         +0.62%
AppendFloat/64Fixed17Hard              +0.27%   -0.94%            ~        ~     +2.07%         +1.79%
AppendFloat/64Fixed18Hard                   ~        ~            ~        ~          ~              ~
AppendFloat/64FixedF1                 -69.59%  -76.08%      -70.94%  -68.26%    -75.27%        -69.88%
AppendFloat/64FixedF2                 -76.28%  -81.82%      -76.95%  -77.34%    -83.53%        -80.04%
AppendFloat/64FixedF3                 -77.30%  -84.51%      -77.82%  -77.81%    -78.77%        -73.69%
AppendFloat/Slowpath64                      ~   -1.30%       +1.64%        ~     -2.66%         -0.44%
AppendFloat/SlowpathDenormal64         +0.11%   -1.69%            ~        ~     -2.90%              ~

host: linux-arm64
goos: linux
goarch: arm64
pkg: internal/strconv
cpu: unknown
                                 │ 1cc918cc725  │             b66c604f523              │
                                 │    sec/op    │    sec/op     vs base                │
AppendFloat/Decimal-8               60.22n ± 0%    60.21n ± 0%        ~ (p=0.416 n=20)
AppendFloat/Float-8                 88.93n ± 0%    88.53n ± 0%   -0.45% (p=0.000 n=20)
AppendFloat/Exp-8                   93.09n ± 0%    93.20n ± 0%   +0.12% (p=0.000 n=20)
AppendFloat/NegExp-8                93.06n ± 0%    93.56n ± 0%   +0.53% (p=0.000 n=20)
AppendFloat/LongExp-8               99.79n ± 0%   100.20n ± 0%   +0.41% (p=0.000 n=20)
AppendFloat/Big-8                   103.9n ± 0%    104.0n ± 0%        ~ (p=0.004 n=20)
AppendFloat/BinaryExp-8             47.34n ± 0%    47.52n ± 0%   +0.38% (p=0.000 n=20)
AppendFloat/32Integer-8             60.43n ± 0%    60.40n ± 0%        ~ (p=0.006 n=20)
AppendFloat/32ExactFraction-8       86.21n ± 0%    86.24n ± 0%        ~ (p=0.634 n=20)
AppendFloat/32Point-8               83.20n ± 0%    82.87n ± 0%   -0.41% (p=0.000 n=20)
AppendFloat/32Exp-8                 89.43n ± 0%    89.45n ± 0%        ~ (p=0.193 n=20)
AppendFloat/32NegExp-8              87.31n ± 0%    87.58n ± 0%   +0.30% (p=0.000 n=20)
AppendFloat/32Shortest-8            76.28n ± 0%    76.49n ± 0%   +0.28% (p=0.000 n=20)
AppendFloat/32Fixed8Hard-8          52.44n ± 0%    52.29n ± 0%   -0.29% (p=0.000 n=20)
AppendFloat/32Fixed9Hard-8          60.57n ± 0%    60.54n ± 0%        ~ (p=0.285 n=20)
AppendFloat/64Fixed1-8              46.27n ± 0%    46.55n ± 0%   +0.61% (p=0.000 n=20)
AppendFloat/64Fixed2-8              46.77n ± 0%    46.80n ± 0%        ~ (p=0.060 n=20)
AppendFloat/64Fixed2.5-8            43.70n ± 0%    43.95n ± 0%   +0.57% (p=0.000 n=20)
AppendFloat/64Fixed3-8              47.22n ± 0%    47.19n ± 0%        ~ (p=0.008 n=20)
AppendFloat/64Fixed4-8              44.07n ± 0%    44.13n ± 0%   +0.15% (p=0.000 n=20)
AppendFloat/64Fixed5Hard-8          51.81n ± 0%    52.04n ± 0%   +0.45% (p=0.000 n=20)
AppendFloat/64Fixed12-8             78.41n ± 0%    78.29n ± 0%   -0.16% (p=0.000 n=20)
AppendFloat/64Fixed16-8             65.14n ± 0%    64.93n ± 0%   -0.33% (p=0.000 n=20)
AppendFloat/64Fixed12Hard-8         62.12n ± 0%    61.76n ± 0%   -0.58% (p=0.000 n=20)
AppendFloat/64Fixed17Hard-8         73.93n ± 0%    74.13n ± 0%   +0.27% (p=0.000 n=20)
AppendFloat/64Fixed18Hard-8         4.285µ ± 0%    4.283µ ± 0%        ~ (p=0.039 n=20)
AppendFloat/64FixedF1-8            216.10n ± 0%    65.71n ± 0%  -69.59% (p=0.000 n=20)
AppendFloat/64FixedF2-8            227.70n ± 0%    54.02n ± 0%  -76.28% (p=0.000 n=20)
AppendFloat/64FixedF3-8            208.20n ± 1%    47.25n ± 0%  -77.30% (p=0.000 n=20)
AppendFloat/Slowpath64-8            97.40n ± 0%    97.45n ± 0%        ~ (p=0.018 n=20)
AppendFloat/SlowpathDenormal64-8    94.75n ± 0%    94.86n ± 0%   +0.11% (p=0.000 n=20)
geomean                             87.86n         76.99n       -12.37%

host: local
goos: darwin
cpu: Apple M3 Pro
                                  │ 1cc918cc725  │             b66c604f523             │
                                  │    sec/op    │   sec/op     vs base                │
AppendFloat/Decimal-12               21.05n ± 1%   20.91n ± 1%        ~ (p=0.051 n=20)
AppendFloat/Float-12                 32.13n ± 0%   32.04n ± 1%        ~ (p=0.457 n=20)
AppendFloat/Exp-12                   31.84n ± 0%   31.72n ± 0%        ~ (p=0.151 n=20)
AppendFloat/NegExp-12                31.78n ± 1%   31.79n ± 1%        ~ (p=0.867 n=20)
AppendFloat/LongExp-12               33.70n ± 0%   33.22n ± 1%   -1.42% (p=0.000 n=20)
AppendFloat/Big-12                   35.52n ± 1%   35.07n ± 1%   -1.25% (p=0.000 n=20)
AppendFloat/BinaryExp-12             19.32n ± 1%   19.64n ± 0%   +1.68% (p=0.000 n=20)
AppendFloat/32Integer-12             21.32n ± 0%   21.18n ± 1%        ~ (p=0.025 n=20)
AppendFloat/32ExactFraction-12       30.88n ± 0%   31.07n ± 0%        ~ (p=0.087 n=20)
AppendFloat/32Point-12               30.88n ± 0%   30.95n ± 1%        ~ (p=0.250 n=20)
AppendFloat/32Exp-12                 31.57n ± 0%   31.67n ± 2%        ~ (p=0.126 n=20)
AppendFloat/32NegExp-12              30.50n ± 1%   30.76n ± 1%        ~ (p=0.087 n=20)
AppendFloat/32Shortest-12            27.14n ± 0%   26.91n ± 1%   -0.85% (p=0.001 n=20)
AppendFloat/32Fixed8Hard-12          17.11n ± 0%   17.08n ± 0%        ~ (p=0.027 n=20)
AppendFloat/32Fixed9Hard-12          19.16n ± 1%   19.31n ± 1%        ~ (p=0.062 n=20)
AppendFloat/64Fixed1-12              15.50n ± 0%   15.18n ± 1%   -2.03% (p=0.000 n=20)
AppendFloat/64Fixed2-12              15.46n ± 0%   14.93n ± 0%   -3.43% (p=0.000 n=20)
AppendFloat/64Fixed2.5-12            15.28n ± 0%   14.94n ± 1%   -2.23% (p=0.000 n=20)
AppendFloat/64Fixed3-12              15.58n ± 0%   15.32n ± 1%   -1.64% (p=0.000 n=20)
AppendFloat/64Fixed4-12              15.39n ± 0%   15.06n ± 1%   -2.11% (p=0.000 n=20)
AppendFloat/64Fixed5Hard-12          18.00n ± 0%   18.07n ± 1%        ~ (p=0.011 n=20)
AppendFloat/64Fixed12-12             27.97n ± 8%   29.05n ± 3%        ~ (p=0.107 n=20)
AppendFloat/64Fixed16-12             21.48n ± 0%   21.38n ± 0%   -0.49% (p=0.000 n=20)
AppendFloat/64Fixed12Hard-12         20.79n ± 1%   21.05n ± 2%        ~ (p=0.784 n=20)
AppendFloat/64Fixed17Hard-12         27.21n ± 1%   26.95n ± 1%   -0.94% (p=0.000 n=20)
AppendFloat/64Fixed18Hard-12         2.166µ ± 1%   2.182µ ± 1%        ~ (p=0.031 n=20)
AppendFloat/64FixedF1-12            103.35n ± 0%   24.72n ± 0%  -76.08% (p=0.000 n=20)
AppendFloat/64FixedF2-12            114.30n ± 1%   20.78n ± 0%  -81.82% (p=0.000 n=20)
AppendFloat/64FixedF3-12            107.10n ± 0%   16.58n ± 0%  -84.51% (p=0.000 n=20)
AppendFloat/Slowpath64-12            32.01n ± 0%   31.59n ± 0%   -1.30% (p=0.000 n=20)
AppendFloat/SlowpathDenormal64-12    30.21n ± 0%   29.70n ± 0%   -1.69% (p=0.000 n=20)
geomean                              31.84n        27.00n       -15.20%

host: linux-amd64
goos: linux
goarch: amd64
cpu: Intel(R) Xeon(R) CPU @ 2.30GHz
                                  │ 1cc918cc725  │             b66c604f523              │
                                  │    sec/op    │    sec/op     vs base                │
AppendFloat/Decimal-16               63.62n ± 1%    64.05n ± 1%        ~ (p=0.753 n=20)
AppendFloat/Float-16                 97.12n ± 1%    94.98n ± 1%   -2.20% (p=0.000 n=20)
AppendFloat/Exp-16                   98.12n ± 1%   102.15n ± 1%   +4.11% (p=0.000 n=20)
AppendFloat/NegExp-16                101.1n ± 1%    101.5n ± 1%        ~ (p=0.089 n=20)
AppendFloat/LongExp-16               104.5n ± 1%    109.2n ± 1%   +4.50% (p=0.000 n=20)
AppendFloat/Big-16                   108.5n ± 0%    112.5n ± 1%   +3.69% (p=0.000 n=20)
AppendFloat/BinaryExp-16             47.68n ± 1%    47.44n ± 1%        ~ (p=0.143 n=20)
AppendFloat/32Integer-16             63.77n ± 2%    63.45n ± 1%        ~ (p=0.015 n=20)
AppendFloat/32ExactFraction-16       97.69n ± 1%    95.14n ± 1%   -2.61% (p=0.000 n=20)
AppendFloat/32Point-16               92.17n ± 1%    89.72n ± 1%   -2.65% (p=0.000 n=20)
AppendFloat/32Exp-16                 95.63n ± 1%   100.75n ± 1%   +5.35% (p=0.000 n=20)
AppendFloat/32NegExp-16              94.53n ± 1%    96.72n ± 0%   +2.31% (p=0.000 n=20)
AppendFloat/32Shortest-16            86.43n ± 0%    86.95n ± 0%        ~ (p=0.010 n=20)
AppendFloat/32Fixed8Hard-16          57.75n ± 1%    57.95n ± 1%        ~ (p=0.098 n=20)
AppendFloat/32Fixed9Hard-16          66.56n ± 2%    66.97n ± 1%        ~ (p=0.380 n=20)
AppendFloat/64Fixed1-16              51.02n ± 1%    50.99n ± 1%        ~ (p=0.473 n=20)
AppendFloat/64Fixed2-16              50.94n ± 1%    51.01n ± 1%        ~ (p=0.136 n=20)
AppendFloat/64Fixed2.5-16            49.27n ± 1%    49.37n ± 1%        ~ (p=0.218 n=20)
AppendFloat/64Fixed3-16              51.85n ± 1%    52.55n ± 1%        ~ (p=0.045 n=20)
AppendFloat/64Fixed4-16              50.30n ± 1%    50.43n ± 1%        ~ (p=0.794 n=20)
AppendFloat/64Fixed5Hard-16          57.57n ± 1%    58.48n ± 1%   +1.58% (p=0.000 n=20)
AppendFloat/64Fixed12-16             82.67n ± 1%    84.02n ± 1%   +1.63% (p=0.000 n=20)
AppendFloat/64Fixed16-16             71.10n ± 1%    70.94n ± 1%        ~ (p=0.569 n=20)
AppendFloat/64Fixed12Hard-16         68.36n ± 1%    68.64n ± 1%        ~ (p=0.155 n=20)
AppendFloat/64Fixed17Hard-16         80.16n ± 1%    80.10n ± 1%        ~ (p=0.836 n=20)
AppendFloat/64Fixed18Hard-16         4.916µ ± 1%    4.919µ ± 1%        ~ (p=0.507 n=20)
AppendFloat/64FixedF1-16            239.75n ± 1%    69.67n ± 1%  -70.94% (p=0.000 n=20)
AppendFloat/64FixedF2-16            252.50n ± 1%    58.20n ± 1%  -76.95% (p=0.000 n=20)
AppendFloat/64FixedF3-16            238.00n ± 1%    52.79n ± 1%  -77.82% (p=0.000 n=20)
AppendFloat/Slowpath64-16            100.4n ± 1%    102.0n ± 1%   +1.64% (p=0.000 n=20)
AppendFloat/SlowpathDenormal64-16    97.92n ± 1%    98.01n ± 1%        ~ (p=0.304 n=20)
geomean                              95.58n         84.00n       -12.12%

host: s7
cpu: AMD Ryzen 9 7950X 16-Core Processor
                                  │ 1cc918cc725 │             b66c604f523             │
                                  │   sec/op    │   sec/op     vs base                │
AppendFloat/Decimal-32              22.00n ± 0%   22.06n ± 0%   +0.30% (p=0.001 n=20)
AppendFloat/Float-32                34.83n ± 0%   34.76n ± 0%        ~ (p=0.159 n=20)
AppendFloat/Exp-32                  34.91n ± 0%   34.89n ± 0%        ~ (p=0.188 n=20)
AppendFloat/NegExp-32               35.24n ± 0%   35.32n ± 0%        ~ (p=0.026 n=20)
AppendFloat/LongExp-32              37.02n ± 0%   37.02n ± 0%        ~ (p=0.317 n=20)
AppendFloat/Big-32                  38.51n ± 0%   38.43n ± 0%        ~ (p=0.060 n=20)
AppendFloat/BinaryExp-32            17.57n ± 0%   17.59n ± 0%        ~ (p=0.278 n=20)
AppendFloat/32Integer-32            22.06n ± 0%   22.09n ± 0%        ~ (p=0.762 n=20)
AppendFloat/32ExactFraction-32      32.91n ± 0%   33.00n ± 0%        ~ (p=0.055 n=20)
AppendFloat/32Point-32              33.24n ± 0%   33.18n ± 0%        ~ (p=0.068 n=20)
AppendFloat/32Exp-32                34.50n ± 0%   34.55n ± 0%        ~ (p=0.030 n=20)
AppendFloat/32NegExp-32             33.53n ± 0%   33.61n ± 0%        ~ (p=0.045 n=20)
AppendFloat/32Shortest-32           30.10n ± 0%   30.10n ± 0%        ~ (p=0.931 n=20)
AppendFloat/32Fixed8Hard-32         22.89n ± 0%   22.49n ± 0%   -1.75% (p=0.000 n=20)
AppendFloat/32Fixed9Hard-32         25.82n ± 0%   25.75n ± 1%        ~ (p=0.143 n=20)
AppendFloat/64Fixed1-32             18.80n ± 0%   18.70n ± 0%        ~ (p=0.004 n=20)
AppendFloat/64Fixed2-32             18.64n ± 1%   18.54n ± 0%        ~ (p=0.001 n=20)
AppendFloat/64Fixed2.5-32           17.89n ± 0%   17.81n ± 0%        ~ (p=0.001 n=20)
AppendFloat/64Fixed3-32             19.62n ± 0%   19.68n ± 0%   +0.31% (p=0.000 n=20)
AppendFloat/64Fixed4-32             18.64n ± 0%   18.82n ± 0%        ~ (p=0.010 n=20)
AppendFloat/64Fixed5Hard-32         21.62n ± 0%   21.57n ± 0%        ~ (p=0.058 n=20)
AppendFloat/64Fixed12-32            30.98n ± 1%   30.61n ± 1%   -1.23% (p=0.000 n=20)
AppendFloat/64Fixed16-32            26.89n ± 0%   27.08n ± 1%        ~ (p=0.003 n=20)
AppendFloat/64Fixed12Hard-32        26.03n ± 0%   26.20n ± 1%        ~ (p=0.344 n=20)
AppendFloat/64Fixed17Hard-32        30.03n ± 1%   29.72n ± 1%        ~ (p=0.001 n=20)
AppendFloat/64Fixed18Hard-32        1.824µ ± 0%   1.825µ ± 1%        ~ (p=0.567 n=20)
AppendFloat/64FixedF1-32            83.58n ± 1%   26.52n ± 0%  -68.26% (p=0.000 n=20)
AppendFloat/64FixedF2-32            89.68n ± 1%   20.32n ± 1%  -77.34% (p=0.000 n=20)
AppendFloat/64FixedF3-32            84.84n ± 0%   18.82n ± 0%  -77.81% (p=0.000 n=20)
AppendFloat/Slowpath64-32           35.55n ± 0%   35.61n ± 0%        ~ (p=0.394 n=20)
AppendFloat/SlowpathDenormal64-32   35.03n ± 0%   35.02n ± 0%        ~ (p=0.733 n=20)
geomean                             34.67n        30.31n       -12.56%

host: linux-386
goarch: 386
cpu: Intel(R) Xeon(R) CPU @ 2.30GHz
                                  │ 1cc918cc725 │             b66c604f523             │
                                  │   sec/op    │   sec/op     vs base                │
AppendFloat/Decimal-16              133.6n ± 1%   130.5n ± 1%        ~ (p=0.002 n=20)
AppendFloat/Float-16                242.3n ± 1%   237.0n ± 1%   -2.19% (p=0.000 n=20)
AppendFloat/Exp-16                  249.1n ± 3%   252.5n ± 1%        ~ (p=0.005 n=20)
AppendFloat/NegExp-16               248.7n ± 3%   253.8n ± 2%        ~ (p=0.006 n=20)
AppendFloat/LongExp-16              258.4n ± 2%   253.0n ± 6%        ~ (p=0.185 n=20)
AppendFloat/Big-16                  285.6n ± 1%   279.2n ± 5%        ~ (p=0.012 n=20)
AppendFloat/BinaryExp-16            89.47n ± 1%   91.85n ± 2%   +2.65% (p=0.000 n=20)
AppendFloat/32Integer-16            133.5n ± 1%   129.9n ± 1%        ~ (p=0.004 n=20)
AppendFloat/32ExactFraction-16      213.7n ± 1%   212.2n ± 2%        ~ (p=0.071 n=20)
AppendFloat/32Point-16              202.0n ± 0%   200.4n ± 1%        ~ (p=0.223 n=20)
AppendFloat/32Exp-16                236.4n ± 1%   239.8n ± 1%   +1.44% (p=0.000 n=20)
AppendFloat/32NegExp-16             212.5n ± 1%   211.9n ± 1%        ~ (p=0.995 n=20)
AppendFloat/32Shortest-16           200.3n ± 1%   193.9n ± 1%   -3.20% (p=0.000 n=20)
AppendFloat/32Fixed8Hard-16         136.0n ± 1%   133.2n ± 4%        ~ (p=0.323 n=20)
AppendFloat/32Fixed9Hard-16         155.6n ± 1%   156.7n ± 2%        ~ (p=0.022 n=20)
AppendFloat/64Fixed1-16             132.8n ± 1%   133.0n ± 3%        ~ (p=0.199 n=20)
AppendFloat/64Fixed2-16             128.9n ± 1%   129.7n ± 3%        ~ (p=0.018 n=20)
AppendFloat/64Fixed2.5-16           127.0n ± 1%   126.5n ± 3%        ~ (p=0.825 n=20)
AppendFloat/64Fixed3-16             127.3n ± 1%   130.3n ± 4%   +2.32% (p=0.001 n=20)
AppendFloat/64Fixed4-16             121.4n ± 1%   123.2n ± 2%   +1.48% (p=0.000 n=20)
AppendFloat/64Fixed5Hard-16         136.2n ± 1%   136.2n ± 3%        ~ (p=0.256 n=20)
AppendFloat/64Fixed12-16            159.0n ± 1%   165.2n ± 2%   +3.93% (p=0.000 n=20)
AppendFloat/64Fixed16-16            151.4n ± 0%   156.9n ± 1%   +3.67% (p=0.000 n=20)
AppendFloat/64Fixed12Hard-16        146.5n ± 1%   153.8n ± 1%   +4.98% (p=0.000 n=20)
AppendFloat/64Fixed17Hard-16        166.3n ± 1%   169.8n ± 1%   +2.07% (p=0.001 n=20)
AppendFloat/64Fixed18Hard-16        10.59µ ± 2%   10.60µ ± 0%        ~ (p=0.499 n=20)
AppendFloat/64FixedF1-16            614.4n ± 1%   152.0n ± 1%  -75.27% (p=0.000 n=20)
AppendFloat/64FixedF2-16            845.0n ± 0%   139.1n ± 1%  -83.53% (p=0.000 n=20)
AppendFloat/64FixedF3-16            608.8n ± 1%   129.3n ± 1%  -78.77% (p=0.000 n=20)
AppendFloat/Slowpath64-16           251.7n ± 1%   245.0n ± 1%   -2.66% (p=0.000 n=20)
AppendFloat/SlowpathDenormal64-16   248.4n ± 1%   241.2n ± 1%   -2.90% (p=0.000 n=20)
geomean                             225.7n        193.8n       -14.14%

host: s7:GOARCH=386
cpu: AMD Ryzen 9 7950X 16-Core Processor
                                  │ 1cc918cc725  │             b66c604f523             │
                                  │    sec/op    │   sec/op     vs base                │
AppendFloat/Decimal-32               41.88n ± 0%   42.02n ± 1%        ~ (p=0.004 n=20)
AppendFloat/Float-32                 71.05n ± 0%   71.24n ± 0%        ~ (p=0.044 n=20)
AppendFloat/Exp-32                   74.91n ± 1%   74.80n ± 0%        ~ (p=0.433 n=20)
AppendFloat/NegExp-32                74.10n ± 0%   74.20n ± 0%        ~ (p=0.867 n=20)
AppendFloat/LongExp-32               75.73n ± 0%   75.84n ± 0%        ~ (p=0.147 n=20)
AppendFloat/Big-32                   82.47n ± 0%   82.36n ± 0%        ~ (p=0.490 n=20)
AppendFloat/BinaryExp-32             32.31n ± 1%   32.62n ± 0%   +0.97% (p=0.000 n=20)
AppendFloat/32Integer-32             41.38n ± 1%   41.40n ± 1%        ~ (p=0.106 n=20)
AppendFloat/32ExactFraction-32       62.72n ± 0%   62.92n ± 0%        ~ (p=0.009 n=20)
AppendFloat/32Point-32               60.36n ± 0%   60.33n ± 0%        ~ (p=0.050 n=20)
AppendFloat/32Exp-32                 68.97n ± 0%   69.24n ± 0%   +0.39% (p=0.000 n=20)
AppendFloat/32NegExp-32              62.63n ± 0%   63.15n ± 0%   +0.82% (p=0.000 n=20)
AppendFloat/32Shortest-32            58.76n ± 0%   58.87n ± 0%        ~ (p=0.053 n=20)
AppendFloat/32Fixed8Hard-32          41.67n ± 1%   43.46n ± 1%   +4.30% (p=0.000 n=20)
AppendFloat/32Fixed9Hard-32          49.78n ± 1%   50.53n ± 1%   +1.52% (p=0.000 n=20)
AppendFloat/64Fixed1-32              41.15n ± 0%   42.95n ± 1%   +4.36% (p=0.000 n=20)
AppendFloat/64Fixed2-32              40.83n ± 1%   41.24n ± 1%   +1.03% (p=0.000 n=20)
AppendFloat/64Fixed2.5-32            39.42n ± 0%   40.47n ± 1%   +2.66% (p=0.000 n=20)
AppendFloat/64Fixed3-32              40.73n ± 1%   41.58n ± 1%   +2.10% (p=0.000 n=20)
AppendFloat/64Fixed4-32              38.68n ± 0%   39.29n ± 0%   +1.58% (p=0.000 n=20)
AppendFloat/64Fixed5Hard-32          42.88n ± 1%   43.62n ± 1%   +1.73% (p=0.000 n=20)
AppendFloat/64Fixed12-32             51.67n ± 1%   52.92n ± 1%   +2.42% (p=0.000 n=20)
AppendFloat/64Fixed16-32             49.15n ± 0%   50.30n ± 0%   +2.33% (p=0.000 n=20)
AppendFloat/64Fixed12Hard-32         48.51n ± 0%   48.81n ± 0%   +0.62% (p=0.001 n=20)
AppendFloat/64Fixed17Hard-32         54.62n ± 1%   55.60n ± 1%   +1.79% (p=0.000 n=20)
AppendFloat/64Fixed18Hard-32         3.979µ ± 1%   3.980µ ± 1%        ~ (p=0.569 n=20)
AppendFloat/64FixedF1-32            165.90n ± 1%   49.97n ± 0%  -69.88% (p=0.000 n=20)
AppendFloat/64FixedF2-32            225.50n ± 0%   45.02n ± 1%  -80.04% (p=0.000 n=20)
AppendFloat/64FixedF3-32            160.20n ± 1%   42.16n ± 1%  -73.69% (p=0.000 n=20)
AppendFloat/Slowpath64-32            75.55n ± 0%   75.23n ± 0%   -0.44% (p=0.000 n=20)
AppendFloat/SlowpathDenormal64-32    74.84n ± 0%   75.00n ± 0%        ~ (p=0.268 n=20)
geomean                              69.22n        61.13n       -11.69%

Change-Id: I722d2e2621e74e32cb3fc34a2df5b16cc595715c
Reviewed-on: https://go-review.googlesource.com/c/go/+/717183
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
2025-11-04 11:43:22 -08:00
Russ Cox
6e165b4d17 cmd/compile: implement Avg64u, Hmul64, Hmul64u for wasm
This lets us remove useAvg and useHmul from the division rules.
The compiler is simpler and the generated code is faster.

goos: wasip1
goarch: wasm
pkg: internal/strconv
                               │   old.txt   │               new.txt               │
                               │   sec/op    │   sec/op     vs base                │
AppendFloat/Decimal              192.8n ± 1%   194.6n ± 0%   +0.91% (p=0.000 n=10)
AppendFloat/Float                328.6n ± 0%   279.6n ± 0%  -14.93% (p=0.000 n=10)
AppendFloat/Exp                  335.6n ± 1%   289.2n ± 1%  -13.80% (p=0.000 n=10)
AppendFloat/NegExp               336.0n ± 0%   289.1n ± 1%  -13.97% (p=0.000 n=10)
AppendFloat/LongExp              332.4n ± 0%   285.2n ± 1%  -14.20% (p=0.000 n=10)
AppendFloat/Big                  348.2n ± 0%   300.1n ± 0%  -13.83% (p=0.000 n=10)
AppendFloat/BinaryExp            137.4n ± 0%   138.2n ± 0%   +0.55% (p=0.001 n=10)
AppendFloat/32Integer            193.3n ± 1%   196.5n ± 0%   +1.66% (p=0.000 n=10)
AppendFloat/32ExactFraction      283.3n ± 0%   268.9n ± 1%   -5.08% (p=0.000 n=10)
AppendFloat/32Point              279.9n ± 0%   266.5n ± 0%   -4.80% (p=0.000 n=10)
AppendFloat/32Exp                300.1n ± 0%   288.3n ± 1%   -3.90% (p=0.000 n=10)
AppendFloat/32NegExp             288.2n ± 1%   277.9n ± 1%   -3.59% (p=0.000 n=10)
AppendFloat/32Shortest           261.7n ± 0%   250.2n ± 0%   -4.39% (p=0.000 n=10)
AppendFloat/32Fixed8Hard         173.3n ± 1%   158.9n ± 1%   -8.31% (p=0.000 n=10)
AppendFloat/32Fixed9Hard         180.0n ± 0%   167.9n ± 2%   -6.70% (p=0.000 n=10)
AppendFloat/64Fixed1             167.1n ± 0%   149.6n ± 1%  -10.50% (p=0.000 n=10)
AppendFloat/64Fixed2             162.4n ± 1%   146.5n ± 0%   -9.73% (p=0.000 n=10)
AppendFloat/64Fixed2.5           165.5n ± 0%   149.4n ± 1%   -9.70% (p=0.000 n=10)
AppendFloat/64Fixed3             166.4n ± 1%   150.2n ± 0%   -9.74% (p=0.000 n=10)
AppendFloat/64Fixed4             163.7n ± 0%   149.6n ± 1%   -8.62% (p=0.000 n=10)
AppendFloat/64Fixed5Hard         182.8n ± 1%   167.1n ± 1%   -8.61% (p=0.000 n=10)
AppendFloat/64Fixed12            222.2n ± 0%   208.8n ± 0%   -6.05% (p=0.000 n=10)
AppendFloat/64Fixed16            197.6n ± 1%   181.7n ± 0%   -8.02% (p=0.000 n=10)
AppendFloat/64Fixed12Hard        194.5n ± 0%   181.0n ± 0%   -6.99% (p=0.000 n=10)
AppendFloat/64Fixed17Hard        205.1n ± 1%   191.9n ± 0%   -6.44% (p=0.000 n=10)
AppendFloat/64Fixed18Hard        6.269µ ± 0%   6.643µ ± 0%   +5.97% (p=0.000 n=10)
AppendFloat/64FixedF1            211.7n ± 1%   197.0n ± 0%   -6.95% (p=0.000 n=10)
AppendFloat/64FixedF2            189.4n ± 0%   174.2n ± 0%   -8.08% (p=0.000 n=10)
AppendFloat/64FixedF3            169.0n ± 0%   154.9n ± 0%   -8.32% (p=0.000 n=10)
AppendFloat/Slowpath64           321.2n ± 0%   274.2n ± 1%  -14.63% (p=0.000 n=10)
AppendFloat/SlowpathDenormal64   307.4n ± 1%   261.2n ± 0%  -15.03% (p=0.000 n=10)
AppendInt                        3.367µ ± 1%   3.376µ ± 0%        ~ (p=0.517 n=10)
AppendUint                       675.5n ± 0%   676.9n ± 0%        ~ (p=0.196 n=10)
AppendIntSmall                   28.13n ± 1%   28.17n ± 0%   +0.14% (p=0.015 n=10)
AppendUintVarlen/digits=1        20.70n ± 0%   20.51n ± 1%   -0.89% (p=0.018 n=10)
AppendUintVarlen/digits=2        20.43n ± 0%   20.27n ± 0%   -0.81% (p=0.001 n=10)
AppendUintVarlen/digits=3        38.48n ± 0%   37.93n ± 0%   -1.43% (p=0.000 n=10)
AppendUintVarlen/digits=4        41.10n ± 0%   38.78n ± 1%   -5.62% (p=0.000 n=10)
AppendUintVarlen/digits=5        42.25n ± 1%   42.11n ± 0%   -0.32% (p=0.041 n=10)
AppendUintVarlen/digits=6        45.40n ± 1%   43.14n ± 0%   -4.98% (p=0.000 n=10)
AppendUintVarlen/digits=7        46.81n ± 1%   46.03n ± 0%   -1.66% (p=0.000 n=10)
AppendUintVarlen/digits=8        48.88n ± 1%   46.59n ± 1%   -4.68% (p=0.000 n=10)
AppendUintVarlen/digits=9        49.94n ± 2%   49.41n ± 1%   -1.06% (p=0.000 n=10)
AppendUintVarlen/digits=10       57.28n ± 1%   56.92n ± 1%   -0.62% (p=0.045 n=10)
AppendUintVarlen/digits=11       60.09n ± 1%   58.11n ± 2%   -3.30% (p=0.000 n=10)
AppendUintVarlen/digits=12       62.22n ± 0%   61.85n ± 0%   -0.59% (p=0.000 n=10)
AppendUintVarlen/digits=13       64.94n ± 0%   62.92n ± 0%   -3.10% (p=0.000 n=10)
AppendUintVarlen/digits=14       65.42n ± 1%   65.19n ± 1%   -0.34% (p=0.005 n=10)
AppendUintVarlen/digits=15       68.17n ± 0%   66.13n ± 0%   -2.99% (p=0.000 n=10)
AppendUintVarlen/digits=16       70.21n ± 1%   70.09n ± 1%        ~ (p=0.517 n=10)
AppendUintVarlen/digits=17       72.93n ± 0%   70.49n ± 0%   -3.34% (p=0.000 n=10)
AppendUintVarlen/digits=18       73.01n ± 0%   72.75n ± 0%   -0.35% (p=0.000 n=10)
AppendUintVarlen/digits=19       79.27n ± 1%   79.49n ± 1%        ~ (p=0.671 n=10)
AppendUintVarlen/digits=20       82.18n ± 0%   80.43n ± 1%   -2.14% (p=0.000 n=10)
geomean                          143.4n        136.0n        -5.20%


Change-Id: I8245814a0259ad13cf9225f57db8e9fe3d2e4267
Reviewed-on: https://go-review.googlesource.com/c/go/+/717407
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-11-04 11:38:18 -08:00
Alexander Musman
fe040658b2 [dev.simd] simd/_gen: fix sorting ops slices
Fix sorting slices to avoid panic when there are more opsDataImm than
opsData (the problem occurs when generating only a subset of instructions
but it may be better to keep them sorted by their own names anyway).

Change-Id: Iea7fe61259e8416f16c46158d87c84b1d7a3076d
Reviewed-on: https://go-review.googlesource.com/c/go/+/716121
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>
Auto-Submit: Junyang Shao <shaojunyang@google.com>
2025-11-04 10:18:50 -08:00
Roland Shoemaker
9f6590f333 encoding/pem: don't reslice in failure modes
We re-slice the data being processed at the stat of each loop. If the
var that we use to calculate where to re-slice is < 0 or > the length
of the remaining data, return instead of attempting to re-slice.

Change-Id: I1d6c2b6c596feedeea8feeaace370ea73ba02c4c
Reviewed-on: https://go-review.googlesource.com/c/go/+/715260
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Roland Shoemaker <roland@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
2025-11-04 09:21:51 -08:00
Russ Cox
34fec512ce internal/strconv: extract fixed-precision ftoa from ftoaryu.go
The fixed-precision ftoa algorithm is not actually
documented in the Ryū paper, and it is fairly
straightforward: multiply by a power of 10 to get
an integer that contains the digits we need.
There is also no need for separate float32 and float64
implementations.

This CL implements a new fixedFtoa, separate from Ryū.
The overall algorithm is the same, but the new code
is simpler, faster, and better documented.

Now ftoaryu.go is only about shortest-output formatting,
so if and when yet another algorithm comes along, it will
be clearer what should be replaced (all of ftoaryu.go)
and what should not (all of ftoafixed.go).

benchmark \ host                  linux-arm64    local  linux-amd64       s7  linux-386  s7:GOARCH=386
                                      vs base  vs base      vs base  vs base    vs base        vs base
AppendFloat/Decimal                    -0.18%        ~            ~   -0.68%     +0.49%         -0.79%
AppendFloat/Float                      +0.09%        ~       +1.50%   +0.84%     -0.37%         -0.69%
AppendFloat/Exp                        -0.51%        ~            ~   +1.20%     -1.27%         -1.01%
AppendFloat/NegExp                     -1.01%        ~       +3.43%   +1.35%     -2.33%              ~
AppendFloat/LongExp                    -1.22%   +0.77%            ~        ~     -1.48%              ~
AppendFloat/Big                        -2.07%        ~       -2.07%   -1.97%     -2.89%         -2.93%
AppendFloat/BinaryExp                  -0.28%   +1.06%            ~   +1.35%     -0.64%         -1.64%
AppendFloat/32Integer                       ~        ~            ~   -0.79%          ~         -0.66%
AppendFloat/32ExactFraction            -0.50%        ~       +5.69%        ~     -1.24%         +0.69%
AppendFloat/32Point                         ~   -1.19%       +2.59%   +1.03%     -1.37%         +0.80%
AppendFloat/32Exp                      -3.39%   -2.79%       -8.36%   -0.94%     -5.72%         -5.92%
AppendFloat/32NegExp                   -0.63%        ~            ~   +0.98%     -1.34%         -0.73%
AppendFloat/32Shortest                 -1.00%   +1.36%       +2.94%        ~          ~              ~
AppendFloat/32Fixed8Hard               -5.91%  -12.45%       -6.62%        ~    +18.46%        +11.61%
AppendFloat/32Fixed9Hard               -6.53%  -11.35%       -6.01%   -0.97%    -18.31%         -9.16%
AppendFloat/64Fixed1                  -13.84%  -16.90%      -13.13%  -10.71%    -24.52%        -18.94%
AppendFloat/64Fixed2                  -11.12%  -16.97%      -12.13%   -9.88%    -22.73%        -15.48%
AppendFloat/64Fixed2.5                -21.98%  -20.75%      -19.08%  -14.74%    -28.11%        -24.92%
AppendFloat/64Fixed3                  -11.53%  -16.21%      -10.75%   -7.53%    -23.11%        -15.78%
AppendFloat/64Fixed4                  -12.89%  -12.36%      -11.07%   -9.79%    -14.51%        -13.44%
AppendFloat/64Fixed5Hard              -47.62%  -38.59%      -40.83%  -37.06%    -60.51%        -55.29%
AppendFloat/64Fixed12                  -7.40%        ~       -8.56%   -4.31%    -13.82%         -8.61%
AppendFloat/64Fixed16                  -9.10%   -8.95%       -6.92%   -3.92%    -12.99%         -9.03%
AppendFloat/64Fixed12Hard              -9.14%   -5.24%       -6.23%   -4.82%    -13.58%         -8.99%
AppendFloat/64Fixed17Hard              -6.80%        ~       -4.03%   -2.84%    -19.81%        -10.27%
AppendFloat/64Fixed18Hard              -0.12%        ~            ~        ~          ~              ~
AppendFloat/64FixedF1                       ~        ~            ~        ~     -0.40%         +2.72%
AppendFloat/64FixedF2                  -0.18%        ~       -1.98%   -0.95%          ~         +1.25%
AppendFloat/64FixedF3                  -0.29%        ~            ~        ~          ~         +1.22%
AppendFloat/Slowpath64                 -1.16%        ~            ~        ~          ~         -2.16%
AppendFloat/SlowpathDenormal64         -1.09%        ~            ~   -0.88%     -0.83%              ~

host: linux-arm64
goos: linux
goarch: arm64
pkg: internal/strconv
cpu: unknown
                                 │ 14b7e09f493  │             f9bf7fcb8e2             │
                                 │    sec/op    │   sec/op     vs base                │
AppendFloat/Decimal-8               60.35n ± 0%   60.24n ± 0%   -0.18% (p=0.000 n=20)
AppendFloat/Float-8                 88.83n ± 0%   88.91n ± 0%   +0.09% (p=0.000 n=20)
AppendFloat/Exp-8                   93.55n ± 0%   93.06n ± 0%   -0.51% (p=0.000 n=20)
AppendFloat/NegExp-8                94.01n ± 0%   93.06n ± 0%   -1.01% (p=0.000 n=20)
AppendFloat/LongExp-8              101.00n ± 0%   99.77n ± 0%   -1.22% (p=0.000 n=20)
AppendFloat/Big-8                   106.1n ± 0%   103.9n ± 0%   -2.07% (p=0.000 n=20)
AppendFloat/BinaryExp-8             47.48n ± 0%   47.35n ± 0%   -0.28% (p=0.000 n=20)
AppendFloat/32Integer-8             60.45n ± 0%   60.43n ± 0%        ~ (p=0.150 n=20)
AppendFloat/32ExactFraction-8       86.65n ± 0%   86.22n ± 0%   -0.50% (p=0.000 n=20)
AppendFloat/32Point-8               83.26n ± 0%   83.21n ± 0%        ~ (p=0.046 n=20)
AppendFloat/32Exp-8                 92.55n ± 0%   89.42n ± 0%   -3.39% (p=0.000 n=20)
AppendFloat/32NegExp-8              87.89n ± 0%   87.34n ± 0%   -0.63% (p=0.000 n=20)
AppendFloat/32Shortest-8            77.05n ± 0%   76.28n ± 0%   -1.00% (p=0.000 n=20)
AppendFloat/32Fixed8Hard-8          55.73n ± 0%   52.44n ± 0%   -5.91% (p=0.000 n=20)
AppendFloat/32Fixed9Hard-8          64.80n ± 0%   60.57n ± 0%   -6.53% (p=0.000 n=20)
AppendFloat/64Fixed1-8              53.72n ± 0%   46.29n ± 0%  -13.84% (p=0.000 n=20)
AppendFloat/64Fixed2-8              52.64n ± 0%   46.79n ± 0%  -11.12% (p=0.000 n=20)
AppendFloat/64Fixed2.5-8            56.01n ± 0%   43.70n ± 0%  -21.98% (p=0.000 n=20)
AppendFloat/64Fixed3-8              53.38n ± 0%   47.23n ± 0%  -11.53% (p=0.000 n=20)
AppendFloat/64Fixed4-8              50.62n ± 0%   44.10n ± 0%  -12.89% (p=0.000 n=20)
AppendFloat/64Fixed5Hard-8          98.94n ± 0%   51.82n ± 0%  -47.62% (p=0.000 n=20)
AppendFloat/64Fixed12-8             84.70n ± 0%   78.44n ± 0%   -7.40% (p=0.000 n=20)
AppendFloat/64Fixed16-8             71.68n ± 0%   65.16n ± 0%   -9.10% (p=0.000 n=20)
AppendFloat/64Fixed12Hard-8         68.41n ± 0%   62.16n ± 0%   -9.14% (p=0.000 n=20)
AppendFloat/64Fixed17Hard-8         79.31n ± 0%   73.92n ± 0%   -6.80% (p=0.000 n=20)
AppendFloat/64Fixed18Hard-8         4.290µ ± 0%   4.285µ ± 0%   -0.12% (p=0.000 n=20)
AppendFloat/64FixedF1-8             216.0n ± 0%   216.1n ± 0%        ~ (p=0.090 n=20)
AppendFloat/64FixedF2-8             228.2n ± 0%   227.8n ± 0%   -0.18% (p=0.000 n=20)
AppendFloat/64FixedF3-8             208.8n ± 0%   208.2n ± 0%   -0.29% (p=0.000 n=20)
AppendFloat/Slowpath64-8            98.56n ± 0%   97.42n ± 0%   -1.16% (p=0.000 n=20)
AppendFloat/SlowpathDenormal64-8    95.81n ± 0%   94.77n ± 0%   -1.09% (p=0.000 n=20)
geomean                             93.81n        87.87n        -6.33%

host: local
goos: darwin
cpu: Apple M3 Pro
                                  │ 14b7e09f493 │             f9bf7fcb8e2              │
                                  │   sec/op    │    sec/op     vs base                │
AppendFloat/Decimal-12              21.14n ± 0%   21.15n ±  0%        ~ (p=0.963 n=20)
AppendFloat/Float-12                32.48n ± 1%   32.43n ±  0%        ~ (p=0.358 n=20)
AppendFloat/Exp-12                  31.85n ± 0%   31.94n ±  1%        ~ (p=0.634 n=20)
AppendFloat/NegExp-12               31.75n ± 0%   32.04n ±  0%        ~ (p=0.004 n=20)
AppendFloat/LongExp-12              33.55n ± 0%   33.81n ±  0%   +0.77% (p=0.000 n=20)
AppendFloat/Big-12                  35.62n ± 1%   35.73n ±  1%        ~ (p=0.888 n=20)
AppendFloat/BinaryExp-12            19.26n ± 0%   19.46n ±  1%   +1.06% (p=0.000 n=20)
AppendFloat/32Integer-12            21.41n ± 0%   21.46n ±  1%        ~ (p=0.733 n=20)
AppendFloat/32ExactFraction-12      31.23n ± 1%   31.30n ±  1%        ~ (p=0.857 n=20)
AppendFloat/32Point-12              31.39n ± 1%   31.02n ±  0%   -1.19% (p=0.000 n=20)
AppendFloat/32Exp-12                32.42n ± 1%   31.52n ±  1%   -2.79% (p=0.000 n=20)
AppendFloat/32NegExp-12             30.66n ± 1%   30.66n ±  1%        ~ (p=0.380 n=20)
AppendFloat/32Shortest-12           26.88n ± 1%   27.25n ±  1%   +1.36% (p=0.000 n=20)
AppendFloat/32Fixed8Hard-12         19.52n ± 0%   17.09n ±  1%  -12.45% (p=0.000 n=20)
AppendFloat/32Fixed9Hard-12         21.55n ± 2%   19.11n ±  1%  -11.35% (p=0.000 n=20)
AppendFloat/64Fixed1-12             18.64n ± 0%   15.49n ±  0%  -16.90% (p=0.000 n=20)
AppendFloat/64Fixed2-12             18.65n ± 0%   15.49n ±  0%  -16.97% (p=0.000 n=20)
AppendFloat/64Fixed2.5-12           19.23n ± 1%   15.24n ±  0%  -20.75% (p=0.000 n=20)
AppendFloat/64Fixed3-12             18.61n ± 0%   15.59n ±  1%  -16.21% (p=0.000 n=20)
AppendFloat/64Fixed4-12             17.55n ± 1%   15.38n ±  0%  -12.36% (p=0.000 n=20)
AppendFloat/64Fixed5Hard-12         29.27n ± 1%   17.97n ±  0%  -38.59% (p=0.000 n=20)
AppendFloat/64Fixed12-12            28.26n ± 1%   28.17n ± 10%        ~ (p=0.941 n=20)
AppendFloat/64Fixed16-12            23.56n ± 0%   21.46n ±  0%   -8.95% (p=0.000 n=20)
AppendFloat/64Fixed12Hard-12        21.85n ± 2%   20.70n ±  1%   -5.24% (p=0.000 n=20)
AppendFloat/64Fixed17Hard-12        26.91n ± 1%   27.10n ±  0%        ~ (p=0.059 n=20)
AppendFloat/64Fixed18Hard-12        2.197µ ± 1%   2.169µ ±  1%        ~ (p=0.013 n=20)
AppendFloat/64FixedF1-12            103.7n ± 1%   103.3n ±  0%        ~ (p=0.035 n=20)
AppendFloat/64FixedF2-12            114.8n ± 1%   114.1n ±  1%        ~ (p=0.234 n=20)
AppendFloat/64FixedF3-12            107.8n ± 1%   107.1n ±  1%        ~ (p=0.180 n=20)
AppendFloat/Slowpath64-12           32.05n ± 1%   32.00n ±  0%        ~ (p=0.952 n=20)
AppendFloat/SlowpathDenormal64-12   29.98n ± 1%   30.20n ±  0%        ~ (p=0.004 n=20)
geomean                             33.83n        31.91n         -5.68%

host: linux-amd64
goos: linux
goarch: amd64
cpu: Intel(R) Xeon(R) CPU @ 2.30GHz
                                  │ 14b7e09f493  │             f9bf7fcb8e2              │
                                  │    sec/op    │    sec/op     vs base                │
AppendFloat/Decimal-16               64.00n ± 1%    63.67n ± 1%        ~ (p=0.784 n=20)
AppendFloat/Float-16                 95.99n ± 1%    97.42n ± 1%   +1.50% (p=0.000 n=20)
AppendFloat/Exp-16                   97.59n ± 1%    97.72n ± 1%        ~ (p=0.984 n=20)
AppendFloat/NegExp-16                97.80n ± 1%   101.15n ± 1%   +3.43% (p=0.000 n=20)
AppendFloat/LongExp-16               103.1n ± 1%    104.5n ± 1%        ~ (p=0.006 n=20)
AppendFloat/Big-16                   110.8n ± 1%    108.5n ± 1%   -2.07% (p=0.000 n=20)
AppendFloat/BinaryExp-16             47.82n ± 1%    47.33n ± 1%        ~ (p=0.007 n=20)
AppendFloat/32Integer-16             63.65n ± 1%    63.51n ± 0%        ~ (p=0.560 n=20)
AppendFloat/32ExactFraction-16       91.81n ± 1%    97.03n ± 1%   +5.69% (p=0.000 n=20)
AppendFloat/32Point-16               89.84n ± 1%    92.16n ± 1%   +2.59% (p=0.000 n=20)
AppendFloat/32Exp-16                103.80n ± 1%    95.12n ± 1%   -8.36% (p=0.000 n=20)
AppendFloat/32NegExp-16              93.70n ± 1%    94.87n ± 1%        ~ (p=0.003 n=20)
AppendFloat/32Shortest-16            83.98n ± 1%    86.45n ± 1%   +2.94% (p=0.000 n=20)
AppendFloat/32Fixed8Hard-16          61.91n ± 1%    57.81n ± 1%   -6.62% (p=0.000 n=20)
AppendFloat/32Fixed9Hard-16          71.08n ± 0%    66.81n ± 1%   -6.01% (p=0.000 n=20)
AppendFloat/64Fixed1-16              59.27n ± 2%    51.49n ± 1%  -13.13% (p=0.000 n=20)
AppendFloat/64Fixed2-16              57.89n ± 1%    50.87n ± 1%  -12.13% (p=0.000 n=20)
AppendFloat/64Fixed2.5-16            61.04n ± 1%    49.40n ± 1%  -19.08% (p=0.000 n=20)
AppendFloat/64Fixed3-16              58.42n ± 1%    52.14n ± 1%  -10.75% (p=0.000 n=20)
AppendFloat/64Fixed4-16              56.52n ± 1%    50.27n ± 1%  -11.07% (p=0.000 n=20)
AppendFloat/64Fixed5Hard-16          97.79n ± 1%    57.86n ± 1%  -40.83% (p=0.000 n=20)
AppendFloat/64Fixed12-16             90.78n ± 1%    83.01n ± 1%   -8.56% (p=0.000 n=20)
AppendFloat/64Fixed16-16             76.11n ± 1%    70.84n ± 0%   -6.92% (p=0.000 n=20)
AppendFloat/64Fixed12Hard-16         73.56n ± 1%    68.98n ± 2%   -6.23% (p=0.000 n=20)
AppendFloat/64Fixed17Hard-16         83.20n ± 1%    79.85n ± 1%   -4.03% (p=0.000 n=20)
AppendFloat/64Fixed18Hard-16         4.947µ ± 1%    4.915µ ± 1%        ~ (p=0.229 n=20)
AppendFloat/64FixedF1-16             242.4n ± 1%    239.4n ± 1%        ~ (p=0.038 n=20)
AppendFloat/64FixedF2-16             257.7n ± 2%    252.6n ± 1%   -1.98% (p=0.000 n=20)
AppendFloat/64FixedF3-16             237.5n ± 0%    237.5n ± 1%        ~ (p=0.440 n=20)
AppendFloat/Slowpath64-16            99.75n ± 1%    99.78n ± 1%        ~ (p=0.995 n=20)
AppendFloat/SlowpathDenormal64-16    97.41n ± 1%    98.20n ± 1%        ~ (p=0.006 n=20)
geomean                              100.7n         95.60n        -5.05%

host: s7
cpu: AMD Ryzen 9 7950X 16-Core Processor
                                  │ 14b7e09f493 │             f9bf7fcb8e2             │
                                  │   sec/op    │   sec/op     vs base                │
AppendFloat/Decimal-32              22.19n ± 0%   22.04n ± 0%   -0.68% (p=0.000 n=20)
AppendFloat/Float-32                34.59n ± 0%   34.88n ± 0%   +0.84% (p=0.000 n=20)
AppendFloat/Exp-32                  34.47n ± 0%   34.88n ± 0%   +1.20% (p=0.000 n=20)
AppendFloat/NegExp-32               34.85n ± 0%   35.32n ± 0%   +1.35% (p=0.000 n=20)
AppendFloat/LongExp-32              37.23n ± 0%   37.09n ± 0%        ~ (p=0.003 n=20)
AppendFloat/Big-32                  39.27n ± 0%   38.50n ± 0%   -1.97% (p=0.000 n=20)
AppendFloat/BinaryExp-32            17.38n ± 0%   17.61n ± 0%   +1.35% (p=0.000 n=20)
AppendFloat/32Integer-32            22.26n ± 0%   22.08n ± 0%   -0.79% (p=0.000 n=20)
AppendFloat/32ExactFraction-32      32.82n ± 0%   32.91n ± 0%        ~ (p=0.018 n=20)
AppendFloat/32Point-32              32.88n ± 0%   33.22n ± 0%   +1.03% (p=0.000 n=20)
AppendFloat/32Exp-32                34.95n ± 0%   34.62n ± 0%   -0.94% (p=0.000 n=20)
AppendFloat/32NegExp-32             33.23n ± 0%   33.55n ± 0%   +0.98% (p=0.000 n=20)
AppendFloat/32Shortest-32           30.19n ± 0%   30.12n ± 0%        ~ (p=0.122 n=20)
AppendFloat/32Fixed8Hard-32         22.94n ± 0%   22.88n ± 0%        ~ (p=0.124 n=20)
AppendFloat/32Fixed9Hard-32         26.20n ± 0%   25.94n ± 1%   -0.97% (p=0.000 n=20)
AppendFloat/64Fixed1-32             21.10n ± 0%   18.84n ± 0%  -10.71% (p=0.000 n=20)
AppendFloat/64Fixed2-32             20.75n ± 0%   18.70n ± 0%   -9.88% (p=0.000 n=20)
AppendFloat/64Fixed2.5-32           21.07n ± 0%   17.96n ± 0%  -14.74% (p=0.000 n=20)
AppendFloat/64Fixed3-32             21.24n ± 0%   19.64n ± 0%   -7.53% (p=0.000 n=20)
AppendFloat/64Fixed4-32             20.63n ± 0%   18.61n ± 0%   -9.79% (p=0.000 n=20)
AppendFloat/64Fixed5Hard-32         34.48n ± 0%   21.70n ± 0%  -37.06% (p=0.000 n=20)
AppendFloat/64Fixed12-32            32.26n ± 0%   30.87n ± 1%   -4.31% (p=0.000 n=20)
AppendFloat/64Fixed16-32            27.95n ± 0%   26.86n ± 0%   -3.92% (p=0.000 n=20)
AppendFloat/64Fixed12Hard-32        27.30n ± 0%   25.98n ± 1%   -4.82% (p=0.000 n=20)
AppendFloat/64Fixed17Hard-32        30.80n ± 0%   29.93n ± 0%   -2.84% (p=0.000 n=20)
AppendFloat/64Fixed18Hard-32        1.833µ ± 0%   1.831µ ± 0%        ~ (p=0.663 n=20)
AppendFloat/64FixedF1-32            83.42n ± 1%   84.00n ± 1%        ~ (p=0.003 n=20)
AppendFloat/64FixedF2-32            90.10n ± 0%   89.23n ± 1%   -0.95% (p=0.001 n=20)
AppendFloat/64FixedF3-32            84.42n ± 1%   84.39n ± 0%        ~ (p=0.878 n=20)
AppendFloat/Slowpath64-32           35.72n ± 0%   35.59n ± 0%        ~ (p=0.007 n=20)
AppendFloat/SlowpathDenormal64-32   35.36n ± 0%   35.05n ± 0%   -0.88% (p=0.000 n=20)
geomean                             36.05n        34.69n        -3.77%

host: linux-386
goarch: 386
cpu: Intel(R) Xeon(R) CPU @ 2.30GHz
                                  │ 14b7e09f493 │             f9bf7fcb8e2             │
                                  │   sec/op    │   sec/op     vs base                │
AppendFloat/Decimal-16              132.8n ± 0%   133.5n ± 0%   +0.49% (p=0.001 n=20)
AppendFloat/Float-16                242.6n ± 0%   241.7n ± 0%   -0.37% (p=0.000 n=20)
AppendFloat/Exp-16                  252.2n ± 0%   249.1n ± 0%   -1.27% (p=0.000 n=20)
AppendFloat/NegExp-16               253.6n ± 0%   247.7n ± 0%   -2.33% (p=0.000 n=20)
AppendFloat/LongExp-16              260.9n ± 0%   257.1n ± 0%   -1.48% (p=0.000 n=20)
AppendFloat/Big-16                  293.7n ± 0%   285.2n ± 0%   -2.89% (p=0.000 n=20)
AppendFloat/BinaryExp-16            89.63n ± 1%   89.06n ± 0%   -0.64% (p=0.000 n=20)
AppendFloat/32Integer-16            132.6n ± 0%   133.2n ± 0%        ~ (p=0.016 n=20)
AppendFloat/32ExactFraction-16      216.9n ± 0%   214.2n ± 0%   -1.24% (p=0.000 n=20)
AppendFloat/32Point-16              205.0n ± 0%   202.2n ± 0%   -1.37% (p=0.000 n=20)
AppendFloat/32Exp-16                250.2n ± 0%   235.9n ± 0%   -5.72% (p=0.000 n=20)
AppendFloat/32NegExp-16             213.5n ± 0%   210.6n ± 0%   -1.34% (p=0.000 n=20)
AppendFloat/32Shortest-16           198.3n ± 0%   197.8n ± 0%        ~ (p=0.147 n=20)
AppendFloat/32Fixed8Hard-16         114.9n ± 1%   136.0n ± 1%  +18.46% (p=0.000 n=20)
AppendFloat/32Fixed9Hard-16         189.8n ± 0%   155.0n ± 1%  -18.31% (p=0.000 n=20)
AppendFloat/64Fixed1-16             175.8n ± 0%   132.7n ± 0%  -24.52% (p=0.000 n=20)
AppendFloat/64Fixed2-16             166.6n ± 0%   128.7n ± 0%  -22.73% (p=0.000 n=20)
AppendFloat/64Fixed2.5-16           176.5n ± 0%   126.8n ± 0%  -28.11% (p=0.000 n=20)
AppendFloat/64Fixed3-16             165.3n ± 0%   127.1n ± 0%  -23.11% (p=0.000 n=20)
AppendFloat/64Fixed4-16             141.3n ± 0%   120.8n ± 1%  -14.51% (p=0.000 n=20)
AppendFloat/64Fixed5Hard-16         344.6n ± 0%   136.0n ± 0%  -60.51% (p=0.000 n=20)
AppendFloat/64Fixed12-16            184.2n ± 0%   158.7n ± 0%  -13.82% (p=0.000 n=20)
AppendFloat/64Fixed16-16            174.0n ± 0%   151.3n ± 0%  -12.99% (p=0.000 n=20)
AppendFloat/64Fixed12Hard-16        169.7n ± 0%   146.7n ± 0%  -13.58% (p=0.000 n=20)
AppendFloat/64Fixed17Hard-16        207.7n ± 0%   166.6n ± 0%  -19.81% (p=0.000 n=20)
AppendFloat/64Fixed18Hard-16        10.66µ ± 0%   10.63µ ± 0%        ~ (p=0.030 n=20)
AppendFloat/64FixedF1-16            615.9n ± 0%   613.5n ± 0%   -0.40% (p=0.000 n=20)
AppendFloat/64FixedF2-16            846.6n ± 0%   847.4n ± 0%        ~ (p=0.551 n=20)
AppendFloat/64FixedF3-16            609.9n ± 0%   609.5n ± 0%        ~ (p=0.213 n=20)
AppendFloat/Slowpath64-16           254.1n ± 0%   252.6n ± 1%        ~ (p=0.048 n=20)
AppendFloat/SlowpathDenormal64-16   251.5n ± 0%   249.4n ± 0%   -0.83% (p=0.000 n=20)
geomean                             249.2n        225.4n        -9.54%

host: s7:GOARCH=386
cpu: AMD Ryzen 9 7950X 16-Core Processor
                                  │ 14b7e09f493 │             f9bf7fcb8e2             │
                                  │   sec/op    │   sec/op     vs base                │
AppendFloat/Decimal-32              42.65n ± 0%   42.31n ± 0%   -0.79% (p=0.000 n=20)
AppendFloat/Float-32                71.56n ± 0%   71.06n ± 0%   -0.69% (p=0.000 n=20)
AppendFloat/Exp-32                  75.61n ± 1%   74.85n ± 1%   -1.01% (p=0.000 n=20)
AppendFloat/NegExp-32               74.36n ± 0%   74.30n ± 0%        ~ (p=0.482 n=20)
AppendFloat/LongExp-32              75.82n ± 0%   75.73n ± 0%        ~ (p=0.490 n=20)
AppendFloat/Big-32                  85.10n ± 0%   82.61n ± 0%   -2.93% (p=0.000 n=20)
AppendFloat/BinaryExp-32            33.02n ± 0%   32.48n ± 1%   -1.64% (p=0.000 n=20)
AppendFloat/32Integer-32            41.54n ± 1%   41.27n ± 1%   -0.66% (p=0.000 n=20)
AppendFloat/32ExactFraction-32      62.48n ± 0%   62.91n ± 0%   +0.69% (p=0.000 n=20)
AppendFloat/32Point-32              60.17n ± 0%   60.65n ± 0%   +0.80% (p=0.000 n=20)
AppendFloat/32Exp-32                73.34n ± 0%   68.99n ± 0%   -5.92% (p=0.000 n=20)
AppendFloat/32NegExp-32             63.29n ± 0%   62.83n ± 0%   -0.73% (p=0.000 n=20)
AppendFloat/32Shortest-32           58.97n ± 0%   59.07n ± 0%        ~ (p=0.029 n=20)
AppendFloat/32Fixed8Hard-32         37.42n ± 0%   41.76n ± 1%  +11.61% (p=0.000 n=20)
AppendFloat/32Fixed9Hard-32         55.18n ± 0%   50.13n ± 1%   -9.16% (p=0.000 n=20)
AppendFloat/64Fixed1-32             50.89n ± 1%   41.25n ± 0%  -18.94% (p=0.000 n=20)
AppendFloat/64Fixed2-32             48.33n ± 1%   40.85n ± 1%  -15.48% (p=0.000 n=20)
AppendFloat/64Fixed2.5-32           52.46n ± 0%   39.39n ± 0%  -24.92% (p=0.000 n=20)
AppendFloat/64Fixed3-32             48.28n ± 1%   40.66n ± 0%  -15.78% (p=0.000 n=20)
AppendFloat/64Fixed4-32             44.57n ± 0%   38.58n ± 0%  -13.44% (p=0.000 n=20)
AppendFloat/64Fixed5Hard-32         96.16n ± 0%   42.99n ± 1%  -55.29% (p=0.000 n=20)
AppendFloat/64Fixed12-32            56.84n ± 0%   51.95n ± 1%   -8.61% (p=0.000 n=20)
AppendFloat/64Fixed16-32            54.23n ± 0%   49.33n ± 0%   -9.03% (p=0.000 n=20)
AppendFloat/64Fixed12Hard-32        53.47n ± 0%   48.67n ± 0%   -8.99% (p=0.000 n=20)
AppendFloat/64Fixed17Hard-32        61.76n ± 0%   55.42n ± 1%  -10.27% (p=0.000 n=20)
AppendFloat/64Fixed18Hard-32        3.998µ ± 1%   4.001µ ± 0%        ~ (p=0.449 n=20)
AppendFloat/64FixedF1-32            161.8n ± 0%   166.2n ± 1%   +2.72% (p=0.000 n=20)
AppendFloat/64FixedF2-32            223.4n ± 2%   226.2n ± 1%   +1.25% (p=0.000 n=20)
AppendFloat/64FixedF3-32            159.6n ± 0%   161.6n ± 1%   +1.22% (p=0.000 n=20)
AppendFloat/Slowpath64-32           76.69n ± 0%   75.03n ± 0%   -2.16% (p=0.000 n=20)
AppendFloat/SlowpathDenormal64-32   75.02n ± 0%   74.36n ± 1%        ~ (p=0.003 n=20)
geomean                             74.66n        69.39n        -7.06%

Change-Id: I9db46471a93bd2aab3c2796e563d154cb531d4cb
Reviewed-on: https://go-review.googlesource.com/c/go/+/717182
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Russ Cox <rsc@golang.org>
2025-11-03 20:29:54 -08:00
Russ Cox
162ba6cc40 internal/strconv: add tests and benchmarks for ftoaFixed
ftoaFixed is in the next CL; this proves the tests are correct
against the current implementation, and it adds a benchmark
for comparison with the new implementation.

Change-Id: I7ac8a1f699b693ea6d11a7122b22fc70cc135af6
Reviewed-on: https://go-review.googlesource.com/c/go/+/717181
Auto-Submit: Russ Cox <rsc@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-03 20:09:15 -08:00
Russ Cox
9795c7ba22 internal/strconv: fix pow10 off-by-one in exponent result
The exact meaning of pow10 was not defined nor tested directly.
Define it as pow10(e) returns mant, exp where mant/2^128 * 2**exp = 10^e.
This is the most natural definition but is off-by-one from what
it had been returning. Fix the off-by-one and then adjust the
call sites to stop compensating for it.

Change-Id: I9ee475854f30be4bd0d4f4d770a6b12ec68281fe
Reviewed-on: https://go-review.googlesource.com/c/go/+/717180
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>
2025-11-03 20:09:12 -08:00
Guoqi Chen
ad5e941a45 cmd/internal/obj/loong64: using {xv,v}slli.d to perform copying between vector registers
Go asm syntax:
	VMOVQ     Vj, Vd
	XVMOVQ    Xj, Xd

Equivalent platform assembler syntax:
	vslli.d   vd, vj, 0x0
	xvslli.d  xd, xj, 0x0

Change-Id: Ifddc3d4d3fbaa6fee2e079bf2ebfe96a2febaa1c
Reviewed-on: https://go-review.googlesource.com/c/go/+/716801
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-03 17:16:59 -08:00
Guoqi Chen
dadbac0c9e cmd/internal/obj/loong64: add VPERMI.W, XVPERMI.{W,V,Q} instruction support
Go asm syntax:
	 VPERMIW        $0x1b, vj, vd
	XVPERMI{W,V,Q}  $0x1b, xj, xd

Equivalent platform assembler syntax:
	 vpermi.w       vd, vj, $0x1b
	xvpermi.{w,d,q} xd, xj, $0x1b

Change-Id: Ie23b2fdd09b4c93801dc804913206f1c5a496268
Reviewed-on: https://go-review.googlesource.com/c/go/+/716800
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-11-03 17:16:43 -08:00
Russ Cox
e2c6a2024c runtime: avoid append in printint, printuint
Should make cmd/link/internal/ld.TestAbstractOriginSanity happier.

Change-Id: I121927d42e527ff23d996e7387066f149b11cc59
Reviewed-on: https://go-review.googlesource.com/c/go/+/717480
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-03 16:37:04 -08:00
Michael Anthony Knyszek
c93cc603cd runtime: allow Stack to traceback goroutines in syscall _Grunning window
net/http/cgi.TestCopyError calls runtime.Stack to take a stack trace of
all goroutines, and searches for a specific line in that stack trace.

It currently sometimes fails because it encounters the goroutine its
looking for in the small window where a goroutine might be in _Grunning
while in a syscall, introduced in CL 646198. In that case, the traceback
will give up, failing to print the stack TestCopyError is expecting.

This represents a general regression, since previously runtime.Stack
could never fail to take a goroutine's stack; giving up was only
possible in fatal panic cases.

Fix this the same way we fixed goroutine profiles: allow the stack trace
to proceed if the g's syscallsp != 0. This is safe in any
stop-the-world-related context, because syscallsp won't be mutated while
the goroutine fails to acquire a P, and thus fails to fully exit the
syscall context. This also means the stack below syscallsp won't be
mutated, and thus taking a traceback is also safe.

Fixes #66639.

Change-Id: Ie6f4b0661d9f8df02c9b8434e99bc95f26fe5f0d
Reviewed-on: https://go-review.googlesource.com/c/go/+/716680
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-03 14:54:13 -08:00
Michael Anthony Knyszek
b5353fd90a runtime: don't panic in castogscanstatus
The panic calls gopanic which may have write barriers, but
castogscanstatus is called from //go:nowritebarrier contexts.

The panic is dead code anyway, and appears immediately before a call to
'throw'.

Change-Id: I4a8e296b71bf002295a3aa1db4f723c305ed939a
Reviewed-on: https://go-review.googlesource.com/c/go/+/717406
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-11-03 14:50:47 -08:00
Ariel Otilibili
43491f8d52 cmd/cgo: use the export'ed file/line in error messages
When an unpinned Go pointer (or a pointer to an unpinned Go pointer) is
returned from Go to C,

     1  package main
     2
     3  import (
     4          "C"
     5  )
     6
     7  //export foo
     8  func foo(CLine *C.char) string {
     9          return C.GoString(CLine)
    10  }
    11
    12
    13  func main() {
    14  }

The error message mentions the file/line of the cgo wrapper,

    panic: runtime error: cgo result is unpinned Go pointer or points to unpinned Go pointer

    goroutine 17 [running, locked to thread]:
    panic({0x798f2341a4c0?, 0xc000112000?})
            /usr/lib/go/src/runtime/panic.go:802 +0x168
    runtime.cgoCheckArg(0x798f23417e20, 0xc000066e50, 0x0?, 0x0, {0x798f233f5a62, 0x42})
            /usr/lib/go/src/runtime/cgocall.go:679 +0x35b
    runtime.cgoCheckResult({0x798f23417e20, 0xc000066e50})
            /usr/lib/go/src/runtime/cgocall.go:795 +0x4b
    _cgoexp_3c910ddb72c4_foo(0x7ffc9fa9bfa0)
            _cgo_gotypes.go:65 +0x5d
    runtime.cgocallbackg1(0x798f233ec780, 0x7ffc9fa9bfa0, 0x0)
            /usr/lib/go/src/runtime/cgocall.go:446 +0x289
    runtime.cgocallbackg(0x798f233ec780, 0x7ffc9fa9bfa0, 0x0)
            /usr/lib/go/src/runtime/cgocall.go:350 +0x132
    runtime.cgocallbackg(0x798f233ec780, 0x7ffc9fa9bfa0, 0x0)
            <autogenerated>:1 +0x2b
    runtime.cgocallback(0x0, 0x0, 0x0)
            /usr/lib/go/src/runtime/asm_amd64.s:1082 +0xcd
    runtime.goexit({})
            /usr/lib/go/src/runtime/asm_amd64.s:1693 +0x1

The cgo wrapper (_cgoexp_3c910ddb72c4_foo) is located in a temporary
build artifact (_cgo_gotypes.go)

    $ go tool cgo -objdir objdir parse.go
    $ cat -n objdir/_cgo_gotypes.go | sed -n '55,70p'
        55  //go:cgo_export_dynamic foo
        56  //go:linkname _cgoexp_d48770e267d1_foo _cgoexp_d48770e267d1_foo
        57  //go:cgo_export_static _cgoexp_d48770e267d1_foo
        58  func _cgoexp_d48770e267d1_foo(a *struct {
        59                  p0 *_Ctype_char
        60                  r0 string
        61          }) {
        62          a.r0 = foo(a.p0)
        63          _cgoCheckResult(a.r0)
        64  }

The file/line of the export'ed function is expected in the error message.

Use it in error messages.

    panic: runtime error: cgo result is unpinned Go pointer or points to unpinned Go pointer

    goroutine 17 [running, locked to thread]:
    panic({0x7df72b1d8ae0?, 0x3ec8a1790030?})
            /mnt/go/src/runtime/panic.go:877 +0x16f
    runtime.cgoCheckArg(0x7df72b1d62c0, 0x3ec8a16eee50, 0x68?, 0x0, {0x7df72b1ad44c, 0x42})
            /mnt/go/src/runtime/cgocall.go:679 +0x35b
    runtime.cgoCheckResult({0x7df72b1d62c0, 0x3ec8a16eee50})
            /mnt/go/src/runtime/cgocall.go:795 +0x4b
    _cgoexp_3c910ddb72c4_foo(0x7ffca1b21020)
            /mnt/tmp/parse.go:8 +0x5d
    runtime.cgocallbackg1(0x7df72b1a4360, 0x7ffca1b21020, 0x0)
            /mnt/go/src/runtime/cgocall.go:446 +0x289
    runtime.cgocallbackg(0x7df72b1a4360, 0x7ffca1b21020, 0x0)
            /mnt/go/src/runtime/cgocall.go:350 +0x132
    runtime.cgocallbackg(0x7df72b1a4360, 0x7ffca1b21020, 0x0)
            <autogenerated>:1 +0x2b
    runtime.cgocallback(0x0, 0x0, 0x0)
            /mnt/go/src/runtime/asm_amd64.s:1101 +0xcd
    runtime.goexit({})
            /mnt/go/src/runtime/asm_amd64.s:1712 +0x1

So doing, fix typos in comments.

Link: https://web.archive.org/web/20251008114504/https://dave.cheney.net/2018/01/08/gos-hidden-pragmas
Suggested-by: Keith Randall <khr@golang.org>
For #75856

Change-Id: I0bf36d5c8c5c0c7df13b00818bc4641009058979
GitHub-Last-Rev: e65839cfb2
GitHub-Pull-Request: golang/go#76118
Reviewed-on: https://go-review.googlesource.com/c/go/+/716441
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Florian Lehner <lehner.florian86@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-03 13:12:23 -08:00
Mateusz Poliwczak
aa94fdf0cc cmd/go: link to go.dev/doc/godebug for removed GODEBUG settings
This makes the user experience better, before users would receive
an unknown godebug error message, now we explicitly mention that
it was removed and link to go.dev/doc/godebug where users can find
more information about the removal.

Additionally we keep all the removed GODEBUGs in the source, making
sure we do not reuse such GODEBUG after it is removed.

Updates #72111
Updates #75316

Change-Id: I6a6a6964cce1c100108fdba4bfba7d13cd9a893a
Reviewed-on: https://go-review.googlesource.com/c/go/+/701875
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Mateusz Poliwczak <mpoliwczak34@gmail.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
2025-11-03 13:12:15 -08:00
Daniel McCarney
4d2b03d2fc crypto/tls: add BetterTLS test coverage
This commit adds test coverage of path building and name constraint
verification using the suite of test data provided by Netflix's
BetterTLS project.

Since the uncompressed raw JSON test data exported by BetterTLS for
external test integrations is ~31MB we use a similar approach to the
BoGo and ACVP test integrations and fetch the BetterTLS Go module, and
run its export tool on-the-fly to generate the test data in a tempdir.

As expected, all tests pass currently and this coverage is mainly
helpful in catching regressions, especially with tricky/cursed name
constraints.

Change-Id: I23d7c24232e314aece86bcbfd133b7f02c9e71b5
Reviewed-on: https://go-review.googlesource.com/c/go/+/717420
TryBot-Bypass: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Auto-Submit: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-11-03 13:11:11 -08:00
Alexander Musman
0c4444e13d cmd/internal/obj: support arm64 FMOVQ large offset encoding
Support arm64 FMOVQ with large offset in immediate which is encoded
using register offset instruction in opldrr or opstrr. This will help
allowing folding immediate into new ssa ops FMOVQload and FMOVQstore.

For example: FMOVQ F0, -20000(R0) is encoded as following:
  MOVD 3(PC), R27
  FMOVQ F0, (R0)(R27)
  RET
  ffff b1e0 # constant value

Change-Id: Ib71f92f6ff4b310bda004a440b1df41ffe164523
Reviewed-on: https://go-review.googlesource.com/c/go/+/716960
Reviewed-by: Cherry Mui <cherryyz@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 Pratt <mpratt@google.com>
2025-11-03 13:09:40 -08:00
matloob@golang.org
85bec791a0 cmd/go/testdata/script: loosen list_empty_importpath for freebsd
We've been seeing the flakes where we get a 'no errors' output on
freebsd in addition to windows and solaris. Also allow that case to
avoid flakes.

For #73976

Change-Id: I6a6a696445ec908b55520d8d75e7c1f867b9c092
Reviewed-on: https://go-review.googlesource.com/c/go/+/715640
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@google.com>
Reviewed-by: Ian Alexander <jitsu@google.com>
2025-11-03 12:46:38 -08:00
Michael Anthony Knyszek
17b57078ab internal/runtime/cgobench: add cgo callback benchmark
Change-Id: I43ea575aff87a3e420477cb26d35185d03df5ccc
Reviewed-on: https://go-review.googlesource.com/c/go/+/713283
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>
2025-11-03 12:46:35 -08:00
Ian Alexander
5f8fdb720c cmd/go: move functions to methods
[git-generate]
cd src/cmd/go/internal/modload
rf '
  mv InitWorkfile State.InitWorkfile
  mv FindGoWork State.FindGoWork
  mv WillBeEnabled State.WillBeEnabled
  mv Enabled State.Enabled
  mv inWorkspaceMode State.inWorkspaceMode
  mv HasModRoot State.HasModRoot
  mv MustHaveModRoot State.MustHaveModRoot
  mv ModFilePath State.ModFilePath
'

Change-Id: I207113868af037c9c0049f4207c3d3b4c19468bb
Reviewed-on: https://go-review.googlesource.com/c/go/+/716602
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-03 12:20:37 -08:00
Ian Alexander
0a95856b95 cmd/go: eliminate additional global variable
Move global variable to a field on the State type.

Change-Id: I1edd32e1d28ce814bcd75501098ee4b22227546b
Reviewed-on: https://go-review.googlesource.com/c/go/+/716162
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>
2025-11-03 12:20:15 -08:00
qmuntal
f93186fb44 cmd/go/internal/telemetrystats: count cgo usage
Knowing how many times cgo is used is useful information to have in the
local telemetry database.

It also opens the door for uploading them in the future if desired.

Change-Id: Ia92b11fc489f015bbface7f28ed5a5c2871c44f0
Reviewed-on: https://go-review.googlesource.com/c/go/+/707055
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Michael Matloob <matloob@google.com>
Reviewed-by: Florian Lehner <lehner.florian86@gmail.com>
2025-11-03 12:18:49 -08:00
Youlin Feng
eaf28a27fd runtime: update outdated comments for deferprocStack
Change-Id: I0ea4d15da163cec6fe2a703376ce5a6032e15484
Reviewed-on: https://go-review.googlesource.com/c/go/+/714861
Reviewed-by: Keith Randall <khr@google.com>
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@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
2025-11-03 10:44:04 -08:00
cuishuang
e12d8a90bf all: remove extra space in the comments
Change-Id: I26302d801732f40b1fe6b30ff69d222047bca490
Reviewed-on: https://go-review.googlesource.com/c/go/+/716740
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-11-03 10:05:39 -08:00
Maxim Merzhanov
c5559344ac internal/profile: optimize Parse allocs
In our case, it greatly improves the performance of continuously collecting diff profiles from the net/http/pprof endpoint, such as /debug/pprof/allocs?seconds=30.

This CL is a cherry-pick of my PR upstream: https://github.com/google/pprof/pull/951

Benchmark of profile Parse func:

goos: linux
goarch: amd64
pkg: github.com/google/pprof/profile
cpu: 13th Gen Intel(R) Core(TM) i7-1360P
         │ old-parse.txt │            new-parse.txt             │
         │    sec/op     │    sec/op     vs base                │
Parse-16    62.07m ± 13%   55.54m ± 13%  -10.52% (p=0.035 n=10)

         │ old-parse.txt │            new-parse.txt             │
         │     B/op      │     B/op      vs base                │
Parse-16    47.56Mi ± 0%   41.09Mi ± 0%  -13.59% (p=0.000 n=10)

         │ old-parse.txt │            new-parse.txt            │
         │   allocs/op   │  allocs/op   vs base                │
Parse-16     272.9k ± 0%   175.8k ± 0%  -35.58% (p=0.000 n=10)

Change-Id: I737ff9b9f815fdc56bc3b5743403717c4b6f07fd
GitHub-Last-Rev: a09108f7ff
GitHub-Pull-Request: golang/go#76145
Reviewed-on: https://go-review.googlesource.com/c/go/+/717081
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Florian Lehner <lehner.florian86@gmail.com>
2025-11-03 09:56:37 -08:00
Ilia Choly
5132158ac2 bytes: add Buffer.Peek
Fixes #73794

Change-Id: I0a57db05aacfa805213fe8278fc727e76eb8a65e
GitHub-Last-Rev: 3494d93f80
GitHub-Pull-Request: golang/go#73795
Reviewed-on: https://go-review.googlesource.com/c/go/+/674415
Reviewed-by: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-11-03 09:39:00 -08:00
Youlin Feng
361d51a6b5 runtime: remove the pc field of _defer struct
Since we always can get the address of `CALL runtime.deferreturn(SB)`
from the unwinder, so it is not necessary to record the caller's pc
in the _defer struct. For the stack allocated _defer, this CL makes
the frame smaller.

Change-Id: I0fd347e4bc07cf8a9b954816323df30fc52552b6
Reviewed-on: https://go-review.googlesource.com/c/go/+/716720
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-11-03 09:26:36 -08:00
Filippo Valsorda
00ee1860ce crypto/internal/constanttime: expose intrinsics to the FIPS 140-3 packages
Intrinsifying things inside the module (crypto/internal/fips140/subtle)
is asking for trouble, as the import paths are rewritten by the
GOFIPS140 mechanism, and we might have to support multiple modules
in the future.

Importing crypto/subtle from inside a FIPS 140-3 module is not allowed,
and is basically asking for circular dependencies.

Instead, break off the intrinsics into their own package
(crypto/internal/constanttime), and keep the byte slice operations
in crypto/internal/fips140/subtle. crypto/subtle then becomes a thin
dispatch layer.

Change-Id: I6a6a6964cd5cb5ad06e9d1679201447f5a811da4
Reviewed-on: https://go-review.googlesource.com/c/go/+/716120
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
2025-11-03 07:14:16 -08:00
David Finkel
388c41c412 cmd/go: skip git sha256 tests if git < 2.29
Fix test building on older Ubuntu LTS releases (that are still
supported). Git SHA256 support was only included in 2.29, which came out
in 2021. Check the output of `git version` and skip these tests if the
version is older than that introduction.

Thanks to @ianlancetaylor for flagging this.

Updates: #73704
Change-Id: I9d413a63fa43f34f94c274bba7f7b883c80433b6
Reviewed-on: https://go-review.googlesource.com/c/go/+/698835
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: Michael Matloob <matloob@google.com>
Reviewed-by: Ian Alexander <jitsu@google.com>
2025-11-02 07:51:05 -08:00
Nicholas S. Husin
385dc33250 runtime: prevent time.Timer.Reset(0) from deadlocking testing/synctest tests
In Go 1.23+, timer channels behave synchronously. When we have a timer
channel (i.e. !async && t.isChan) we would lock the
runtime.timer.sendLock mutex at the beginning of
runtime.timer.modify()'s execution.

Calling time.Timer.Reset(0) within a testing/synctest test,
unfortunately, causes it to hang indefinitely. This is because the
runtime.timer.sendLock mutex ends up being locked twice before it could
be unlocked:

- When calling time.Timer.Reset(), runtime.timer.modify() would lock the
  mutex per usual.
- Due to the 0 argument, runtime.timer.modify() would also try to
  execute the bubbled timer immediately rather than adding them to a
  heap. However, in doing so, it uses runtime.timer.unlockAndRun(),
  which also locks the same mutex.

This CL solves this issue by making sure that a locked
runtime.timer.sendLock mutex is unlocked first, whenever we try to
execute bubbled timer immediately in the stack.

Fixes #76052

Change-Id: I66429b9bf6971400de95dcf2d5dc9670c3135492
Reviewed-on: https://go-review.googlesource.com/c/go/+/716883
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Nicholas Husin <nsh@golang.org>
Reviewed-by: Nicholas Husin <husin@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-01 08:37:04 -07:00
Sean Liao
99b724f454 cmd/go: document purego convention
Fixes #23172

Change-Id: I854e399471dfa22e62fbdec9719e561c4501e5ac
Reviewed-on: https://go-review.googlesource.com/c/go/+/660136
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-10-31 07:35:59 -07:00
Lance Yang
27937289dc runtime: avoid zeroing scavenged memory
On Linux, memory returned to the kernel via MADV_DONTNEED is guaranteed
to be zero-filled on its next use.

This commit leverages this kernel behavior to avoid a redundant software
zeroing pass in the runtime, improving performance.

Change-Id: Ia14343b447a2cec7af87644fe8050e23e983c787
GitHub-Last-Rev: 6c8df32283
GitHub-Pull-Request: golang/go#76063
Reviewed-on: https://go-review.googlesource.com/c/go/+/715160
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: David Chase <drchase@google.com>
2025-10-31 05:33:04 -07:00
Michael Anthony Knyszek
89dee70484 runtime: prioritize panic output over racefini
For some reason CL 646198 uncovered #3934 and #20018 again, but only in
race mode. It turns out that because racefini does not return, and
racefini is called early after main returns, we would not properly wait
for a concurrent panic to complete. This would result in fairly
consistent failures of TestPanicRace, which specifically looks for the
panic output to appear if main concurrently exits.

The important part of this change is that race mode will no longer have
the bug described in #3934 and #20018. A byproduct, however, is that
racefini is that we're essentially prioritizing the panic output over
racefini in this scenario. If racefini were to reveal a latent race
condition and fail, we'll prefer to surface the panic. Such a case is
probably fine, because the panic is always an crashing, unrecoverable
panic.

For #3934.
For #20018.

Change-Id: I0674a75c918563c5ec4ee1eec057dfd096fcfbc8
Reviewed-on: https://go-review.googlesource.com/c/go/+/691795
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>
2025-10-30 12:57:08 -07:00
Michael Anthony Knyszek
8683bb846d runtime: optimistically CAS atomicstatus directly in enter/exitsyscall
This change steals the performance trick from the coro implementation to
try to do the CAS directly first before calling into casgstatus, a much
more heavyweight function. We have to be careful about synctest
bubbling, but overall it's a good bit faster, and easy low-hanging
fruit.

goos: linux
goarch: amd64
pkg: internal/runtime/cgobench
cpu: AMD EPYC 7B13
           │ after-2-2.out │            after-3.out             │
           │    sec/op     │   sec/op     vs base               │
CgoCall-64     34.62n ± 1%   30.55n ± 1%  -11.76% (p=0.002 n=6)

Change-Id: Ic38620233b55f58b8a07510666aa18648373e2e7
Reviewed-on: https://go-review.googlesource.com/c/go/+/708596
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>
2025-10-30 12:55:45 -07:00
Michael Anthony Knyszek
5b8e850340 runtime: don't track scheduling latency for _Grunning <-> _Gsyscall
The current logic causes much more tracking than necessary, when really
_Grunning and _Gsyscall are both sort of "running" from the perspective
of tracking scheduling latency.

This makes cgo calls and syscalls a little faster in the single-threaded
case, and shows much larger improvement in the multi-threaded case
by removing updates of shared variables (though this parallel
microbenchmark is a little unrealistic, so don't ascribe too much weight
to it).

goos: linux
goarch: amd64
pkg: internal/runtime/cgobench
cpu: AMD EPYC 7B13
                   │  after.out  │            after-2.out             │
                   │   sec/op    │   sec/op     vs base               │
CgoCall-64           35.83n ± 1%   34.69n ± 1%   -3.20% (p=0.002 n=6)
CgoCallParallel-64   5.338n ± 1%   1.352n ± 4%  -74.67% (p=0.002 n=6)

Change-Id: I2ea494dd5ebbbfb457373549986fbe2fbe318d45
Reviewed-on: https://go-review.googlesource.com/c/go/+/646275
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-30 10:46:51 -07:00
Michael Anthony Knyszek
251814e580 runtime: document tracer invariants explicitly
This change is a documentation update for the execution tracer. Far too
much is left to small comments scattered around places. This change
accumulates the big important trace invariants, with rationale, into one
file: trace.go.

Change-Id: I5fd1402a3d8fdf14a0051e305b3a8fb5dfeafcb3
Reviewed-on: https://go-review.googlesource.com/c/go/+/708398
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-30 10:45:52 -07:00
Michael Anthony Knyszek
7244e9221f runtime: eliminate _Psyscall
This change eliminates the _Psyscall state by using synchronization on
the G status _Gsyscall to make syscalls work instead. This removes an
atomic Store and an atomic CAS on the syscall path, which reduces
syscall and cgo overheads. It also simplifies the syscall paths quite a
bit.

The one danger with this change is that we have a new combination of
states that was previously impossible. There are brief windows where
it's possible to observe a goroutine in _Grunning but without a P. This
change is careful to hide this detail from the execution tracer, but it
may have unexpected effects in the rest of the runtime, making this
change somewhat risky.

goos: linux
goarch: amd64
pkg: internal/runtime/cgobench
cpu: AMD EPYC 7B13
                   │ before.out  │             after.out              │
                   │   sec/op    │   sec/op     vs base               │
CgoCall-64           43.69n ± 1%   35.83n ± 1%  -17.99% (p=0.002 n=6)
CgoCallParallel-64   5.306n ± 1%   5.338n ± 1%        ~ (p=0.132 n=6)

Change-Id: I4551afc1eea0c1b67a0b2dd26b0d49aa47bf1fb8
Reviewed-on: https://go-review.googlesource.com/c/go/+/646198
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>
2025-10-30 10:08:55 -07:00
Russ Cox
5ef19c0d0c strconv: delete divmod1e9
The compiler is just as good now, even on 32-bit systems.

Change-Id: Ifee72c0e84a68703c0721a7a9f4ca5aa637ad5e2
Reviewed-on: https://go-review.googlesource.com/c/go/+/716464
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Russ Cox <rsc@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
2025-10-30 09:55:09 -07:00
Russ Cox
d32b1f02c3 runtime: delete timediv
Now that the compiler handles constant 64-bit divisions
without function calls on 32-bit systems, we no longer need
to maintain and test a bad custom implementation of 64-bit division.

Change-Id: If28807ad4f86507267ae69bc8f0b09ec18e98b66
Reviewed-on: https://go-review.googlesource.com/c/go/+/716463
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Russ Cox <rsc@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
2025-10-30 09:55:06 -07:00
Russ Cox
cbbd385cb8 strconv: remove arch-specific decision in formatBase10
There is only one architecture-specific code segment left in formatBase10.
Remove it for simplicity.

The only affected system is ppc64le, which does add 10-20% to the
runtime, but that's a ppc64le problem, not a strconv problem.
Changing the "uint32" to "uint" makes ppc64le not slower anymore,
meaning that somehow uint32 divide-by-constant is slower than
uint divide-by-constant on ppc64le. If this minor slowdown matters,
it should be addressed by improving the generated code for
ppc64le division, not by complicating strconv.
Even though some percentages look big, the geomean is +6% and
the worst case slowdown is only about 6ns/call.

benchmark \ host                    local       s7  s7:GOARCH=386  linux-amd64  linux-386  linux-ppc64le
                                  vs base  vs base        vs base      vs base    vs base        vs base
AppendFloat/Decimal                     ~        ~         -0.75%            ~          ~              ~
AppendFloat/Float                       ~        ~              ~            ~          ~              ~
AppendFloat/Exp                         ~        ~              ~            ~          ~              ~
AppendFloat/NegExp                      ~        ~              ~            ~          ~              ~
AppendFloat/LongExp                     ~        ~              ~            ~          ~              ~
AppendFloat/Big                         ~        ~              ~            ~          ~              ~
AppendFloat/BinaryExp                   ~        ~              ~            ~     -2.92%        +10.31%
AppendFloat/32Integer                   ~        ~              ~            ~          ~              ~
AppendFloat/32ExactFraction             ~        ~         -0.43%            ~          ~              ~
AppendFloat/32Point                     ~        ~              ~            ~          ~              ~
AppendFloat/32Exp                       ~        ~              ~            ~          ~              ~
AppendFloat/32NegExp                    ~        ~              ~            ~          ~              ~
AppendFloat/32Shortest                  ~        ~              ~            ~          ~              ~
AppendFloat/32Fixed8Hard                ~        ~         -1.12%            ~     -4.19%         +5.39%
AppendFloat/32Fixed9Hard                ~        ~              ~            ~          ~        +12.09%
AppendFloat/64Fixed1                    ~        ~              ~            ~     -0.78%              ~
AppendFloat/64Fixed2                    ~        ~         +0.53%            ~     -0.74%              ~
AppendFloat/64Fixed3                    ~        ~              ~            ~     -0.82%              ~
AppendFloat/64Fixed4                    ~        ~              ~            ~     -0.63%         +2.55%
AppendFloat/64Fixed12                   ~        ~         +0.63%       -1.83%     -1.01%         +5.68%
AppendFloat/64Fixed16                   ~        ~         +0.63%            ~     -1.33%              ~
AppendFloat/64Fixed12Hard               ~        ~         +1.31%            ~     -0.34%         +4.43%
AppendFloat/64Fixed17Hard               ~        ~              ~            ~     -1.66%         +4.63%
AppendFloat/64Fixed18Hard               ~        ~              ~            ~          ~              ~
AppendFloat/Slowpath64                  ~        ~              ~            ~          ~              ~
AppendFloat/SlowpathDenormal64          ~        ~              ~            ~          ~              ~
AppendInt                               ~        ~              ~            ~     -0.77%        +11.06%
AppendUint                              ~        ~         +0.42%            ~     -1.35%         +7.27%
AppendIntSmall                          ~        ~              ~            ~          ~              ~
AppendUintVarlen/digits=1               ~        ~              ~            ~          ~              ~
AppendUintVarlen/digits=2               ~        ~              ~            ~          ~         +4.80%
AppendUintVarlen/digits=3               ~        ~         -1.61%            ~     -4.49%        +10.04%
AppendUintVarlen/digits=4               ~        ~         -2.09%            ~     -2.88%         +9.99%
AppendUintVarlen/digits=5               ~        ~         -3.97%            ~     -8.92%         +7.19%
AppendUintVarlen/digits=6               ~        ~         -3.88%            ~     -7.84%         +5.25%
AppendUintVarlen/digits=7               ~        ~         -2.93%            ~    -11.08%              ~
AppendUintVarlen/digits=8               ~        ~         -2.88%            ~    -10.09%        +10.74%
AppendUintVarlen/digits=9               ~        ~         -3.69%            ~    -10.98%        +11.56%
AppendUintVarlen/digits=10              ~        ~         +0.90%            ~     -1.09%        +34.49%
AppendUintVarlen/digits=11              ~        ~         +2.11%            ~     +0.72%        +20.63%
AppendUintVarlen/digits=12              ~        ~         +1.21%            ~     -2.26%        +27.38%
AppendUintVarlen/digits=13              ~        ~         +2.07%            ~     -2.13%        +15.37%
AppendUintVarlen/digits=14              ~        ~              ~            ~     -3.27%        +19.32%
AppendUintVarlen/digits=15              ~        ~         +0.56%            ~     -3.18%         +8.55%
AppendUintVarlen/digits=16              ~        ~              ~            ~     -4.31%        +15.69%
AppendUintVarlen/digits=17              ~        ~              ~            ~     -4.50%         +7.61%
AppendUintVarlen/digits=18              ~        ~              ~            ~     -5.54%        +12.74%
AppendUintVarlen/digits=19              ~        ~         +0.87%            ~     +0.41%        +13.82%
AppendUintVarlen/digits=20              ~        ~         +1.40%            ~     +0.82%        +15.80%

host: local
                                  │ e8ffcf3095c │            3c5742b667a             │
                                  │   sec/op    │   sec/op     vs base               │
AppendFloat/Decimal-12              21.04n ± 2%   21.10n ± 0%       ~ (p=0.542 n=20)
AppendFloat/Float-12                32.77n ± 1%   32.56n ± 0%       ~ (p=0.213 n=20)
AppendFloat/Exp-12                  32.42n ± 1%   32.42n ± 0%       ~ (p=0.995 n=20)
AppendFloat/NegExp-12               31.78n ± 2%   31.79n ± 2%       ~ (p=0.542 n=20)
AppendFloat/LongExp-12              31.54n ± 1%   31.45n ± 1%       ~ (p=0.507 n=20)
AppendFloat/Big-12                  33.75n ± 1%   33.59n ± 1%       ~ (p=0.597 n=20)
AppendFloat/BinaryExp-12            19.16n ± 1%   19.14n ± 1%       ~ (p=0.635 n=20)
AppendFloat/32Integer-12            21.59n ± 1%   21.63n ± 1%       ~ (p=0.569 n=20)
AppendFloat/32ExactFraction-12      31.12n ± 1%   31.17n ± 1%       ~ (p=0.337 n=20)
AppendFloat/32Point-12              31.11n ± 1%   31.13n ± 0%       ~ (p=0.899 n=20)
AppendFloat/32Exp-12                32.27n ± 0%   32.24n ± 1%       ~ (p=0.794 n=20)
AppendFloat/32NegExp-12             30.56n ± 1%   30.64n ± 1%       ~ (p=0.899 n=20)
AppendFloat/32Shortest-12           26.88n ± 0%   27.11n ± 1%       ~ (p=0.001 n=20)
AppendFloat/32Fixed8Hard-12         20.63n ± 1%   20.63n ± 0%       ~ (p=0.596 n=20)
AppendFloat/32Fixed9Hard-12         22.69n ± 1%   22.81n ± 1%       ~ (p=0.763 n=20)
AppendFloat/64Fixed1-12             18.65n ± 0%   18.73n ± 1%       ~ (p=0.112 n=20)
AppendFloat/64Fixed2-12             18.91n ± 1%   18.88n ± 0%       ~ (p=0.569 n=20)
AppendFloat/64Fixed3-12             18.73n ± 1%   18.60n ± 0%       ~ (p=0.003 n=20)
AppendFloat/64Fixed4-12             17.87n ± 3%   17.84n ± 1%       ~ (p=0.569 n=20)
AppendFloat/64Fixed12-12            28.18n ± 0%   28.30n ± 0%       ~ (p=0.010 n=20)
AppendFloat/64Fixed16-12            24.38n ± 1%   24.34n ± 1%       ~ (p=0.683 n=20)
AppendFloat/64Fixed12Hard-12        21.61n ± 0%   21.63n ± 1%       ~ (p=0.542 n=20)
AppendFloat/64Fixed17Hard-12        27.02n ± 1%   26.94n ± 0%       ~ (p=0.077 n=20)
AppendFloat/64Fixed18Hard-12        2.179µ ± 1%   2.189µ ± 1%       ~ (p=0.337 n=20)
AppendFloat/Slowpath64-12           29.93n ± 1%   30.01n ± 1%       ~ (p=0.402 n=20)
AppendFloat/SlowpathDenormal64-12   28.29n ± 1%   28.35n ± 0%       ~ (p=0.952 n=20)
AppendInt-12                        400.7n ± 1%   401.8n ± 1%       ~ (p=0.176 n=20)
AppendUint-12                       95.87n ± 1%   96.06n ± 1%       ~ (p=0.208 n=20)
AppendIntSmall-12                   3.450n ± 0%   3.455n ± 1%       ~ (p=0.203 n=20)
AppendUintVarlen/digits=1-12        3.150n ± 1%   3.175n ± 1%       ~ (p=0.147 n=20)
AppendUintVarlen/digits=2-12        2.654n ± 0%   2.667n ± 1%       ~ (p=0.003 n=20)
AppendUintVarlen/digits=3-12        5.044n ± 0%   5.069n ± 0%       ~ (p=0.026 n=20)
AppendUintVarlen/digits=4-12        5.046n ± 0%   5.047n ± 1%       ~ (p=0.408 n=20)
AppendUintVarlen/digits=5-12        5.851n ± 0%   5.860n ± 1%       ~ (p=0.132 n=20)
AppendUintVarlen/digits=6-12        6.118n ± 0%   6.120n ± 0%       ~ (p=0.888 n=20)
AppendUintVarlen/digits=7-12        7.333n ± 0%   7.334n ± 0%       ~ (p=0.588 n=20)
AppendUintVarlen/digits=8-12        7.312n ± 1%   7.322n ± 0%       ~ (p=0.805 n=20)
AppendUintVarlen/digits=9-12        7.832n ± 1%   7.838n ± 1%       ~ (p=0.465 n=20)
AppendUintVarlen/digits=10-12       8.606n ± 1%   8.602n ± 1%       ~ (p=0.974 n=20)
AppendUintVarlen/digits=11-12       8.908n ± 0%   8.899n ± 1%       ~ (p=0.931 n=20)
AppendUintVarlen/digits=12-12       9.178n ± 0%   9.118n ± 0%       ~ (p=0.007 n=20)
AppendUintVarlen/digits=13-12       9.398n ± 1%   9.405n ± 1%       ~ (p=0.888 n=20)
AppendUintVarlen/digits=14-12       10.24n ± 0%   10.22n ± 0%       ~ (p=0.154 n=20)
AppendUintVarlen/digits=15-12       10.50n ± 0%   10.48n ± 0%       ~ (p=0.692 n=20)
AppendUintVarlen/digits=16-12       11.66n ± 0%   11.75n ± 2%       ~ (p=0.087 n=20)
AppendUintVarlen/digits=17-12       11.65n ± 0%   11.72n ± 1%       ~ (p=0.079 n=20)
AppendUintVarlen/digits=18-12       12.38n ± 1%   12.42n ± 2%       ~ (p=0.035 n=20)
AppendUintVarlen/digits=19-12       13.59n ± 1%   13.60n ± 0%       ~ (p=0.673 n=20)
AppendUintVarlen/digits=20-12       13.85n ± 1%   13.84n ± 0%       ~ (p=0.634 n=20)
geomean                             17.99n        18.01n       +0.09%

host: s7
                                  │ e8ffcf3095c │            3c5742b667a             │
                                  │   sec/op    │   sec/op     vs base               │
AppendFloat/Decimal-32              22.24n ± 0%   22.20n ± 0%       ~ (p=0.143 n=20)
AppendFloat/Float-32                34.70n ± 0%   34.59n ± 0%       ~ (p=0.057 n=20)
AppendFloat/Exp-32                  34.85n ± 0%   34.77n ± 0%       ~ (p=0.051 n=20)
AppendFloat/NegExp-32               35.19n ± 0%   35.17n ± 0%       ~ (p=0.533 n=20)
AppendFloat/LongExp-32              36.80n ± 0%   36.78n ± 0%       ~ (p=0.941 n=20)
AppendFloat/Big-32                  38.63n ± 0%   38.71n ± 0%       ~ (p=0.143 n=20)
AppendFloat/BinaryExp-32            17.39n ± 0%   17.36n ± 0%       ~ (p=0.049 n=20)
AppendFloat/32Integer-32            22.29n ± 0%   22.23n ± 0%       ~ (p=0.068 n=20)
AppendFloat/32ExactFraction-32      33.52n ± 0%   33.44n ± 0%       ~ (p=0.058 n=20)
AppendFloat/32Point-32              32.96n ± 0%   32.93n ± 0%       ~ (p=0.256 n=20)
AppendFloat/32Exp-32                35.31n ± 0%   35.24n ± 0%       ~ (p=0.014 n=20)
AppendFloat/32NegExp-32             33.56n ± 0%   33.50n ± 0%       ~ (p=0.032 n=20)
AppendFloat/32Shortest-32           30.03n ± 0%   29.97n ± 0%       ~ (p=0.351 n=20)
AppendFloat/32Fixed8Hard-32         22.93n ± 0%   22.94n ± 0%       ~ (p=0.920 n=20)
AppendFloat/32Fixed9Hard-32         26.27n ± 0%   26.22n ± 0%       ~ (p=0.693 n=20)
AppendFloat/64Fixed1-32             21.15n ± 0%   21.09n ± 0%       ~ (p=0.006 n=20)
AppendFloat/64Fixed2-32             20.75n ± 0%   20.75n ± 0%       ~ (p=0.898 n=20)
AppendFloat/64Fixed3-32             21.29n ± 0%   21.28n ± 0%       ~ (p=0.524 n=20)
AppendFloat/64Fixed4-32             20.59n ± 0%   20.63n ± 0%       ~ (p=0.350 n=20)
AppendFloat/64Fixed12-32            32.53n ± 0%   32.51n ± 0%       ~ (p=0.804 n=20)
AppendFloat/64Fixed16-32            28.43n ± 0%   28.34n ± 0%       ~ (p=0.060 n=20)
AppendFloat/64Fixed12Hard-32        27.27n ± 0%   27.22n ± 0%       ~ (p=0.056 n=20)
AppendFloat/64Fixed17Hard-32        30.76n ± 0%   30.70n ± 0%       ~ (p=0.304 n=20)
AppendFloat/64Fixed18Hard-32        1.812µ ± 0%   1.806µ ± 1%       ~ (p=0.216 n=20)
AppendFloat/Slowpath64-32           35.48n ± 0%   35.43n ± 0%       ~ (p=0.129 n=20)
AppendFloat/SlowpathDenormal64-32   35.62n ± 0%   35.60n ± 0%       ~ (p=0.273 n=20)
AppendInt-32                        387.5n ± 0%   387.9n ± 0%       ~ (p=0.417 n=20)
AppendUint-32                       104.9n ± 0%   104.9n ± 0%       ~ (p=0.641 n=20)
AppendIntSmall-32                   3.329n ± 5%   3.489n ± 5%       ~ (p=0.723 n=20)
AppendUintVarlen/digits=1-32        2.396n ± 7%   2.398n ± 8%       ~ (p=0.409 n=20)
AppendUintVarlen/digits=2-32        2.399n ± 7%   2.315n ± 4%       ~ (p=0.386 n=20)
AppendUintVarlen/digits=3-32        5.516n ± 0%   5.506n ± 0%       ~ (p=0.026 n=20)
AppendUintVarlen/digits=4-32        5.515n ± 0%   5.510n ± 0%       ~ (p=0.291 n=20)
AppendUintVarlen/digits=5-32        5.748n ± 1%   5.731n ± 0%       ~ (p=0.014 n=20)
AppendUintVarlen/digits=6-32        5.873n ± 0%   5.853n ± 0%       ~ (p=0.011 n=20)
AppendUintVarlen/digits=7-32        6.460n ± 0%   6.444n ± 0%       ~ (p=0.041 n=20)
AppendUintVarlen/digits=8-32        6.457n ± 0%   6.446n ± 0%       ~ (p=0.047 n=20)
AppendUintVarlen/digits=9-32        7.377n ± 0%   7.373n ± 0%       ~ (p=0.569 n=20)
AppendUintVarlen/digits=10-32       8.496n ± 0%   8.492n ± 0%       ~ (p=0.525 n=20)
AppendUintVarlen/digits=11-32       8.674n ± 0%   8.653n ± 0%       ~ (p=0.060 n=20)
AppendUintVarlen/digits=12-32       9.416n ± 0%   9.386n ± 0%       ~ (p=0.035 n=20)
AppendUintVarlen/digits=13-32       9.621n ± 0%   9.594n ± 0%       ~ (p=0.069 n=20)
AppendUintVarlen/digits=14-32       10.34n ± 0%   10.35n ± 0%       ~ (p=0.332 n=20)
AppendUintVarlen/digits=15-32       10.48n ± 0%   10.52n ± 0%       ~ (p=0.196 n=20)
AppendUintVarlen/digits=16-32       11.27n ± 0%   11.27n ± 0%       ~ (p=0.445 n=20)
AppendUintVarlen/digits=17-32       11.50n ± 0%   11.48n ± 0%       ~ (p=0.283 n=20)
AppendUintVarlen/digits=18-32       12.15n ± 0%   12.18n ± 0%       ~ (p=0.414 n=20)
AppendUintVarlen/digits=19-32       13.42n ± 0%   13.42n ± 0%       ~ (p=0.782 n=20)
AppendUintVarlen/digits=20-32       13.70n ± 0%   13.71n ± 0%       ~ (p=0.540 n=20)
geomean                             18.71n        18.70n       -0.08%

host: s7:GOARCH=386
                                  │ e8ffcf3095c  │            3c5742b667a             │
                                  │    sec/op    │   sec/op     vs base               │
AppendFloat/Decimal-32               42.03n ± 0%   41.71n ± 1%  -0.75% (p=0.000 n=20)
AppendFloat/Float-32                 69.99n ± 0%   69.85n ± 0%       ~ (p=0.062 n=20)
AppendFloat/Exp-32                   73.07n ± 0%   73.13n ± 0%       ~ (p=0.240 n=20)
AppendFloat/NegExp-32                72.75n ± 0%   72.72n ± 0%       ~ (p=0.298 n=20)
AppendFloat/LongExp-32               74.20n ± 0%   74.13n ± 0%       ~ (p=0.952 n=20)
AppendFloat/Big-32                   82.88n ± 0%   82.91n ± 0%       ~ (p=0.909 n=20)
AppendFloat/BinaryExp-32             32.12n ± 0%   32.23n ± 0%       ~ (p=0.014 n=20)
AppendFloat/32Integer-32             41.18n ± 0%   41.15n ± 0%       ~ (p=0.212 n=20)
AppendFloat/32ExactFraction-32       62.65n ± 0%   62.38n ± 0%  -0.43% (p=0.000 n=20)
AppendFloat/32Point-32               59.98n ± 0%   59.82n ± 0%       ~ (p=0.109 n=20)
AppendFloat/32Exp-32                 72.62n ± 0%   72.69n ± 0%       ~ (p=0.417 n=20)
AppendFloat/32NegExp-32              62.36n ± 0%   62.49n ± 0%       ~ (p=0.578 n=20)
AppendFloat/32Shortest-32            58.03n ± 0%   57.95n ± 0%       ~ (p=0.615 n=20)
AppendFloat/32Fixed8Hard-32          36.75n ± 0%   36.34n ± 0%  -1.12% (p=0.000 n=20)
AppendFloat/32Fixed9Hard-32          53.83n ± 0%   53.96n ± 0%       ~ (p=0.126 n=20)
AppendFloat/64Fixed1-32              48.52n ± 0%   48.72n ± 0%       ~ (p=0.075 n=20)
AppendFloat/64Fixed2-32              46.50n ± 0%   46.74n ± 0%  +0.53% (p=0.000 n=20)
AppendFloat/64Fixed3-32              46.43n ± 0%   46.24n ± 1%       ~ (p=0.147 n=20)
AppendFloat/64Fixed4-32              42.52n ± 0%   42.69n ± 0%       ~ (p=0.038 n=20)
AppendFloat/64Fixed12-32             54.51n ± 1%   54.85n ± 0%  +0.63% (p=0.000 n=20)
AppendFloat/64Fixed16-32             52.61n ± 0%   52.94n ± 0%  +0.63% (p=0.000 n=20)
AppendFloat/64Fixed12Hard-32         50.78n ± 0%   51.45n ± 0%  +1.31% (p=0.000 n=20)
AppendFloat/64Fixed17Hard-32         59.91n ± 0%   59.91n ± 0%       ~ (p=0.713 n=20)
AppendFloat/64Fixed18Hard-32         3.984µ ± 1%   4.000µ ± 1%       ~ (p=0.569 n=20)
AppendFloat/Slowpath64-32            73.42n ± 0%   73.37n ± 0%       ~ (p=0.425 n=20)
AppendFloat/SlowpathDenormal64-32    73.27n ± 0%   73.36n ± 0%       ~ (p=0.298 n=20)
AppendInt-32                         1.036µ ± 1%   1.041µ ± 1%       ~ (p=0.024 n=20)
AppendUint-32                        261.1n ± 0%   262.1n ± 1%  +0.42% (p=0.000 n=20)
AppendIntSmall-32                    5.515n ± 0%   5.506n ± 0%       ~ (p=0.394 n=20)
AppendUintVarlen/digits=1-32         3.679n ± 0%   3.685n ± 0%       ~ (p=0.815 n=20)
AppendUintVarlen/digits=2-32         3.683n ± 0%   3.687n ± 0%       ~ (p=0.899 n=20)
AppendUintVarlen/digits=3-32         8.988n ± 2%   8.843n ± 1%  -1.61% (p=0.000 n=20)
AppendUintVarlen/digits=4-32         9.300n ± 1%   9.106n ± 1%  -2.09% (p=0.000 n=20)
AppendUintVarlen/digits=5-32        10.235n ± 1%   9.829n ± 1%  -3.97% (p=0.000 n=20)
AppendUintVarlen/digits=6-32         10.44n ± 1%   10.03n ± 0%  -3.88% (p=0.000 n=20)
AppendUintVarlen/digits=7-32         11.27n ± 1%   10.94n ± 1%  -2.93% (p=0.000 n=20)
AppendUintVarlen/digits=8-32         11.46n ± 1%   11.13n ± 1%  -2.88% (p=0.000 n=20)
AppendUintVarlen/digits=9-32         12.74n ± 0%   12.27n ± 1%  -3.69% (p=0.000 n=20)
AppendUintVarlen/digits=10-32        15.57n ± 0%   15.71n ± 1%  +0.90% (p=0.000 n=20)
AppendUintVarlen/digits=11-32        15.65n ± 1%   15.98n ± 0%  +2.11% (p=0.000 n=20)
AppendUintVarlen/digits=12-32        16.54n ± 0%   16.73n ± 0%  +1.21% (p=0.000 n=20)
AppendUintVarlen/digits=13-32        16.69n ± 0%   17.04n ± 0%  +2.07% (p=0.000 n=20)
AppendUintVarlen/digits=14-32        17.52n ± 1%   17.62n ± 0%       ~ (p=0.005 n=20)
AppendUintVarlen/digits=15-32        17.76n ± 0%   17.86n ± 0%  +0.56% (p=0.001 n=20)
AppendUintVarlen/digits=16-32        18.68n ± 1%   18.59n ± 0%       ~ (p=0.006 n=20)
AppendUintVarlen/digits=17-32        18.78n ± 1%   18.74n ± 0%       ~ (p=0.040 n=20)
AppendUintVarlen/digits=18-32        19.63n ± 1%   19.54n ± 0%       ~ (p=0.202 n=20)
AppendUintVarlen/digits=19-32        24.02n ± 1%   24.23n ± 1%  +0.87% (p=0.000 n=20)
AppendUintVarlen/digits=20-32        23.87n ± 1%   24.20n ± 1%  +1.40% (p=0.000 n=20)
geomean                              35.08n        35.00n       -0.21%

host: linux-amd64
                                  │ e8ffcf3095c │            3c5742b667a             │
                                  │   sec/op    │   sec/op     vs base               │
AppendFloat/Decimal-16              62.16n ± 1%   61.81n ± 0%       ~ (p=0.060 n=20)
AppendFloat/Float-16                91.66n ± 1%   91.22n ± 1%       ~ (p=0.606 n=20)
AppendFloat/Exp-16                  95.42n ± 2%   95.22n ± 1%       ~ (p=0.417 n=20)
AppendFloat/NegExp-16               96.88n ± 1%   95.89n ± 1%       ~ (p=0.185 n=20)
AppendFloat/LongExp-16              102.0n ± 1%   101.6n ± 1%       ~ (p=0.794 n=20)
AppendFloat/Big-16                  110.8n ± 1%   110.8n ± 1%       ~ (p=0.984 n=20)
AppendFloat/BinaryExp-16            46.33n ± 1%   46.19n ± 1%       ~ (p=0.723 n=20)
AppendFloat/32Integer-16            62.62n ± 2%   61.88n ± 1%       ~ (p=0.286 n=20)
AppendFloat/32ExactFraction-16      89.09n ± 3%   88.25n ± 2%       ~ (p=0.101 n=20)
AppendFloat/32Point-16              86.17n ± 1%   86.90n ± 1%       ~ (p=0.251 n=20)
AppendFloat/32Exp-16                101.7n ± 1%   101.2n ± 1%       ~ (p=0.379 n=20)
AppendFloat/32NegExp-16             92.17n ± 1%   92.81n ± 1%       ~ (p=0.165 n=20)
AppendFloat/32Shortest-16           82.38n ± 1%   82.89n ± 1%       ~ (p=0.185 n=20)
AppendFloat/32Fixed8Hard-16         60.32n ± 1%   60.41n ± 1%       ~ (p=0.337 n=20)
AppendFloat/32Fixed9Hard-16         69.58n ± 1%   69.22n ± 1%       ~ (p=0.794 n=20)
AppendFloat/64Fixed1-16             57.56n ± 1%   57.65n ± 1%       ~ (p=0.597 n=20)
AppendFloat/64Fixed2-16             55.84n ± 1%   55.54n ± 1%       ~ (p=0.059 n=20)
AppendFloat/64Fixed3-16             57.12n ± 2%   56.55n ± 1%       ~ (p=0.449 n=20)
AppendFloat/64Fixed4-16             55.38n ± 2%   54.50n ± 2%       ~ (p=0.010 n=20)
AppendFloat/64Fixed12-16            88.28n ± 1%   86.67n ± 1%  -1.83% (p=0.000 n=20)
AppendFloat/64Fixed16-16            73.41n ± 1%   73.56n ± 2%       ~ (p=0.794 n=20)
AppendFloat/64Fixed12Hard-16        72.08n ± 1%   71.71n ± 1%       ~ (p=0.116 n=20)
AppendFloat/64Fixed17Hard-16        79.78n ± 1%   79.78n ± 1%       ~ (p=0.224 n=20)
AppendFloat/64Fixed18Hard-16        4.720µ ± 1%   4.746µ ± 1%       ~ (p=0.877 n=20)
AppendFloat/Slowpath64-16           98.71n ± 1%   98.79n ± 1%       ~ (p=0.678 n=20)
AppendFloat/SlowpathDenormal64-16   97.58n ± 2%   98.16n ± 2%       ~ (p=0.862 n=20)
AppendInt-16                        1.185µ ± 1%   1.194µ ± 1%       ~ (p=0.457 n=20)
AppendUint-16                       292.6n ± 1%   293.9n ± 1%       ~ (p=0.351 n=20)
AppendIntSmall-16                   7.197n ± 1%   7.203n ± 1%       ~ (p=0.952 n=20)
AppendUintVarlen/digits=1-16        5.905n ± 1%   5.897n ± 2%       ~ (p=0.474 n=20)
AppendUintVarlen/digits=2-16        5.770n ± 1%   5.733n ± 1%       ~ (p=0.180 n=20)
AppendUintVarlen/digits=3-16        14.00n ± 2%   14.00n ± 1%       ~ (p=0.909 n=20)
AppendUintVarlen/digits=4-16        13.99n ± 1%   14.03n ± 1%       ~ (p=0.578 n=20)
AppendUintVarlen/digits=5-16        15.88n ± 2%   15.83n ± 1%       ~ (p=0.542 n=20)
AppendUintVarlen/digits=6-16        16.25n ± 1%   16.30n ± 1%       ~ (p=0.899 n=20)
AppendUintVarlen/digits=7-16        17.66n ± 1%   17.70n ± 1%       ~ (p=0.440 n=20)
AppendUintVarlen/digits=8-16        18.54n ± 1%   18.58n ± 2%       ~ (p=0.262 n=20)
AppendUintVarlen/digits=9-16        20.25n ± 2%   20.43n ± 1%       ~ (p=0.007 n=20)
AppendUintVarlen/digits=10-16       23.88n ± 1%   24.00n ± 1%       ~ (p=0.473 n=20)
AppendUintVarlen/digits=11-16       24.42n ± 1%   24.57n ± 2%       ~ (p=0.743 n=20)
AppendUintVarlen/digits=12-16       25.54n ± 2%   25.88n ± 1%       ~ (p=0.499 n=20)
AppendUintVarlen/digits=13-16       26.55n ± 1%   26.60n ± 1%       ~ (p=0.774 n=20)
AppendUintVarlen/digits=14-16       28.18n ± 1%   28.16n ± 1%       ~ (p=0.606 n=20)
AppendUintVarlen/digits=15-16       28.66n ± 1%   28.85n ± 0%       ~ (p=0.031 n=20)
AppendUintVarlen/digits=16-16       29.84n ± 1%   30.00n ± 1%       ~ (p=0.151 n=20)
AppendUintVarlen/digits=17-16       30.54n ± 1%   30.60n ± 1%       ~ (p=0.952 n=20)
AppendUintVarlen/digits=18-16       32.01n ± 1%   32.26n ± 2%       ~ (p=0.239 n=20)
AppendUintVarlen/digits=19-16       35.50n ± 1%   35.56n ± 1%       ~ (p=0.256 n=20)
AppendUintVarlen/digits=20-16       35.94n ± 1%   35.96n ± 1%       ~ (p=0.867 n=20)
geomean                             50.35n        50.35n       -0.01%

host: linux-386
                                  │ e8ffcf3095c │             3c5742b667a             │
                                  │   sec/op    │   sec/op     vs base                │
AppendFloat/Decimal-16              122.9n ± 0%   122.9n ± 0%        ~ (p=0.351 n=20)
AppendFloat/Float-16                226.7n ± 0%   227.1n ± 0%        ~ (p=0.003 n=20)
AppendFloat/Exp-16                  238.3n ± 0%   238.3n ± 0%        ~ (p=0.301 n=20)
AppendFloat/NegExp-16               239.2n ± 0%   239.5n ± 0%        ~ (p=0.015 n=20)
AppendFloat/LongExp-16              237.6n ± 0%   237.8n ± 0%        ~ (p=0.357 n=20)
AppendFloat/Big-16                  275.6n ± 0%   275.7n ± 0%        ~ (p=0.576 n=20)
AppendFloat/BinaryExp-16            90.33n ± 0%   87.69n ± 0%   -2.92% (p=0.000 n=20)
AppendFloat/32Integer-16            121.7n ± 0%   121.8n ± 0%        ~ (p=0.340 n=20)
AppendFloat/32ExactFraction-16      209.4n ± 0%   209.4n ± 0%        ~ (p=0.566 n=20)
AppendFloat/32Point-16              196.1n ± 0%   196.5n ± 0%        ~ (p=0.036 n=20)
AppendFloat/32Exp-16                246.3n ± 0%   246.4n ± 0%        ~ (p=0.407 n=20)
AppendFloat/32NegExp-16             205.4n ± 0%   205.4n ± 0%        ~ (p=0.221 n=20)
AppendFloat/32Shortest-16           187.8n ± 0%   187.8n ± 0%        ~ (p=0.671 n=20)
AppendFloat/32Fixed8Hard-16         112.3n ± 0%   107.6n ± 0%   -4.19% (p=0.000 n=20)
AppendFloat/32Fixed9Hard-16         182.3n ± 0%   182.1n ± 0%        ~ (p=0.098 n=20)
AppendFloat/64Fixed1-16             167.0n ± 0%   165.7n ± 0%   -0.78% (p=0.000 n=20)
AppendFloat/64Fixed2-16             161.9n ± 0%   160.7n ± 0%   -0.74% (p=0.000 n=20)
AppendFloat/64Fixed3-16             157.7n ± 0%   156.4n ± 0%   -0.82% (p=0.000 n=20)
AppendFloat/64Fixed4-16             134.4n ± 0%   133.5n ± 0%   -0.63% (p=0.000 n=20)
AppendFloat/64Fixed12-16            178.2n ± 0%   176.4n ± 0%   -1.01% (p=0.000 n=20)
AppendFloat/64Fixed16-16            168.7n ± 0%   166.4n ± 0%   -1.33% (p=0.000 n=20)
AppendFloat/64Fixed12Hard-16        162.8n ± 0%   162.2n ± 0%   -0.34% (p=0.000 n=20)
AppendFloat/64Fixed17Hard-16        201.9n ± 0%   198.6n ± 0%   -1.66% (p=0.000 n=20)
AppendFloat/64Fixed18Hard-16        14.45µ ± 0%   14.46µ ± 0%        ~ (p=0.189 n=20)
AppendFloat/Slowpath64-16           232.8n ± 0%   232.8n ± 0%        ~ (p=0.995 n=20)
AppendFloat/SlowpathDenormal64-16   229.0n ± 0%   228.9n ± 0%        ~ (p=0.605 n=20)
AppendInt-16                        3.123µ ± 0%   3.099µ ± 0%   -0.77% (p=0.000 n=20)
AppendUint-16                       832.0n ± 0%   820.8n ± 0%   -1.35% (p=0.000 n=20)
AppendIntSmall-16                   13.27n ± 0%   13.28n ± 0%        ~ (p=0.127 n=20)
AppendUintVarlen/digits=1-16        10.19n ± 0%   10.20n ± 0%        ~ (p=0.414 n=20)
AppendUintVarlen/digits=2-16        10.19n ± 0%   10.19n ± 0%        ~ (p=0.700 n=20)
AppendUintVarlen/digits=3-16        21.47n ± 0%   20.51n ± 0%   -4.49% (p=0.000 n=20)
AppendUintVarlen/digits=4-16        21.68n ± 0%   21.05n ± 0%   -2.88% (p=0.000 n=20)
AppendUintVarlen/digits=5-16        26.28n ± 0%   23.94n ± 0%   -8.92% (p=0.000 n=20)
AppendUintVarlen/digits=6-16        26.77n ± 0%   24.67n ± 0%   -7.84% (p=0.000 n=20)
AppendUintVarlen/digits=7-16        30.65n ± 0%   27.25n ± 0%  -11.08% (p=0.000 n=20)
AppendUintVarlen/digits=8-16        31.27n ± 0%   28.11n ± 0%  -10.09% (p=0.000 n=20)
AppendUintVarlen/digits=9-16        36.55n ± 0%   32.53n ± 0%  -10.98% (p=0.000 n=20)
AppendUintVarlen/digits=10-16       42.53n ± 0%   42.06n ± 0%   -1.09% (p=0.000 n=20)
AppendUintVarlen/digits=11-16       42.21n ± 0%   42.51n ± 0%   +0.72% (p=0.000 n=20)
AppendUintVarlen/digits=12-16       45.44n ± 0%   44.41n ± 0%   -2.26% (p=0.000 n=20)
AppendUintVarlen/digits=13-16       46.04n ± 0%   45.06n ± 0%   -2.13% (p=0.000 n=20)
AppendUintVarlen/digits=14-16       49.35n ± 0%   47.73n ± 0%   -3.27% (p=0.000 n=20)
AppendUintVarlen/digits=15-16       50.04n ± 0%   48.45n ± 0%   -3.18% (p=0.000 n=20)
AppendUintVarlen/digits=16-16       53.51n ± 0%   51.21n ± 0%   -4.31% (p=0.000 n=20)
AppendUintVarlen/digits=17-16       53.60n ± 0%   51.19n ± 0%   -4.50% (p=0.000 n=20)
AppendUintVarlen/digits=18-16       57.21n ± 0%   54.03n ± 0%   -5.54% (p=0.000 n=20)
AppendUintVarlen/digits=19-16       64.41n ± 0%   64.68n ± 0%   +0.41% (p=0.000 n=20)
AppendUintVarlen/digits=20-16       64.51n ± 0%   65.04n ± 0%   +0.82% (p=0.000 n=20)
geomean                             104.9n        102.8n        -2.02%

host: linux-ppc64le
                                 │ e8ffcf3095c │             3c5742b667a             │
                                 │   sec/op    │   sec/op     vs base                │
AppendFloat/Decimal-5              53.78n ± 1%   53.62n ± 1%        ~ (p=0.588 n=20)
AppendFloat/Float-5                76.29n ± 2%   75.77n ± 2%        ~ (p=0.402 n=20)
AppendFloat/Exp-5                  83.73n ± 0%   82.25n ± 2%        ~ (p=0.009 n=20)
AppendFloat/NegExp-5               84.22n ± 1%   83.15n ± 1%        ~ (p=0.031 n=20)
AppendFloat/LongExp-5              88.66n ± 1%   88.34n ± 1%        ~ (p=0.213 n=20)
AppendFloat/Big-5                  93.25n ± 0%   92.73n ± 1%        ~ (p=0.007 n=20)
AppendFloat/BinaryExp-5            40.69n ± 0%   44.88n ± 1%  +10.31% (p=0.000 n=20)
AppendFloat/32Integer-5            54.17n ± 0%   54.39n ± 1%        ~ (p=0.245 n=20)
AppendFloat/32ExactFraction-5      79.89n ± 1%   79.41n ± 1%        ~ (p=0.457 n=20)
AppendFloat/32Point-5              74.81n ± 1%   74.89n ± 0%        ~ (p=0.625 n=20)
AppendFloat/32Exp-5                85.59n ± 1%   85.42n ± 1%        ~ (p=0.331 n=20)
AppendFloat/32NegExp-5             82.74n ± 1%   82.22n ± 1%        ~ (p=0.025 n=20)
AppendFloat/32Shortest-5           69.72n ± 0%   69.79n ± 1%        ~ (p=0.625 n=20)
AppendFloat/32Fixed8Hard-5         54.60n ± 0%   57.54n ± 0%   +5.39% (p=0.000 n=20)
AppendFloat/32Fixed9Hard-5         58.49n ± 1%   65.56n ± 0%  +12.09% (p=0.000 n=20)
AppendFloat/64Fixed1-5             47.07n ± 1%   47.81n ± 1%        ~ (p=0.002 n=20)
AppendFloat/64Fixed2-5             47.88n ± 1%   48.52n ± 1%        ~ (p=0.007 n=20)
AppendFloat/64Fixed3-5             47.47n ± 1%   48.32n ± 1%        ~ (p=0.007 n=20)
AppendFloat/64Fixed4-5             45.12n ± 1%   46.26n ± 1%   +2.55% (p=0.000 n=20)
AppendFloat/64Fixed12-5            79.27n ± 0%   83.78n ± 1%   +5.68% (p=0.000 n=20)
AppendFloat/64Fixed16-5            69.28n ± 1%   70.69n ± 0%        ~ (p=0.001 n=20)
AppendFloat/64Fixed12Hard-5        65.42n ± 0%   68.31n ± 1%   +4.43% (p=0.000 n=20)
AppendFloat/64Fixed17Hard-5        73.89n ± 0%   77.30n ± 1%   +4.63% (p=0.000 n=20)
AppendFloat/64Fixed18Hard-5        5.163µ ± 1%   5.169µ ± 0%        ~ (p=0.733 n=20)
AppendFloat/Slowpath64-5           86.31n ± 1%   86.70n ± 2%        ~ (p=0.578 n=20)
AppendFloat/SlowpathDenormal64-5   83.10n ± 1%   82.97n ± 1%        ~ (p=0.218 n=20)
AppendInt-5                        1.013µ ± 1%   1.125µ ± 0%  +11.06% (p=0.000 n=20)
AppendUint-5                       268.2n ± 0%   287.7n ± 1%   +7.27% (p=0.000 n=20)
AppendIntSmall-5                   6.644n ± 3%   6.936n ± 2%        ~ (p=0.023 n=20)
AppendUintVarlen/digits=1-5        5.556n ± 4%   5.381n ± 3%        ~ (p=0.108 n=20)
AppendUintVarlen/digits=2-5        5.165n ± 1%   5.413n ± 1%   +4.80% (p=0.000 n=20)
AppendUintVarlen/digits=3-5        10.26n ± 1%   11.29n ± 2%  +10.04% (p=0.000 n=20)
AppendUintVarlen/digits=4-5        10.11n ± 1%   11.12n ± 1%   +9.99% (p=0.000 n=20)
AppendUintVarlen/digits=5-5        12.37n ± 2%   13.26n ± 1%   +7.19% (p=0.000 n=20)
AppendUintVarlen/digits=6-5        12.85n ± 3%   13.52n ± 1%   +5.25% (p=0.000 n=20)
AppendUintVarlen/digits=7-5        15.46n ± 7%   16.52n ± 1%        ~ (p=0.005 n=20)
AppendUintVarlen/digits=8-5        14.99n ± 1%   16.60n ± 1%  +10.74% (p=0.000 n=20)
AppendUintVarlen/digits=9-5        18.13n ± 1%   20.23n ± 1%  +11.56% (p=0.000 n=20)
AppendUintVarlen/digits=10-5       19.05n ± 3%   25.62n ± 1%  +34.49% (p=0.000 n=20)
AppendUintVarlen/digits=11-5       21.64n ± 2%   26.11n ± 1%  +20.63% (p=0.000 n=20)
AppendUintVarlen/digits=12-5       21.91n ± 1%   27.91n ± 0%  +27.38% (p=0.000 n=20)
AppendUintVarlen/digits=13-5       24.60n ± 1%   28.38n ± 1%  +15.37% (p=0.000 n=20)
AppendUintVarlen/digits=14-5       25.80n ± 1%   30.79n ± 0%  +19.32% (p=0.000 n=20)
AppendUintVarlen/digits=15-5       28.90n ± 1%   31.38n ± 3%   +8.55% (p=0.000 n=20)
AppendUintVarlen/digits=16-5       28.13n ± 2%   32.54n ± 0%  +15.69% (p=0.000 n=20)
AppendUintVarlen/digits=17-5       30.82n ± 1%   33.16n ± 1%   +7.61% (p=0.000 n=20)
AppendUintVarlen/digits=18-5       32.03n ± 0%   36.12n ± 1%  +12.74% (p=0.000 n=20)
AppendUintVarlen/digits=19-5       35.99n ± 3%   40.97n ± 1%  +13.82% (p=0.000 n=20)
AppendUintVarlen/digits=20-5       35.15n ± 1%   40.71n ± 0%  +15.80% (p=0.000 n=20)
geomean                            44.34n        47.15n        +6.34%

Change-Id: Ia6a3971a76f39d6187b10d6944071ee1c1b47316
Reviewed-on: https://go-review.googlesource.com/c/go/+/716462
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>
2025-10-30 09:55:03 -07:00
Ian Lance Taylor
6aca04a73a reflect: correct internal docs for uncommonType
This updates the doc to reflect the change in CL 19790 from 2016.

Change-Id: I1017babf6660aa3b4929755e2eccbe3168b7860c
Reviewed-on: https://go-review.googlesource.com/c/go/+/714880
Reviewed-by: Michael Knyszek <mknyszek@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>
2025-10-30 09:47:47 -07:00
Russ Cox
235b4e729d cmd/compile/internal/ssa: model right shift more precisely
Prove currently checks for 0 sign bit extraction (x>>63) at the
end of the pass, but it is more general and more useful
(and not really more work) to model right shift during
value range tracking. This handles sign bit extraction (both 0 and -1)
but also makes the value ranges available for proving bounds checks.

'go build -a -gcflags=-d=ssa/prove/debug=1 std'
finds 105 new things to prove.
https://gist.github.com/rsc/8ac41176e53ed9c2f1a664fc668e8336

For example, the compiler now recognizes that this code in
strconv does not need to check the second shift for being ≥ 64.

	msb := xHi >> 63
	retMantissa := xHi >> (msb + 38)

nor does this code in regexp:

	return b < utf8.RuneSelf && specialBytes[b%16]&(1<<(b/16)) != 0

This code in math no longer has a bounds check on the first index:

	if 0 <= n && n <= 308 {
		return pow10postab32[uint(n)/32] * pow10tab[uint(n)%32]
	}

The diff shows one "lost" proof in ycbcr.go but it's not really lost:
the expression was folded to a constant instead, and that only shows
up with debug=2. A diff of that output is at
https://gist.github.com/rsc/9139ed46c6019ae007f5a1ba4bb3250f

Change-Id: I84087311e0a303f00e2820d957a6f8b29ee22519
Reviewed-on: https://go-review.googlesource.com/c/go/+/716140
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Russ Cox <rsc@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2025-10-30 09:17:59 -07:00
Alexander F. Rødseth
d44db293f9 go/token: fix a typo in a comment
Fixes #75632

Change-Id: I71f891eb837147b6ff818ec4b2133c8c07091931
GitHub-Last-Rev: 3eeeea2dc2
GitHub-Pull-Request: golang/go#76117
Reviewed-on: https://go-review.googlesource.com/c/go/+/716440
Reviewed-by: t hepudds <thepudds1460@gmail.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: t hepudds <thepudds1460@gmail.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
2025-10-30 09:00:07 -07:00
Russ Cox
cdc6b559ca strconv: remove hand-written divide on 32-bit systems
The compiler now generates code that is just as good.

host: s7:GOARCH=386
goos: linux
goarch: 386
pkg: strconv
cpu: AMD Ryzen 9 7950X 16-Core Processor
                                 │ 8d2b4ce71b3 │            d5524a1f38c             │
                                 │   sec/op    │   sec/op     vs base               │
AppendFloat/Decimal-4              43.91n ± 2%   44.23n ± 1%       ~ (p=0.654 n=20)
AppendFloat/Float-4                73.73n ± 0%   74.17n ± 1%       ~ (p=0.062 n=20)
AppendFloat/Exp-4                  77.33n ± 1%   77.11n ± 1%       ~ (p=0.234 n=20)
AppendFloat/NegExp-4               77.56n ± 1%   77.00n ± 1%       ~ (p=0.136 n=20)
AppendFloat/LongExp-4              79.01n ± 1%   79.62n ± 1%       ~ (p=0.213 n=20)
AppendFloat/Big-4                  88.02n ± 2%   88.88n ± 1%       ~ (p=0.159 n=20)
AppendFloat/BinaryExp-4            34.43n ± 1%   34.58n ± 1%       ~ (p=0.683 n=20)
AppendFloat/32Integer-4            44.05n ± 2%   43.74n ± 1%       ~ (p=0.055 n=20)
AppendFloat/32ExactFraction-4      66.55n ± 1%   66.62n ± 1%       ~ (p=0.753 n=20)
AppendFloat/32Point-4              64.01n ± 1%   63.39n ± 1%       ~ (p=0.032 n=20)
AppendFloat/32Exp-4                77.05n ± 1%   77.84n ± 1%       ~ (p=0.055 n=20)
AppendFloat/32NegExp-4             66.96n ± 1%   67.41n ± 1%       ~ (p=0.569 n=20)
AppendFloat/32Shortest-4           61.73n ± 1%   62.00n ± 1%       ~ (p=0.457 n=20)
AppendFloat/32Fixed8Hard-4         39.09n ± 1%   39.06n ± 1%       ~ (p=0.588 n=20)
AppendFloat/32Fixed9Hard-4         57.66n ± 0%   57.39n ± 1%       ~ (p=0.167 n=20)
AppendFloat/64Fixed1-4             52.52n ± 1%   52.45n ± 1%       ~ (p=0.867 n=20)
AppendFloat/64Fixed2-4             50.64n ± 1%   50.12n ± 4%       ~ (p=0.208 n=20)
AppendFloat/64Fixed3-4             49.54n ± 1%   50.84n ± 1%  +2.62% (p=0.000 n=20)
AppendFloat/64Fixed4-4             45.60n ± 1%   45.25n ± 1%       ~ (p=0.034 n=20)
AppendFloat/64Fixed12-4            57.70n ± 1%   57.70n ± 1%       ~ (p=0.394 n=20)
AppendFloat/64Fixed16-4            56.49n ± 1%   56.15n ± 1%       ~ (p=0.044 n=20)
AppendFloat/64Fixed12Hard-4        53.99n ± 1%   53.79n ± 1%       ~ (p=0.358 n=20)
AppendFloat/64Fixed17Hard-4        64.51n ± 1%   63.18n ± 1%  -2.06% (p=0.000 n=20)
AppendFloat/64Fixed18Hard-4        4.281µ ± 1%   4.294µ ± 1%       ~ (p=0.995 n=20)
AppendFloat/Slowpath64-4           77.94n ± 1%   78.66n ± 2%       ~ (p=0.136 n=20)
AppendFloat/SlowpathDenormal64-4   77.64n ± 1%   77.96n ± 1%       ~ (p=0.229 n=20)
AppendInt-4                        1.122µ ± 1%   1.116µ ± 1%       ~ (p=0.115 n=20)
AppendUint-4                       287.9n ± 1%   286.9n ± 1%       ~ (p=0.185 n=20)
AppendIntSmall-4                   5.845n ± 1%   5.819n ± 1%       ~ (p=0.516 n=20)
AppendUintVarlen/digits=1-4        3.924n ± 1%   3.905n ± 1%       ~ (p=0.317 n=20)
AppendUintVarlen/digits=2-4        3.909n ± 1%   3.940n ± 1%       ~ (p=0.995 n=20)
AppendUintVarlen/digits=3-4        9.543n ± 1%   9.567n ± 2%       ~ (p=0.606 n=20)
AppendUintVarlen/digits=4-4        9.710n ± 1%   9.748n ± 1%       ~ (p=0.602 n=20)
AppendUintVarlen/digits=5-4        10.84n ± 1%   10.88n ± 2%       ~ (p=0.425 n=20)
AppendUintVarlen/digits=6-4        11.06n ± 1%   11.06n ± 1%       ~ (p=0.506 n=20)
AppendUintVarlen/digits=7-4        11.97n ± 1%   12.05n ± 1%       ~ (p=0.218 n=20)
AppendUintVarlen/digits=8-4        12.27n ± 1%   12.32n ± 2%       ~ (p=0.358 n=20)
AppendUintVarlen/digits=9-4        13.57n ± 1%   13.57n ± 1%       ~ (p=0.952 n=20)
AppendUintVarlen/digits=10-4       16.88n ± 1%   16.52n ± 1%  -2.13% (p=0.000 n=20)
AppendUintVarlen/digits=11-4       16.83n ± 1%   16.72n ± 1%       ~ (p=0.012 n=20)
AppendUintVarlen/digits=12-4       17.93n ± 1%   17.63n ± 1%  -1.65% (p=0.000 n=20)
AppendUintVarlen/digits=13-4       18.38n ± 2%   17.80n ± 1%  -3.16% (p=0.000 n=20)
AppendUintVarlen/digits=14-4       19.20n ± 1%   18.65n ± 1%  -2.89% (p=0.000 n=20)
AppendUintVarlen/digits=15-4       19.41n ± 1%   18.85n ± 1%  -2.86% (p=0.000 n=20)
AppendUintVarlen/digits=16-4       20.33n ± 1%   19.79n ± 1%  -2.63% (p=0.000 n=20)
AppendUintVarlen/digits=17-4       20.32n ± 2%   19.79n ± 0%  -2.61% (p=0.000 n=20)
AppendUintVarlen/digits=18-4       21.09n ± 1%   20.84n ± 1%  -1.16% (p=0.000 n=20)
AppendUintVarlen/digits=19-4       25.68n ± 1%   25.24n ± 0%  -1.69% (p=0.000 n=20)
AppendUintVarlen/digits=20-4       25.42n ± 1%   25.15n ± 1%  -1.06% (p=0.000 n=20)
geomean                            37.54n        37.39n       -0.40%
%

Change-Id: I0dba26d1f6fbadc2a951dc0bbc8cf30d1391e10f
Reviewed-on: https://go-review.googlesource.com/c/go/+/716062
Auto-Submit: Russ Cox <rsc@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-10-30 08:04:24 -07:00
Russ Cox
1e5bb416d8 cmd/compile: implement bits.Mul64 on 32-bit systems
This CL implements Mul64uhilo, Hmul64, Hmul64u, and Avg64u
on 32-bit systems, with the effect that constant division of both
int64s and uint64s can now be emitted directly in all cases,
and also that bits.Mul64 can be intrinsified on 32-bit systems.

Previously, constant division of uint64s by values 0 ≤ c ≤ 0xFFFF were
implemented as uint32 divisions by c and some fixup. After expanding
those smaller constant divisions, the code for i/999 required:

	(386) 7 mul, 10 add, 2 sub, 3 rotate, 3 shift (104 bytes)
	(arm) 7 mul, 9 add, 3 sub, 2 shift (104 bytes)
	(mips) 7 mul, 10 add, 5 sub, 6 shift, 3 sgtu (176 bytes)

For that much code, we might as well use a full 64x64->128 multiply
that can be used for all divisors, not just small ones.
Having done that, the same i/999 now generates:

	(386) 4 mul, 9 add, 2 sub, 2 or, 6 shift (112 bytes)
	(arm) 4 mul, 8 add, 2 sub, 2 or, 3 shift (92 bytes)
	(mips) 4 mul, 11 add, 3 sub, 6 shift, 8 sgtu, 4 or (196 bytes)

The size increase on 386 is due to a few extra register spills.
The size increase on mips is due to add-with-carry being hard.

The new approach is more general, letting us delete the old special case
and guarantee that all int64 and uint64 divisions by constants are
generated directly on 32-bit systems.

This especially speeds up code making heavy use of bits.Mul64 with
a constant argument, which happens in strconv and various crypto
packages. A few examples are benchmarked below.

pkg: cmd/compile/internal/test

benchmark \ host                      local  linux-amd64       s7  linux-386  s7:GOARCH=386
                                    vs base      vs base  vs base    vs base        vs base
DivconstI64                               ~            ~        ~    -49.66%        -21.02%
ModconstI64                               ~            ~        ~    -13.45%        +14.52%
DivisiblePow2constI64                     ~            ~        ~     +0.97%         -1.32%
DivisibleconstI64                         ~            ~        ~    -20.01%        -48.28%
DivisibleWDivconstI64                     ~            ~   -1.76%    -38.59%        -42.74%
DivconstU64/3                             ~            ~        ~    -13.82%         -4.09%
DivconstU64/5                             ~            ~        ~    -14.10%         -3.54%
DivconstU64/37                       -2.07%       -4.45%        ~    -19.60%         -9.55%
DivconstU64/1234567                       ~            ~        ~    -61.55%        -56.93%
ModconstU64                               ~            ~        ~     -6.25%              ~
DivisibleconstU64                         ~            ~        ~     -2.78%         -7.82%
DivisibleWDivconstU64                     ~            ~        ~     +4.23%         +2.56%

pkg: math/bits

benchmark \ host         s7  linux-amd64  linux-386  s7:GOARCH=386
                    vs base      vs base    vs base        vs base
Add                       ~            ~          ~              ~
Add32                +1.59%            ~          ~              ~
Add64                     ~            ~          ~              ~
Add64multiple             ~            ~          ~              ~
Sub                       ~            ~          ~              ~
Sub32                     ~            ~          ~              ~
Sub64                     ~            ~     -9.20%              ~
Sub64multiple             ~            ~          ~              ~
Mul                       ~            ~          ~              ~
Mul32                     ~            ~          ~              ~
Mul64                     ~            ~    -41.58%        -53.21%
Div                       ~            ~          ~              ~
Div32                     ~            ~          ~              ~
Div64                     ~            ~          ~              ~

pkg: strconv

benchmark \ host                       s7  linux-amd64  linux-386  s7:GOARCH=386
                                  vs base      vs base    vs base        vs base
ParseInt/Pos/7bit                       ~            ~    -11.08%         -6.75%
ParseInt/Pos/26bit                      ~            ~    -13.65%        -11.02%
ParseInt/Pos/31bit                      ~            ~    -14.65%         -9.71%
ParseInt/Pos/56bit                 -1.80%            ~    -17.97%        -10.78%
ParseInt/Pos/63bit                      ~            ~    -13.85%         -9.63%
ParseInt/Neg/7bit                       ~            ~    -12.14%         -7.26%
ParseInt/Neg/26bit                      ~            ~    -14.18%         -9.81%
ParseInt/Neg/31bit                      ~            ~    -14.51%         -9.02%
ParseInt/Neg/56bit                      ~            ~    -15.79%         -9.79%
ParseInt/Neg/63bit                      ~            ~    -15.68%        -11.07%
AppendFloat/Decimal                     ~            ~     -7.25%        -12.26%
AppendFloat/Float                       ~            ~    -15.96%        -19.45%
AppendFloat/Exp                         ~            ~    -13.96%        -17.76%
AppendFloat/NegExp                      ~            ~    -14.89%        -20.27%
AppendFloat/LongExp                     ~            ~    -12.68%        -17.97%
AppendFloat/Big                         ~            ~    -11.10%        -16.64%
AppendFloat/BinaryExp                   ~            ~          ~              ~
AppendFloat/32Integer                   ~            ~    -10.05%        -10.91%
AppendFloat/32ExactFraction             ~            ~     -8.93%        -13.00%
AppendFloat/32Point                     ~            ~    -10.36%        -14.89%
AppendFloat/32Exp                       ~            ~     -9.88%        -13.54%
AppendFloat/32NegExp                    ~            ~    -10.16%        -14.26%
AppendFloat/32Shortest                  ~            ~    -11.39%        -14.96%
AppendFloat/32Fixed8Hard                ~            ~          ~         -2.31%
AppendFloat/32Fixed9Hard                ~            ~          ~         -7.01%
AppendFloat/64Fixed1                    ~            ~     -2.83%         -8.23%
AppendFloat/64Fixed2                    ~            ~          ~         -7.94%
AppendFloat/64Fixed3                    ~            ~     -4.07%         -7.22%
AppendFloat/64Fixed4                    ~            ~     -7.24%         -7.62%
AppendFloat/64Fixed12                   ~            ~     -6.57%         -4.82%
AppendFloat/64Fixed16                   ~            ~     -4.00%         -5.81%
AppendFloat/64Fixed12Hard          -2.22%            ~     -4.07%         -6.35%
AppendFloat/64Fixed17Hard          -2.12%            ~          ~         -3.79%
AppendFloat/64Fixed18Hard          -1.89%            ~     +2.48%              ~
AppendFloat/Slowpath64             -1.85%            ~    -14.49%        -18.21%
AppendFloat/SlowpathDenormal64          ~            ~    -13.08%        -19.41%

pkg: crypto/internal/fips140/nistec/fiat

benchmark \ host         s7  linux-amd64  linux-386  s7:GOARCH=386
                    vs base      vs base    vs base        vs base
Mul/P224                  ~            ~    -29.95%        -39.60%
Mul/P384                  ~            ~    -37.11%        -63.33%
Mul/P521                  ~            ~    -26.62%        -12.42%
Square/P224          +1.46%            ~    -40.62%        -49.18%
Square/P384               ~            ~    -45.51%        -69.68%
Square/P521         +90.37%            ~    -25.26%        -11.23%

(The +90% is a separate problem and not real; that much variation
can be seen on that system by running the same binary from two
different files.)

pkg: crypto/internal/fips140/edwards25519

benchmark \ host                    s7  linux-amd64  linux-386  s7:GOARCH=386
                               vs base      vs base    vs base        vs base
EncodingDecoding                     ~            ~    -34.67%        -35.75%
ScalarBaseMult                       ~            ~    -31.25%        -30.29%
ScalarMult                           ~            ~    -33.45%        -32.54%
VarTimeDoubleScalarBaseMult          ~            ~    -33.78%        -33.68%

Change-Id: Id3c91d42cd01def6731b755e99f8f40c6ad1bb65
Reviewed-on: https://go-review.googlesource.com/c/go/+/716061
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Russ Cox <rsc@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
2025-10-30 08:04:20 -07:00
Boris Nagaev
38317c44e7 crypto/internal/fips140/aes: fix CTR generator
Fixed two issues in AVO based generator of amd64 asm code.

1. Updated golang.org/x/tools dependency to prevent build issue in Go 1.25.

> golang.org/x/tools@v0.24.0/internal/tokeninternal/tokeninternal.go:64:9:
> invalid array length -delta * delta (constant -256 of type int64)

This error was caused by changes in layout of data structures in Go. Package
golang.org/x/tools has a mirror of that struct and a static assert that it
matches the Go's struct.

2. Changed the package name from crypto/aes to crypto/internal/fips140/aes.

This fixed run time error:

> ctr_amd64_asm.go:31: could not find function "ctrBlocks1Asm"
and other errors

Now the following works as expected:

$ cd src/crypto/internal/fips140/aes/_asm/ctr/
$ go generate

The command re-generates file "src/crypto/internal/fips140/aes/ctr_amd64.s".

Fixes #75972

Change-Id: I28e4c9ebb5bf72506a524e36a0c81a1b50367a84
GitHub-Last-Rev: afc9f506e5
GitHub-Pull-Request: golang/go#75973
Reviewed-on: https://go-review.googlesource.com/c/go/+/712920
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-30 07:20:10 -07:00
Robert Griesemer
3be9a0e014 go/types, types: proceed with correct (invalid) type in case of a selector error
Fixes #76103.

Change-Id: Idc2f5d1d7aeb4a9b468e7c268e3bf5b85d1c3777
Reviewed-on: https://go-review.googlesource.com/c/go/+/716300
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Griesemer <gri@google.com>
2025-10-29 19:16:42 -07:00
Russ Cox
d2c5fa0814 strconv: remove &0xFF trick in formatBase10
The compiler is now smart enough to remove the bounds check itself.

                              │ 731f809c971  │            48fabc7d33b             │
                              │    sec/op    │   sec/op     vs base               │
AppendUint-12                    98.69n ± 1%   95.81n ± 1%  -2.91% (p=0.000 n=20)
AppendUintVarlen/digits=1-12     3.119n ± 1%   3.099n ± 1%       ~ (p=0.743 n=20)
AppendUintVarlen/digits=2-12     2.654n ± 0%   2.653n ± 0%       ~ (p=0.825 n=20)
AppendUintVarlen/digits=3-12     5.042n ± 0%   5.055n ± 1%       ~ (p=0.005 n=20)
AppendUintVarlen/digits=4-12     5.062n ± 1%   5.044n ± 0%       ~ (p=0.011 n=20)
AppendUintVarlen/digits=5-12     5.863n ± 0%   5.908n ± 1%       ~ (p=0.075 n=20)
AppendUintVarlen/digits=6-12     6.137n ± 0%   6.117n ± 1%       ~ (p=0.857 n=20)
AppendUintVarlen/digits=7-12     7.367n ± 0%   7.366n ± 0%       ~ (p=0.784 n=20)
AppendUintVarlen/digits=8-12     7.369n ± 0%   7.381n ± 0%       ~ (p=0.159 n=20)
AppendUintVarlen/digits=9-12     7.795n ± 2%   7.749n ± 0%       ~ (p=0.180 n=20)
AppendUintVarlen/digits=10-12    9.208n ± 1%   8.661n ± 0%  -5.94% (p=0.000 n=20)
AppendUintVarlen/digits=11-12    9.479n ± 1%   8.984n ± 0%  -5.22% (p=0.000 n=20)
AppendUintVarlen/digits=12-12    9.784n ± 0%   9.229n ± 1%  -5.67% (p=0.000 n=20)
AppendUintVarlen/digits=13-12   10.035n ± 1%   9.504n ± 0%  -5.29% (p=0.000 n=20)
AppendUintVarlen/digits=14-12    10.89n ± 1%   10.35n ± 0%  -4.96% (p=0.000 n=20)
AppendUintVarlen/digits=15-12    11.12n ± 0%   10.61n ± 1%  -4.67% (p=0.000 n=20)
AppendUintVarlen/digits=16-12    12.29n ± 0%   11.85n ± 1%  -3.62% (p=0.000 n=20)
AppendUintVarlen/digits=17-12    12.32n ± 0%   11.85n ± 1%  -3.85% (p=0.000 n=20)
AppendUintVarlen/digits=18-12    12.80n ± 0%   12.32n ± 1%  -3.79% (p=0.000 n=20)
AppendUintVarlen/digits=19-12    14.62n ± 1%   13.71n ± 1%  -6.29% (p=0.000 n=20)
AppendUintVarlen/digits=20-12    14.83n ± 0%   13.93n ± 0%  -6.10% (p=0.000 n=20)
geomean                          9.102n        8.843n       -2.84%

Change-Id: Ic8c79b472d5c30dccc1d974b47647f6425618e00
Reviewed-on: https://go-review.googlesource.com/c/go/+/714161
Auto-Submit: Russ Cox <rsc@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
2025-10-29 19:16:37 -07:00
Russ Cox
9bbda7c99d cmd/compile: make prove understand div, mod better
This CL introduces new divisible and divmod passes that rewrite
divisibility checks and div, mod, and mul. These happen after
prove, so that prove can make better sense of the code for
deriving bounds, and they must run before decompose, so that
64-bit ops can be lowered to 32-bit ops on 32-bit systems.
And then they need another generic pass as well, to optimize
the generated code before decomposing.

The three opt passes are "opt", "middle opt", and "late opt".
(Perhaps instead they should be "generic", "opt", and "late opt"?)

The "late opt" pass repeats the "middle opt" work on any new code
that has been generated in the interim.
There will not be new divs or mods, but there may be new muls.

The x%c==0 rewrite rules are much simpler now, since they can
match before divs have been rewritten. This has the effect of
applying them more consistently and making the rewrite rules
independent of the exact div rewrites.

Prove is also now charged with marking signed div/mod as
unsigned when the arguments call for it, allowing simpler
code to be emitted in various cases. For example,
t.Seconds()/2 and len(x)/2 are now recognized as unsigned,
meaning they compile to a simple shift (unsigned division),
avoiding the more complex fixup we need for signed values.

https://gist.github.com/rsc/99d9d3bd99cde87b6a1a390e3d85aa32
shows a diff of 'go build -a -gcflags=-d=ssa/prove/debug=1 std'
output before and after. "Proved Rsh64x64 shifts to zero" is replaced
by the higher-level "Proved Div64 is unsigned" (the shift was in the
signed expansion of div by constant), but otherwise prove is only
finding more things to prove.

One short example, in code that does x[i%len(x)]:

< runtime/mfinal.go:131:34: Proved Rsh64x64 shifts to zero
---
> runtime/mfinal.go:131:34: Proved Div64 is unsigned
> runtime/mfinal.go:131:38: Proved IsInBounds

A longer example:

< crypto/internal/fips140/sha3/shake.go:28:30: Proved Rsh64x64 shifts to zero
< crypto/internal/fips140/sha3/shake.go:38:27: Proved Rsh64x64 shifts to zero
< crypto/internal/fips140/sha3/shake.go:53:46: Proved Rsh64x64 shifts to zero
< crypto/internal/fips140/sha3/shake.go:55:46: Proved Rsh64x64 shifts to zero
---
> crypto/internal/fips140/sha3/shake.go:28:30: Proved Div64 is unsigned
> crypto/internal/fips140/sha3/shake.go:28:30: Proved IsInBounds
> crypto/internal/fips140/sha3/shake.go:28:30: Proved IsSliceInBounds
> crypto/internal/fips140/sha3/shake.go:38:27: Proved Div64 is unsigned
> crypto/internal/fips140/sha3/shake.go:45:7: Proved IsSliceInBounds
> crypto/internal/fips140/sha3/shake.go:46:4: Proved IsInBounds
> crypto/internal/fips140/sha3/shake.go:53:46: Proved Div64 is unsigned
> crypto/internal/fips140/sha3/shake.go:53:46: Proved IsInBounds
> crypto/internal/fips140/sha3/shake.go:53:46: Proved IsSliceInBounds
> crypto/internal/fips140/sha3/shake.go:55:46: Proved Div64 is unsigned
> crypto/internal/fips140/sha3/shake.go:55:46: Proved IsInBounds
> crypto/internal/fips140/sha3/shake.go:55:46: Proved IsSliceInBounds

These diffs are due to the smaller opt being better
and taking work away from prove:

< image/jpeg/dct.go:307:5: Proved IsInBounds
< image/jpeg/dct.go:308:5: Proved IsInBounds
...
< image/jpeg/dct.go:442:5: Proved IsInBounds

In the old opt, Mul by 8 was rewritten to Lsh by 3 early.
This CL delays that rule to help prove recognize mods,
but it also helps opt constant-fold the slice x[8*i:8*i+8:8*i+8].
Specifically, computing the length, opt can now do:

	(Sub64 (Add (Mul 8 i) 8) (Add (Mul 8 i) 8)) ->
	(Add 8 (Sub (Mul 8 i) (Mul 8 i))) ->
	(Add 8 (Mul 8 (Sub i i))) ->
	(Add 8 (Mul 8 0)) ->
	(Add 8 0) ->
	8

The key step is (Sub (Mul x y) (Mul x z)) -> (Mul x (Sub y z)),
Leaving the multiply as Mul enables using that step; the old
rewrite to Lsh blocked it, leaving prove to figure out the length
and then remove the bounds checks. But now opt can evaluate
the length down to a constant 8 and then constant-fold away
the bounds checks 0 < 8, 1 < 8, and so on. After that,
the compiler has nothing left to prove.

Benchmarks are noisy in general; I checked the assembly for the many
large increases below, and the vast majority are unchanged and
presumably hitting the caches differently in some way.

The divisibility optimizations were not reliably triggering before.
This leads to a very large improvement in some cases, like
DivisiblePow2constI64, DivisibleconstI64 on 64-bit systems
and DivisbleconstU64 on 32-bit systems.

Another way the divisibility optimizations were unreliable before
was incorrectly triggering for x/3, x%3 even though they are
written not to do that. There is a real but small slowdown
in the DivisibleWDivconst benchmarks on Mac because in the cases
used in the benchmark, it is still faster (on Mac) to do the
divisibility check than to remultiply.
This may be worth further study. Perhaps when there is no rotate
(meaning the divisor is odd), the divisibility optimization
should be enabled always. In any event, this CL makes it possible
to study that.

benchmark \ host                          s7  linux-amd64      mac  linux-arm64  linux-ppc64le  linux-386  s7:GOARCH=386  linux-arm
                                     vs base      vs base  vs base      vs base        vs base    vs base        vs base    vs base
LoadAdd                                    ~            ~        ~            ~              ~     -1.59%              ~          ~
ExtShift                                   ~            ~  -42.14%       +0.10%              ~     +1.44%         +5.66%     +8.50%
Modify                                     ~            ~        ~            ~              ~          ~              ~     -1.53%
MullImm                                    ~            ~        ~            ~              ~    +37.90%        -21.87%     +3.05%
ConstModify                                ~            ~        ~            ~        -49.14%          ~              ~          ~
BitSet                                     ~            ~        ~            ~        -15.86%    -14.57%         +6.44%     +0.06%
BitClear                                   ~            ~        ~            ~              ~     +1.78%         +3.50%     +0.06%
BitToggle                                  ~            ~        ~            ~              ~    -16.09%         +2.91%          ~
BitSetConst                                ~            ~        ~            ~              ~          ~              ~     -0.49%
BitClearConst                              ~            ~        ~            ~        -28.29%          ~              ~     -0.40%
BitToggleConst                             ~            ~        ~       +8.89%        -31.19%          ~              ~     -0.77%
MulNeg                                     ~            ~        ~            ~              ~          ~              ~          ~
Mul2Neg                                    ~            ~   -4.83%            ~              ~    -13.75%         -5.92%          ~
DivconstI64                                ~            ~        ~            ~              ~    -30.12%              ~     +0.50%
ModconstI64                                ~            ~   -9.94%       -4.63%              ~     +3.15%              ~     +5.32%
DivisiblePow2constI64                -34.49%      -12.58%        ~            ~        -12.25%          ~              ~          ~
DivisibleconstI64                    -24.69%      -25.06%   -0.40%       -2.27%        -42.61%     -3.31%              ~     +1.63%
DivisibleWDivconstI64                      ~            ~        ~            ~              ~    -17.55%              ~     -0.60%
DivconstU64/3                              ~            ~        ~            ~              ~     +1.51%              ~          ~
DivconstU64/5                              ~            ~        ~            ~              ~          ~              ~          ~
DivconstU64/37                             ~            ~   -0.18%            ~              ~     +2.70%              ~          ~
DivconstU64/1234567                        ~            ~        ~            ~              ~          ~              ~     +0.12%
ModconstU64                                ~            ~        ~       -0.24%              ~     -5.10%         -1.07%     -1.56%
DivisibleconstU64                          ~            ~        ~            ~              ~    -29.01%        -59.13%    -50.72%
DivisibleWDivconstU64                      ~            ~  -12.18%      -18.88%              ~     -5.50%         -3.91%     +5.17%
DivconstI32                                ~            ~   -0.48%            ~        -34.69%    +89.01%         -6.01%    -16.67%
ModconstI32                                ~       +2.95%   -0.33%            ~              ~     -2.98%         -5.40%     -8.30%
DivisiblePow2constI32                      ~            ~        ~            ~              ~          ~              ~    -16.22%
DivisibleconstI32                          ~            ~        ~            ~              ~    -37.27%        -47.75%    -25.03%
DivisibleWDivconstI32                -11.59%       +5.22%  -12.99%      -23.83%              ~    +45.95%         -7.03%    -10.01%
DivconstU32                                ~            ~        ~            ~              ~    +74.71%         +4.81%          ~
ModconstU32                                ~            ~   +0.53%       +0.18%              ~    +51.16%              ~          ~
DivisibleconstU32                          ~            ~        ~       -0.62%              ~     -4.25%              ~          ~
DivisibleWDivconstU32                 -2.77%       +5.56%  +11.12%       -5.15%              ~    +48.70%        +25.11%     -4.07%
DivconstI16                           -6.06%            ~   -0.33%       +0.22%              ~          ~         -9.68%     +5.47%
ModconstI16                                ~            ~   +4.44%       +2.82%              ~          ~              ~     +5.06%
DivisiblePow2constI16                      ~            ~        ~            ~              ~          ~              ~     -0.17%
DivisibleconstI16                          ~            ~   -0.23%            ~              ~          ~         +4.60%     +6.64%
DivisibleWDivconstI16                 -1.44%       -0.43%  +13.48%       -5.76%              ~     +1.62%        -23.15%     -9.06%
DivconstU16                           +1.61%            ~   -0.35%       -0.47%              ~          ~        +15.59%          ~
ModconstU16                                ~            ~        ~            ~              ~     -0.72%              ~    +14.23%
DivisibleconstU16                          ~            ~   -0.05%       +3.00%              ~          ~              ~     +5.06%
DivisibleWDivconstU16                +52.10%       +0.75%  +17.28%       +4.79%              ~    -37.39%         +5.28%     -9.06%
DivconstI8                                 ~            ~   -0.34%       -0.96%              ~          ~         -9.20%          ~
ModconstI8                            +2.29%            ~   +4.38%       +2.96%              ~          ~              ~          ~
DivisiblePow2constI8                       ~            ~        ~            ~              ~          ~              ~          ~
DivisibleconstI8                           ~            ~        ~            ~              ~          ~         +6.04%          ~
DivisibleWDivconstI8                 -26.44%       +1.69%  +17.03%       +4.05%              ~    +32.48%        -24.90%          ~
DivconstU8                            -4.50%      +14.06%   -0.28%            ~              ~          ~         +4.16%     +0.88%
ModconstU8                                 ~            ~  +25.84%       -0.64%              ~          ~              ~          ~
DivisibleconstU8                           ~            ~   -5.70%            ~              ~          ~              ~          ~
DivisibleWDivconstU8                 +49.55%       +9.07%        ~       +4.03%        +53.87%    -40.03%        +39.72%     -3.01%
Mul2                                       ~            ~        ~            ~              ~          ~              ~          ~
MulNeg2                                    ~            ~        ~            ~        -11.73%          ~              ~     -0.02%
EfaceInteger                               ~            ~        ~            ~              ~    +18.11%              ~     +2.53%
TypeAssert                           +33.90%       +2.86%        ~            ~              ~     -1.07%         -5.29%     -1.04%
Div64UnsignedSmall                         ~            ~        ~            ~              ~          ~              ~          ~
Div64Small                                 ~            ~        ~            ~              ~     -0.88%              ~     +2.39%
Div64SmallNegDivisor                       ~            ~        ~            ~              ~          ~              ~     +0.35%
Div64SmallNegDividend                      ~            ~        ~            ~              ~     -0.84%              ~     +3.57%
Div64SmallNegBoth                          ~            ~        ~            ~              ~     -0.86%              ~     +3.55%
Div64Unsigned                              ~            ~        ~            ~              ~          ~              ~     -0.11%
Div64                                      ~            ~        ~            ~              ~          ~              ~     +0.11%
Div64NegDivisor                            ~            ~        ~            ~              ~     -1.29%              ~          ~
Div64NegDividend                           ~            ~        ~            ~              ~     -1.44%              ~          ~
Div64NegBoth                               ~            ~        ~            ~              ~          ~              ~     +0.28%
Mod64UnsignedSmall                         ~            ~        ~            ~              ~     +0.48%              ~     +0.93%
Mod64Small                                 ~            ~        ~            ~              ~          ~              ~          ~
Mod64SmallNegDivisor                       ~            ~        ~            ~              ~          ~              ~     +1.44%
Mod64SmallNegDividend                      ~            ~        ~            ~              ~     +0.22%              ~     +1.37%
Mod64SmallNegBoth                          ~            ~        ~            ~              ~          ~              ~     -2.22%
Mod64Unsigned                              ~            ~        ~            ~              ~     -0.95%              ~     +0.11%
Mod64                                      ~            ~        ~            ~              ~          ~              ~          ~
Mod64NegDivisor                            ~            ~        ~            ~              ~          ~              ~     -0.02%
Mod64NegDividend                           ~            ~        ~            ~              ~          ~              ~          ~
Mod64NegBoth                               ~            ~        ~            ~              ~          ~              ~     -0.02%
MulconstI32/3                              ~            ~        ~      -25.00%              ~          ~              ~    +47.37%
MulconstI32/5                              ~            ~        ~      +33.28%              ~          ~              ~    +32.21%
MulconstI32/12                             ~            ~        ~       -2.13%              ~          ~              ~     -0.02%
MulconstI32/120                            ~            ~        ~       +2.93%              ~          ~              ~     -0.03%
MulconstI32/-120                           ~            ~        ~       -2.17%              ~          ~              ~     -0.03%
MulconstI32/65537                          ~            ~        ~            ~              ~          ~              ~     +0.03%
MulconstI32/65538                          ~            ~        ~            ~              ~    -33.38%              ~     +0.04%
MulconstI64/3                              ~            ~        ~      +33.35%              ~     -0.37%              ~     -0.13%
MulconstI64/5                              ~            ~        ~      -25.00%              ~     -0.34%              ~          ~
MulconstI64/12                             ~            ~        ~       +2.13%              ~    +11.62%              ~     +2.30%
MulconstI64/120                            ~            ~        ~       -1.98%              ~          ~              ~          ~
MulconstI64/-120                           ~            ~        ~       +0.75%              ~          ~              ~          ~
MulconstI64/65537                          ~            ~        ~            ~              ~     +5.61%              ~          ~
MulconstI64/65538                          ~            ~        ~            ~              ~     +5.25%              ~          ~
MulconstU32/3                              ~       +0.81%        ~      +33.39%              ~    +77.92%              ~    -32.31%
MulconstU32/5                              ~            ~        ~      -24.97%              ~    +77.92%              ~    -24.47%
MulconstU32/12                             ~            ~        ~       +2.06%              ~          ~              ~     +0.03%
MulconstU32/120                            ~            ~        ~       -2.74%              ~          ~              ~     +0.03%
MulconstU32/65537                          ~            ~        ~            ~              ~          ~              ~     +0.03%
MulconstU32/65538                          ~            ~        ~            ~              ~    -33.42%              ~     -0.03%
MulconstU64/3                              ~            ~        ~      +33.33%              ~     -0.28%              ~     +1.22%
MulconstU64/5                              ~            ~        ~      -25.00%              ~          ~              ~     -0.64%
MulconstU64/12                             ~            ~        ~       +2.30%              ~    +11.59%              ~     +0.14%
MulconstU64/120                            ~            ~        ~       -2.82%              ~          ~              ~     +0.04%
MulconstU64/65537                          ~       +0.37%        ~            ~              ~     +5.58%              ~          ~
MulconstU64/65538                          ~            ~        ~            ~              ~     +5.16%              ~          ~
ShiftArithmeticRight                       ~            ~        ~            ~              ~    -10.81%              ~     +0.31%
Switch8Predictable                   +14.69%            ~        ~            ~              ~    -24.85%              ~          ~
Switch8Unpredictable                       ~       -0.58%   -3.80%            ~              ~    -11.78%              ~     -0.79%
Switch32Predictable                  -10.33%      +17.89%        ~            ~              ~     +5.76%              ~          ~
Switch32Unpredictable                 -3.15%       +1.19%   +9.42%            ~              ~    -10.30%         -5.09%     +0.44%
SwitchStringPredictable              +70.88%      +20.48%        ~            ~              ~     +2.39%              ~     +0.31%
SwitchStringUnpredictable                  ~       +3.91%   -5.06%       -0.98%              ~     +0.61%         +2.03%          ~
SwitchTypePredictable               +146.58%       -1.10%        ~      -12.45%              ~     -0.46%         -3.81%          ~
SwitchTypeUnpredictable               +0.46%       -0.83%        ~       +4.18%              ~     +0.43%              ~     +0.62%
SwitchInterfaceTypePredictable       -13.41%      -10.13%  +11.03%            ~              ~     -4.38%              ~     +0.75%
SwitchInterfaceTypeUnpredictable      -6.37%       -2.14%        ~       -3.21%              ~     -4.20%              ~     +1.08%

Fixes #63110.
Fixes #75954.

Change-Id: I55a876f08c6c14f419ce1a8cbba2eaae6c6efbf0
Reviewed-on: https://go-review.googlesource.com/c/go/+/714160
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-29 18:49:40 -07:00
Russ Cox
915c1839fe test/codegen: simplify asmcheck pattern matching
Separate patterns in asmcheck by spaces instead of commas.
Many patterns end in comma (like "MOV [$]123,") so separating
patterns by comma is not great; they're already quoted, so spaces are fine.

Also replace all tabs in the assembly lines with spaces before matching.
Finally, replace \$ or \\$ with [$] as the matching idiom.
The effect of all these is to make the patterns look like:

  	   // amd64:"BSFQ" "ORQ [$]256"

instead of the old:

  	   // amd64:"BSFQ","ORQ\t\\$256"

Update all tests as well.

Change-Id: Ia39febe5d7f67ba115846422789e11b185d5c807
Reviewed-on: https://go-review.googlesource.com/c/go/+/716060
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
2025-10-29 13:55:00 -07:00
David Chase
e452f4ac7d [dev.simd] cmd/compile: enhance inlining for closure-of-SIMD
We noticed some hand-translated code that used
nested functions as the translation of asm macros,
and they were too big to inline, and the resulting
performance was underwhelming.  Any such closures
really need to be inlined.

Because Gerrit removed votes from a previous patch
set, and because in offline discussion we realized
that this was actually a hard-to-abuse inlining hack,
I decided to turn it up some more, and also add a
"this one goes to 11" joke.  The number is utterly
unprincipled, only "simd is supposed to go fast,
and this is a natural use of closures, and we don't
want there to be issues where it doesn't go fast."

The test verifies that the inlining occurs for a
function that exceeds the current inlining threshold.
Inspection of the generated code shows that it has
the desired effect.

Change-Id: I7a8b57c07d6482e6d98cedaf9622c960f956834d
Reviewed-on: https://go-review.googlesource.com/c/go/+/715740
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-10-29 13:46:34 -07:00
Jes Cok
32ee3f3f73 runtime: tweak example code for gorecover
Change-Id: Ie545610fab008f7855bcb1a608f98e0c5109ec20
GitHub-Last-Rev: 66401b913a
GitHub-Pull-Request: golang/go#76100
Reviewed-on: https://go-review.googlesource.com/c/go/+/716040
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Keith Randall <khr@google.com>
2025-10-29 11:27:57 -07:00
Filippo Valsorda
da3fb90b23 crypto/internal/fips140/bigmod: fix extendedGCD comment
Change-Id: I6a6a6964642991dc46929bfc47e411bb7563e425
Reviewed-on: https://go-review.googlesource.com/c/go/+/716080
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-29 11:26:42 -07:00
Russ Cox
9035f7aea5 runtime: use internal/strconv
Runtime doing its own number formatting dates back to
when runtime was the bottom-most Go package.
Those days are long gone. Use internal/strconv to avoid
duplicating code and also to get better floating-point
formatting:

% go1.24.6 run x.go
+1.234568e+004
% go run x.go
12345.678
%

With accurate floating point it becomes necessary to
introduce separate printers for float32 vs float64 and
for complex64 vs complex128. Otherwise float32(93.7)
prints as 93.69999694824219.

Change-Id: I25ae3f09519342dc3d1dcabf4711651423e00128
Reviewed-on: https://go-review.googlesource.com/c/go/+/716002
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-29 11:00:23 -07:00
Russ Cox
49c1da474d internal/itoa, internal/runtime/strconv: delete
Replaced by internal/strconv.

Change-Id: I0656a9ad5075e60339e963fbae7d194d2f3e16be
Reviewed-on: https://go-review.googlesource.com/c/go/+/716001
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-29 11:00:09 -07:00
Russ Cox
b2a346bbd1 strconv: move all but Quote to internal/strconv
This will let low-level things depend on the canonical routines,
even for floating-point printing.

Change-Id: I31207dc6584ad90d4e365dbe6eaf20f8662ed22d
Reviewed-on: https://go-review.googlesource.com/c/go/+/716000
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-29 11:00:02 -07:00
Michael Pratt
041f564b3e internal/runtime/gc/scan: avoid memory destination on VPCOMPRESSQ
On AMD Genoa / Zen 4, VPCOMPRESSQ with a memory destination imposes a
severe performance penalty of another an order of magnitude compared to
a register destination.

We can trivially work around this penalty with a register destination
and an additional move to memory.

Benchmark results from:

$ go test -bench=BenchmarkScanSpanPacked/.*/.*/.*/.*/impl=Platform internal/runtime/gc/scan

I've only included the summarized geomean here because there are ~2500
unique test cases.

AMD Genoa (Zen 4):

cpu: AMD EPYC 9B14 96-Core Processor
         │      mem      │                 reg        │
         │    sec/op     │    sec/op     vs base      │
geomean     1.039µ         310.1n        -70.16%

         │      mem      │                  reg       │
         │      B/s      │      B/s        vs base    │
geomean    2.906Gi          10.99Gi        +278.27%

As expected, we see a massive performance improvement on Genoa.

AMD Turin (Zen 5):

cpu: AMD EPYC 9B45 128-Core Processor
         │      mem      │                 reg        │
         │    sec/op     │    sec/op      vs base     │
geomean     231.9n          237.3n         +2.32%

         │      mem       │                  reg      │
         │      B/s       │      B/s        vs base   │
geomean     14.79Gi          14.43Gi         -2.50%

On Turin there is a minor regression. This is primarily due to a fairly
large regression (~15%) in very small microbenchmark cases where the
entire memory fits in L1 cache. This regression disappears as memory
access slows down with larger memories. The latter should be more common
in real workloads.

Intel Sapphire Rapids:

cpu: Intel(R) Xeon(R) Platinum 8481C
         │      mem      │                 reg        │
         │    sec/op     │    sec/op      vs base     │
geomean     254.9n          246.8n         -3.18%

         │      mem       │                  reg      │
         │      B/s       │      B/s        vs base   │
geomean     13.65Gi          14.15Gi         +3.69%

On Sapphire Rapids there is a minor improvement. Here results are fairly
noisy. Most cases are a wash, but some are arbitrary 20% slower or 20%
faster for unclear reasons.

For #73581.

Change-Id: I6a6a636cfd294a0dcdc4f34c9ece1bc9a6e5e4c7
Reviewed-on: https://go-review.googlesource.com/c/go/+/715362
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>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-10-28 13:58:12 -07:00
Jorropo
81afd3a59b cmd/compile: extend ppc64 MADDLD to match const ADDconst & MULLDconst
Fixes #76084

I was focused on restoring the old behavior and fixing the failing
test/codegen/arithmetic.go:MergeMuls2 test.

It is probable this same bug hides elsewhere in this file.

Change-Id: I17f2ee6b97a1e33b8132648d9d750749d006f7e0
Reviewed-on: https://go-review.googlesource.com/c/go/+/715560
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Paul Murphy <paumurph@redhat.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Jayanth Krishnamurthy <jayanth.krishnamurthy@ibm.com>
2025-10-28 11:13:41 -07:00
Keith Randall
ea50d61b66 cmd/compile: name change isDirect -> isDirectAndComparable
Now that it also restricts to comparable types. Followon to CL 713840.

Change-Id: Idd975c3fd16fb51f55360f2fa0b89ab0bf1d00ed
Reviewed-on: https://go-review.googlesource.com/c/go/+/715700
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Mateusz Poliwczak <mpoliwczak34@gmail.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-28 11:12:30 -07:00
Keith Randall
bd4dc413cd cmd/compile: don't optimize away a panicing interface comparison
We can't do direct pointer comparisons if the type is not a
comparable type.

Fixes #76008

Change-Id: I1687acff21832d2c2e8f3b875e7b5ec125702ef3
Reviewed-on: https://go-review.googlesource.com/c/go/+/713840
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
2025-10-28 10:24:14 -07:00
Jorropo
30c047d0d0 cmd/compile: extend loong MOV*idx rules to match ADDshiftLLV
Fixes #76085

I was focused on restoring the old behavior and fixing the failing
test/codegen/floats.go:index* tests.

It is probable this same bug hides elsewhere in this file.

Change-Id: Ibb2cb2be5c7bbeb5eafa9705d998a67380f2b04c
Reviewed-on: https://go-review.googlesource.com/c/go/+/715580
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-10-28 09:45:14 -07:00
Ian Lance Taylor
46e5e2b09a runtime: define PanicBounds in funcdata.h
The comment in funcdata.h says that the constants must agree
with those in internal/abi/symtab.go. Make that so.

Change-Id: Ib64146bfb31fdecfc1cc6ae03ae746a1b4a4d22e
Reviewed-on: https://go-review.googlesource.com/c/go/+/715521
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
2025-10-28 09:45:10 -07:00
Filippo Valsorda
3da0356685 crypto/internal/fips140test: collect 300M entropy samples for ESV
Change-Id: I6a6a69649df8f576df62e22c16db7813cde75224
Reviewed-on: https://go-review.googlesource.com/c/go/+/715401
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-28 09:45:07 -07:00
Jes Cok
d5953185d5 runtime: amend comments a bit
Change-Id: I3cabc57f6b8f803f966221f9583a5edb8828ca12
GitHub-Last-Rev: 57569ace50
GitHub-Pull-Request: golang/go#76086
Reviewed-on: https://go-review.googlesource.com/c/go/+/715600
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
2025-10-28 09:24:16 -07:00
Damien Neil
12c8d14d94 errors: document that the target of Is must be comparable
If target is not comparable, then errors.Is(err, target) can panic.
(Put another way, if target == target panics, then Is can panic.)

Document that the target must be comparable.

For #74488

Change-Id: I694dc4c91a608b80f044f06dd1c6ac32b8e77c9c
Reviewed-on: https://go-review.googlesource.com/c/go/+/715440
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
TryBot-Bypass: Damien Neil <dneil@google.com>
2025-10-28 08:30:47 -07:00
Mark Freeman
1f4d14e493 go/types, types2: pull up package-level object sort to a separate phase
This step allows future additional phases to reuse the sorted object
list. Preparation for upcoming CLs.

Change-Id: I22eaffd5bbe39c7cc101c6d860011dc3cb98ce37
Reviewed-on: https://go-review.googlesource.com/c/go/+/715480
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Mark Freeman <markfreeman@google.com>
2025-10-28 08:29:09 -07:00
Mark Freeman
b8aa1ee442 go/types, types2: reduce locks held at once in resolveUnderlying
There is no need to hold locks for the entire chain of Named types in
resolveUnderlying. This change moves the locking / unlocking right to
where t.underlying is set.

This change consolidates logic into resolveUnderlying where possible
and makes minor stylistic / documentation adjustments.

Change-Id: Ic5ec5a7e9a0da8bc34954bf456e4e23a28df296d
Reviewed-on: https://go-review.googlesource.com/c/go/+/714403
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-28 08:27:54 -07:00
Jorropo
24af441437 cmd/compile: rewrite proved multiplies by 0 or 1 into CondSelect
Updates #76056

Change-Id: I64fe631ab381c74f902f877392530d7cc91860ab
Reviewed-on: https://go-review.googlesource.com/c/go/+/715044
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-28 07:51:50 -07:00
Jorropo
2d33a456c6 cmd/compile: move branchelim supported arches to Config
Change-Id: I8d10399ba71e5fa97ead06a717fc972c806c0856
Reviewed-on: https://go-review.googlesource.com/c/go/+/715042
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-10-28 07:51:47 -07:00
Jorropo
2c91c33e88 crypto/subtle,cmd/compile: add intrinsics for ConstantTimeSelect and *Eq
Targeting crypto/subtle rather than
crypto/internal/fips140/subtle after discussion with Filippo.

goos: linux
goarch: amd64
pkg: crypto/subtle
cpu: AMD Ryzen 5 3600 6-Core Processor
                        │ /tmp/old.logs │            /tmp/new.logs             │
                        │    sec/op     │    sec/op     vs base                │
ConstantTimeSelect-12      0.5246n ± 1%   0.5217n ± 2%        ~ (p=0.118 n=10)
ConstantTimeByteEq-12      1.0415n ± 1%   0.5202n ± 2%  -50.05% (p=0.000 n=10)
ConstantTimeEq-12          0.7813n ± 2%   0.7819n ± 0%        ~ (p=0.897 n=10)
ConstantTimeLessOrEq-12    1.0415n ± 3%   0.7813n ± 1%  -24.98% (p=0.000 n=10)
geomean                    0.8166n        0.6381n       -21.86%

The last three will become 1 lat-cycle (0.25ns) faster once #76066 is fixed.

The Select being that fast with the old code is really impressive.
I am pretty sure this happens because my CPU has BMI1&2 support and
a fusing unit able to translate non BMI code into BMI code.
This benchmark doesn't capture the CACHE gains from the shorter assembly.

It currently compiles as:
v17 = TESTQ <flags> v31 v31 // v != 0
v20 = CMOVQNE <int> v32 v33 v17 (y[int])

It is possible to remove the `TESTQ` by compiletime fusing it with the
compare in a pattern like this:
subtle.ConstantTimeSelect(subtle.ConstantTimeLessOrEq(left, right), right, left)

Saving 2 latency-cycles (1 with #76066 fixed).

Updates #76056

Change-Id: I61a1df99e97a1506f75dae13db529f43846d8f1e
Reviewed-on: https://go-review.googlesource.com/c/go/+/715045
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Keith Randall <khr@google.com>
2025-10-27 23:29:19 -07:00
Jorropo
73d7635fae cmd/compile: add generic rules to remove bool → int → bool roundtrips
Change-Id: I8b0a3b64c89fe167d304f901a5d38470f35400ab
Reviewed-on: https://go-review.googlesource.com/c/go/+/715200
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2025-10-27 23:24:54 -07:00
Jorropo
1662d55247 cmd/compile: do not Zext bools to 64bits in amd64 CMOV generation rules
Change-Id: I77b714ed767e50d13183f4307f65e47ca7577f9f
Reviewed-on: https://go-review.googlesource.com/c/go/+/715380
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-27 23:24:41 -07:00
Jorropo
b8468d8c4e cmd/compile: introduce bytesizeToConst to cleanup switches in prove
Change-Id: I32b45d9632a8131911cb9bd6eff075eb8312ccfd
Reviewed-on: https://go-review.googlesource.com/c/go/+/715043
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
2025-10-27 23:24:29 -07:00
qmuntal
9e25c2f6de cmd/link: internal linking support for windows/arm64
The internal linker was missing some pieces to support windows/arm64.

Closes #75485

Cq-Include-Trybots: luci.golang.try:gotip-windows-arm64
Change-Id: I5c18a47e63e09b8ae22c9b24832249b54f544b7e
Reviewed-on: https://go-review.googlesource.com/c/go/+/704295
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-10-27 22:57:10 -07:00
Michael Pratt
ff2ebf69c4 internal/runtime/gc/scan: correct size class size check
This check intends to skip size classes that are too big for scanSpan,
but it compares the size class index with a byte size. It must do the
conversion first.

For #73581.

Change-Id: I6a6a636c8d19fa3bf2a2b609870d67d33f47f66e
Reviewed-on: https://go-review.googlesource.com/c/go/+/715460
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>
2025-10-27 19:09:48 -07:00
Jorropo
9a77aa4f08 cmd/compile: add position info to sccp debug messages
Change-Id: Ic568dd3b2e3ebebb1b6aaa41ee78a12d4e8d3f06
Reviewed-on: https://go-review.googlesource.com/c/go/+/714221
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
2025-10-27 19:09:34 -07:00
Jorropo
77dc138030 cmd/compile: teach prove about unsigned rounding-up divide
Change-Id: Ia7b5242c723f83ba85d12e4ca64a19fbbd126016
Reviewed-on: https://go-review.googlesource.com/c/go/+/714622
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-10-27 19:08:00 -07:00
Jorropo
a0f33b2887 cmd/compile: change !l.nonzero() into l.maybezero()
if l.maybezero()
is easier to read than
  if !l.nonzero()

Change-Id: I1183b0c0dc51fa1eed26dfc7a5a996783806a991
Reviewed-on: https://go-review.googlesource.com/c/go/+/714621
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-10-27 19:07:57 -07:00
Jorropo
5453b788fd cmd/compile: optimize Add64carry with unused carries into plain Add64
Change-Id: I8a63f567cfc574bb066ad6269eec6929760cb9c3
Reviewed-on: https://go-review.googlesource.com/c/go/+/656338
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
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>
2025-10-27 19:07:38 -07:00
Jorropo
2ce5aab79e cmd/compile: remove 68857 ModU flowLimit workaround in prove
We can know this is correct because all the testcases added by CL 605156 are still passing.
Partial revert of CL 605156 (everything but the testcases).

Change-Id: I5d8daadb4cb35a9de29daaabc22baee642511fe0
Reviewed-on: https://go-review.googlesource.com/c/go/+/714941
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-27 19:06:18 -07:00
Jorropo
a50de4bda7 cmd/compile: remove 68857 min & max flowLimit workaround in prove
We can know this is correct because all the testcases added by CL 656157 are still passing.
Partial revert of CL 656157 (everything but the testcases).

Change-Id: I24931fa1affba7e9e92233b3de74ebade3d48a09
Reviewed-on: https://go-review.googlesource.com/c/go/+/714921
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-27 19:06:16 -07:00
Jorropo
53be78630a cmd/compile: use topo-sort in prove to correctly learn facts while walking once
Fixes #68857

Change-Id: Ideb359cc6f1550afb4c79f02d25a00d0ae5e5c50
Reviewed-on: https://go-review.googlesource.com/c/go/+/714920
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
2025-10-27 19:06:13 -07:00
Cuong Manh Le
dec2b4c83d runtime: avoid bound check in freebsd binuptime
Fixes #76062

Change-Id: I683c1232aaeac12b0b3688472bb277adb95ad542
Reviewed-on: https://go-review.googlesource.com/c/go/+/715180
Reviewed-by: Keith Randall <khr@golang.org>
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: Keith Randall <khr@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
2025-10-27 19:02:06 -07:00
Xiaolin Zhao
916e682d51 cmd/internal/obj, cmd/asm: reclassify the offset of memory access operations on loong64
This CL also fixes the encoding error of LL/SC[V] instruction and
adds the handling of offset greater than 16 bits in MOV{W/V}P instructions.

Change-Id: I7a8fab4b68a6839da81c5e59af1f42289d00ef61
Reviewed-on: https://go-review.googlesource.com/c/go/+/706435
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-10-27 18:21:57 -07:00
Ian Alexander
2835b994fb cmd/go: remove global loader state variable
Prior commits have removed all dependencies on the global module
loader state variable, so it is now unnecessary and thus removed.

This commit is part of the overall effort to eliminate global
modloader state.

Change-Id: Idaf033ee703a18ffd29e40fad80ef13c7b33dbec
Reviewed-on: https://go-review.googlesource.com/c/go/+/711139
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2025-10-27 13:29:38 -07:00
Ian Alexander
139f89226f cmd/go: use local state for telemetry
This change adds a new loader state to satisfy the requirements for
the (currently unused) telemetry stats for the go command.

This commit is part of the overall effort to eliminate global
modloader state.

Change-Id: I6d4e38c91e5413d7649dfc6301e3ba35ee36c9b9
Reviewed-on: https://go-review.googlesource.com/c/go/+/711136
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-27 13:29:10 -07:00
Ian Alexander
8239156571 cmd/go: use tagged switch
Minor modernization to use a tagged switch statement in lieu of
if-else chain.

Change-Id: I132d279d421b4a609403f85f9f1ddfc2605a5399
Reviewed-on: https://go-review.googlesource.com/c/go/+/715341
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-10-27 13:28:59 -07:00
Ian Alexander
d741483a1f cmd/go: increase stmt threshold on amd64
This change slightly increases the stmt threshold on the amd64
platform.

Change-Id: I87e39753b52d6d72f2cd77f1cb8015b1e550921a
Reviewed-on: https://go-review.googlesource.com/c/go/+/715340
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-27 13:28:47 -07:00
Ian Alexander
a6929cf4a7 cmd/go: removed unused code in toolchain.Exec
This change removes the unused module loader state in the function
`toolchain.Exec`.

This commit is part of the overall effort to eliminate global
modloader state.

Change-Id: I8935f14447db4669457becc5a96db7f45132772f
Reviewed-on: https://go-review.googlesource.com/c/go/+/709980
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2025-10-27 13:28:15 -07:00
David Chase
ca1264ac50 [dev.simd] test: add some trickier cases to ternary-boolean simd test
These new tests check a hypothesis about interactions
between CPU features and common subexpressions.  Happily,
they hypothesis was not (yet) correct and the test did not
fail.

These are probably good to have in the corpus in case we
decide to tinker with the rewrite in the future, or if
someone wants to write a fuzzer and needs a little
inspiration.

Change-Id: I8ea6e1655a293c22e39bf53e4d2c5afd3dcb2510
Reviewed-on: https://go-review.googlesource.com/c/go/+/714803
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-27 12:57:33 -07:00
Mark Freeman
180c07e2c1 go/types, types2: clarify docs for resolveUnderlying
The resolveUnderlying method only detects cycles among type names, where
no type literal or predeclared type can be found (which would yield an
underlying type).

Change-Id: I203f3856eaf63a8a9d317c22521755390f9c1023
Reviewed-on: https://go-review.googlesource.com/c/go/+/714402
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-27 11:47:41 -07:00
Mark Freeman
d8a32f3d4b go/types, types2: wrap Named.fromRHS into Named.rhs
In debug mode, the Named.rhs method asserts that Named is in a state
with Named.fromRHS populated.

This caught a missing call to Named.unpack in validtype, which has been
added.

Change-Id: Id3f95f78f03d98a6efe87af6ac24f2ac2e285f96
Reviewed-on: https://go-review.googlesource.com/c/go/+/714242
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>
2025-10-27 11:47:38 -07:00
Mark Freeman
b2af92270f go/types, types2: verify stateMask transitions in debug mode
Recently, we've changed the representation of Named type state from
an integer to a bit mask, which is a bit more complicated. To make
sure we uphold state invariants, we are adding a verification step
on each state transition.

This uncovered a few places where we do not uphold the transition
invariants; those are patched in this CL.

Change-Id: I76569e4326b2d362d7a1f078641029ffb3dca531
Reviewed-on: https://go-review.googlesource.com/c/go/+/714241
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>
2025-10-27 11:31:58 -07:00
Julien Cretel
92decdcbaa net/url: further speed up escape and unescape
This change is a follow-up to CL 712200. It further simplifies and speeds up
functions escape and unescape.

Here are some benchmark results (no change to allocations):

goos: darwin
goarch: amd64
pkg: net/url
cpu: Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
                    │ go/src/old  │             go/src/new             │
                    │   sec/op    │   sec/op     vs base               │
QueryEscape/#00-8     34.58n ± 1%   31.97n ± 1%  -7.55% (p=0.000 n=20)
QueryEscape/#01-8     92.92n ± 0%   94.63n ± 0%  +1.84% (p=0.000 n=20)
QueryEscape/#02-8     75.44n ± 0%   73.32n ± 0%  -2.80% (p=0.000 n=20)
QueryEscape/#03-8     143.4n ± 0%   136.6n ± 0%  -4.71% (p=0.000 n=20)
QueryEscape/#04-8     918.8n ± 1%   838.3n ± 0%  -8.76% (p=0.000 n=20)
PathEscape/#00-8      43.93n ± 0%   42.86n ± 0%  -2.44% (p=0.000 n=20)
PathEscape/#01-8      94.99n ± 0%   95.86n ± 0%  +0.91% (p=0.000 n=20)
PathEscape/#02-8      75.40n ± 1%   71.50n ± 1%  -5.18% (p=0.000 n=20)
PathEscape/#03-8      143.4n ± 0%   136.2n ± 0%  -4.99% (p=0.000 n=20)
PathEscape/#04-8      871.8n ± 0%   822.7n ± 0%  -5.63% (p=0.000 n=20)
QueryUnescape/#00-8   52.64n ± 1%   51.19n ± 0%  -2.75% (p=0.000 n=20)
QueryUnescape/#01-8   137.4n ± 1%   137.9n ± 1%       ~ (p=0.297 n=20)
QueryUnescape/#02-8   114.0n ± 0%   122.3n ± 1%  +7.24% (p=0.000 n=20)
QueryUnescape/#03-8   271.8n ± 0%   260.7n ± 1%  -4.08% (p=0.000 n=20)
QueryUnescape/#04-8   1.390µ ± 1%   1.355µ ± 0%  -2.52% (p=0.000 n=20)
PathUnescape/#00-8    52.45n ± 1%   53.03n ± 1%  +1.10% (p=0.008 n=20)
PathUnescape/#01-8    138.5n ± 1%   141.3n ± 0%  +2.06% (p=0.000 n=20)
PathUnescape/#02-8    114.0n ± 0%   121.5n ± 0%  +6.62% (p=0.000 n=20)
PathUnescape/#03-8    273.1n ± 1%   260.1n ± 0%  -4.76% (p=0.000 n=20)
PathUnescape/#04-8    1.431µ ± 1%   1.359µ ± 0%  -5.07% (p=0.000 n=20)
geomean               160.4n        156.9n       -2.14%

Updates #17860

Change-Id: If64ac3e9c62c41f672db06cfd7eab7357e934e6d
GitHub-Last-Rev: 1da047ac75
GitHub-Pull-Request: golang/go#76048
Reviewed-on: https://go-review.googlesource.com/c/go/+/714900
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-10-27 09:51:24 -07:00
Ian Lance Taylor
5f4ec3541f runtime: remove unused cgoCheckUsingType function
The only calls to it were removed in CL 616255.

Change-Id: I6c6b01e2e98d54300b6323fd74ccc45fa1d433dd
Reviewed-on: https://go-review.googlesource.com/c/go/+/714820
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
2025-10-27 09:49:00 -07:00
baycore
189f2c08cc time: rewrite IsZero method to use wall and ext fields
Using wall and ext fields will be more efficient.

Fixes #76001

Change-Id: If2b9f597562e0d0d3f8ab300556fa559926480a0
GitHub-Last-Rev: 4a91948413
GitHub-Pull-Request: golang/go#76006
Reviewed-on: https://go-review.googlesource.com/c/go/+/713720
Reviewed-by: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: David Chase <drchase@google.com>
2025-10-27 09:44:55 -07:00
Ian Alexander
f619b4a00d cmd/go: reorder parameters so that context is first
This change simply reorders parameters so that the context.Context is
the first, as per standard practice.

This commit is part of the overall effort to eliminate global
modloader state.

Change-Id: I22d366fb2d2457f44d668409da3fe76fb87180cc
Reviewed-on: https://go-review.googlesource.com/c/go/+/714780
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2025-10-27 09:40:50 -07:00
Jes Cok
f527994c61 sync: update comments for Once.done
Sync with CL 666895.

Change-Id: I49c4a7f88d87cee9c30a858facd3cd8348efdf94
GitHub-Last-Rev: 88ac1c9c41
GitHub-Pull-Request: golang/go#76026
Reviewed-on: https://go-review.googlesource.com/c/go/+/714360
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
2025-10-27 09:32:27 -07:00
thepudds
5dcaf9a01b runtime: add GOEXPERIMENT=runtimefree
This CL is part of a series of CLs to triangulate between the runtime,
compiler, and standard library to reduce how much work the GC must do.

An overall design document is in CL 700255.

This CL stack implements a runtime.free within the runtime, and
then uses it via automatic calls inserted by the compiler when
the compiler proves it is safe to do so. In the future, we can
also consider possibly a limited set of explicit calls from certain
low-level portions of the standard library.

When called, runtime.free allows immediate reuse of memory
without waiting for a GC cycle. The goals include less overall
CPU usage by the GC, longer times between GC cycles
(with less overall time with the write barrier enabled),
and more cache-friendly allocations for user code.

Here, we just add the GOEXPERIMENT=runtimefree flag. It currently
defaults to on, but can be disabled with GOEXPERIMENT=noruntimefree.

The actual implementation starts in CL 673695.

Updates #74299

Change-Id: I2f1f04dbdca51f4aaa735fd65bb2719c298d922e
Reviewed-on: https://go-review.googlesource.com/c/go/+/700235
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-26 21:49:25 -07:00
Meng Zhuo
d7a52f9369 cmd/compile: use MOV(D|F) with const for Const(64|32)F on riscv64
The original Const64F using: AUIPC + LD + FMVDX to load
float64 const, we can use AUIPC + FLD instead, same as Const32F.

Change-Id: I8ca0a0e90d820a26e69b74cd25df3cc662132bf7
Reviewed-on: https://go-review.googlesource.com/c/go/+/703215
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Joel Sing <joel@sing.id.au>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2025-10-26 18:35:09 -07:00
Meng Zhuo
6f04a92be3 internal/chacha8rand: provide vector implementation for riscv64
Provide a vector implementation of chacha8rand for riscv64,
which improves performance.

goos: linux
goarch: riscv64
pkg: internal/chacha8rand
cpu: Spacemit(R) X60
      │ /root/chacha8.rand.old.log │     /root/chacha8.rand.new.log      │
      │           sec/op           │   sec/op     vs base                │
Block                  1.640µ ± 0%   1.294µ ± 0%  -21.10% (p=0.000 n=10)

      │ /root/chacha8.rand.old.log │      /root/chacha8.rand.new.log      │
      │            B/s             │     B/s       vs base                │
Block                 148.9Mi ± 0%   188.6Mi ± 0%  +26.72% (p=0.000 n=10)

Change-Id: I1e04c5c44e5ce0c78814a6a48c5ab65e4d758937
Reviewed-on: https://go-review.googlesource.com/c/go/+/710035
Reviewed-by: Joel Sing <joel@sing.id.au>
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>
2025-10-26 18:34:48 -07:00
Ian Alexander
54e3adc533 cmd/go: use local loader state in test
This change converts the import test to use a local module loader
state variable, instead of the dependency on global state.

This commit is part of the overall effort to eliminate global
modloader state.

Change-Id: I5687090c160bf64ce36356768f7cf74333fab724
Reviewed-on: https://go-review.googlesource.com/c/go/+/711138
Reviewed-by: Michael Matloob <matloob@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-26 14:11:34 -07:00
Ian Alexander
ca379b1c56 cmd/go: remove loaderstate dependency
This change removes the dependency on the module loader state from the
`QueryMatchesMainModulesError.Error()` method.

This commit is part of the overall effort to eliminate global
modloader state.

Change-Id: I47241587a0bf9b578931628f35ed3b936a0cb04a
Reviewed-on: https://go-review.googlesource.com/c/go/+/714700
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2025-10-26 14:11:07 -07:00
Ian Alexander
83a44bde64 cmd/go: remove unused loader state
This test file does not make any use of the module loader state.

This commit is part of the overall effort to eliminate global
modloader state.

Change-Id: I198c76aef9d9a87ae1a2299230f8a06d7a87767a
Reviewed-on: https://go-review.googlesource.com/c/go/+/711137
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>
2025-10-26 14:10:22 -07:00
Ian Alexander
7e7cd9de68 cmd/go: remove temporary rf cleanup script
This commit is part of the overall effort to eliminate global
modloader state.

Change-Id: I9d2deebafbbb374de2a1f9bae99e9caf417313a0
Reviewed-on: https://go-review.googlesource.com/c/go/+/709991
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-26 14:09:48 -07:00
Cherry Mui
53ad68de4b cmd/compile: allow unaligned load/store on Wasm
Wasm supports unaligned load/store instructions. Use them.

This speeds up map hashing slightly (among others):
goos: js
goarch: wasm
pkg: runtime
                     │   old.txt   │               new.txt               │
                     │   sec/op    │   sec/op     vs base                │
Hash5                  14.06n ± 2%   13.83n ± 5%        ~ (p=0.186 n=10)
Hash16                 17.52n ± 1%   17.04n ± 1%   -2.71% (p=0.000 n=10)
Hash64                 28.68n ± 1%   26.61n ± 1%   -7.18% (p=0.000 n=10)
Hash1024               271.4n ± 0%   243.6n ± 1%  -10.21% (p=0.000 n=10)
Hash65536              16.66µ ± 0%   15.74µ ± 1%   -5.49% (p=0.000 n=10)
HashStringSpeed        29.23n ± 1%   28.70n ± 1%   -1.83% (p=0.000 n=10)
HashBytesSpeed         46.11n ± 4%   45.17n ± 5%   -2.04% (p=0.008 n=10)
HashInt32Speed         20.39n ± 1%   20.24n ± 5%        ~ (p=0.239 n=10)
HashInt64Speed         20.81n ± 7%   20.58n ± 7%        ~ (p=0.238 n=10)
HashStringArraySpeed   76.65n ± 2%   73.72n ± 1%   -3.83% (p=0.000 n=10)
FastrandHashiter       87.65n ± 1%   87.58n ± 1%        ~ (p=0.725 n=10)
geomean                67.03n        64.75n        -3.40%

Change-Id: I7fd1817c74323f628f310393b0330a0a51ffa3a7
Reviewed-on: https://go-review.googlesource.com/c/go/+/714720
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-26 08:38:45 -07:00
Ian Alexander
12ec09f434 cmd/go: use local state object in work.runBuild and work.runInstall
This commit modifies `runBuild` and `runInstall` to construct a new
modload.State object using the new constructor instead of the current
global `modload.LoaderState` variable.

This commit is part of the overall effort to eliminate global
modloader state.

[git-generate]
cd src/cmd/go/internal/work
rf '
  add build.go:/func runBuild\(/-0 var moduleLoaderState *modload.State
  ex {
    import "cmd/go/internal/modload";
    modload.LoaderState -> moduleLoaderState
  }
  add runBuild://+0 moduleLoaderState := modload.NewState()
  add runInstall://+0 moduleLoaderState := modload.NewState()
  rm build.go:/var moduleLoaderState \*modload.State/
'

Change-Id: I1137e0b898a5bda8697dce8713f96f238ae8b76c
Reviewed-on: https://go-review.googlesource.com/c/go/+/711135
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-25 06:33:03 -07:00
Jorropo
643f80a11f runtime: add ppc and s390 to 32 build constraints for gccgo
Theses are not supported by the go compiler but it may helps porting to gccgo.

I have no idea if this change is correct, but it is weird that
os_linux32.go and os_linux64.go should have ppc & s390 but not all other
files gated to 32bits in the same package.

Change-Id: I0bb70cdb88c19096386320d02d546942263e009d
Reviewed-on: https://go-review.googlesource.com/c/go/+/714082
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2025-10-24 22:48:56 -07:00
Jorropo
0afbeb5102 runtime: add ppc and s390 to linux 32 bits syscall build constraints for gccgo
Theses are not supported by the go compiler but it may helps porting to gccgo.

This is similar to reverting CL 712740 however unlike reverting:
- it fixes the build tags so that 32 & 64 bits
  constraints are complement of each other
- it applies the same changes to os_linux_settime32.go and
  os_linux_settime64.go since the four files are the exact same
  fix of the same bug to different parts of the codebase.
  It does not make sense for them to be different.

Change-Id: I08cdcb07e837a5e06ee6f04b7868a4c57b07dd56
Reviewed-on: https://go-review.googlesource.com/c/go/+/714080
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: 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>
2025-10-24 22:27:05 -07:00
Ian Alexander
7b506d106f cmd/go: use local state object in generate.runGenerate
This commit modifies `generate.runGenerate` to construct a new
modload.State object using the new constructor instead of the current
global `modload.LoaderState` variable.

This commit is part of the overall effort to eliminate global
modloader state.

[git-generate]
cd src/cmd/go/internal/generate
rf '
  add generate.go:/func runGenerate\(/-0 var moduleLoaderState *modload.State
  ex {
    import "cmd/go/internal/modload";
    modload.LoaderState -> moduleLoaderState
  }
  add runGenerate://+0 moduleLoaderState := modload.NewState()
  rm generate.go:/var moduleLoaderState \*modload.State/
'

Change-Id: Iea9d662ba47657aa5daa70d32117cdf52fd02b7e
Reviewed-on: https://go-review.googlesource.com/c/go/+/711132
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-24 18:10:58 -07:00
Ian Alexander
26a8a21d7f cmd/go: use local state object in env.runEnv
This commit modifies `env.runEnv` to construct a new modload.State
object using the new constructor instead of the current global
`modload.LoaderState` variable.

This commit is part of the overall effort to eliminate global
modloader state.

[git-generate]
cd src/cmd/go/internal/envcmd
rf '
  add env.go:/func runEnv\(/-0 var moduleLoaderState *modload.State
  ex {
    import "cmd/go/internal/modload";
    modload.LoaderState -> moduleLoaderState
  }
  add runEnv://+0 moduleLoaderState := modload.NewState()
  rm env.go:/var moduleLoaderState \*modload.State/
'

Change-Id: I1177df5d09a6ee642eade6cfa4278bb1629843a8
Reviewed-on: https://go-review.googlesource.com/c/go/+/711131
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-24 18:10:22 -07:00
Ian Alexander
f2dd3d7e31 cmd/go: use local state object in vet.runVet
This commit modifies `vet.runVet` to construct a new modload.State
object using the new constructor instead of the current global
`modload.LoaderState` variable.

This commit is part of the overall effort to eliminate global
modloader state.

[git-generate]
cd src/cmd/go/internal/vet
rf '
  add vet.go:/func run\(/-0 var moduleLoaderState *modload.State
  ex {
    import "cmd/go/internal/modload";
    modload.LoaderState -> moduleLoaderState
  }
  add run://+0 moduleLoaderState := modload.NewState()
  rm vet.go:/var moduleLoaderState \*modload.State/
'

Change-Id: I31c7f3ea8d301b9210f5afeb632afb5b53e93e46
Reviewed-on: https://go-review.googlesource.com/c/go/+/711130
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2025-10-24 18:10:11 -07:00
Ian Alexander
784700439a cmd/go: use local state object in pkg workcmd
This commit modifies package `workcmd` to construct a new
modload.State object using the new constructor instead of the current
global `modload.LoaderState` variable.

This commit is part of the overall effort to eliminate global
modloader state.

[git-generate]
cd src/cmd/go/internal/workcmd
rf '
  inject modload.LoaderState runUse
  add sync.go:/func runSync\(/-0 var moduleLoaderState *modload.State
  ex {
    import "cmd/go/internal/modload";
    modload.LoaderState -> moduleLoaderState
  }
  add runSync://+0 moduleLoaderState := modload.NewState()
  add runEditwork://+0 moduleLoaderState := modload.NewState()
  add runInit://+0 moduleLoaderState := modload.NewState()
  add runUse://+0 moduleLoaderState := modload.NewState()
  add runVendor://+0 moduleLoaderState := modload.NewState()
  rm sync.go:/var moduleLoaderState \*modload.State/
'

Change-Id: Iadc4ffd19d15f80a694285c86adfc01f0d26bac7
Reviewed-on: https://go-review.googlesource.com/c/go/+/711129
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-24 18:09:54 -07:00
Ian Alexander
69673e9be2 cmd/go: use local state object in tool.runTool
This commit modifies `tool.runTool` to construct a new modload.State
object using the new constructor instead of the current global
`modload.LoaderState` variable.

This commit is part of the overall effort to eliminate global
modloader state.

[git-generate]
cd src/cmd/go/internal/tool
rf '
  add tool.go:/func runTool\(/-0 var moduleLoaderState *modload.State
  ex {
    import "cmd/go/internal/modload";
    modload.LoaderState -> moduleLoaderState
  }
  add runTool://+0 moduleLoaderState := modload.NewState()
  rm tool.go:/var moduleLoaderState \*modload.State/
'

Change-Id: I0aff1bc2b57d973c258510dc52fb877fa824355c
Reviewed-on: https://go-review.googlesource.com/c/go/+/711128
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2025-10-24 18:09:41 -07:00
Ian Alexander
2e12c5db11 cmd/go: use local state object in test.runTest
This commit modifies `test.runTest` to construct a new modload.State
object using the new constructor instead of the current global
`modload.LoaderState` variable.

This commit is part of the overall effort to eliminate global
modloader state.

[git-generate]
cd src/cmd/go/internal/test
rf '
  add test.go:/func runTest\(/-0 var moduleLoaderState *modload.State
  ex {
    import "cmd/go/internal/modload";
    modload.LoaderState -> moduleLoaderState
  }
  add runTest://+0 moduleLoaderState := modload.NewState()
  rm test.go:/var moduleLoaderState \*modload.State/
'

Change-Id: Ia387160f30818714ab578c5b78713e532cd394df
Reviewed-on: https://go-review.googlesource.com/c/go/+/711127
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>
2025-10-24 18:09:25 -07:00
Ian Alexander
fe345ff2ae cmd/go: use local state object in modget.runGet
This commit modifies `modget.runGet` to construct a new modload.State
object using the new constructor instead of the current global
`modload.LoaderState` variable.

This commit is part of the overall effort to eliminate global
modloader state.

[git-generate]
cd src/cmd/go/internal/modget
rf '
  add get.go:/func runGet\(/-0 var moduleLoaderState *modload.State
  ex {
    import "cmd/go/internal/modload";
    modload.LoaderState -> moduleLoaderState
  }
  add runGet://+0 moduleLoaderState := modload.NewState()
  rm get.go:/var moduleLoaderState \*modload.State/
'

Change-Id: I977c3f57c00b60d383ffd2c2c0d7bc90813c7988
Reviewed-on: https://go-review.googlesource.com/c/go/+/711126
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>
2025-10-24 18:09:07 -07:00
Ian Alexander
d312e27e8b cmd/go: use local state object in pkg modcmd
This commit modifies `modcmd.runDownload` to construct a new
modload.State object using the new constructor instead of the current
global `modload.LoaderState` variable.

This commit is part of the overall effort to eliminate global
modloader state.

[git-generate]
cd src/cmd/go/internal/modcmd
rf '
  add download.go:/func runDownload\(/-0 var moduleLoaderState *modload.State
  ex {
    import "cmd/go/internal/modload";
    modload.LoaderState -> moduleLoaderState
  }
  add runDownload://+0 moduleLoaderState := modload.NewState()
  add runEdit://+0 moduleLoaderState := modload.NewState()
  add runGraph://+0 moduleLoaderState := modload.NewState()
  add runInit://+0 moduleLoaderState := modload.NewState()
  add runTidy://+0 moduleLoaderState := modload.NewState()
  add runVendor://+0 moduleLoaderState := modload.NewState()
  add runVerify://+0 moduleLoaderState := modload.NewState()
  add runWhy://+0 moduleLoaderState := modload.NewState()
  rm download.go:/var moduleLoaderState \*modload.State/
'

Change-Id: Id69deba173032a4d6da228eae28e38bd87176db5
Reviewed-on: https://go-review.googlesource.com/c/go/+/711125
Reviewed-by: Michael Matloob <matloob@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-24 18:08:51 -07:00
Ian Alexander
ea9cf26aa1 cmd/go: use local state object in list.runList
This commit modifies `list.runList` to construct a new modload.State
object using the new constructor instead of the current global
`modload.LoaderState` variable.

This commit is part of the overall effort to eliminate global
modloader state.

[git-generate]
cd src/cmd/go/internal/list
rf '
  add list.go:/func runList\(/-0 var moduleLoaderState *modload.State
  ex {
    import "cmd/go/internal/modload";
    modload.LoaderState -> moduleLoaderState
  }
  add runList://+0 moduleLoaderState := modload.NewState()
  rm list.go:/var moduleLoaderState \*modload.State/
'

Change-Id: I7f45205c1c946189eb05c6178d14ce74ae259547
Reviewed-on: https://go-review.googlesource.com/c/go/+/711124
Reviewed-by: Michael Matloob <matloob@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-24 18:08:37 -07:00
Ian Alexander
9926e1124e cmd/go: use local state object in bug.runBug
This commit modifies `bug.runBug` to construct a new modload.State
object using the new constructor instead of the current global
`modload.LoaderState` variable.

This commit is part of the overall effort to eliminate global
modloader state.

[git-generate]
cd src/cmd/go/internal/bug
rf '
  add bug.go:/func runBug\(/-0 var moduleLoaderState *modload.State
  ex {
    import "cmd/go/internal/modload";
    modload.LoaderState -> moduleLoaderState
  }
  add runBug://+0 moduleLoaderState := modload.NewState()
  rm bug.go:/var moduleLoaderState \*modload.State/
'

Change-Id: Ic4f74d2127f667491136ee4bad4388b4d606821e
Reviewed-on: https://go-review.googlesource.com/c/go/+/711123
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>
2025-10-24 18:08:21 -07:00
Ian Alexander
2c4fd7b2cd cmd/go: use local state object in run.runRun
This commit modifies `run.runRun` to construct a new modload.State
object using the new constructor instead of the current global
`modload.LoaderState` variable.

This commit is part of the overall effort to eliminate global
modloader state.

[git-generate]
cd src/cmd/go/internal/run
rf '
  add run.go:/func runRun\(/-0 var moduleLoaderState *modload.State
  ex {
    import "cmd/go/internal/modload";
    modload.LoaderState -> moduleLoaderState
  }
  add runRun://+0 moduleLoaderState := modload.NewState()
  rm run.go:/var moduleLoaderState \*modload.State/
'

Change-Id: I76e56798b2e0d23a0fefe65d997740e3e411d99d
Reviewed-on: https://go-review.googlesource.com/c/go/+/711116
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-24 18:08:10 -07:00
Ian Alexander
ade9f33e1f cmd/go: add loaderstate as field on mvsReqs
This change modifies the type `mvsReqs` to have an additional field to
store the current module loader state.  The field is used to break the
dependency on the global `modload.LoaderState` variable.

This commit is part of the overall effort to eliminate global
modloader state.

Change-Id: Id6bd96bc5de68bf327f9e78a778173634e1d15d2
Reviewed-on: https://go-review.googlesource.com/c/go/+/711122
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-24 18:07:56 -07:00
Ian Alexander
ccf4192a31 cmd/go: make ImportMissingError work with local state
This change adds fields to the type `ImportMissingError` so
that the `Error()` method can be called without accessing the global
`LoaderState` variable.

This commit is part of the overall effort to eliminate global
modloader state.

Change-Id: Ib313faeb27ae44e9ac68086313633ce742f596dd
Reviewed-on: https://go-review.googlesource.com/c/go/+/711121
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>
2025-10-24 18:07:40 -07:00
Cherry Mui
f5403f15f0 debug/pe: check for zdebug_gdb_scripts section in testDWARF
The debug_gdb_scripts sectino may or may not be compressed. Check
for both.

For #76022.

Change-Id: I7541e0aa2b90f6b3b694e02d3dfa99f9019a9e5a
Reviewed-on: https://go-review.googlesource.com/c/go/+/714461
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2025-10-24 14:17:50 -07:00
Cherry Mui
a26f860fa4 runtime: use 32-bit hash for maps on Wasm
Currently we use 64-bit hash calculations on Wasm. The 64-bit hash
calculation make intensive uses of 64x64->128 bit multiplications,
which on many 64-bit platforms are compiler intrinsics and can be
compiled to one or two instructions. This is not the case on Wasm,
so it is not very performant.

This CL makes it use 32-bit hashes on Wasm, just like other 32-bit
architectures. The 32-bit hash calculation only uses 32x32->64 bit
multiplications, which can be compiled efficiently on Wasm.

Using 32-bit hashes may increase the chance of collisions. But it
is the same as 32-bit architectures like 386. And our Wasm port
supports only 32-bit address space (like 386), so this is not too
bad.

Runtime Hash benchmark results
goos: js
goarch: wasm
pkg: runtime
                     │   0h.txt    │               1h.txt                │
                     │   sec/op    │   sec/op     vs base                │
Hash5                  20.45n ± 9%   14.06n ± 2%  -31.21% (p=0.000 n=10)
Hash16                 22.34n ± 7%   17.52n ± 1%  -21.62% (p=0.000 n=10)
Hash64                 47.47n ± 3%   28.68n ± 1%  -39.59% (p=0.000 n=10)
Hash1024               475.4n ± 1%   271.4n ± 0%  -42.92% (p=0.000 n=10)
Hash65536              28.42µ ± 1%   16.66µ ± 0%  -41.40% (p=0.000 n=10)
HashStringSpeed        40.07n ± 7%   29.23n ± 1%  -27.05% (p=0.000 n=10)
HashBytesSpeed         62.01n ± 3%   46.11n ± 4%  -25.64% (p=0.000 n=10)
HashInt32Speed         24.31n ± 2%   20.39n ± 1%  -16.13% (p=0.000 n=10)
HashInt64Speed         25.48n ± 7%   20.81n ± 7%  -18.29% (p=0.000 n=10)
HashStringArraySpeed   87.69n ± 4%   76.65n ± 2%  -12.58% (p=0.000 n=10)
FastrandHashiter       87.65n ± 1%   87.65n ± 1%        ~ (p=0.896 n=10)
geomean                90.82n        67.03n       -26.19%

Map benchmarks are too many to post here. The speedups are around
0-40%.

Change-Id: I2f7a68cfc446ab5a547fdb6a40aea07854516d51
Reviewed-on: https://go-review.googlesource.com/c/go/+/714600
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-10-24 12:40:49 -07:00
Joe Tsai
747fe2efed encoding/json/v2: fix typo in documentation about errors.AsType
CL 708495 mass migrated the stdlib to use errors.AsType.
It rewrote the documentation, but uses the non-pointer type
of SemanticError or SyntacticError, which is invalid since
the Error method is declared on the pointer receiver.

Also, call errors.AsType on a separate line for readability.

Change-Id: I2eaf59614e2b58aa4bc8669ab81ce64168c54f13
Reviewed-on: https://go-review.googlesource.com/c/go/+/714660
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Auto-Submit: Joseph Tsai <joetsai@digital-static.net>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-24 11:49:08 -07:00
Ian Lance Taylor
94f47fc03f cmd/link: remove pointless assignment in SetSymAlign
This code path became useless after CL 231220.

Change-Id: I35c25368652eeb107350dcd9d1b283429ad3d5e4
Reviewed-on: https://go-review.googlesource.com/c/go/+/714500
Auto-Submit: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-10-24 11:43:28 -07:00
David Chase
f6b4711095 [dev.simd] cmd/compile, simd: add rewrite to convert logical expression trees into TERNLOG instructions
includes tests of both rewrite application and
rewrite correctness

Change-Id: I7983ccf87a8408af95bb6c447cb22f01beda9f61
Reviewed-on: https://go-review.googlesource.com/c/go/+/710697
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-10-24 11:05:14 -07:00
Junyang Shao
cf7c1a4cbb [dev.simd] cmd/compile, simd: add SHA features
This CL also fixed some bugs left in CL 712181.

Change-Id: I9cb6cd9fbaef307f352809bf21b8fec3eb62721a
Reviewed-on: https://go-review.googlesource.com/c/go/+/712361
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-24 10:53:28 -07:00
Junyang Shao
2b8eded4f4 [dev.simd] simd/_gen: parse SHA features from XED
To parse SHA feature instructions from XED, this CL added some utility
to decode fixed reg operands.

SHA512 parsing will be in next CL as we don't have SHA512 cpu features
in src/internal/cpu/cpu.go yet.

Change-Id: Id14cced57eab2ca9e75693a201f4ce7c04981587
Reviewed-on: https://go-review.googlesource.com/c/go/+/712181
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-10-24 10:53:21 -07:00
David Chase
c75965b666 [dev.simd] simd: added String() method to SIMD vectors.
this required a little plumbing to get access
to the "good" floating point formatting.

Change-Id: Iebec157c28a39df59351bade53b09a3729fc49c0
Reviewed-on: https://go-review.googlesource.com/c/go/+/711781
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-24 09:19:39 -07:00
Roland Shoemaker
e6cff69051 crypto/x509: move constraint checking after chain building
The standard approach to constraint checking involves checking the
constraints during chain building. This is typically done as most chain
building algorithms want to find a single chain. We don't do this, and
instead build every valid chain we can find. Because of this, we don't
_need_ to do constraint checking during the chain building stage, and
instead can defer it until we have built all of the potentially valid
chains (we already do this for EKU nesting and policy checking).

This allows us to limit the constraints we check to only chains issued
by trusted roots, which reduces the attack surface for constraint
checking, which is an annoyingly algorithmically complex process (for
now).

To maintain previous behavior, if we see an error during constraint
checking, and we end up with no valid chains, we return the first
constraint checking error, instead of a more verbose error indicating
if there were different problems during filtering. At some point we
probably should come up with a more unified error type for chain
building that can contain information about multiple failure modes.

Change-Id: I5780b3adce8538eb4c3b56ddec52f0723d39009e
Reviewed-on: https://go-review.googlesource.com/c/go/+/713240
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Roland Shoemaker <roland@golang.org>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
2025-10-24 09:13:02 -07:00
Joe Tsai
f5f69a3de9 encoding/json/jsontext: avoid pinning application data in pools
Previously, we put a jsontext.Encoder (or Decoder)
back into a pool with minimal reset logic.
This was semantically safe since we always did a full reset
after obtaining an Encoder/Decoder back out of the pool.

However, this meant that so long as an Encoder/Decoder was
alive in the pool, any application data referenced by the coder
would be kept alive longer than necessary.
Explicitly, clear such fields so that application data
can be more aggressively garbage collected.

Performance:

	name               old time/op    new time/op    delta
	Unmarshal/Bool-32    52.0ns ± 3%    50.3ns ± 3%  -3.30%  (p=0.001 n=10+10)
	Marshal/Bool-32      55.4ns ± 3%    54.4ns ± 2%  -1.75%  (p=0.006 n=10+9)

This only impacts the performance of discrete Marshal/Unmarshal calls.
For the simplest possible call (i.e., to marsha/unmarshal a bool),
there is a 1-2ns slow down. This is an appropriate slowdown
for an improvement in memory utilization.

Change-Id: I5e7d7827473773e53a9dcb3d7fe9052a75481e9f
Reviewed-on: https://go-review.googlesource.com/c/go/+/713640
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
TryBot-Bypass: Damien Neil <dneil@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Auto-Submit: Damien Neil <dneil@google.com>
2025-10-24 09:07:03 -07:00
Joe Tsai
a6a59f0762 encoding/json/v2: use slices.Sort directly
This is semantically identical and just a cleanup.

Prior to #63397, JSON object names were sorted according to UTF-16
to match the semantic of RFC 8785, but there were a number of
objections in the discussion to using that as the sorting order.

In https://github.com/go-json-experiment/json/pull/121,
we switched to sorting by UTF-8, which matches the behavior
of v1 and avoids an option to toggle the behavior.
However, we should have deleted the stringSlice.Sort method
and just directly called slices.Sort.

From a principled perspective, both UTF-16 and UTF-8 are
reasonable ways to sort JSON object names.
RFC 8259 specifies that the entire JSON text is encoded as UTF-8.
However, the way JSON strings are encoded requires escaping
Unicode codepoints according to UTF-16 surragate halves
(a quirk of JavaScript inherited by JSON).
Thus, JSON is inconsistently both UTF-8 and UTF-16.

Change-Id: Id92b5cc20efe4201827e9d3fccf24ccf894d3e60
Reviewed-on: https://go-review.googlesource.com/c/go/+/713522
Reviewed-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Bypass: Damien Neil <dneil@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Damien Neil <dneil@google.com>
2025-10-24 09:05:36 -07:00
Roland Shoemaker
0d3dab9b1d crypto/x509: simplify candidate chain filtering
Use slices.DeleteFunc to remove chains with invalid policies and
incompatible key usage, instead of iterating over the chains and
reconstructing the slice.

Change-Id: I8ad2bc1ac2469d0d18b2c090e3d4f702b1b577cb
Reviewed-on: https://go-review.googlesource.com/c/go/+/708415
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: David Chase <drchase@google.com>
2025-10-24 08:40:50 -07:00
Ian Alexander
29046398bb cmd/go: refactor injection of modload.LoaderState
This change refactors the injection of the global
`modload.LoaderState` variable such that the injection can occur later
in the chain of function calls.  This allows us to keep the behavior
of the global PerPackageFlags (e.g. BuildGcFlags, etc) consistent and
avoid introducing a dependency on the module loader state there.

This commit is part of the overall effort to eliminate global
modloader state.

Change-Id: I1a0cc07173a1804426392581ba8de4ae1e30cdef
Reviewed-on: https://go-review.googlesource.com/c/go/+/711115
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>
2025-10-24 07:27:27 -07:00
Ian Alexander
c18fa69e52 cmd/go: make ErrNoModRoot work with local state
This change reworks the sentinel error value ErrNoModRoot and the type
noMainModulesError so that we can determine the appropriate error
message to display based on the loader state without depending on the
state directly.

This commit is part of the overall effort to eliminate global
modloader state.

Change-Id: I64de433faca96ed90fad4c153766c50575a72157
Reviewed-on: https://go-review.googlesource.com/c/go/+/711120
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2025-10-24 07:25:52 -07:00
Ian Alexander
296ecc918d cmd/go: add modload.State parameter to AllowedFunc
This change makes the following functions methods on the State:
  * CheckAllowed
  * CheckExclusions
  * CheckRetractions

Doing so allows us to reduce the use of the global state variable in
downstream function calls.

This commit is part of the overall effort to eliminate global
modloader state.

Change-Id: I97147311d9de16ecac8c122c2b6bdde94bad9d8f
Reviewed-on: https://go-review.googlesource.com/c/go/+/711119
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-24 07:24:18 -07:00
Ian Alexander
c445a61e52 cmd/go: add loaderstate as field on QueryMatchesMainModulesError
This change modifies the type `QueryMatchesMainModulesError` to have
an additional field to store the current module loader state.  The
field is used to break the dependency on the global
`modload.LoaderState` variable.

This commit is part of the overall effort to eliminate global
modloader state.

Change-Id: Ia2066fab9f3ec4ffdd3d7393dacdf65c0fd35b92
Reviewed-on: https://go-review.googlesource.com/c/go/+/711118
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2025-10-24 07:23:31 -07:00
Ian Alexander
6ac40051d3 cmd/go: remove module loader state from ccompile
This commit is part of the overall effort to eliminate global
modloader state.

Change-Id: Iff90d83b440b39df3d598f5a999e270baa893e24
Reviewed-on: https://go-review.googlesource.com/c/go/+/711134
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>
2025-10-24 07:21:55 -07:00
Ian Alexander
6a5a452528 cmd/go: inject vendor dir into builder struct
This change adds a new field to the Builder struct to store a function
to retrieve the current vendor directory.  This allows us to delay the
determination of the vendor directory until later, which is currently
necessary to successful interaction with the module loader state.
This behavior will be changed in a future CL and the Builder field
will then be removed.

In addition, a new method to get the vendor dir from the module loader
state is added that will return the empty string instead of panicing.

This commit is part of the overall effort to eliminate global
modloader state.

Change-Id: Ib0165edb9502d98ddfa986acf5579c1b746a026f
Reviewed-on: https://go-review.googlesource.com/c/go/+/711133
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-24 07:21:16 -07:00
Felix Stein
dfac972233 crypto/pbkdf2: add missing error return value in example
This function returns two values, one was missing in the example.

Change-Id: I738597f959011260f666c29b7d3ffad8e5cdc473
GitHub-Last-Rev: 5d99e04f7e
GitHub-Pull-Request: golang/go#76032
Reviewed-on: https://go-review.googlesource.com/c/go/+/714420
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Sean Liao <sean@liao.dev>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Sean Liao <sean@liao.dev>
2025-10-23 14:44:03 -07:00
mohanson
47bf8f073e unique: fix inconsistent panic prefix in canonmap cleanup path
Other panic messages in the file use the "unique.canonMap"
prefix, but this one used "internal/sync.HashTrieMap",
looks like it was copied from the "internal/sync" package.

Change-Id: Ic3e85154eb5a593d41c19013d5696afed2178b7e
Reviewed-on: https://go-review.googlesource.com/c/go/+/713660
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Auto-Submit: Sean Liao <sean@liao.dev>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: David Chase <drchase@google.com>
2025-10-23 13:42:09 -07:00
Mark Freeman
03bd43e8bb go/types, types2: rename Named.resolve to unpack
Named.resolve normalizes a named type's representation so that type
operations have a uniform surface to work with, regardless of how
the type was created.

This often gives the type a heavier footprint, such as when filling
in a lazy-loaded type from UIR, or expanding the RHS of an
instantiated type.

For that reason, it seems more appropriate to call this "unpacking"
the type, as it hints to this heavier form. The term "resolving"
is used in many contexts, and generally suggests that we are
trying to figure out what a name means.

Change-Id: Ia733fd68656380b2be4f7433b7b971b7c1422783
Reviewed-on: https://go-review.googlesource.com/c/go/+/713285
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>
2025-10-23 13:20:04 -07:00
Mark Freeman
9fcdc814b2 go/types, types2: rename loaded namedState to lazyLoaded
This is a minor renaming to help differentiate the two kinds of loading
that can happen for named types (eager and lazy).

Use of the term "loaded" suggests that it might also apply to types
which are eagerly-loaded, which is not the case. This change uses
"lazyLoaded" instead to mark this difference.

Change-Id: Iee170024246d9adf3eed978bde2b0500f6d490b7
Reviewed-on: https://go-review.googlesource.com/c/go/+/713282
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-23 13:16:51 -07:00
Mark Freeman
8401512a9b go/types, types2: rename complete namedState to hasMethods
The complete namedState tracks whether an instantiated named type has
expanded all of its methods. In the past, this was the terminal state
of a linear lifecycle, and so a term like "complete" made sense.

Now that we've expanded the lifecycle of named types to a tree structure,
the complete namedState is no longer a terminal state, and so the term
"complete" is now a bit confusing.

This change a) makes the expansion aspect of the complete namedState more
explicit and b) removes a misleading suggestion of terminality by changing
the name from complete to hasMethods.

To take a similar naming convention with the underlying namedState, which
signals presence of Named.underlying, we rename the underlying namedState
to hasUnder.

Change-Id: I29fee26efea3de88c7c1240f2dc53df218acf8b4
Reviewed-on: https://go-review.googlesource.com/c/go/+/713280
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-23 13:04:20 -07:00
Mark Freeman
cf826bfcb4 go/types, types2: set t.underlying exactly once in resolveUnderlying
While the locking in Named.resolveUnderlying is mostly fine, we do not
perform an atomic read before the write to underlying.

If resolveUnderlying returns and another thread was waiting on the lock,
it can perform a second (in this case identical) write to t.underlying.
A reader thread on n.underlying can thus observe either of those writes,
tripping the race detector.

Michael was kind enough to provide a diagram:

   T1                                   T2
1. t.stateHas(underlying) // false
2.                                      t.stateHas(underlying) // false
3. t.mu.Lock() // acquired
4.                                      t.mu.Lock() // blocked
5. t.underlying = u
6. t.setState(underlying)
7. t.mu.Unlock()
8.                                      t.underlying = u // overwritten
9.                                      t.setState(underlying)
10.                                     t.mu.Unlock()

Adding a second check before setting t.underlying prevents the write on
line 8.

Change-Id: Ia43a6d3ba751caef436b9926c6ece2a71dfb9d38
Reviewed-on: https://go-review.googlesource.com/c/go/+/714300
Auto-Submit: Mark Freeman <markfreeman@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-23 13:01:36 -07:00
Julien Cretel
c4e910895b net/url: speed up escape and unescape
This change adds a generated 8-bit bitmask for use in functions shouldEscape and ishex.

Function shouldEscape is now inlineable. Function escape is now much faster;
function unescape is a bit faster. Here are some benchmark results (no change
to allocations):

goos: darwin
goarch: amd64
pkg: net/url
cpu: Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
                    │     old      │                 new                 │
                    │    sec/op    │   sec/op     vs base                │
QueryEscape/#00-8      58.38n ± 1%   35.98n ± 1%  -38.38% (p=0.000 n=20)
QueryEscape/#01-8     303.50n ± 0%   94.77n ± 0%  -68.77% (p=0.000 n=20)
QueryEscape/#02-8     202.90n ± 0%   78.66n ± 1%  -61.23% (p=0.000 n=20)
QueryEscape/#03-8      444.5n ± 0%   145.9n ± 0%  -67.17% (p=0.000 n=20)
QueryEscape/#04-8     2678.0n ± 0%   913.7n ± 0%  -65.88% (p=0.000 n=20)
PathEscape/#00-8       81.34n ± 0%   44.64n ± 1%  -45.12% (p=0.000 n=20)
PathEscape/#01-8      307.65n ± 0%   96.71n ± 1%  -68.56% (p=0.000 n=20)
PathEscape/#02-8      200.80n ± 1%   78.25n ± 0%  -61.03% (p=0.000 n=20)
PathEscape/#03-8       450.1n ± 1%   145.5n ± 0%  -67.67% (p=0.000 n=20)
PathEscape/#04-8      2663.5n ± 0%   876.5n ± 0%  -67.09% (p=0.000 n=20)
QueryUnescape/#00-8    53.32n ± 1%   51.67n ± 1%   -3.09% (p=0.000 n=20)
QueryUnescape/#01-8    161.0n ± 1%   136.2n ± 1%  -15.40% (p=0.000 n=20)
QueryUnescape/#02-8    126.1n ± 1%   118.3n ± 1%   -6.23% (p=0.000 n=20)
QueryUnescape/#03-8    294.6n ± 0%   273.1n ± 0%   -7.30% (p=0.000 n=20)
QueryUnescape/#04-8    1.511µ ± 0%   1.411µ ± 0%   -6.62% (p=0.000 n=20)
PathUnescape/#00-8     63.84n ± 1%   53.59n ± 1%  -16.05% (p=0.000 n=20)
PathUnescape/#01-8     163.6n ± 3%   137.9n ± 1%  -15.71% (p=0.000 n=20)
PathUnescape/#02-8     126.4n ± 1%   119.1n ± 1%   -5.78% (p=0.000 n=20)
PathUnescape/#03-8     294.2n ± 0%   273.3n ± 0%   -7.12% (p=0.000 n=20)
PathUnescape/#04-8     1.554µ ± 0%   1.417µ ± 0%   -8.78% (p=0.000 n=20)
geomean                277.8n        162.7n       -41.44%

This change draws heavy inspiration from CL 174998, which showed promise but stalled years ago.

Updates #17860

Change-Id: Idcbb1696608998b9e2fc91e1f2a488d8f1f6028c
GitHub-Last-Rev: ff360c2f1b
GitHub-Pull-Request: golang/go#75914
Reviewed-on: https://go-review.googlesource.com/c/go/+/712200
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Takuto Nagami <logica0419@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2025-10-23 11:58:12 -07:00
qiulaidongfeng
3f6ac3a10f go/build: use slices.Equal
Change-Id: Id10293b6fe7a5916599fd4684430d694bb8c8920
Reviewed-on: https://go-review.googlesource.com/c/go/+/690615
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Sean Liao <sean@liao.dev>
2025-10-23 11:27:27 -07:00
Roland Shoemaker
839da71f89 encoding/pem: properly calculate end indexes
When a block is missing the END line trailer, calculate the indexes of
the end and end trailer _before_ continuing the loop, making the
reslicing at the start of the loop work as expected.

Change-Id: If45c8cb473315623618f02cc7609f517a72d232d
Reviewed-on: https://go-review.googlesource.com/c/go/+/714200
Auto-Submit: Roland Shoemaker <roland@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-23 08:52:44 -07:00
Joel Sing
39ed968832 cmd: update golang.org/x/arch for riscv64 disassembler
Update to a newer version of golang.org/x/arch, in order to bring in
changes to the riscv64 disassembler, including support for vector and
zicond instructions:

  go get golang.org/x/arch@fea4a9e
  go mod tidy
  go mod vendor

Change-Id: I19623f76a63cee7d0f83d9f6c2305554ed5d5efb
Reviewed-on: https://go-review.googlesource.com/c/go/+/714140
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Joel Sing <joel@sing.id.au>
2025-10-23 07:51:54 -07:00
cuishuang
ca448191c9 all: replace Split in loops with more efficient SplitSeq
Find these replacements through https://pkg.go.dev/golang.org/x/tools/gopls/internal/analysis/modernize.

Change-Id: If88fe0e109b7c7557bfb3d3ffc15271af1ab5856
Reviewed-on: https://go-review.googlesource.com/c/go/+/668437
Reviewed-by: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Sean Liao <sean@liao.dev>
Reviewed-by: David Chase <drchase@google.com>
2025-10-23 07:34:31 -07:00
cuishuang
107fcb70de internal/goroot: replace HasPrefix+TrimPrefix with CutPrefix
Change-Id: I97305df6babbede57bb0c3b48c89c96cb74307f7
Reviewed-on: https://go-review.googlesource.com/c/go/+/668456
Auto-Submit: Sean Liao <sean@liao.dev>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2025-10-23 07:31:44 -07:00
Russ Cox
8378276d66 strconv: optimize int-to-decimal and use consistently
Integer-to-decimal conversion is hand-written in multiple
places in this package, with different incomplete optimizations
in  different copies. This CL establishes a single implementation,
formatBase10, accurately optimized for a variety of systems,
and then uses it consistently.

Removed the fastSmalls const, which has been true since 2017.
Also renamed smallsString to smalls.

benchmark \ host                    local  linux-arm64       s7  linux-amd64  linux-ppc64le  linux-s390x  linux-arm  s7:GOARCH=386  linux-386
                                  vs base      vs base  vs base      vs base        vs base      vs base    vs base        vs base    vs base
AppendFloat/Decimal                     ~            ~        ~            ~              ~            ~     +0.99%              ~          ~
AppendFloat/Float                       ~            ~        ~       +2.67%              ~            ~     -0.17%              ~          ~
AppendFloat/Exp                         ~            ~        ~            ~         -5.01%       -0.88%     -0.14%              ~          ~
AppendFloat/NegExp                      ~            ~        ~       +1.80%              ~       -1.55%     -0.67%              ~          ~
AppendFloat/LongExp                     ~            ~        ~       -1.36%         -2.34%            ~     +0.41%              ~          ~
AppendFloat/Big                         ~            ~        ~       -3.94%         -2.66%       -0.61%     +1.01%              ~          ~
AppendFloat/BinaryExp              -5.86%       -2.20%   -3.27%      -17.16%         -6.89%            ~    -61.81%        -33.80%    -27.61%
AppendFloat/32Integer                   ~            ~        ~            ~              ~            ~     +0.74%              ~          ~
AppendFloat/32ExactFraction             ~            ~        ~       +2.96%              ~            ~     +0.09%         +1.62%          ~
AppendFloat/32Point                     ~            ~        ~            ~              ~            ~     +1.31%              ~          ~
AppendFloat/32Exp                       ~            ~        ~            ~         -4.05%            ~     -0.05%              ~          ~
AppendFloat/32NegExp                    ~            ~        ~       -0.86%         -4.97%            ~     +0.23%              ~          ~
AppendFloat/32Shortest                  ~            ~        ~            ~              ~            ~     +0.72%              ~          ~
AppendFloat/32Fixed8Hard           +4.58%       +1.94%   +2.77%       -4.39%              ~       +4.39%     -9.36%        -11.97%    -15.71%
AppendFloat/32Fixed9Hard           +4.52%       +5.41%   +4.13%       +3.10%         -4.84%      +14.34%     -3.83%         -1.84%     -6.42%
AppendFloat/64Fixed1               +3.37%       +3.45%   +1.31%            ~         +6.93%       +4.79%     -2.99%         -2.07%     -5.51%
AppendFloat/64Fixed2               +3.44%       +3.46%   +0.80%            ~         +6.03%       +6.51%     -3.07%         -2.23%     -6.47%
AppendFloat/64Fixed3               +5.27%       +3.06%        ~       +2.08%              ~       +6.20%     -2.85%         -3.07%     -6.21%
AppendFloat/64Fixed4               +7.82%       +3.70%   +2.25%       +2.01%         +5.18%       +5.68%     -2.18%         -1.31%     -3.55%
AppendFloat/64Fixed12              +3.81%       +3.67%        ~       +3.91%              ~       +5.71%     -9.49%        -12.13%    -11.63%
AppendFloat/64Fixed16              -6.26%       -1.42%   -3.37%       -3.15%         -2.03%       +1.15%    -16.18%        -21.43%    -20.40%
AppendFloat/64Fixed12Hard               ~       +2.34%   -1.44%            ~         -1.99%       +9.96%    -10.34%        -13.89%    -13.23%
AppendFloat/64Fixed17Hard          -3.86%       -0.96%   -3.23%       -2.85%         -5.54%       +9.12%    -15.76%        -19.37%    -18.01%
AppendFloat/64Fixed18Hard               ~            ~   -1.34%            ~              ~            ~          ~              ~          ~
AppendFloat/Slowpath64                  ~            ~        ~            ~              ~       -0.63%     +0.94%              ~          ~
AppendFloat/SlowpathDenormal64          ~            ~        ~       -0.96%              ~       -0.53%     +0.65%         +1.08%          ~
AppendUint                         -5.10%       +2.64%   -4.21%       -8.75%         -1.69%       -9.73%    -60.54%        -18.30%    -22.34%
AppendUintVarlen/digits=1          +2.91%       +4.79%   -7.80%            ~         +7.60%            ~     -4.13%              ~     +3.56%
AppendUintVarlen/digits=2               ~       -0.36%        ~            ~              ~       +0.99%     -5.45%              ~     +2.71%
AppendUintVarlen/digits=3          -3.69%       -9.19%   -5.28%      -11.24%        -12.90%      -28.62%    -42.12%        -43.20%    -32.72%
AppendUintVarlen/digits=4          -5.18%      -14.79%   -6.11%      -11.44%        -17.82%      -31.59%    -39.66%        -40.86%    -27.99%
AppendUintVarlen/digits=5               ~       -8.76%  -11.18%      -15.73%         -6.94%      -16.84%    -37.31%        -40.43%    -29.18%
AppendUintVarlen/digits=6          -1.48%       -8.18%  -11.67%      -15.29%         -5.74%      -16.51%    -38.73%        -39.42%    -26.00%
AppendUintVarlen/digits=7          -9.34%       -9.38%  -14.86%      -18.42%         -4.30%      -12.42%    -35.23%        -38.90%    -26.84%
AppendUintVarlen/digits=8         -10.37%       -8.50%  -17.32%      -17.57%         -6.52%      -21.17%    -35.56%        -37.64%    -22.88%
AppendUintVarlen/digits=9         -15.94%      -10.40%  -16.51%      -21.68%         -8.14%      -12.55%    -33.50%        -36.50%    -23.86%
AppendUintVarlen/digits=10         -4.16%       +7.58%   -6.11%       -7.51%         -5.73%       -7.21%    -40.04%        -26.20%    -25.59%
AppendUintVarlen/digits=11         -9.66%       -3.38%  -12.55%      -14.52%         -5.92%      -16.85%    -46.87%        -34.70%    -32.89%
AppendUintVarlen/digits=12         -7.75%       +3.13%   -5.16%      -11.19%         -5.28%       -9.87%    -52.39%        -33.95%    -33.40%
AppendUintVarlen/digits=13        -14.43%       -6.62%  -12.24%      -16.02%         -3.26%      -18.73%    -57.28%        -33.80%    -31.58%
AppendUintVarlen/digits=14         -8.62%       +0.74%   -7.87%      -13.63%         -3.57%      -10.55%    -62.94%        -34.30%    -35.06%
AppendUintVarlen/digits=15        -14.52%       -6.86%  -14.08%      -17.37%         -4.55%      -23.38%    -61.99%        -33.33%    -32.28%
AppendUintVarlen/digits=16        -10.77%       -2.06%   -7.70%      -15.64%         -4.43%      -13.30%    -64.95%        -33.08%    -32.25%
AppendUintVarlen/digits=17        -14.18%       -8.84%  -12.96%      -18.62%         -7.55%      -21.40%    -66.71%        -31.96%    -31.40%
AppendUintVarlen/digits=18        -11.04%       -3.66%   -8.43%      -16.19%         -5.77%      -11.42%    -71.09%        -31.44%    -32.31%
AppendUintVarlen/digits=19         -8.62%       +0.33%   -9.66%      -12.56%         -5.37%      -11.96%    -71.30%        -23.09%    -31.52%
AppendUintVarlen/digits=20         -9.26%       +0.36%   -6.55%      -12.95%         -6.83%      -13.41%    -74.49%        -31.80%    -38.76%

host: local
                                 │ 428dc15ab39 │             c6ec0aa13de             │
                                 │   sec/op    │   sec/op     vs base                │
AppendFloat/Decimal-4              40.13n ± 2%   40.15n ± 2%        ~ (p=0.773 n=40)
AppendFloat/Float-4                56.98n ± 1%   57.27n ± 1%        ~ (p=0.394 n=40)
AppendFloat/Exp-4                  61.46n ± 1%   61.52n ± 1%        ~ (p=0.829 n=40)
AppendFloat/NegExp-4               60.24n ± 1%   59.99n ± 2%        ~ (p=0.912 n=40)
AppendFloat/LongExp-4              62.09n ± 2%   62.37n ± 2%        ~ (p=0.394 n=40)
AppendFloat/Big-4                  67.41n ± 1%   66.99n ± 1%        ~ (p=0.292 n=40)
AppendFloat/BinaryExp-4            32.27n ± 2%   30.38n ± 2%   -5.86% (p=0.000 n=40)
AppendFloat/32Integer-4            39.68n ± 1%   39.34n ± 1%        ~ (p=0.233 n=40)
AppendFloat/32ExactFraction-4      57.95n ± 1%   57.88n ± 2%        ~ (p=0.900 n=40)
AppendFloat/32Point-4              56.40n ± 1%   56.58n ± 2%        ~ (p=0.196 n=40)
AppendFloat/32Exp-4                63.12n ± 2%   63.39n ± 1%        ~ (p=0.082 n=40)
AppendFloat/32NegExp-4             59.64n ± 1%   60.29n ± 1%        ~ (p=0.192 n=40)
AppendFloat/32Shortest-4           51.58n ± 1%   51.98n ± 0%        ~ (p=0.082 n=40)
AppendFloat/32Fixed8Hard-4         39.91n ± 1%   41.74n ± 1%   +4.58% (p=0.000 n=40)
AppendFloat/32Fixed9Hard-4         43.56n ± 1%   45.53n ± 1%   +4.52% (p=0.000 n=40)
AppendFloat/64Fixed1-4             34.61n ± 2%   35.77n ± 2%   +3.37% (p=0.000 n=40)
AppendFloat/64Fixed2-4             33.91n ± 1%   35.07n ± 1%   +3.44% (p=0.000 n=40)
AppendFloat/64Fixed3-4             35.36n ± 1%   37.23n ± 1%   +5.27% (p=0.000 n=40)
AppendFloat/64Fixed4-4             33.95n ± 1%   36.60n ± 1%   +7.82% (p=0.000 n=40)
AppendFloat/64Fixed12-4            57.03n ± 1%   59.20n ± 2%   +3.81% (p=0.000 n=40)
AppendFloat/64Fixed16-4            51.82n ± 1%   48.58n ± 0%   -6.26% (p=0.000 n=40)
AppendFloat/64Fixed12Hard-4        48.32n ± 1%   49.00n ± 0%        ~ (p=0.118 n=40)
AppendFloat/64Fixed17Hard-4        57.40n ± 2%   55.18n ± 5%   -3.86% (p=0.000 n=40)
AppendFloat/64Fixed18Hard-4        3.298µ ± 1%   3.291µ ± 1%        ~ (p=0.927 n=40)
AppendFloat/Slowpath64-4           61.94n ± 3%   62.08n ± 3%        ~ (p=0.324 n=40)
AppendFloat/SlowpathDenormal64-4   59.94n ± 1%   59.82n ± 1%        ~ (p=0.288 n=40)
AppendUint-4                       180.6n ± 2%   171.3n ± 2%   -5.10% (p=0.000 n=40)
AppendUintVarlen/digits=1-4        4.475n ± 0%   4.605n ± 0%   +2.91% (p=0.000 n=40)
AppendUintVarlen/digits=2-4        4.424n ± 1%   4.486n ± 1%        ~ (p=0.025 n=40)
AppendUintVarlen/digits=3-4        12.46n ± 4%   12.00n ± 4%   -3.69% (p=0.000 n=40)
AppendUintVarlen/digits=4-4        11.68n ± 2%   11.08n ± 2%   -5.18% (p=0.000 n=40)
AppendUintVarlen/digits=5-4        11.89n ± 0%   11.82n ± 0%        ~ (p=0.001 n=40)
AppendUintVarlen/digits=6-4        12.18n ± 0%   12.00n ± 0%   -1.48% (p=0.000 n=40)
AppendUintVarlen/digits=7-4        13.49n ± 2%   12.23n ± 2%   -9.34% (p=0.000 n=40)
AppendUintVarlen/digits=8-4        13.21n ± 1%   11.84n ± 2%  -10.37% (p=0.000 n=40)
AppendUintVarlen/digits=9-4        15.21n ± 2%   12.79n ± 2%  -15.94% (p=0.000 n=40)
AppendUintVarlen/digits=10-4       15.49n ± 3%   14.85n ± 2%   -4.16% (p=0.000 n=40)
AppendUintVarlen/digits=11-4       16.82n ± 1%   15.20n ± 1%   -9.66% (p=0.000 n=40)
AppendUintVarlen/digits=12-4       17.42n ± 2%   16.07n ± 3%   -7.75% (p=0.000 n=40)
AppendUintVarlen/digits=13-4       18.75n ± 2%   16.05n ± 2%  -14.43% (p=0.000 n=40)
AppendUintVarlen/digits=14-4       18.90n ± 1%   17.27n ± 2%   -8.62% (p=0.000 n=40)
AppendUintVarlen/digits=15-4       20.49n ± 2%   17.52n ± 1%  -14.52% (p=0.000 n=40)
AppendUintVarlen/digits=16-4       21.08n ± 1%   18.81n ± 1%  -10.77% (p=0.000 n=40)
AppendUintVarlen/digits=17-4       22.64n ± 1%   19.43n ± 1%  -14.18% (p=0.000 n=40)
AppendUintVarlen/digits=18-4       22.96n ± 2%   20.42n ± 3%  -11.04% (p=0.000 n=40)
AppendUintVarlen/digits=19-4       24.58n ± 0%   22.46n ± 0%   -8.62% (p=0.000 n=40)
AppendUintVarlen/digits=20-4       25.23n ± 2%   22.89n ± 0%   -9.26% (p=0.000 n=40)
geomean                            33.23n        32.17n        -3.18%

host: linux-arm64
                                 │  428dc15ab39  │              c6ec0aa13de              │
                                 │    sec/op     │    sec/op      vs base                │
AppendFloat/Decimal-4              61.13n ± 0% ¹   61.15n ± 0% ¹        ~ (p=0.006 n=40)
AppendFloat/Float-4                88.90n ± 0% ¹   88.88n ± 0% ¹        ~ (p=0.528 n=40)
AppendFloat/Exp-4                  92.87n ± 0% ¹   92.87n ± 0% ¹        ~ (p=0.795 n=40)
AppendFloat/NegExp-4               93.06n ± 0% ¹   93.10n ± 0% ¹        ~ (p=0.031 n=40)
AppendFloat/LongExp-4              100.3n ± 0% ¹   100.3n ± 0% ¹        ~ (p=0.184 n=40)
AppendFloat/Big-4                  105.5n ± 0% ¹   105.6n ± 0% ¹        ~ (p=0.007 n=40)
AppendFloat/BinaryExp-4            47.80n ± 0% ¹   46.75n ± 0% ¹   -2.20% (p=0.000 n=40)
AppendFloat/32Integer-4            61.24n ± 0% ¹   61.24n ± 0% ¹        ~ (p=0.809 n=40)
AppendFloat/32ExactFraction-4      85.63n ± 0% ¹   85.69n ± 0% ¹        ~ (p=0.002 n=40)
AppendFloat/32Point-4              83.23n ± 0% ¹   83.24n ± 0% ¹        ~ (p=0.410 n=40)
AppendFloat/32Exp-4                92.18n ± 0% ¹   92.19n ± 0% ¹        ~ (p=0.104 n=40)
AppendFloat/32NegExp-4             87.69n ± 0% ¹   87.70n ± 0% ¹        ~ (p=0.106 n=40)
AppendFloat/32Shortest-4           77.13n ± 0% ¹   77.12n ± 0% ¹        ~ (p=0.599 n=40)
AppendFloat/32Fixed8Hard-4         54.55n ± 0% ¹   55.61n ± 0% ¹   +1.94% (p=0.000 n=40)
AppendFloat/32Fixed9Hard-4         60.91n ± 0% ¹   64.21n ± 0% ¹   +5.41% (p=0.000 n=40)
AppendFloat/64Fixed1-4             51.37n ± 0% ¹   53.14n ± 0% ¹   +3.45% (p=0.000 n=40)
AppendFloat/64Fixed2-4             50.34n ± 0% ¹   52.08n ± 0% ¹   +3.46% (p=0.000 n=40)
AppendFloat/64Fixed3-4             50.91n ± 0% ¹   52.47n ± 0% ¹   +3.06% (p=0.000 n=40)
AppendFloat/64Fixed4-4             48.59n ± 0% ¹   50.39n ± 0% ¹   +3.70% (p=0.000 n=40)
AppendFloat/64Fixed12-4            81.00n ± 0% ¹   83.98n ± 0% ¹   +3.67% (p=0.000 n=40)
AppendFloat/64Fixed16-4            71.60n ± 0% ¹   70.59n ± 0% ¹   -1.42% (p=0.000 n=40)
AppendFloat/64Fixed12Hard-4        66.07n ± 0% ¹   67.62n ± 0% ¹   +2.34% (p=0.000 n=40)
AppendFloat/64Fixed17Hard-4        79.00n ± 0% ¹   78.24n ± 0% ¹   -0.96% (p=0.000 n=40)
AppendFloat/64Fixed18Hard-4        4.290µ ± 0% ¹   4.291µ ± 0% ¹        ~ (p=0.674 n=40)
AppendFloat/Slowpath64-4           97.87n ± 0% ¹   97.88n ± 0% ¹        ~ (p=0.847 n=40)
AppendFloat/SlowpathDenormal64-4   95.66n ± 0% ¹   95.66n ± 0% ¹        ~ (p=0.519 n=40)
AppendUint-4                       269.2n ± 0% ¹   276.3n ± 0% ¹   +2.64% (p=0.000 n=40)
AppendUintVarlen/digits=1-4        6.106n ± 0% ¹   6.398n ± 0% ¹   +4.79% (p=0.000 n=40)
AppendUintVarlen/digits=2-4        6.082n ± 0% ¹   6.060n ± 0% ¹   -0.36% (p=0.000 n=40)
AppendUintVarlen/digits=3-4        13.39n ± 0% ¹   12.16n ± 0% ¹   -9.19% (p=0.000 n=40)
AppendUintVarlen/digits=4-4        15.01n ± 0% ¹   12.79n ± 0% ¹  -14.79% (p=0.000 n=40)
AppendUintVarlen/digits=5-4        15.92n ± 0% ¹   14.52n ± 0% ¹   -8.76% (p=0.000 n=40)
AppendUintVarlen/digits=6-4        16.25n ± 0% ¹   14.92n ± 0% ¹   -8.18% (p=0.000 n=40)
AppendUintVarlen/digits=7-4        18.71n ± 0% ¹   16.96n ± 0% ¹   -9.38% (p=0.000 n=40)
AppendUintVarlen/digits=8-4        18.94n ± 0% ¹   17.33n ± 0% ¹   -8.50% (p=0.000 n=40)
AppendUintVarlen/digits=9-4        21.73n ± 0% ¹   19.47n ± 0% ¹  -10.40% (p=0.000 n=40)
AppendUintVarlen/digits=10-4       22.02n ± 0% ¹   23.69n ± 0% ¹   +7.58% (p=0.000 n=40)
AppendUintVarlen/digits=11-4       24.85n ± 0% ¹   24.01n ± 0% ¹   -3.38% (p=0.000 n=40)
AppendUintVarlen/digits=12-4       25.21n ± 0% ¹   26.00n ± 0% ¹   +3.13% (p=0.000 n=40)
AppendUintVarlen/digits=13-4       28.01n ± 0% ¹   26.15n ± 0% ¹   -6.62% (p=0.000 n=40)
AppendUintVarlen/digits=14-4       28.36n ± 0% ¹   28.57n ± 0% ¹   +0.74% (p=0.000 n=40)
AppendUintVarlen/digits=15-4       31.20n ± 0% ¹   29.06n ± 0% ¹   -6.86% (p=0.000 n=40)
AppendUintVarlen/digits=16-4       31.55n ± 0% ¹   30.90n ± 0% ¹   -2.06% (p=0.000 n=40)
AppendUintVarlen/digits=17-4       35.05n ± 0% ¹   31.95n ± 0% ¹   -8.84% (p=0.000 n=40)
AppendUintVarlen/digits=18-4       35.50n ± 0% ¹   34.20n ± 0% ¹   -3.66% (p=0.000 n=40)
AppendUintVarlen/digits=19-4       38.22n ± 0% ¹   38.34n ± 0% ¹   +0.33% (p=0.000 n=40)
AppendUintVarlen/digits=20-4       38.68n ± 0% ¹   38.82n ± 0% ¹   +0.36% (p=0.000 n=40)
geomean                            48.25n          47.59n          -1.36%
¹ benchmarks vary in cpu

host: s7
                                 │ 428dc15ab39  │             c6ec0aa13de             │
                                 │    sec/op    │   sec/op     vs base                │
AppendFloat/Decimal-4               23.81n ± 1%   23.76n ± 1%        ~ (p=0.885 n=40)
AppendFloat/Float-4                 36.85n ± 1%   36.97n ± 1%        ~ (p=0.002 n=40)
AppendFloat/Exp-4                   36.82n ± 1%   36.59n ± 1%        ~ (p=0.292 n=40)
AppendFloat/NegExp-4                37.44n ± 1%   37.41n ± 1%        ~ (p=0.596 n=40)
AppendFloat/LongExp-4               39.82n ± 1%   39.78n ± 1%        ~ (p=0.025 n=40)
AppendFloat/Big-4                   41.94n ± 1%   41.81n ± 1%        ~ (p=0.054 n=40)
AppendFloat/BinaryExp-4             20.18n ± 1%   19.52n ± 0%   -3.27% (p=0.000 n=40)
AppendFloat/32Integer-4             23.88n ± 0%   23.92n ± 0%        ~ (p=0.408 n=40)
AppendFloat/32ExactFraction-4       36.45n ± 1%   36.26n ± 0%        ~ (p=0.088 n=40)
AppendFloat/32Point-4               35.23n ± 1%   35.33n ± 1%        ~ (p=0.470 n=40)
AppendFloat/32Exp-4                 38.04n ± 1%   37.89n ± 1%        ~ (p=0.885 n=40)
AppendFloat/32NegExp-4              36.20n ± 0%   36.21n ± 1%        ~ (p=0.923 n=40)
AppendFloat/32Shortest-4            32.55n ± 0%   32.42n ± 1%        ~ (p=0.238 n=40)
AppendFloat/32Fixed8Hard-4          24.70n ± 0%   25.38n ± 1%   +2.77% (p=0.000 n=40)
AppendFloat/32Fixed9Hard-4          27.13n ± 0%   28.25n ± 1%   +4.13% (p=0.000 n=40)
AppendFloat/64Fixed1-4              21.40n ± 0%   21.68n ± 1%   +1.31% (p=0.000 n=40)
AppendFloat/64Fixed2-4              21.17n ± 0%   21.33n ± 1%   +0.80% (p=0.001 n=40)
AppendFloat/64Fixed3-4              22.09n ± 1%   22.29n ± 1%        ~ (p=0.003 n=40)
AppendFloat/64Fixed4-4              21.38n ± 1%   21.86n ± 1%   +2.25% (p=0.000 n=40)
AppendFloat/64Fixed12-4             35.17n ± 0%   35.28n ± 1%        ~ (p=0.125 n=40)
AppendFloat/64Fixed16-4             32.02n ± 1%   30.94n ± 1%   -3.37% (p=0.000 n=40)
AppendFloat/64Fixed12Hard-4         29.79n ± 1%   29.36n ± 0%   -1.44% (p=0.000 n=40)
AppendFloat/64Fixed17Hard-4         34.79n ± 1%   33.66n ± 0%   -3.23% (p=0.000 n=40)
AppendFloat/64Fixed18Hard-4         1.983µ ± 1%   1.956µ ± 1%   -1.34% (p=0.000 n=40)
AppendFloat/Slowpath64-4            38.15n ± 0%   37.84n ± 1%        ~ (p=0.039 n=40)
AppendFloat/SlowpathDenormal64-4    38.06n ± 1%   38.24n ± 1%        ~ (p=0.025 n=40)
AppendUint-4                        121.0n ± 0%   115.9n ± 1%   -4.21% (p=0.000 n=40)
AppendUintVarlen/digits=1-4         2.557n ± 1%   2.358n ± 4%   -7.80% (p=0.000 n=40)
AppendUintVarlen/digits=2-4         2.387n ± 4%   2.405n ± 4%        ~ (p=0.149 n=40)
AppendUintVarlen/digits=3-4         6.198n ± 1%   5.871n ± 1%   -5.28% (p=0.000 n=40)
AppendUintVarlen/digits=4-4         6.196n ± 0%   5.817n ± 1%   -6.11% (p=0.000 n=40)
AppendUintVarlen/digits=5-4         6.773n ± 1%   6.016n ± 1%  -11.18% (p=0.000 n=40)
AppendUintVarlen/digits=6-4         6.948n ± 1%   6.136n ± 1%  -11.67% (p=0.000 n=40)
AppendUintVarlen/digits=7-4         8.157n ± 1%   6.944n ± 1%  -14.86% (p=0.000 n=40)
AppendUintVarlen/digits=8-4         8.364n ± 1%   6.915n ± 0%  -17.32% (p=0.000 n=40)
AppendUintVarlen/digits=9-4         9.740n ± 1%   8.132n ± 1%  -16.51% (p=0.000 n=40)
AppendUintVarlen/digits=10-4        9.836n ± 1%   9.235n ± 1%   -6.11% (p=0.000 n=40)
AppendUintVarlen/digits=11-4       11.000n ± 1%   9.620n ± 0%  -12.55% (p=0.000 n=40)
AppendUintVarlen/digits=12-4        11.14n ± 1%   10.57n ± 1%   -5.16% (p=0.000 n=40)
AppendUintVarlen/digits=13-4        12.30n ± 1%   10.79n ± 1%  -12.24% (p=0.000 n=40)
AppendUintVarlen/digits=14-4        12.44n ± 1%   11.46n ± 0%   -7.87% (p=0.000 n=40)
AppendUintVarlen/digits=15-4        13.71n ± 1%   11.78n ± 1%  -14.08% (p=0.000 n=40)
AppendUintVarlen/digits=16-4        13.82n ± 1%   12.76n ± 1%   -7.70% (p=0.000 n=40)
AppendUintVarlen/digits=17-4        14.97n ± 1%   13.03n ± 0%  -12.96% (p=0.000 n=40)
AppendUintVarlen/digits=18-4        15.36n ± 1%   14.06n ± 1%   -8.43% (p=0.000 n=40)
AppendUintVarlen/digits=19-4        16.40n ± 1%   14.81n ± 1%   -9.66% (p=0.000 n=40)
AppendUintVarlen/digits=20-4        16.48n ± 0%   15.40n ± 1%   -6.55% (p=0.000 n=40)
geomean                             20.56n        19.65n        -4.42%

host: linux-amd64
                                 │ 428dc15ab39 │             c6ec0aa13de             │
                                 │   sec/op    │   sec/op     vs base                │
AppendFloat/Decimal-4              64.49n ± 0%   64.79n ± 2%        ~ (p=0.169 n=40)
AppendFloat/Float-4                95.98n ± 4%   98.54n ± 4%   +2.67% (p=0.000 n=40)
AppendFloat/Exp-4                  97.10n ± 1%   97.99n ± 4%        ~ (p=0.002 n=40)
AppendFloat/NegExp-4               98.10n ± 0%   99.87n ± 4%   +1.80% (p=0.000 n=40)
AppendFloat/LongExp-4              106.7n ± 4%   105.3n ± 4%   -1.36% (p=0.001 n=40)
AppendFloat/Big-4                  116.8n ± 3%   112.3n ± 4%   -3.94% (p=0.001 n=40)
AppendFloat/BinaryExp-4            57.70n ± 3%   47.79n ± 3%  -17.16% (p=0.000 n=40)
AppendFloat/32Integer-4            64.75n ± 3%   64.71n ± 3%        ~ (p=0.700 n=40)
AppendFloat/32ExactFraction-4      91.48n ± 2%   94.19n ± 3%   +2.96% (p=0.000 n=40)
AppendFloat/32Point-4              92.48n ± 2%   92.73n ± 4%        ~ (p=0.389 n=40)
AppendFloat/32Exp-4                103.6n ± 2%   103.4n ± 1%        ~ (p=0.069 n=40)
AppendFloat/32NegExp-4             95.16n ± 1%   94.33n ± 0%   -0.86% (p=0.001 n=40)
AppendFloat/32Shortest-4           85.43n ± 4%   84.89n ± 1%        ~ (p=0.082 n=40)
AppendFloat/32Fixed8Hard-4         64.42n ± 3%   61.59n ± 0%   -4.39% (p=0.000 n=40)
AppendFloat/32Fixed9Hard-4         69.74n ± 3%   71.91n ± 4%   +3.10% (p=0.000 n=40)
AppendFloat/64Fixed1-4             59.70n ± 3%   59.16n ± 4%        ~ (p=0.051 n=40)
AppendFloat/64Fixed2-4             58.73n ± 2%   58.03n ± 0%        ~ (p=0.110 n=40)
AppendFloat/64Fixed3-4             57.92n ± 4%   59.13n ± 4%   +2.08% (p=0.000 n=40)
AppendFloat/64Fixed4-4             55.21n ± 3%   56.33n ± 4%   +2.01% (p=0.000 n=40)
AppendFloat/64Fixed12-4            87.98n ± 3%   91.42n ± 1%   +3.91% (p=0.000 n=40)
AppendFloat/64Fixed16-4            80.05n ± 3%   77.52n ± 4%   -3.15% (p=0.000 n=40)
AppendFloat/64Fixed12Hard-4        75.03n ± 4%   74.99n ± 0%        ~ (p=0.641 n=40)
AppendFloat/64Fixed17Hard-4        87.45n ± 1%   84.96n ± 2%   -2.85% (p=0.000 n=40)
AppendFloat/64Fixed18Hard-4        4.903µ ± 3%   4.912µ ± 3%        ~ (p=0.829 n=40)
AppendFloat/Slowpath64-4           101.8n ± 1%   101.4n ± 4%        ~ (p=0.268 n=40)
AppendFloat/SlowpathDenormal64-4   101.0n ± 4%   100.1n ± 3%   -0.96% (p=0.000 n=40)
AppendUint-4                       336.7n ± 1%   307.2n ± 0%   -8.75% (p=0.000 n=40)
AppendUintVarlen/digits=1-4        6.069n ± 1%   6.069n ± 1%        ~ (p=0.904 n=40)
AppendUintVarlen/digits=2-4        5.920n ± 3%   5.925n ± 3%        ~ (p=0.010 n=40)
AppendUintVarlen/digits=3-4        16.33n ± 1%   14.49n ± 2%  -11.24% (p=0.000 n=40)
AppendUintVarlen/digits=4-4        16.70n ± 2%   14.79n ± 2%  -11.44% (p=0.000 n=40)
AppendUintVarlen/digits=5-4        19.33n ± 1%   16.29n ± 1%  -15.73% (p=0.000 n=40)
AppendUintVarlen/digits=6-4        20.15n ± 2%   17.07n ± 1%  -15.29% (p=0.000 n=40)
AppendUintVarlen/digits=7-4        22.78n ± 2%   18.58n ± 1%  -18.42% (p=0.000 n=40)
AppendUintVarlen/digits=8-4        23.56n ± 3%   19.43n ± 2%  -17.57% (p=0.000 n=40)
AppendUintVarlen/digits=9-4        27.12n ± 3%   21.24n ± 3%  -21.68% (p=0.000 n=40)
AppendUintVarlen/digits=10-4       27.10n ± 2%   25.07n ± 3%   -7.51% (p=0.000 n=40)
AppendUintVarlen/digits=11-4       29.72n ± 3%   25.41n ± 3%  -14.52% (p=0.000 n=40)
AppendUintVarlen/digits=12-4       30.35n ± 3%   26.95n ± 4%  -11.19% (p=0.000 n=40)
AppendUintVarlen/digits=13-4       32.98n ± 0%   27.70n ± 3%  -16.02% (p=0.000 n=40)
AppendUintVarlen/digits=14-4       33.89n ± 2%   29.28n ± 3%  -13.63% (p=0.000 n=40)
AppendUintVarlen/digits=15-4       36.45n ± 3%   30.11n ± 1%  -17.37% (p=0.000 n=40)
AppendUintVarlen/digits=16-4       37.12n ± 0%   31.31n ± 1%  -15.64% (p=0.000 n=40)
AppendUintVarlen/digits=17-4       39.84n ± 1%   32.42n ± 0%  -18.62% (p=0.000 n=40)
AppendUintVarlen/digits=18-4       40.53n ± 0%   33.97n ± 3%  -16.19% (p=0.000 n=40)
AppendUintVarlen/digits=19-4       43.20n ± 4%   37.78n ± 0%  -12.56% (p=0.000 n=40)
AppendUintVarlen/digits=20-4       43.87n ± 1%   38.19n ± 0%  -12.95% (p=0.000 n=40)
geomean                            54.70n        51.10n        -6.58%

host: linux-ppc64le
                                 │ 428dc15ab39  │             c6ec0aa13de             │
                                 │    sec/op    │   sec/op     vs base                │
AppendFloat/Decimal-4               55.69n ± 3%   56.06n ± 3%        ~ (p=0.821 n=40)
AppendFloat/Float-4                 79.23n ± 1%   77.13n ± 3%        ~ (p=0.019 n=40)
AppendFloat/Exp-4                   91.14n ± 2%   86.58n ± 2%   -5.01% (p=0.000 n=40)
AppendFloat/NegExp-4                90.77n ± 1%   85.43n ± 6%        ~ (p=0.003 n=40)
AppendFloat/LongExp-4               93.40n ± 2%   91.21n ± 2%   -2.34% (p=0.000 n=40)
AppendFloat/Big-4                  101.55n ± 3%   98.84n ± 2%   -2.66% (p=0.000 n=40)
AppendFloat/BinaryExp-4             45.16n ± 3%   42.05n ± 2%   -6.89% (p=0.000 n=40)
AppendFloat/32Integer-4             56.50n ± 3%   57.45n ± 2%        ~ (p=0.821 n=40)
AppendFloat/32ExactFraction-4       80.94n ± 2%   80.60n ± 1%        ~ (p=0.106 n=40)
AppendFloat/32Point-4               77.03n ± 3%   76.69n ± 2%        ~ (p=0.242 n=40)
AppendFloat/32Exp-4                 92.44n ± 1%   88.70n ± 1%   -4.05% (p=0.000 n=40)
AppendFloat/32NegExp-4              89.50n ± 2%   85.06n ± 2%   -4.97% (p=0.000 n=40)
AppendFloat/32Shortest-4            74.63n ± 2%   72.75n ± 4%        ~ (p=0.042 n=40)
AppendFloat/32Fixed8Hard-4          58.18n ± 2%   56.86n ± 1%        ~ (p=0.002 n=40)
AppendFloat/32Fixed9Hard-4          64.17n ± 1%   61.06n ± 1%   -4.84% (p=0.000 n=40)
AppendFloat/64Fixed1-4              47.56n ± 2%   50.86n ± 1%   +6.93% (p=0.000 n=40)
AppendFloat/64Fixed2-4              47.87n ± 4%   50.75n ± 2%   +6.03% (p=0.000 n=40)
AppendFloat/64Fixed3-4              50.84n ± 2%   51.68n ± 1%        ~ (p=0.014 n=40)
AppendFloat/64Fixed4-4              46.29n ± 3%   48.69n ± 4%   +5.18% (p=0.000 n=40)
AppendFloat/64Fixed12-4             79.97n ± 1%   85.03n ± 4%        ~ (p=0.001 n=40)
AppendFloat/64Fixed16-4             73.18n ± 1%   71.70n ± 2%   -2.03% (p=0.000 n=40)
AppendFloat/64Fixed12Hard-4         68.41n ± 4%   67.06n ± 1%   -1.99% (p=0.000 n=40)
AppendFloat/64Fixed17Hard-4         81.02n ± 1%   76.54n ± 1%   -5.54% (p=0.000 n=40)
AppendFloat/64Fixed18Hard-4         5.184µ ± 0%   5.215µ ± 1%        ~ (p=0.056 n=40)
AppendFloat/Slowpath64-4            89.16n ± 2%   88.85n ± 2%        ~ (p=0.405 n=40)
AppendFloat/SlowpathDenormal64-4    84.27n ± 3%   84.38n ± 1%        ~ (p=0.424 n=40)
AppendUint-4                        277.5n ± 1%   272.9n ± 1%   -1.69% (p=0.000 n=40)
AppendUintVarlen/digits=1-4         5.044n ± 3%   5.428n ± 1%   +7.60% (p=0.000 n=40)
AppendUintVarlen/digits=2-4         5.051n ± 1%   5.038n ± 2%        ~ (p=0.613 n=40)
AppendUintVarlen/digits=3-4         12.13n ± 4%   10.57n ± 2%  -12.90% (p=0.000 n=40)
AppendUintVarlen/digits=4-4         13.33n ± 3%   10.95n ± 1%  -17.82% (p=0.000 n=40)
AppendUintVarlen/digits=5-4         14.05n ± 2%   13.08n ± 3%   -6.94% (p=0.000 n=40)
AppendUintVarlen/digits=6-4         14.46n ± 2%   13.63n ± 2%   -5.74% (p=0.000 n=40)
AppendUintVarlen/digits=7-4         17.11n ± 4%   16.38n ± 1%   -4.30% (p=0.000 n=40)
AppendUintVarlen/digits=8-4         17.34n ± 5%   16.20n ± 1%   -6.52% (p=0.000 n=40)
AppendUintVarlen/digits=9-4         21.06n ± 2%   19.34n ± 2%   -8.14% (p=0.000 n=40)
AppendUintVarlen/digits=10-4        21.11n ± 2%   19.90n ± 1%   -5.73% (p=0.000 n=40)
AppendUintVarlen/digits=11-4        24.25n ± 4%   22.81n ± 1%   -5.92% (p=0.000 n=40)
AppendUintVarlen/digits=12-4        24.53n ± 3%   23.23n ± 2%   -5.28% (p=0.000 n=40)
AppendUintVarlen/digits=13-4        27.14n ± 5%   26.26n ± 1%   -3.26% (p=0.000 n=40)
AppendUintVarlen/digits=14-4        27.72n ± 6%   26.73n ± 0%   -3.57% (p=0.000 n=40)
AppendUintVarlen/digits=15-4        31.23n ± 3%   29.80n ± 1%   -4.55% (p=0.000 n=40)
AppendUintVarlen/digits=16-4        30.78n ± 3%   29.41n ± 1%   -4.43% (p=0.000 n=40)
AppendUintVarlen/digits=17-4        35.04n ± 1%   32.39n ± 0%   -7.55% (p=0.000 n=40)
AppendUintVarlen/digits=18-4        35.10n ± 7%   33.08n ± 0%   -5.77% (p=0.000 n=40)
AppendUintVarlen/digits=19-4        38.26n ± 6%   36.21n ± 0%   -5.37% (p=0.000 n=40)
AppendUintVarlen/digits=20-4        39.24n ± 3%   36.56n ± 0%   -6.83% (p=0.000 n=40)
geomean                             46.39n        44.95n        -3.11%

host: linux-s390x
                                 │  428dc15ab39  │              c6ec0aa13de               │
                                 │    sec/op     │     sec/op      vs base                │
AppendFloat/Decimal-4              70.92n ± 0% ¹    70.81n ± 1% ¹        ~ (p=0.668 n=40)
AppendFloat/Float-4                111.5n ± 0% ¹    111.8n ± 0% ¹        ~ (p=0.143 n=40)
AppendFloat/Exp-4                  119.1n ± 1% ¹    118.1n ± 1% ¹   -0.88% (p=0.000 n=40)
AppendFloat/NegExp-4               119.7n ± 0% ¹    117.8n ± 0% ¹   -1.55% (p=0.000 n=40)
AppendFloat/LongExp-4              128.1n ± 0% ¹    127.8n ± 1% ¹        ~ (p=0.181 n=40)
AppendFloat/Big-4                  131.3n ± 1% ¹    130.5n ± 1% ¹   -0.61% (p=0.001 n=40)
AppendFloat/BinaryExp-4            58.47n ± 0% ¹    58.29n ± 0% ¹        ~ (p=0.189 n=40)
AppendFloat/32Integer-4            72.66n ± 0% ¹    72.31n ± 1% ¹        ~ (p=0.012 n=40)
AppendFloat/32ExactFraction-4      108.6n ± 0% ¹    108.5n ± 1% ¹        ~ (p=0.754 n=40)
AppendFloat/32Point-4              108.6n ± 1% ¹    108.2n ± 0% ¹        ~ (p=0.073 n=40)
AppendFloat/32Exp-4                116.9n ± 1% ¹    117.8n ± 0% ¹        ~ (p=0.008 n=40)
AppendFloat/32NegExp-4             117.9n ± 0% ¹    118.0n ± 0% ¹        ~ (p=0.954 n=40)
AppendFloat/32Shortest-4           107.7n ± 1% ¹    107.0n ± 1% ¹        ~ (p=0.106 n=40)
AppendFloat/32Fixed8Hard-4         71.77n ± 1% ¹    74.92n ± 1% ¹   +4.39% (p=0.000 n=40)
AppendFloat/32Fixed9Hard-4         73.49n ± 0% ¹    84.03n ± 0% ¹  +14.34% (p=0.000 n=40)
AppendFloat/64Fixed1-4             63.55n ± 1% ¹    66.59n ± 1% ¹   +4.79% (p=0.000 n=40)
AppendFloat/64Fixed2-4             61.74n ± 1% ¹    65.77n ± 1% ¹   +6.51% (p=0.000 n=40)
AppendFloat/64Fixed3-4             63.84n ± 2% ¹    67.80n ± 1% ¹   +6.20% (p=0.000 n=40)
AppendFloat/64Fixed4-4             60.41n ± 1% ¹    63.84n ± 1% ¹   +5.68% (p=0.000 n=40)
AppendFloat/64Fixed12-4            98.06n ± 0% ¹   103.65n ± 0% ¹   +5.71% (p=0.000 n=40)
AppendFloat/64Fixed16-4            86.71n ± 0% ¹    87.70n ± 0% ¹   +1.15% (p=0.000 n=40)
AppendFloat/64Fixed12Hard-4        80.62n ± 1% ¹    88.65n ± 1% ¹   +9.96% (p=0.000 n=40)
AppendFloat/64Fixed17Hard-4        89.77n ± 1% ¹    97.96n ± 1% ¹   +9.12% (p=0.000 n=40)
AppendFloat/64Fixed18Hard-4        4.791µ ± 0% ¹    4.790µ ± 0% ¹        ~ (p=0.973 n=40)
AppendFloat/Slowpath64-4           126.0n ± 0% ¹    125.2n ± 0% ¹   -0.63% (p=0.000 n=40)
AppendFloat/SlowpathDenormal64-4   121.7n ± 0% ¹    121.1n ± 0% ¹   -0.53% (p=0.001 n=40)
AppendUint-4                       374.6n ± 1% ¹    338.2n ± 0% ¹   -9.73% (p=0.000 n=40)
AppendUintVarlen/digits=1-4        5.433n ± 0% ¹    5.416n ± 0% ¹        ~ (p=0.032 n=40)
AppendUintVarlen/digits=2-4        5.357n ± 0% ¹    5.410n ± 0% ¹   +0.99% (p=0.000 n=40)
AppendUintVarlen/digits=3-4        17.45n ± 0% ¹    12.46n ± 0% ¹  -28.62% (p=0.000 n=40)
AppendUintVarlen/digits=4-4        17.38n ± 0% ¹    11.89n ± 0% ¹  -31.59% (p=0.000 n=40)
AppendUintVarlen/digits=5-4        21.38n ± 0% ¹    17.78n ± 1% ¹  -16.84% (p=0.000 n=40)
AppendUintVarlen/digits=6-4        21.60n ± 0% ¹    18.03n ± 1% ¹  -16.51% (p=0.000 n=40)
AppendUintVarlen/digits=7-4        26.44n ± 0% ¹    23.15n ± 0% ¹  -12.42% (p=0.000 n=40)
AppendUintVarlen/digits=8-4        26.60n ± 0% ¹    20.97n ± 1% ¹  -21.17% (p=0.000 n=40)
AppendUintVarlen/digits=9-4        31.44n ± 0% ¹    27.49n ± 0% ¹  -12.55% (p=0.000 n=40)
AppendUintVarlen/digits=10-4       31.26n ± 1% ¹    29.00n ± 0% ¹   -7.21% (p=0.000 n=40)
AppendUintVarlen/digits=11-4       35.90n ± 0% ¹    29.84n ± 0% ¹  -16.85% (p=0.000 n=40)
AppendUintVarlen/digits=12-4       35.95n ± 0% ¹    32.40n ± 0% ¹   -9.87% (p=0.000 n=40)
AppendUintVarlen/digits=13-4       40.98n ± 0% ¹    33.31n ± 0% ¹  -18.73% (p=0.000 n=40)
AppendUintVarlen/digits=14-4       38.96n ± 0% ¹    34.85n ± 0% ¹  -10.55% (p=0.000 n=40)
AppendUintVarlen/digits=15-4       45.51n ± 0% ¹    34.87n ± 0% ¹  -23.38% (p=0.000 n=40)
AppendUintVarlen/digits=16-4       45.05n ± 0% ¹    39.05n ± 0% ¹  -13.30% (p=0.000 n=40)
AppendUintVarlen/digits=17-4       50.76n ± 0% ¹    39.89n ± 0% ¹  -21.40% (p=0.000 n=40)
AppendUintVarlen/digits=18-4       49.86n ± 1% ¹    44.16n ± 0% ¹  -11.42% (p=0.000 n=40)
AppendUintVarlen/digits=19-4       54.68n ± 0% ¹    48.14n ± 0% ¹  -11.96% (p=0.000 n=40)
AppendUintVarlen/digits=20-4       55.48n ± 0% ¹    48.04n ± 0% ¹  -13.41% (p=0.000 n=40)
geomean                            62.00n           58.40n          -5.80%
¹ benchmarks vary in cpu

host: linux-arm
                                 │ 428dc15ab39  │             c6ec0aa13de             │
                                 │    sec/op    │   sec/op     vs base                │
AppendFloat/Decimal-4               121.6n ± 0%   122.8n ± 0%   +0.99% (p=0.000 n=40)
AppendFloat/Float-4                 209.1n ± 0%   208.8n ± 0%   -0.17% (p=0.000 n=40)
AppendFloat/Exp-4                   208.8n ± 0%   208.5n ± 0%   -0.14% (p=0.000 n=40)
AppendFloat/NegExp-4                210.1n ± 0%   208.7n ± 0%   -0.67% (p=0.000 n=40)
AppendFloat/LongExp-4               217.5n ± 0%   218.4n ± 0%   +0.41% (p=0.000 n=40)
AppendFloat/Big-4                   237.8n ± 0%   240.2n ± 0%   +1.01% (p=0.000 n=40)
AppendFloat/BinaryExp-4            226.90n ± 0%   86.66n ± 0%  -61.81% (p=0.000 n=40)
AppendFloat/32Integer-4             121.9n ± 0%   122.8n ± 0%   +0.74% (p=0.000 n=40)
AppendFloat/32ExactFraction-4       174.0n ± 0%   174.1n ± 0%   +0.09% (p=0.000 n=40)
AppendFloat/32Point-4               171.9n ± 0%   174.2n ± 0%   +1.31% (p=0.000 n=40)
AppendFloat/32Exp-4                 195.4n ± 0%   195.3n ± 0%   -0.05% (p=0.000 n=40)
AppendFloat/32NegExp-4              174.0n ± 0%   174.4n ± 0%   +0.23% (p=0.000 n=40)
AppendFloat/32Shortest-4            167.5n ± 0%   168.7n ± 0%   +0.72% (p=0.000 n=40)
AppendFloat/32Fixed8Hard-4          115.4n ± 0%   104.6n ± 0%   -9.36% (p=0.000 n=40)
AppendFloat/32Fixed9Hard-4          144.9n ± 0%   139.3n ± 0%   -3.83% (p=0.000 n=40)
AppendFloat/64Fixed1-4              127.3n ± 0%   123.5n ± 0%   -2.99% (p=0.000 n=40)
AppendFloat/64Fixed2-4              123.6n ± 0%   119.8n ± 0%   -3.07% (p=0.000 n=40)
AppendFloat/64Fixed3-4              122.8n ± 0%   119.3n ± 0%   -2.85% (p=0.000 n=40)
AppendFloat/64Fixed4-4              114.5n ± 0%   112.0n ± 0%   -2.18% (p=0.000 n=40)
AppendFloat/64Fixed12-4             161.3n ± 0%   146.0n ± 0%   -9.49% (p=0.000 n=40)
AppendFloat/64Fixed16-4             168.7n ± 0%   141.4n ± 0%  -16.18% (p=0.000 n=40)
AppendFloat/64Fixed12Hard-4         152.3n ± 0%   136.6n ± 0%  -10.34% (p=0.000 n=40)
AppendFloat/64Fixed17Hard-4         182.7n ± 0%   153.9n ± 0%  -15.76% (p=0.000 n=40)
AppendFloat/64Fixed18Hard-4         7.976µ ± 0%   7.977µ ± 0%        ~ (p=0.093 n=40)
AppendFloat/Slowpath64-4            213.4n ± 0%   215.4n ± 0%   +0.94% (p=0.000 n=40)
AppendFloat/SlowpathDenormal64-4    214.0n ± 0%   215.4n ± 0%   +0.65% (p=0.000 n=40)
AppendUint-4                       1526.0n ± 0%   602.1n ± 0%  -60.54% (p=0.000 n=40)
AppendUintVarlen/digits=1-4         9.338n ± 0%   8.953n ± 0%   -4.13% (p=0.000 n=40)
AppendUintVarlen/digits=2-4         9.789n ± 0%   9.256n ± 0%   -5.45% (p=0.000 n=40)
AppendUintVarlen/digits=3-4         46.42n ± 0%   26.87n ± 0%  -42.12% (p=0.000 n=40)
AppendUintVarlen/digits=4-4         49.23n ± 0%   29.70n ± 0%  -39.66% (p=0.000 n=40)
AppendUintVarlen/digits=5-4         51.45n ± 0%   32.25n ± 0%  -37.31% (p=0.000 n=40)
AppendUintVarlen/digits=6-4         51.02n ± 0%   31.26n ± 0%  -38.73% (p=0.000 n=40)
AppendUintVarlen/digits=7-4         55.45n ± 0%   35.91n ± 0%  -35.23% (p=0.000 n=40)
AppendUintVarlen/digits=8-4         57.11n ± 0%   36.80n ± 0%  -35.56% (p=0.000 n=40)
AppendUintVarlen/digits=9-4         59.28n ± 0%   39.42n ± 0%  -33.50% (p=0.000 n=40)
AppendUintVarlen/digits=10-4        71.62n ± 0%   42.94n ± 0%  -40.04% (p=0.000 n=40)
AppendUintVarlen/digits=11-4        91.41n ± 0%   48.57n ± 0%  -46.87% (p=0.000 n=40)
AppendUintVarlen/digits=12-4       106.50n ± 0%   50.70n ± 0%  -52.39% (p=0.000 n=40)
AppendUintVarlen/digits=13-4       121.90n ± 0%   52.07n ± 0%  -57.28% (p=0.000 n=40)
AppendUintVarlen/digits=14-4       129.70n ± 0%   48.07n ± 0%  -62.94% (p=0.000 n=40)
AppendUintVarlen/digits=15-4       148.50n ± 0%   56.45n ± 0%  -61.99% (p=0.000 n=40)
AppendUintVarlen/digits=16-4       167.40n ± 0%   58.67n ± 0%  -64.95% (p=0.000 n=40)
AppendUintVarlen/digits=17-4       179.70n ± 0%   59.83n ± 0%  -66.71% (p=0.000 n=40)
AppendUintVarlen/digits=18-4       186.00n ± 0%   53.78n ± 0%  -71.09% (p=0.000 n=40)
AppendUintVarlen/digits=19-4       216.50n ± 0%   62.13n ± 0%  -71.30% (p=0.000 n=40)
AppendUintVarlen/digits=20-4       246.80n ± 0%   62.96n ± 0%  -74.49% (p=0.000 n=40)
geomean                             136.3n        95.52n       -29.95%

host: s7:GOARCH=386
                                 │ 428dc15ab39  │             c6ec0aa13de              │
                                 │    sec/op    │    sec/op     vs base                │
AppendFloat/Decimal-4               51.07n ± 1%    51.05n ± 0%        ~ (p=0.346 n=40)
AppendFloat/Float-4                 94.44n ± 1%    95.05n ± 0%        ~ (p=0.343 n=40)
AppendFloat/Exp-4                   97.89n ± 0%    98.59n ± 0%        ~ (p=0.271 n=40)
AppendFloat/NegExp-4                98.22n ± 1%    99.27n ± 0%        ~ (p=0.283 n=40)
AppendFloat/LongExp-4               100.3n ± 0%    101.4n ± 0%        ~ (p=0.001 n=40)
AppendFloat/Big-4                   109.1n ± 0%    110.0n ± 1%        ~ (p=0.141 n=40)
AppendFloat/BinaryExp-4             53.98n ± 1%    35.74n ± 1%  -33.80% (p=0.000 n=40)
AppendFloat/32Integer-4             49.90n ± 0%    50.41n ± 0%        ~ (p=0.005 n=40)
AppendFloat/32ExactFraction-4       78.22n ± 0%    79.49n ± 0%   +1.62% (p=0.000 n=40)
AppendFloat/32Point-4               75.75n ± 1%    75.90n ± 0%        ~ (p=0.119 n=40)
AppendFloat/32Exp-4                 89.74n ± 1%    90.58n ± 0%        ~ (p=0.088 n=40)
AppendFloat/32NegExp-4              79.34n ± 1%    80.22n ± 0%        ~ (p=0.005 n=40)
AppendFloat/32Shortest-4            74.46n ± 1%    74.43n ± 1%        ~ (p=1.000 n=40)
AppendFloat/32Fixed8Hard-4          47.28n ± 1%    41.62n ± 0%  -11.97% (p=0.000 n=40)
AppendFloat/32Fixed9Hard-4          64.92n ± 1%    63.72n ± 1%   -1.84% (p=0.000 n=40)
AppendFloat/64Fixed1-4              58.40n ± 1%    57.19n ± 1%   -2.07% (p=0.000 n=40)
AppendFloat/64Fixed2-4              55.79n ± 1%    54.55n ± 1%   -2.23% (p=0.000 n=40)
AppendFloat/64Fixed3-4              56.70n ± 1%    54.95n ± 0%   -3.07% (p=0.000 n=40)
AppendFloat/64Fixed4-4              51.85n ± 1%    51.18n ± 0%   -1.31% (p=0.000 n=40)
AppendFloat/64Fixed12-4             74.00n ± 0%    65.02n ± 0%  -12.13% (p=0.000 n=40)
AppendFloat/64Fixed16-4             80.23n ± 1%    63.04n ± 0%  -21.43% (p=0.000 n=40)
AppendFloat/64Fixed12Hard-4         70.64n ± 1%    60.83n ± 1%  -13.89% (p=0.000 n=40)
AppendFloat/64Fixed17Hard-4         86.02n ± 1%    69.36n ± 0%  -19.37% (p=0.000 n=40)
AppendFloat/64Fixed18Hard-4         3.736µ ± 1%    3.795µ ± 0%        ~ (p=0.010 n=40)
AppendFloat/Slowpath64-4            99.18n ± 1%   100.25n ± 0%        ~ (p=0.003 n=40)
AppendFloat/SlowpathDenormal64-4    97.35n ± 1%    98.41n ± 0%   +1.08% (p=0.001 n=40)
AppendUint-4                        356.3n ± 1%    291.2n ± 0%  -18.30% (p=0.000 n=40)
AppendUintVarlen/digits=1-4         3.923n ± 0%    3.919n ± 1%        ~ (p=0.061 n=40)
AppendUintVarlen/digits=2-4         3.917n ± 1%    3.924n ± 0%        ~ (p=0.048 n=40)
AppendUintVarlen/digits=3-4        17.205n ± 0%    9.772n ± 0%  -43.20% (p=0.000 n=40)
AppendUintVarlen/digits=4-4         17.18n ± 0%    10.16n ± 1%  -40.86% (p=0.000 n=40)
AppendUintVarlen/digits=5-4         18.33n ± 1%    10.92n ± 0%  -40.43% (p=0.000 n=40)
AppendUintVarlen/digits=6-4         18.67n ± 1%    11.31n ± 0%  -39.42% (p=0.000 n=40)
AppendUintVarlen/digits=7-4         19.77n ± 1%    12.08n ± 0%  -38.90% (p=0.000 n=40)
AppendUintVarlen/digits=8-4         19.95n ± 1%    12.44n ± 1%  -37.64% (p=0.000 n=40)
AppendUintVarlen/digits=9-4         21.44n ± 1%    13.61n ± 1%  -36.50% (p=0.000 n=40)
AppendUintVarlen/digits=10-4        24.31n ± 0%    17.94n ± 0%  -26.20% (p=0.000 n=40)
AppendUintVarlen/digits=11-4        27.75n ± 1%    18.12n ± 0%  -34.70% (p=0.000 n=40)
AppendUintVarlen/digits=12-4        28.76n ± 1%    18.99n ± 0%  -33.95% (p=0.000 n=40)
AppendUintVarlen/digits=13-4        29.12n ± 1%    19.28n ± 0%  -33.80% (p=0.000 n=40)
AppendUintVarlen/digits=14-4        30.56n ± 0%    20.07n ± 1%  -34.30% (p=0.000 n=40)
AppendUintVarlen/digits=15-4        30.71n ± 1%    20.48n ± 0%  -33.33% (p=0.000 n=40)
AppendUintVarlen/digits=16-4        31.86n ± 0%    21.32n ± 0%  -33.08% (p=0.000 n=40)
AppendUintVarlen/digits=17-4        31.51n ± 1%    21.43n ± 1%  -31.96% (p=0.000 n=40)
AppendUintVarlen/digits=18-4        32.46n ± 0%    22.26n ± 1%  -31.44% (p=0.000 n=40)
AppendUintVarlen/digits=19-4        35.42n ± 1%    27.25n ± 1%  -23.09% (p=0.000 n=40)
AppendUintVarlen/digits=20-4        39.50n ± 2%    26.94n ± 1%  -31.80% (p=0.000 n=40)
geomean                             48.59n         39.98n       -17.73%

host: linux-386
                                 │ 428dc15ab39  │             c6ec0aa13de             │
                                 │    sec/op    │   sec/op     vs base                │
AppendFloat/Decimal-4               148.4n ± 2%   147.8n ± 1%        ~ (p=0.053 n=40)
AppendFloat/Float-4                 284.1n ± 2%   281.9n ± 1%        ~ (p=0.001 n=40)
AppendFloat/Exp-4                   294.5n ± 3%   292.7n ± 1%        ~ (p=0.035 n=40)
AppendFloat/NegExp-4                295.4n ± 1%   295.9n ± 3%        ~ (p=0.799 n=40)
AppendFloat/LongExp-4               305.8n ± 2%   304.9n ± 2%        ~ (p=0.186 n=40)
AppendFloat/Big-4                   340.1n ± 3%   340.8n ± 4%        ~ (p=0.069 n=40)
AppendFloat/BinaryExp-4             139.1n ± 0%   100.7n ± 1%  -27.61% (p=0.000 n=40)
AppendFloat/32Integer-4             149.2n ± 2%   148.4n ± 3%        ~ (p=0.450 n=40)
AppendFloat/32ExactFraction-4       247.1n ± 4%   249.9n ± 3%        ~ (p=0.005 n=40)
AppendFloat/32Point-4               231.5n ± 4%   233.9n ± 2%        ~ (p=0.288 n=40)
AppendFloat/32Exp-4                 286.9n ± 3%   284.5n ± 0%        ~ (p=0.015 n=40)
AppendFloat/32NegExp-4              244.5n ± 1%   244.3n ± 4%        ~ (p=0.637 n=40)
AppendFloat/32Shortest-4            227.4n ± 0%   227.2n ± 1%        ~ (p=0.161 n=40)
AppendFloat/32Fixed8Hard-4          146.8n ± 1%   123.7n ± 2%  -15.71% (p=0.000 n=40)
AppendFloat/32Fixed9Hard-4          218.7n ± 3%   204.7n ± 1%   -6.42% (p=0.000 n=40)
AppendFloat/64Fixed1-4              194.3n ± 0%   183.7n ± 3%   -5.51% (p=0.000 n=40)
AppendFloat/64Fixed2-4              184.8n ± 1%   172.8n ± 0%   -6.47% (p=0.000 n=40)
AppendFloat/64Fixed3-4              186.1n ± 3%   174.6n ± 3%   -6.21% (p=0.000 n=40)
AppendFloat/64Fixed4-4              164.9n ± 3%   159.1n ± 3%   -3.55% (p=0.000 n=40)
AppendFloat/64Fixed12-4             233.9n ± 2%   206.7n ± 3%  -11.63% (p=0.000 n=40)
AppendFloat/64Fixed16-4             253.2n ± 4%   201.5n ± 1%  -20.40% (p=0.000 n=40)
AppendFloat/64Fixed12Hard-4         224.0n ± 1%   194.4n ± 1%  -13.23% (p=0.000 n=40)
AppendFloat/64Fixed17Hard-4         282.4n ± 2%   231.5n ± 4%  -18.01% (p=0.000 n=40)
AppendFloat/64Fixed18Hard-4         15.92µ ± 3%   15.73µ ± 2%        ~ (p=0.172 n=40)
AppendFloat/Slowpath64-4            305.2n ± 2%   300.0n ± 3%        ~ (p=0.016 n=40)
AppendFloat/SlowpathDenormal64-4    297.1n ± 2%   294.0n ± 1%        ~ (p=0.075 n=40)
AppendUint-4                       1218.5n ± 1%   946.2n ± 1%  -22.34% (p=0.000 n=40)
AppendUintVarlen/digits=1-4         8.735n ± 2%   9.046n ± 3%   +3.56% (p=0.000 n=40)
AppendUintVarlen/digits=2-4         8.752n ± 1%   8.990n ± 1%   +2.71% (p=0.000 n=40)
AppendUintVarlen/digits=3-4         32.45n ± 2%   21.84n ± 1%  -32.72% (p=0.000 n=40)
AppendUintVarlen/digits=4-4         33.23n ± 1%   23.93n ± 3%  -27.99% (p=0.000 n=40)
AppendUintVarlen/digits=5-4         39.00n ± 3%   27.61n ± 2%  -29.18% (p=0.000 n=40)
AppendUintVarlen/digits=6-4         38.87n ± 2%   28.76n ± 2%  -26.00% (p=0.000 n=40)
AppendUintVarlen/digits=7-4         42.55n ± 1%   31.13n ± 3%  -26.84% (p=0.000 n=40)
AppendUintVarlen/digits=8-4         43.13n ± 3%   33.26n ± 1%  -22.88% (p=0.000 n=40)
AppendUintVarlen/digits=9-4         48.54n ± 3%   36.96n ± 1%  -23.86% (p=0.000 n=40)
AppendUintVarlen/digits=10-4        68.81n ± 1%   51.20n ± 1%  -25.59% (p=0.000 n=40)
AppendUintVarlen/digits=11-4        78.96n ± 1%   52.99n ± 1%  -32.89% (p=0.000 n=40)
AppendUintVarlen/digits=12-4        83.14n ± 2%   55.37n ± 2%  -33.40% (p=0.000 n=40)
AppendUintVarlen/digits=13-4        83.74n ± 1%   57.30n ± 2%  -31.58% (p=0.000 n=40)
AppendUintVarlen/digits=14-4        90.47n ± 1%   58.75n ± 3%  -35.06% (p=0.000 n=40)
AppendUintVarlen/digits=15-4        90.35n ± 3%   61.18n ± 1%  -32.28% (p=0.000 n=40)
AppendUintVarlen/digits=16-4        94.12n ± 1%   63.77n ± 2%  -32.25% (p=0.000 n=40)
AppendUintVarlen/digits=17-4        93.81n ± 0%   64.35n ± 3%  -31.40% (p=0.000 n=40)
AppendUintVarlen/digits=18-4        99.25n ± 1%   67.18n ± 3%  -32.31% (p=0.000 n=40)
AppendUintVarlen/digits=19-4       118.70n ± 0%   81.28n ± 1%  -31.52% (p=0.000 n=40)
AppendUintVarlen/digits=20-4       135.90n ± 1%   83.23n ± 1%  -38.76% (p=0.000 n=40)
geomean                             140.3n        117.7n       -16.12%

Change-Id: If5e2151c397701b23dbc69f20e57b99728898e90
Reviewed-on: https://go-review.googlesource.com/c/go/+/712662
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
2025-10-23 07:26:02 -07:00
Joel Sing
e5688d0bdd cmd/internal/obj/riscv: simplify validation and encoding of raw instructions
Use wantImmU/immU rather than handrolling the same code. This also corrects
the validation output - add tests to ensure this is the case.

Change-Id: Id48f459c7c0de09ddde7a10506f66a3a269f325f
Reviewed-on: https://go-review.googlesource.com/c/go/+/702396
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-10-23 05:38:59 -07:00
Alan Donovan
77fc27972a doc/next: improve new(expr) release note
One reader pointed out that the example isn't compelling because
&age would have worked just as well. This CL changes the example
to use a nontrivial expression. Don't nitpick the arithmetic.

For #45624

Change-Id: Icc745f5ee7000c1d3559da1388c6a5596c4d1f46
Reviewed-on: https://go-review.googlesource.com/c/go/+/714040
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
2025-10-22 20:30:59 -07:00
Florian Lehner
d94a8c56ad runtime: cleanup pagetrace
pagetrace functionality was removed with CL 583379.

Change-Id: I8e8718e6cf5415e326ec127fb294588866ee4e6a
Reviewed-on: https://go-review.googlesource.com/c/go/+/713260
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-10-22 18:04:40 -07:00
Daniel McCarney
02728a2846 crypto/internal/fips140test: add entropy SHA2-384 testing
The crypto/internal/fips140/entropy package vendors a minimal
implementation of SHA2-384 to insulate it from changes in the FIPS
module implementation. This means it also requires ACVP testing separate
from the FIPS module implementation. This commit implements the
required ACVP testing support.

There's no way via the ACVP protocol, or acvptool, to specify that we
want to test a specific SHA2-384 implementation compared to normal. We
use a new environment variable (GOENTROPYSOURCEACVP=1) to make that
distinction.

The capabilities we advertise when testing the entropy SHA2-384
implementation are limited to something that best describes the
input sizes that the entropy module's implementation supports within the
requirements imposed by ACVP. We allow 144 byte messages (3*digest size)
to support MCT and in particular the "standard" MCT algorithm, and allow
1024 byte messages as the production supported message size used by the
entropy module itself.

Change-Id: I6e693a3fa23efba35d8a7d029ddf0b11036621c3
Reviewed-on: https://go-review.googlesource.com/c/go/+/711740
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
2025-10-22 17:59:18 -07:00
Ariel Otilibili
f92e01c117 runtime/cgo: fix cgoCheckArg description
The description is misleading: cgoCheckArg is called by both
cgoCheckPointer and cgoCheckResult.

Mention cgoCheckResult in the cgoCheckArg description. Remove extra
spaces between words.

For #75856

Change-Id: I6780cda76b5cb7b4f9af3fbaa37a6c5099cc8d7d
GitHub-Last-Rev: 531928b679
GitHub-Pull-Request: golang/go#75992
Reviewed-on: https://go-review.googlesource.com/c/go/+/713520
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-10-22 17:52:24 -07:00
fanzha02
50586182ab runtime: use backoff and ISB instruction to reduce contention in (*lfstack).pop and (*spanSet).pop on arm64
When profiling CPU usage LiveKit on AArch64/x86 (AWS), the graphs show
CPU spikes that was repeating in a semi-periodic manner and spikes occur
when the GC(garbage collector) is active.

Our analysis found that the getempty function accounted for 10.54% of the
overhead, which was mainly caused by the work.empty.pop() function. And
listing pop shows that the majority of the time, with a 10.29% overhead,
is spent on atomic.Cas64((*uint64)(head), old, next).

This patch adds a backoff approach to reduce the high overhead of the
atomic operation primarily occurs when contention over a specific memory
address increases, typically with the rise in the number of threads.

Note that on paltforms other than arm64, the initial value of backoff is zero.

This patch rewrites the implementation of procyield() on arm64, which is an
Armv8.0-A compatible delay function using the counter-timer.

The garbage collector benchmark:

                           │    master       │               opt                        │
                           │   sec/op        │        sec/op     vs base                │
Garbage/benchmem-MB=64-160   3.782m ± 4%        2.264m ± 2%      -40.12% (p=0.000 n=10)
                           │ user+sys-sec/op │ user+sys-sec/op   vs base                │
Garbage/benchmem-MB=64-160   433.5m ± 4%        255.4m ± 2%      -41.08% (p=0.000 n=10)

Reference for backoff mechianism:
https://community.arm.com/arm-community-blogs/b/architectures-and-processors-blog/posts/multi-threaded-applications-arm

Change-Id: Ie8128a2243ceacbb82ab2a88941acbb8428bad94
Reviewed-on: https://go-review.googlesource.com/c/go/+/654895
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-10-22 17:02:28 -07:00
Russ Cox
1ff59f3dd3 strconv: clean up powers-of-10 table, tests
Both Eisel-Lemire and Ryu depend on a table of
truncated 128-bit mantissas of powers of 10,
and so will Dragonbox.

This CL:
 - Moves the table to a separate file, so it doesn't look tied to Eisel-Lemire.
 - Introduces a uint128 type in math.go for the table values,
   since .Hi and .Lo are clearer than [1] and [0].
 - Generates the table from a standalone generator pow10gen.go.
 - Adds a new pow10 function in math.go to handle table access details.
 - Factors a 64x128->192-bit multiply into umul192 in math.go.
 - Moves multiplication by log₁₀ 2 and log₂ 10 into math.go.
 - Introduces an import_test.go to avoid having to type differently
   cased names in test code versus regular code.
 - Introduces named constants for the floating-point size parameters.
   Previously these were only in the floatInfo global variables.
 - Changes the BenchmarkAppendUintVarlen subtest names
   to be more useful.

Change-Id: I9826ee5f41c5c19be3b6a7c3c5f277ec6c23b39a
Reviewed-on: https://go-review.googlesource.com/c/go/+/712661
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-10-22 13:50:44 -07:00
Sean Liao
7c9fa4d5e9 cmd/go: check if build output should overwrite files with renames
CopyFile has a check to ensure that only object files are overwritten.
Extend this to moveOrCopyFile, so the check also happens when the source
and destination file are on the same filesystem (when renames are a
valid way of moving files).

Fixes #75970

Change-Id: Ie667301f1c9c00b114cfd91cdf8053ac20fd817b
Reviewed-on: https://go-review.googlesource.com/c/go/+/712960
Reviewed-by: Laurent Demailly <ldemailly@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@google.com>
Reviewed-by: Ian Alexander <jitsu@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2025-10-22 13:35:02 -07:00
David Chase
d03634f807 [dev.simd] cmd/compile, simd: add definitions for VPTERNLOG[DQ]
This includes an non-public intrinsic for testing,
and a test.  Optimizations using this instruction
will follow in another CL.

Change-Id: I7f7a93212249a16a30bd1379c717f8a7f9915daf
Reviewed-on: https://go-review.googlesource.com/c/go/+/708995
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-10-22 11:38:57 -07:00
redteampanda-ng
557b4d6e0f comment: change slice to string in function comment/help
Comment is outdated, it should say a string is returned

Change-Id: I7d40135aac22845dbc1f91e02e5776cc7d58eda7
GitHub-Last-Rev: 08ee556f08
GitHub-Pull-Request: golang/go#75980
Reviewed-on: https://go-review.googlesource.com/c/go/+/713040
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Keith Randall <khr@google.com>
2025-10-22 09:13:14 -07:00
Robert Griesemer
d09a8c8ef4 go/types, types2: simplify locking in Named.resolveUnderlying
Avoid calling Named.resolveUnderlying in the first place (there
is only one caller) if Named.underlying exists already.

In Named.resolveUnderlying remove initial atomic check because
of the check in Named.Underlying. Also, remove a 2nd atomic
check after acquiring the lock as it likely won't help much.

Change-Id: Ife87218fa2549d0903a10218f4dd7a70f85d6c7c
Reviewed-on: https://go-review.googlesource.com/c/go/+/713521
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: Mark Freeman <markfreeman@google.com>
2025-10-22 08:23:27 -07:00
Robert Griesemer
5a42af7f6c go/types, types2: in resolveUnderlying, only compute path when needed
When following a RHS chain, the (TypeName) Object path is only needed
when there is a cycle (i.e., an error), in which case we can be slow.
Rather than always compute the path, only compute it in the error case.
In the same vain, allocate the seen map lazily, only when needed.

This code could use a test (it doesn't seem to be encountered by our
test suite), but I haven't found a case to provoke the error yet.

Change-Id: Iff6313394442a251adc56580f746928ec13450fd
Reviewed-on: https://go-review.googlesource.com/c/go/+/712321
Auto-Submit: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
2025-10-22 08:22:02 -07:00
Robert Griesemer
4bdb55b5b8 go/types, types2: rename Named.under to Named.resolveUnderlying
Named.resolveUnderlying is now just a helper function for Underlying
and only called from there. The name makes is clearer what this function
does; it also doesn't need to return a result anymore.

While at it, slightly simplify the function body.

Change-Id: I167c4be89b1bfcc69f6b528ddb6ed4c90481194a
Reviewed-on: https://go-review.googlesource.com/c/go/+/712521
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
2025-10-22 08:20:32 -07:00
Austin Clements
29d43df8ab go/build, cmd/go: use ast.ParseDirective for go:embed
Currently, "//go:embed" directives are read by bespoke parsers in
go/build and cmd/go/internal/modindex. Replace these bespoke parsers
with scanner.Scanner for finding these directives and
ast.ParseDirective for parsing them.

It's not clear why we had a bespoke parser just for finding
"//go:embed" directives in the first place. We have a bespoke parser
for reading imports in order to avoid having to read the entire source
file into memory, but if we're parsing embeds, we wind up reading the
entire source file into memory anyway. Using scanner.Scanner instead
eliminates some truly confusing code.

This also demonstrates that ast.ParseDirective as proposed in #68021
achieves useful API coverage.

Updates #68021.

Change-Id: Ieb68738121dcff605a6a704a8045ddd2ff35df35
Reviewed-on: https://go-review.googlesource.com/c/go/+/704836
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Austin Clements <austin@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
2025-10-21 14:49:13 -07:00
Austin Clements
4e695dd634 go/ast: add ParseDirective for parsing directive comments
This adds an ast.Directive API for parsing directive comments such as
"//go:build" and "//go:embed".

This will help tools standardize the syntax of these directive
comments. Even within the standard Go tools there's little agreement
on the finer details of the syntax of directives today.

Fixes #68021.

Change-Id: I84a988a667682c9ac70632df6e925461ac95e381
Reviewed-on: https://go-review.googlesource.com/c/go/+/704835
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Austin Clements <austin@google.com>
Reviewed-by: Mateusz Poliwczak <mpoliwczak34@gmail.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
2025-10-21 14:49:10 -07:00
Robert Griesemer
06e57e60a7 go/types, types2: only report version errors if new(expr) is ok otherwise
If new(expr) is used before Go 1.26, don't report version errors if there
are other problems with the expression.

While at it, implement multiple missing type checks for new(expr) and
add corresponding test cases that were missed in CL 704935 (tests for
no value expressions, generic types, untyped nil).

Reorganize/rename builtins0.go tests for new to match existing test case
patterns again.

Fixes #75986.
For #45624.

Change-Id: I39e5516d3f8d191cc390a4d8b9911c312bbb177c
Reviewed-on: https://go-review.googlesource.com/c/go/+/713241
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
2025-10-21 14:41:38 -07:00
Matt T. Proud
6c3d0d259f path/filepath: reword documentation for Rel
The existing func Rel's API documentation was presented in a rather
dense way without a lot of organization that oriented around topical
flow, so the documentation has been cleaned up to present the
function's behavior more clearly and concisely.

Fixes #75893

Change-Id: I6c8f6ef508250397be9d0127a15508e7335f18c4
Reviewed-on: https://go-review.googlesource.com/c/go/+/712440
Reviewed-by: David Chase <drchase@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>
2025-10-21 14:24:23 -07:00
Mark Freeman
39fd61ddb0 go/types, types2: guard Named.underlying with Named.mu
It appears that CL 695977 introduced a data race on Named.underlying.
This fixes that race by specifying a new namedState called underlying,
which, perhaps unsurprisingly, signals that Named.underlying is populated.

Unfortunately, the underlying namedState is independent of the complete
namedState (unsurprising since methods and the underlying type are not related).

Hence, they cannot be ordered and thus do not fit the current integer-based
state representation. To account for combinations of states, we introduce a
bit set representation for namedState instead. The namedState field is also
renamed to stateMask to reflect this new representation.

Methods that operate on the stateMask are adjusted and exposition is added
throughout.

Fixes #75963

Change-Id: Icfa188ea2fa7916804c06f80668e99176bf4e978
Reviewed-on: https://go-review.googlesource.com/c/go/+/712720
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>
2025-10-21 13:51:31 -07:00
qmuntal
4a0115c886 runtime,syscall: implement and use syscalln on darwin
All darwin syscall implementations can be consolidated into a
single syscalln function, as already happens on Windows.

This reduces duplication and allows moving some logic from
runtime to syscall.

Updates #699135

Cq-Include-Trybots: luci.golang.try:gotip-darwin-arm64-longtest,gotip-darwin-amd64-longtest,x_sys-gotip-darwin-arm64-longtest,x_sys-gotip-darwin-amd64-longtest
Change-Id: If5de80442b1d4a1123258401a3ae21695e7c8f6b
Reviewed-on: https://go-review.googlesource.com/c/go/+/699177
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-10-21 13:19:45 -07:00
Jes Cok
261c561f5a all: gofmt -w
Change-Id: Iae74ac910d9db035bb2b726b2128aac09f5b7aae
GitHub-Last-Rev: 7aab5fa8e7
GitHub-Pull-Request: golang/go#75993
Reviewed-on: https://go-review.googlesource.com/c/go/+/713540
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: David Chase <drchase@google.com>
2025-10-21 13:14:55 -07:00
Russ Cox
c9c78c06ef strconv: embed testdata in test
This makes it easier to run test binaries on remote machines.

Change-Id: I3e5bc6cf10272a6743fd5d16ab1089d46f53232c
Reviewed-on: https://go-review.googlesource.com/c/go/+/712660
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-21 11:33:43 -07:00
Nicolas Hillegeer
8f74f9daf4 sync: re-enable race even when panicking
Not doing this can cause user code running after this panic (e.g.:
defers) to produce non-existing races.

Change-Id: Ia6aec88aaeee3b9c17e7b8019d697ffa88dfb492
Reviewed-on: https://go-review.googlesource.com/c/go/+/713460
Commit-Queue: Nicolas Hillegeer <aktau@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Nicolas Hillegeer <aktau@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-21 11:27:38 -07:00
qmuntal
8a6c64f4fe syscall: use rawSyscall6 to call ptrace in forkAndExecInChild
On darwin and openbsd, the autogenerated ptrace wrapper is
nosplit because it is called from forkAndExecInChild.

This makes it difficult to modify and improve the underlying
syscall mechanism, as ptrace is almost over the nosplit limit.

We better call ptrace directly using rawSyscall6 in
forkAndExecInChild so that we can lift the ptrace nosplit
restriction to.

Doing so also fixes a long-standing inconsistency:
forkAndExecInChild is documented to only allow rawSyscall, but
the ptrace wrapper is using non-raw syscalls.

Updates #64113

Change-Id: Ibbbb218511561c1a5cb5b6d288a691f9738b14a6
Reviewed-on: https://go-review.googlesource.com/c/go/+/708575
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-21 10:45:23 -07:00
abdullahkiani007
4620db72d2 runtime: use timer_settime64 on 32-bit Linux
Linux introduced new syscalls to fix the year 2038 issue.
To still be able to use the old ones, the Kconfig option
COMPAT_32BIT_TIME would be necessary.

Use the new 64-bit syscall for timer_settime by default.
Add a fallback to use the 32-bit syscall when the
64-bit version returns _ENOSYS.

Fixes #75133

Change-Id: Iccb8831b67f665067ee526e93c3ff2f4f5392edf
GitHub-Last-Rev: 6c3d62d60e
GitHub-Pull-Request: golang/go#75957
Reviewed-on: https://go-review.googlesource.com/c/go/+/712642
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
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: Jorropo <jorropo.pgm@gmail.com>
2025-10-21 09:35:47 -07:00
qmuntal
b31dc77cea os: support deleting read-only files in RemoveAll on older Windows versions
The Windows implementation of RemoveAll supports deleting read-only
files only on file systems that supports POSIX semantics and on
newer Windows versions (Windows 10 RS5 and latter).

For all the other cases, the read-only bit was not clearer before
deleting read-only files, so they fail to delete.

Note that this case was supported prior to CL 75922, which landed on
Go 1.25.

Fixes #75922

Change-Id: Id6e6477f42e1952d08318ca3e4ab7c1648969f66
Reviewed-on: https://go-review.googlesource.com/c/go/+/713480
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
2025-10-21 08:45:19 -07:00
Jes Cok
46cc532900 cmd/compile/internal/ssa: fix typo in comment
Change-Id: Ic48a756b71a62be1c6c4cfe781c02b89010e2338
GitHub-Last-Rev: 8c0d89b475
GitHub-Pull-Request: golang/go#75985
Reviewed-on: https://go-review.googlesource.com/c/go/+/713041
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-21 08:43:34 -07:00
qmuntal
2163a58021 crypto/internal/fips140/entropy: increase AllocsPerRun iterations
TestNISTECAllocations is flaky (~1% failure rate) on my local Windows
machine since CL 710058, which touched TestEntropyRace.

These tests are unrelated, but some allocations might be incorrectly
accounted to TestNISTECAllocations, affecting the end result due to
the low number of iterations done in that test.

Change-Id: I01323c2a45b12665e86d940467f4f91c2e66696b
Reviewed-on: https://go-review.googlesource.com/c/go/+/712620
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Auto-Submit: Quim Muntal <quimmuntal@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-21 08:42:07 -07:00
matloob
306eacbc11 cmd/go/testdata/script: disable list_empty_importpath test on Windows
The test is flaking on windows, and I haven't been able to figure out
why. For now, to unblock folks, just allow the value that occasionally
appears: 'no errors' to avoid having a broken test. This seems like it's
probably a race though so we should fix it as soon as we can.

For #73976

Change-Id: I6a6a696431d784d048ed798b828a759e752b6393
Reviewed-on: https://go-review.googlesource.com/c/go/+/713220
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>
2025-10-21 08:22:02 -07:00
Jes Cok
a5a249d6a6 all: eliminate unnecessary type conversions
Found by github.com/mdempsky/unconvert

Change-Id: I88ce10390a49ba768a4deaa0df9057c93c1164de
GitHub-Last-Rev: 3b0f7e8f74
GitHub-Pull-Request: golang/go#75974
Reviewed-on: https://go-review.googlesource.com/c/go/+/712940
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: David Chase <drchase@google.com>
2025-10-21 08:13:08 -07:00
Paul Murphy
694182d77b cmd/internal/obj/ppc64: improve large prologue generation
Avoid needing an unsafe section to store LR and adjust SP
for large constants by using the stdux (MOVDU) instruction.

This is also a few instructions shorter as the large
constant adjustment is only created once.

Change-Id: I6ff7a24181cdadb1846a33129fc148dcf59b76d5
Reviewed-on: https://go-review.googlesource.com/c/go/+/710197
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-21 07:41:30 -07:00
Jorropo
b0dcb95542 cmd/compile: leave the horses alone
I don't know why we were eliminating horses, this not cool.

Change-Id: I0d4b5a1b2f584e071de0a85ef88f9baf9183e12e
Reviewed-on: https://go-review.googlesource.com/c/go/+/712820
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
2025-10-21 07:39:38 -07:00
Jorropo
9a5a1202f4 runtime: clean dead architectures from go:build constraint
I've didn't caught theses while reviewing CL 701615.

Change-Id: I721978c173a255eb6d7c3e43dea2b903a9fd016d
Reviewed-on: https://go-review.googlesource.com/c/go/+/712740
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2025-10-21 07:03:33 -07:00
Filippo Valsorda
8539691d0c crypto/internal/fips140/entropy: move to crypto/internal/entropy/v1.0.0
The lab confirmed the that entropy source doesn't have to be inside the
module boundary, although changing the entropy source of a module does
require recertification.

Move the v1.0.0 entropy source out of crypto/internal/fips140, to a
versioned path that lets us keep multiple versions (which would be used
by different modules) if we wish to.

Change-Id: I6a6a69647e9dfca1c375650a0869bdc001d65173
Reviewed-on: https://go-review.googlesource.com/c/go/+/710057
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2025-10-21 07:01:54 -07:00
Guoqi Chen
99cf4d671c runtime: save lasx and lsx registers in loong64 async preemption
This is a port of CL 669195 and CL 695916 adjusted to save loong64
lasx and lsx registers off stack.

Change-Id: Ie56787c76259a9545f5a8adcb09f588c8451bbd6
Reviewed-on: https://go-review.googlesource.com/c/go/+/711180
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>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
2025-10-20 23:25:14 -07:00
Michael Anthony Knyszek
79ae97fe9b runtime: make procyieldAsm no longer loop infinitely if passed 0
Change-Id: I9f01692373623687e09bee54efebaac0ee361f81
Reviewed-on: https://go-review.googlesource.com/c/go/+/712664
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-20 20:28:55 -07:00
Michael Anthony Knyszek
f838faffe2 runtime: wrap procyield assembly and check for 0
procyield will currently loop infinitely if passed 0 on several
platforms. This change sidesteps this bug by renaming procyield to
procyieldAsm, and adding a wrapper named procyield that checks for
cycles == 0. The benefit of this structure is that procyield called
with a constant cycle count of 0 will be inlined and constant folded
away, the expected behavior of a procyield of 0 cycles.

A follow-up change will fix the assembly to not have this footgun
anymore.

Change-Id: I7068abfeb961bc0fa475e216836f7c0e46b38373
Reviewed-on: https://go-review.googlesource.com/c/go/+/712663
Reviewed-by: Michael Pratt <mpratt@google.com>
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>
2025-10-20 20:28:51 -07:00
Michael Anthony Knyszek
ee4d2c312d runtime/trace: dump test traces on validation failure
We currently dump traces for internal/trace tests on validation failure,
but not for the runtime/trace package.

This change moves some of the machinery to do this into the testtrace
package and then uses it from the runtime/trace package.

For #75665.

Change-Id: Ibe2d4f3945c1fd21dcbccf56820865f8d2ea41f9
Reviewed-on: https://go-review.googlesource.com/c/go/+/710755
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>
2025-10-20 18:11:06 -07:00
Julien Cretel
7b81a1e107 net/url: reduce allocs in Encode
This change adds benchmarks for Encode and reverts what CL 617356 did in
this package. At the moment, using maps.Keys in conjunction with
slices.Sorted indeed causes a bunch of closures to escape to heap.
Moreover, all other things being equal, pre-sizing the slice in which
we collect the keys is beneficial to performance when they are "many" (>8)
keys because it results in fewer allocations than if we don't pre-size the
slice.

Here are some benchmark results:

goos: darwin
goarch: amd64
pkg: net/url
cpu: Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
                                                           │     old      │                 new                 │
                                                           │    sec/op    │   sec/op     vs base                │
EncodeQuery/#00-8                                             2.051n ± 1%   2.343n ± 1%  +14.24% (p=0.000 n=20)
EncodeQuery/#01-8                                             2.337n ± 1%   2.458n ± 4%   +5.16% (p=0.000 n=20)
EncodeQuery/oe=utf8&q=puppies-8                               489.6n ± 0%   284.5n ± 0%  -41.88% (p=0.000 n=20)
EncodeQuery/q=dogs&q=%26&q=7-8                                397.2n ± 1%   231.7n ± 1%  -41.66% (p=0.000 n=20)
EncodeQuery/a=a1&a=a2&a=a3&b=b1&b=b2&b=b3&c=c1&c=c2&c=c3-8    743.1n ± 0%   519.0n ± 0%  -30.16% (p=0.000 n=20)
EncodeQuery/a=a&b=b&c=c&d=d&e=e&f=f&g=g&h=h&i=i-8            1324.0n ± 0%   931.0n ± 0%  -29.68% (p=0.000 n=20)
geomean                                                       98.57n        75.38n       -23.53%

                                                           │      old      │                 new                  │
                                                           │     B/op      │    B/op     vs base                  │
EncodeQuery/#00-8                                             0.000 ± 0%     0.000 ± 0%        ~ (p=1.000 n=20) ¹
EncodeQuery/#01-8                                             0.000 ± 0%     0.000 ± 0%        ~ (p=1.000 n=20) ¹
EncodeQuery/oe=utf8&q=puppies-8                              168.00 ± 0%     56.00 ± 0%  -66.67% (p=0.000 n=20)
EncodeQuery/q=dogs&q=%26&q=7-8                               112.00 ± 0%     32.00 ± 0%  -71.43% (p=0.000 n=20)
EncodeQuery/a=a1&a=a2&a=a3&b=b1&b=b2&b=b3&c=c1&c=c2&c=c3-8    296.0 ± 0%     168.0 ± 0%  -43.24% (p=0.000 n=20)
EncodeQuery/a=a&b=b&c=c&d=d&e=e&f=f&g=g&h=h&i=i-8             680.0 ± 0%     264.0 ± 0%  -61.18% (p=0.000 n=20)
geomean                                                                  ²               -47.48%                ²
¹ all samples are equal
² summaries must be >0 to compute geomean

                                                           │      old      │                 new                  │
                                                           │   allocs/op   │ allocs/op   vs base                  │
EncodeQuery/#00-8                                             0.000 ± 0%     0.000 ± 0%        ~ (p=1.000 n=20) ¹
EncodeQuery/#01-8                                             0.000 ± 0%     0.000 ± 0%        ~ (p=1.000 n=20) ¹
EncodeQuery/oe=utf8&q=puppies-8                               8.000 ± 0%     3.000 ± 0%  -62.50% (p=0.000 n=20)
EncodeQuery/q=dogs&q=%26&q=7-8                                7.000 ± 0%     3.000 ± 0%  -57.14% (p=0.000 n=20)
EncodeQuery/a=a1&a=a2&a=a3&b=b1&b=b2&b=b3&c=c1&c=c2&c=c3-8   10.000 ± 0%     5.000 ± 0%  -50.00% (p=0.000 n=20)
EncodeQuery/a=a&b=b&c=c&d=d&e=e&f=f&g=g&h=h&i=i-8            12.000 ± 0%     5.000 ± 0%  -58.33% (p=0.000 n=20)
geomean                                                                  ²               -43.23%                ²
¹ all samples are equal
² summaries must be >0 to compute geomean

Change-Id: Ia0d7579f90434f0546d93b680ab18b47a1ffbdac
GitHub-Last-Rev: f25be71e07
GitHub-Pull-Request: golang/go#75874
Reviewed-on: https://go-review.googlesource.com/c/go/+/711280
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Florian Lehner <lehner.florian86@gmail.com>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: t hepudds <thepudds1460@gmail.com>
2025-10-20 14:16:39 -07:00
Joel Sing
e425176843 cmd/asm: fix typo in comment
Change-Id: I1a7933bce70bcae1f93a45c6810da60d269f48f3
Reviewed-on: https://go-review.googlesource.com/c/go/+/713000
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>
Auto-Submit: Joel Sing <joel@sing.id.au>
2025-10-20 14:02:21 -07:00
Michael Anthony Knyszek
dc9a3e2a65 runtime: fix generation skew with trace reentrancy
Currently when performing multiple nested traceAcquires, we re-read
trace.gen on subsequent reads. But this is invalid, since a generation
transition may happen in between a traceAcquire and a nested
traceAcquire. The first one will produce a traceLocker with a gen from
the previous generation, and the second will produce a traceLocker from
the next generation. (Note: generations cannot _complete_ advancement
under traceAcquire, but trace.gen can move forward.) The end result is
earlier events, from the nested traceAcquire, will write to a future
generation, and then previous events will write to a past generation.
This can break the trace.

(There are also a lot of comments left over talking about the
non-reentrancy of the tracer; we should look at those again.)

Change-Id: I08ac8cc86d41ab3e6061c5de58d657b6ad0d19d8
Reviewed-on: https://go-review.googlesource.com/c/go/+/708397
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-10-20 13:32:29 -07:00
Michael Anthony Knyszek
df33c17091 runtime: add _Gdeadextra status
_Gdeadextra is almost the same as _Gdead but for goroutines attached to
extra Ms. The primary difference is that it can be transitioned into a
_Gscan status, unlike _Gdead. (Why not just use _Gdead? For safety,
mostly. There's exactly one case where we're going to want to transition
_Gdead to _Gscan|_Gdead, and it's for extra Ms. It's also a bit weird to
call this state dead when it can still have a syscalling P attached to
it.)

This status is used in a follow-up change that changes entersyscall and
exitsyscall.

Change-Id: I169a4c8617aa3dc329574b829203f56c86b58169
Reviewed-on: https://go-review.googlesource.com/c/go/+/646197
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-20 13:32:17 -07:00
Ian Alexander
7503856d40 cmd/go: inject loaderstate into matcher function
This change alters the matcher function in vendorPkg in order to
retrieve the go version from the current loaderstate.

This commit is part of the overall effort to eliminate global
modloader state.

Change-Id: Iedb12bdfe4ab3c24dbbf161db1f3842014415c59
Reviewed-on: https://go-review.googlesource.com/c/go/+/711117
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>
2025-10-20 13:04:17 -07:00
Ian Alexander
d57c3fd743 cmd/go: inject State parameter into work.runInstall
This command modifies the call tree starting at `work.runInstall` to
inject a `State` parameter to every function that is currently using
the global `modload.LoaderState` variable.  By explicilty passing a
`State` parameter, we can begin to eliminate the usage of the global
`modload.LoaderState`.

This commit is part of the overall effort to eliminate global
modloader state.

[git-generate]
cd src/cmd/go/internal/work
rf 'inject modload.LoaderState runInstall'
cd ..
./rf-cleanup.zsh

Change-Id: I038d2c4870d67835c165852b223eaad3e2496202
Reviewed-on: https://go-review.googlesource.com/c/go/+/710304
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2025-10-20 13:04:01 -07:00
Ian Alexander
e94a5008f6 cmd/go: inject State parameter into work.runBuild
This command modifies the call tree starting at `work.runBuild` and
`work.runInstall` to inject a `State` parameter to every function that
is currently using the global `modload.LoaderState` variable.  By
explicilty passing a `State` parameter, we can begin to eliminate the
usage of the global `modload.LoaderState`.

This commit is part of the overall effort to eliminate global
modloader state.

[git-generate]
cd src/cmd/go/internal/work
rf 'inject modload.LoaderState runBuild'
cd ..
./rf-cleanup.zsh
 # cd work
 # rf 'inject modload.LoaderState runInstall'
 # cd ..
 # ./rf-cleanup.zsh

Change-Id: I232452d877211d4ac72f42aa193b30dab9649481
Reviewed-on: https://go-review.googlesource.com/c/go/+/709990
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>
2025-10-20 13:02:33 -07:00
Ian Alexander
d9e6f95450 cmd/go: inject State parameter into workcmd.runSync
This command modifies the call tree starting at `workcmd.runSync` to
inject a `State` parameter to every function that is currently using
the global `modload.LoaderState` variable.  By explicilty passing a
`State` parameter, we can begin to eliminate the usage of the global
`modload.LoaderState`.

This commit is part of the overall effort to eliminate global
modloader state.

[git-generate]
cd src/cmd/go/internal/workcmd
rf 'inject modload.LoaderState runSync'
cd ..
./rf-cleanup.zsh

Change-Id: Ib8a7b332b89762a7463ace53243cae6aa0ffcc2d
Reviewed-on: https://go-review.googlesource.com/c/go/+/709987
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2025-10-20 13:00:14 -07:00
Ian Alexander
9769a61e64 cmd/go: inject State parameter into modget.runGet
This command modifies the call tree starting at `modget.runGet` to
inject a `State` parameter to every function that is currently using
the global `modload.LoaderState` variable.  By explicilty passing a
`State` parameter, we can begin to eliminate the usage of the global
`modload.LoaderState`.

This commit is part of the overall effort to eliminate global
modloader state.

[git-generate]
cd src/cmd/go/internal/modget
rf 'inject modload.LoaderState runGet'
cd ..
./rf-cleanup.zsh

Change-Id: Icafc5cff07c49809f5c199feec9ed7795536976c
Reviewed-on: https://go-review.googlesource.com/c/go/+/709981
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2025-10-20 12:59:47 -07:00
Ian Alexander
f859799ccf cmd/go: inject State parameter into modcmd.runVerify
This command modifies the call tree starting at `modcmd.runVerify` to
inject a `State` parameter to every function that is currently using
the global `modload.LoaderState` variable.  By explicilty passing a
`State` parameter, we can begin to eliminate the usage of the global
`modload.LoaderState`.

This commit is part of the overall effort to eliminate global
modloader state.

[git-generate]
cd src/cmd/go/internal/modcmd
rf 'inject modload.LoaderState runVerify'
cd ..
./rf-cleanup.zsh

Change-Id: I5b3b4670a4e2d19375049e585035145d14248b40
Reviewed-on: https://go-review.googlesource.com/c/go/+/709985
Reviewed-by: Michael Matloob <matloob@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-20 12:59:28 -07:00
Ian Alexander
0f820aca29 cmd/go: inject State parameter into modcmd.runVendor
This command modifies the call tree starting at `modcmd.runVendor` to
inject a `State` parameter to every function that is currently using
the global `modload.LoaderState` variable.  By explicilty passing a
`State` parameter, we can begin to eliminate the usage of the global
`modload.LoaderState`.

This commit is part of the overall effort to eliminate global
modloader state.

[git-generate]
cd src/cmd/go/internal/modcmd
rf 'inject modload.LoaderState runVendor'
cd ..
./rf-cleanup.zsh

Change-Id: I0572e165d291e34d212ded9a420871688b7915ad
Reviewed-on: https://go-review.googlesource.com/c/go/+/709984
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2025-10-20 12:59:10 -07:00
Ian Alexander
92aa3e9e98 cmd/go: inject State parameter into modcmd.runInit
This command modifies the call tree starting at `modcmd.runInit` to
inject a `State` parameter to every function that is currently using
the global `modload.LoaderState` variable.  By explicilty passing a
`State` parameter, we can begin to eliminate the usage of the global
`modload.LoaderState`.

This commit is part of the overall effort to eliminate global
modloader state.

[git-generate]
cd src/cmd/go/internal/modcmd
rf 'inject modload.LoaderState runInit'
cd ..
./rf-cleanup.zsh

Change-Id: Ie8bb8eb0edc2fabceafd9c41a2b11fe2a3532b73
Reviewed-on: https://go-review.googlesource.com/c/go/+/709983
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>
2025-10-20 12:57:12 -07:00
Ian Alexander
e176dff41c cmd/go: inject State parameter into modcmd.runDownload
This command modifies the call tree starting at `modcmd.runDownload`
to inject a `State` parameter to every function that is currently
using the global `modload.LoaderState` variable.  By explicilty
passing a `State` parameter, we can begin to eliminate the usage of
the global `modload.LoaderState`.

This commit is part of the overall effort to eliminate global
modloader state.

[git-generate]
cd src/cmd/go/internal/modcmd
rf 'inject modload.LoaderState runDownload'
cd ..
./rf-cleanup.zsh

Change-Id: I64cce3e631a2614b7fabe49205d9d41fc9ba24de
Reviewed-on: https://go-review.googlesource.com/c/go/+/710299
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-20 12:56:59 -07:00
Ian Alexander
e7c66a58d5 cmd/go: inject State parameter into toolchain.Select
This command modifies the call tree starting at `toolchain.Select` to
inject a `State` parameter to every function that is currently using
the global `modload.LoaderState` variable.  By explicilty passing a
`State` parameter, we can begin to eliminate the usage of the global
`modload.LoaderState`.

This commit is part of the overall effort to eliminate global
modloader state.

[git-generate]
cd src/cmd/go/internal/toolchain
rf '
  inject modload.LoaderState Select
  add select.go var moduleLoaderState *modload.State
  ex {
    import "cmd/go/internal/modload";
    modload.LoaderState -> moduleLoaderState
  }
  add Select://+0 moduleLoaderState := modload.NewState()
  rm select.go:/var moduleLoaderState \*modload.State/
'
cd ..
./rf-cleanup.zsh

Change-Id: I759439a47e2b1aaa01a0a800bc18596dd7ce4983
Reviewed-on: https://go-review.googlesource.com/c/go/+/709988
Reviewed-by: Michael Matloob <matloob@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-20 12:56:03 -07:00
Ian Alexander
4dc3dd9a86 cmd/go: add loaderstate to Switcher
Temporarily add modload.State field to the Switcher implementation.
Note that we cannot modify the gover.Switcher interface because doing
so creates an import cycle.

This commit is part of the overall effort to eliminate global
modloader state.

Change-Id: I20dba76328aa3d0df58caff75b174522bf9df9d5
Reviewed-on: https://go-review.googlesource.com/c/go/+/712703
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2025-10-20 12:55:20 -07:00
Ian Alexander
bcf7da1595 cmd/go: convert functions to methods
This commit converts the Reset and setState functions to methods.

This commit is part of the overall effort to eliminate global
modloader state.

[git-generate]
cd src/cmd/go/internal/modload
rf '
  mv setState State.setState
  mv Reset State.Reset
'

Change-Id: Ibc40071dc044ef5d1ab0a0b03f17b75243a42011
Reviewed-on: https://go-review.googlesource.com/c/go/+/712702
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>
2025-10-20 12:53:36 -07:00
Ian Alexander
0d3044f965 cmd/go: make Reset work with any State instance
This commit updates the Reset function to work with any state
object in preparation for converting it to a method.

This commit is part of the overall effort to eliminate global
modloader state.

Change-Id: I6103842ea0a0528698217930afc0e34a2aa21eea
Reviewed-on: https://go-review.googlesource.com/c/go/+/712701
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-20 12:52:55 -07:00
Ian Alexander
386d81151d cmd/go: make setState work with any State instance
This commit updates the setState function to work with any state
object in preparation for converting it to a method.

This commit is part of the overall effort to eliminate global
modloader state.

Change-Id: I6d485156e7c4c83ff608f941b68e6d928418bd8f
Reviewed-on: https://go-review.googlesource.com/c/go/+/712700
Reviewed-by: Michael Matloob <matloob@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-20 12:52:33 -07:00
Ian Alexander
a420aa221e cmd/go: inject State parameter into tool.runTool
This command modifies the call tree starting at `tool.runTool` to
inject a `State` parameter to every function that is currently using
the global `modload.LoaderState` variable.  By explicilty passing a
`State` parameter, we can begin to eliminate the usage of the global
`modload.LoaderState`.

This commit is part of the overall effort to eliminate global
modloader state.

[git-generate]
cd src/cmd/go/internal/tool
rf 'inject modload.LoaderState runTool'
cd ..
./rf-cleanup.zsh

Change-Id: Icd1ce189f7dad421eaa2bd43d53ceaf443c5405e
Reviewed-on: https://go-review.googlesource.com/c/go/+/710302
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>
2025-10-20 12:52:09 -07:00
Ian Alexander
441e7194a4 cmd/go: inject State parameter into test.runTest
This command modifies the call tree starting at `test.runTest` to
inject a `State` parameter to every function that is currently using
the global `modload.LoaderState` variable.  By explicilty passing a
`State` parameter, we can begin to eliminate the usage of the global
`modload.LoaderState`.

This commit is part of the overall effort to eliminate global
modloader state.

[git-generate]
cd src/cmd/go/internal/test
rf 'inject modload.LoaderState runTest'
cd ..
./rf-cleanup.zsh

Change-Id: I6ee495c3beabdc5568ad338f4998a5927491db1a
Reviewed-on: https://go-review.googlesource.com/c/go/+/709986
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2025-10-20 12:51:33 -07:00
Ian Alexander
35e8309be2 cmd/go: inject State parameter into list.runList
This command modifies the call tree starting at `list.runList` to
inject a `State` parameter to every function that is currently using
the global `modload.LoaderState` variable.  By explicilty passing a
`State` parameter, we can begin to eliminate the usage of the global
`modload.LoaderState`.

This commit is part of the overall effort to eliminate global
modloader state.

[git-generate]
cd src/cmd/go/internal/list
rf 'inject modload.LoaderState runList'
cd ..
./rf-cleanup.zsh

Change-Id: I7274bc3dc6779bd8306fb79c158aa6f0473827a1
Reviewed-on: https://go-review.googlesource.com/c/go/+/709979
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2025-10-20 12:51:07 -07:00
Ian Alexander
29a81624f7 cmd/go: inject state parameter into fmtcmd.runFmt
This command modifies the call tree starting at `fmtcmd.runFmt` to
inject a `State` parameter to every function that is currently using
the global `modload.LoaderState` variable.  By explicilty passing a
`State` parameter, we can begin to eliminate the usage of the global
`modload.LoaderState`.

This commit is part of the overall effort to eliminate global
modloader state.

[git-generate]
cd src/cmd/go/internal/fmtcmd
rf '
  inject modload.LoaderState runFmt
  add fmt.go var moduleLoaderState *modload.State
  ex {
    import "cmd/go/internal/modload";
    modload.LoaderState -> moduleLoaderState
  }
  add runFmt://+0 moduleLoaderState := modload.NewState()
  rm fmt.go:/var moduleLoaderState \*modload.State/
'
cd ..
./rf-cleanup.zsh

Change-Id: Ib6692aba37a2cbc5b52d3bb705ec2b442afd26eb
Reviewed-on: https://go-review.googlesource.com/c/go/+/709989
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-20 12:50:38 -07:00
Ian Alexander
f7eaea02fd cmd/go: inject state parameter into clean.runClean
This command modifies the call tree starting at `clean.runClean` to
inject a `State` parameter to every function that is currently using
the global `modload.LoaderState` variable.  By explicilty passing a
`State` parameter, we can begin to eliminate the usage of the global
`modload.LoaderState`.

This commit is part of the overall effort to eliminate global
modloader state.

[git-generate]
cd src/cmd/go/internal/clean
rf '
  inject modload.LoaderState runClean
  add clean.go var moduleLoaderState *modload.State
  ex {
    import "cmd/go/internal/modload";
    modload.LoaderState -> moduleLoaderState
  }
  add runClean://+0 moduleLoaderState := modload.NewState()
  rm clean.go:/var moduleLoaderState \*modload.State/
'
cd ..
./rf-cleanup.zsh

Change-Id: I2e30e44cfff7e533801dabd7159fa760ac6bb824
Reviewed-on: https://go-review.googlesource.com/c/go/+/710296
Reviewed-by: Michael Matloob <matloob@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-20 12:50:25 -07:00
Ian Alexander
58a8fdb6cf cmd/go: inject State parameter into bug.runBug
This command modifies the call tree starting at `bug.runBug` to inject
a `State` parameter to every function that is currently using the
global `modload.LoaderState` variable.  By explicilty passing a
`State` parameter, we can begin to eliminate the usage of the global
`modload.LoaderState`.

This commit is part of the overall effort to eliminate global
modloader state.

[git-generate]
cd src/cmd/go/internal/bug
rf 'inject modload.LoaderState runBug'
cd ..
./rf-cleanup.zsh

Change-Id: Idf87733f586a8aae0779132f54a8d988e2551bae
Reviewed-on: https://go-review.googlesource.com/c/go/+/709982
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2025-10-20 12:50:01 -07:00
Michael Pratt
8d0bef7ffe runtime: add linkname documentation and guidance
Explanation of the different types of linkname and guidance on the
preferred form. Written for myself, as I can never remember the guidance
and always rederive this from first principles.

Change-Id: If10cb8fc87782e25526ad597569e3c526ee33a1f
Reviewed-on: https://go-review.googlesource.com/c/go/+/609715
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
TryBot-Bypass: Michael Pratt <mpratt@google.com>
2025-10-20 11:51:25 -07:00
Tom Thorogood
20b3339542 [dev.simd] simd: add AES feature check
CL 706055 added AES support but chose to not generate feature checks for
composite features. Intel lists AES as AVXAES which gets manually mapped
to the composite feature AVX, AES. With the previous writeSIMDFeatures
code ignoring composite features, and there being no other references to
AES, we neglected to generate a feature check at all.

To resolve this, we instead split composite features into their
constituent parts and ensure that each feature has a check generated.

Currently AVXAES is the only composite feature.

Updates #73787

Change-Id: Ic8e9d8a3c9c0854fc717512c2ce092d81cb6b66c
Reviewed-on: https://go-review.googlesource.com/c/go/+/712880
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>
2025-10-20 10:32:54 -07:00
apocelipes
3e43f48cb6 encoding/asn1: use reflect.TypeAssert to improve performance
Use "reflect.TypeAssert" can gain some performance improvements:

goos: darwin
goarch: arm64
pkg: encoding/asn1
cpu: Apple M4
                          │     old     │                new                 │
                          │   sec/op    │   sec/op     vs base               │
ObjectIdentifierString-10   51.48n ± 1%   49.72n ± 2%  -3.41% (p=0.000 n=10)
Marshal-10                  7.549µ ± 0%   7.466µ ± 1%  -1.10% (p=0.000 n=10)
Unmarshal-10                1.808µ ± 0%   1.798µ ± 0%  -0.58% (p=0.000 n=10)
geomean                     889.0n        873.8n       -1.70%

                          │     old      │                  new                  │
                          │     B/op     │     B/op      vs base                 │
ObjectIdentifierString-10     32.00 ± 0%     32.00 ± 0%       ~ (p=1.000 n=10) ¹
Marshal-10                  7.336Ki ± 0%   7.336Ki ± 0%       ~ (p=1.000 n=10) ¹
Unmarshal-10                  432.0 ± 0%     432.0 ± 0%       ~ (p=1.000 n=10) ¹
geomean                       470.0          470.0       +0.00%
¹ all samples are equal

                          │    old     │                 new                 │
                          │ allocs/op  │ allocs/op   vs base                 │
ObjectIdentifierString-10   1.000 ± 0%   1.000 ± 0%       ~ (p=1.000 n=10) ¹
Marshal-10                  271.0 ± 0%   271.0 ± 0%       ~ (p=1.000 n=10) ¹
Unmarshal-10                24.00 ± 0%   24.00 ± 0%       ~ (p=1.000 n=10) ¹
geomean                     18.67        18.67       +0.00%
¹ all samples are equal

Updates #62121

Change-Id: I139b9d0c729c36018d4e00216ab6fc8388f3b51b
GitHub-Last-Rev: c87aae5372
GitHub-Pull-Request: golang/go#75825
Reviewed-on: https://go-review.googlesource.com/c/go/+/710555
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-20 10:19:38 -07:00
qmuntal
4ad5585c2c runtime: fix _rt0_ppc64x_lib on aix
CL 706395 refactored the ppc64 library entry point and missed some
important aix-specific characteristics:

- _rt0_ppc64x_lib should account for the function descriptor when
getting the callback pointer.

- _rt0_ppc64x_lib should only call _cgo_sys_thread_create when
built as a c-archive.

Fixes #75801

Cq-Include-Trybots: luci.golang.try:gotip-linux-ppc64_power10
Change-Id: I343ca09d3b9688ffa585668a6c52f0ad519d6203
Reviewed-on: https://go-review.googlesource.com/c/go/+/710175
Reviewed-by: Paul Murphy <paumurph@redhat.com>
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>
2025-10-20 09:41:43 -07:00
Alan Donovan
a5f55a441e cmd/fix: add modernize and inline analyzers
We ran 'go mod vendor' to pull in the newly used packages.

Also, add a cmd/go script test that minimally
exercises each analyzer, analogous to the cmd/vet test.

For #75266
For #75267
For #71859

Change-Id: I334daea048e3d2f614a1788292a3175acf173932
Reviewed-on: https://go-review.googlesource.com/c/go/+/710995
Reviewed-by: Michael Matloob <matloob@golang.org>
Auto-Submit: Alan Donovan <adonovan@google.com>
TryBot-Bypass: Alan Donovan <adonovan@google.com>
Reviewed-by: Michael Matloob <matloob@google.com>
2025-10-17 14:39:00 -07:00
Alan Donovan
80876f4b42 cmd/go/internal/vet: tweak help doc
For #71859

Change-Id: I3cea3375bd5adff9486b849e472d29ad8324dd54
Reviewed-on: https://go-review.googlesource.com/c/go/+/712665
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Michael Matloob <matloob@google.com>
2025-10-17 14:12:40 -07:00
Tobias Klauser
b5aefe07e5 all: remove unnecessary loop variable copies in tests
Copying the loop variable is no longer necessary since Go 1.22.

Change-Id: Iebb21dac44a20ec200567f1d786f105a4ee4999d
Reviewed-on: https://go-review.googlesource.com/c/go/+/711640
Reviewed-by: Florian Lehner <lehner.florian86@gmail.com>
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-17 13:10:27 -07:00
Robert Griesemer
5137c473b6 go/types, types2: remove references to under function in comments
Follow-up on CL 712400 which removed the under function.

Change-Id: I253c8adbbaa058150f26e311e37b4c1644b6554d
Reviewed-on: https://go-review.googlesource.com/c/go/+/712520
Reviewed-by: 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>
Auto-Submit: Robert Griesemer <gri@google.com>
2025-10-17 10:23:05 -07:00
Jes Cok
dbbb1bfc91 all: correct name for comments
Change-Id: I390c380349e99ad421264b673ad7734eddb639d3
GitHub-Last-Rev: 32e849a642
GitHub-Pull-Request: golang/go#75905
Reviewed-on: https://go-review.googlesource.com/c/go/+/711941
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2025-10-17 09:52:21 -07:00
Roland Shoemaker
0983090171 encoding/pem: properly decode strange PEM data
When the passed byte slice has leading garbage, properly handle ignoring
it and continuing to parse the slice until we find a valid block (or
nothing).

Change-Id: I07e937d9c754fd71b028b99450b48f57b4464457
Reviewed-on: https://go-review.googlesource.com/c/go/+/712140
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-17 08:44:33 -07:00
qmuntal
36863d6194 runtime: unify riscv64 library entry point
Cq-Include-Trybots: luci.golang.try:gotip-linux-riscv64
Change-Id: I6470dfc5c9e03dfe5fc535605fdd7d861b9ba2f3
Reviewed-on: https://go-review.googlesource.com/c/go/+/706415
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Joel Sing <joel@sing.id.au>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-17 01:07:59 -07:00
Mark Freeman
0c14000f87 go/types, types2: remove under(Type) in favor of Type.Underlying()
As of CL 695977, under(Type) simply delegates to Type.Underlying().
This is just a cleanup.

Change-Id: I48d5fddc38560dfe485184faa6a5ff713bea74a0
Reviewed-on: https://go-review.googlesource.com/c/go/+/712400
Commit-Queue: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-16 15:30:18 -07:00
Mark Freeman
1099436f1b go/types, types2: change and enforce lifecycle of Named.fromRHS and Named.underlying fields
A type definition or alias declaration consists of a type name (LHS)
which is bound to a type expression (RHS) by the declaration.

This CL consistently uses the fromRHS fields of Named and Alias types
to represent that RHS type expression, and sets Named.underlying and
Alias.actual only once those types have been computed.

Currently, Named types use Named.underlying for some of this
functionality, which makes the code difficult to understand. Operations
which used Named.underlying now use Named.fromRHS.

For example, in:

  type A = B
  type B = int

A.fromRHS is B (Alias) and B.fromRHS is int (Basic).

Meanwhile, in:

  type A B
  type B int

A.underlying is B (Named) and B.underlying is int (Basic) initially.

Note that despite A.underlying pointing to B, B is not the underlying
type of A (it is int). At some point during type checking, A walks
through the chain A.underlying -> B.underlying -> int and sets
A.underlying to int.

While this approach works, it introduces some problems:

  1. Whether A.underlying refers to the underlying type (int) or not
     (B) depends on when the field is accessed.
  2. There is no convenient mechanism to check if the underlying type
     of B has been deduced. One can check if B.underlying is a named
     type, but since B.underlying is already B's underlying type (int),
     it's still ambiguous.

Operations derived from Named.underlying share similar problems. For
example, Named.expandUnderlying() (which substitutes type arguments)
returns an instantiated named type whose Named.underlying also may or
may not refer to its underlying type.

With this change, Named.underlying is nil as long as it is unknown, and
non-nil and not a named type once it is known. Additional assertions are
added to enforce that:

  1. Named.underlying is not set until Named has been resolved.
  2. Named is not resolved until Named.fromRHS is populated, unless it
     is given explicit permission. This permission is briefly given
     while type-checking declarations of named types to account for
     cycles of alias types represented as TypeNames. It is also given to
     named types created through NewNamed for backward compatibility.
     This permission is revoked when SetUnderlying is called.

Accessors of Named.underlying are responsible for first resolving
the named type, unless they are in a context where they know the
type to already be resolved.

This change also exposed a bug in validType wherein the underlying
type for struct types containing invalid types did not have their
underlying type set to invalid (see #75194). This bug was exploited by a
test in x/tools, which has been disabled for Go 1.26 (via CL 700395).

Other minor adjustments are made for instantiated and loaded types.
Instantiated types have no RHS as they are not declared, and loaded
types set their RHS to the underlying from export data directly.

Minor simplifications are also made throughout.

Fixes #75194

Change-Id: I72644d7329c996eb1e67514063fe51c3ae06c38d
Reviewed-on: https://go-review.googlesource.com/c/go/+/695977
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>
2025-10-16 11:21:47 -07:00
Robert Griesemer
41f5659347 go/types, types2: remove superfluous unalias call (minor cleanup)
Change-Id: Ifc0d6e999777513498f070c5bc2fb4640d38c671
Reviewed-on: https://go-review.googlesource.com/c/go/+/712460
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
2025-10-16 11:03:04 -07:00
Vasily Leonenko
e7351c03c8 runtime: use DC ZVA instead of its encoding in WORD in arm64 memclr
Change-Id: I900a96b985f4d9378d25b9256c4274610fc2f70e
Reviewed-on: https://go-review.googlesource.com/c/go/+/698417
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-16 06:46:30 -07:00
Alan Donovan
6cbe0920c4 cmd: update to x/tools@7d9453cc
go get golang.org/x/tools@master
 go mod tidy
 go mod vendor

in both cmd and src, for (enforced) consistency.

Also: GOWORK=off go generate -run=bundle std

This will enable use of modernize and inline.

Change-Id: I6348dd97ec2c41437b3ca899ed91f10815f2fe26
Reviewed-on: https://go-review.googlesource.com/c/go/+/707135
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2025-10-16 04:23:16 -07:00
Vasily Leonenko
45eee553e2 cmd/internal/obj: move ARM64RegisterExtension from cmd/asm/internal/arch
Change-Id: Iab41674953655efa7be3d306dfb3f5be486be501
Reviewed-on: https://go-review.googlesource.com/c/go/+/701455
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
2025-10-15 17:35:29 -07:00
Keith Randall
27f9a6705c runtime: increase repeat count for alloc test
To make sure a single spurious alloc doesn't flake the test.

Fixes #75858

Change-Id: I055b37ad5668459bfa7ab1dac97025c997c68f1a
Reviewed-on: https://go-review.googlesource.com/c/go/+/712201
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@google.com>
2025-10-15 15:23:22 -07:00
Damien Neil
b68cebd809 net/http/httptest: record failed ResponseWriter writes
CL 709335 changed ResponseWriter.Write to return an error
when trying to write to a response with a status code which
doesn't permit a body, such as 304.

Continue to return an error, but still record the write in
ResponseWriter.Body. This maintains the documented property that
"the data in buf is written to rw.Body".

For #75471

Change-Id: I69139797559fe09d6580c5d25b4458f04263c60e
Reviewed-on: https://go-review.googlesource.com/c/go/+/711940
Reviewed-by: Sean Liao <sean@liao.dev>
TryBot-Bypass: Damien Neil <dneil@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Nicholas Husin <nsh@golang.org>
Reviewed-by: Nicholas Husin <husin@google.com>
2025-10-15 14:41:11 -07:00
Alan Donovan
f1fed742eb cmd: fix three printf problems reported by newest vet
Change-Id: Id70985d217c940eb022dbc95bfaa20373672512c
Reviewed-on: https://go-review.googlesource.com/c/go/+/712220
Auto-Submit: Alan Donovan <adonovan@google.com>
TryBot-Bypass: Alan Donovan <adonovan@google.com>
Commit-Queue: Alan Donovan <adonovan@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-10-15 13:54:06 -07:00
mohanson
0984dcd757 cmd/compile: fix an error in comments
Remove the redundant only.

Change-Id: I9cf2d84ae080a567ad45a2d0ef002c7c89395479
Reviewed-on: https://go-review.googlesource.com/c/go/+/711960
Auto-Submit: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Bypass: Robert Griesemer <gri@google.com>
2025-10-15 13:48:28 -07:00
Robert Griesemer
31f82877e8 go/types, types2: fix misleading internal comment
See also the discussion in #75885.

Change-Id: Ieb964ea6ee51600c0c08ecba0af50a1deb209a4d
Reviewed-on: https://go-review.googlesource.com/c/go/+/712141
Reviewed-by: Mark Freeman <markfreeman@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
TryBot-Bypass: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
2025-10-15 13:46:26 -07:00
Will Faught
6346349f56 cmd/compile: replace angle brackets with square
Caused Markdown rendering error on https://go.dev/src/cmd/compile/README in macOS (15.6.1) Safari (18.6).

Change-Id: Id71436d9a7bc7e461e522500d66df5dda7cd9f7f
GitHub-Last-Rev: 4e4447e163
GitHub-Pull-Request: golang/go#75549
Reviewed-on: https://go-review.googlesource.com/c/go/+/704716
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Keith Randall <khr@google.com>
2025-10-15 12:58:21 -07:00
Alexander Musman
284379cdfc cmd/compile: remove rematerializable values from live set across calls
Remove rematerializable values in the live set across call operations,
preventing dead constant rematerialization.

When computing live values across function calls, rematerializable
values were being kept in the live set unnecessarily. This caused
the shuffling to rematerialize dead constants.

This change leads to code size reduction on arm64 linux:
    Executable            Old .text  New .text     Change
    -------------------------------------------------------
    asm                     1969236    1964356     -0.25%
    cgo                     1739588    1734884     -0.27%
    compile                 8950788    8932500     -0.20%
    cover                   1877268    1872916     -0.23%
    link                    2572660    2565076     -0.29%
    preprofile               866772     863828     -0.34%
    vet                     2888628    2881028     -0.26%

There seems also some compile time effect:

                        orig.results             uexp.results
                           sec/op       sec/op     vs base
BleveIndexBatch100-4       7.414 ± 2%    7.352 ± 1%       ~ (p=0.218 n=10)
ESBuildThreeJS-4          777.3m ± 1%   778.1m ± 1%       ~ (p=0.529 n=10)
ESBuildRomeTS-4           197.3m ± 1%   199.0m ± 1%       ~ (p=0.143 n=10)
EtcdPut-4                 64.92m ± 2%   64.95m ± 2%       ~ (p=0.912 n=10)
EtcdSTM-4                 323.9m ± 1%   323.0m ± 1%       ~ (p=0.393 n=10)
GoBuildKubelet-4           160.1 ± 0%    159.4 ± 0%  -0.42% (p=0.001 n=10)
GoBuildKubeletLink-4       12.40 ± 1%    12.27 ± 1%       ~ (p=0.529 n=10)
GoBuildIstioctl-4          125.8 ± 0%    125.2 ± 0%  -0.42% (p=0.000 n=10)
GoBuildIstioctlLink-4      8.679 ± 0%    8.686 ± 1%       ~ (p=0.912 n=10)
GoBuildFrontend-4          49.18 ± 0%    48.73 ± 0%  -0.92% (p=0.000 n=10)
GoBuildFrontendLink-4      2.300 ± 1%    2.292 ± 1%  -0.35% (p=0.043 n=10)
GopherLuaKNucleotide-4     37.77 ± 6%    38.07 ± 2%       ~ (p=0.218 n=10)
MarkdownRenderXHTML-4     274.3m ± 0%   275.2m ± 0%  +0.34% (p=0.003 n=10)
Tile38QueryLoad-4         650.7µ ± 0%   650.2µ ± 0%       ~ (p=0.971 n=10)
geomean                    2.130         2.127       -0.15%

Change-Id: I7a766195ee17bfd9e47d7a940864619f553416ff
Reviewed-on: https://go-review.googlesource.com/c/go/+/707415
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-15 12:53:02 -07:00
Youlin Feng
519ae514ab cmd/compile: eliminate bound check for slices of the same length
If two slices start out with the same length and decrease in length by
the same amount on each round of the loop (or in the if block), then
we think their length are always equal.

For example:

if len(a) != len(b) {
	return
}
for len(a) >= 4 {
	a = a[4:]
	b = b[4:] // proved here, omit boundary check
}
if len(a) == len(b) { // proved here
	//...
}

Or, change 'for' to 'if':

if len(a) != len(b) {
	return
}
if len(a) >= 4 {
	a = a[4:]
	b = b[4:]
}
if len(a) == len(b) { // proved here
	//...
}

Fixes #75144

Change-Id: I4e5902a02b5cf8fdc122715a7dbd2fb5e9a8f5dc
Reviewed-on: https://go-review.googlesource.com/c/go/+/699155
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
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>
2025-10-15 12:34:48 -07:00
Alan Donovan
b5a29cca48 cmd/distpack: add fix tool to inventory
(To be consistent with change to build.go in CL 700795.)

For #71859

Change-Id: I8caad28b7e5a2657f21b60a72899daecf0b2c324
Reviewed-on: https://go-review.googlesource.com/c/go/+/712180
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Michael Matloob <matloob@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
TryBot-Bypass: Alan Donovan <adonovan@google.com>
2025-10-15 12:29:26 -07:00
matloob
bb5eb51715 runtime/pprof: fix errors in pprof_test
I think the original depth-1 argument to allocDeep was correct.
Reverted that, and also the change to maxSkip in mprof.go, which was
also incorrect. I think before we were usually passing accidentally in
the loop over matched stacks when we really should usually have been
passing in the previous loop.

Change-Id: I6a6a696463e2baf045b66f418d7afbfcb49258e4
Reviewed-on: https://go-review.googlesource.com/c/go/+/712100
Reviewed-by: Michael Matloob <matloob@google.com>
TryBot-Bypass: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-10-15 11:15:17 -07:00
Vasily Leonenko
5c9a26c7f8 cmd/compile: use arm64 neon in LoweredMemmove/LoweredMemmoveLoop
Raspberry Pi 5 (Cortex-A76)

                     │   base.log   │               opt.log               │
                     │    sec/op    │   sec/op     vs base                │
MemmoveKnownSize112     3.549n ± 0%   3.652n ± 0%   +2.92% (p=0.000 n=10)
MemmoveKnownSize128     3.979n ± 0%   3.617n ± 0%   -9.09% (p=0.000 n=10)
MemmoveKnownSize192     7.566n ± 0%   5.074n ± 0%  -32.94% (p=0.000 n=10)
MemmoveKnownSize248     8.549n ± 0%   7.184n ± 1%  -15.97% (p=0.000 n=10)
MemmoveKnownSize256    10.010n ± 0%   6.827n ± 0%  -31.80% (p=0.000 n=10)
MemmoveKnownSize512     19.81n ± 0%   13.59n ± 0%  -31.40% (p=0.000 n=10)
MemmoveKnownSize1024    39.66n ± 0%   27.00n ± 0%  -31.93% (p=0.000 n=10)
geomean                 9.538n        7.392n       -22.50%

Change-Id: I7b17408cd0a500ceaa80bc93ffe2f19ddeea9c0d
Reviewed-on: https://go-review.googlesource.com/c/go/+/692315
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-15 09:38:03 -07:00
Keith Randall
61d1ff61ad cmd/compile: use block starting position for phi line number
Fixes #75615

Change-Id: I2c7f0ea1203e8a97749c9f780c29a66050f0159d
Reviewed-on: https://go-review.googlesource.com/c/go/+/710355
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-15 09:13:12 -07:00
Ian Alexander
5b29875c8e cmd/go: inject State parameter into run.runRun
This command modifies the call tree starting at `run.runRun` to inject
a `State` parameter to every function that is currently using the
global `modload.LoaderState` variable.  By explicilty passing a
`State` parameter, we can begin to eliminate the usage of the global
`modload.LoaderState`.

This commit is part of the overall effort to eliminate global
modloader state.

[git-generate]
cd src/cmd/go/internal/run
rf 'inject modload.LoaderState runRun'
cd ..
./rf-cleanup.zsh

Change-Id: I337323c087ed4e43af28973fad27152791eefbc2
Reviewed-on: https://go-review.googlesource.com/c/go/+/698063
TryBot-Bypass: Ian Alexander <jitsu@google.com>
Reviewed-by: Michael Matloob <matloob@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2025-10-15 08:59:02 -07:00
matloob
5113496805 runtime/pprof: skip flaky test TestProfilerStackDepth/heap for now
The test has been causing a lot of flakes on the builders. Skip it while
I'm debugging it.

For #74029

Change-Id: I6a6a696450c23f65bc310a2d0ab61b22dba88f00
Reviewed-on: https://go-review.googlesource.com/c/go/+/712060
TryBot-Bypass: Michael Matloob <matloob@google.com>
Reviewed-by: Michael Matloob <matloob@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-10-15 08:32:21 -07:00
Ian Alexander
36086e85f8 cmd/go: create temporary cleanup script
This is a large series of sed commands to cleanup after successful use
of the `rf inject` command.  This script will be used to refactor the
codebase to eliminate global state within the module loader.  Once
that effort is complete, this script will be removed.

This commit is part of the overall effort to eliminate global
modloader state.

Change-Id: If04926b5ca5b7230f91ac98fe4a82c20ef5f73ee
Reviewed-on: https://go-review.googlesource.com/c/go/+/709978
Reviewed-by: Michael Matloob <matloob@golang.org>
TryBot-Bypass: Ian Alexander <jitsu@google.com>
Commit-Queue: Ian Alexander <jitsu@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-10-15 07:30:13 -07:00
David Chase
7056c71d32 cmd/compile: disable use of new saturating float-to-int conversions
The new conversions can be activated (or bisected) with
  -gcflags=all=-d=converthash=PATTERN

where PATTERN is either a hash string or n, qn, y, qy for
no, quietly no, yes, quietly yes.

This CL makes the default pattern be "qn" instead of the
default-default which is an efficient encoding of "qy".

Updates #75834

Change-Id: I88a9fd7880bc999132420c8d0a22a8fdc1e95a2a
Reviewed-on: https://go-review.googlesource.com/c/go/+/711845
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Bypass: David Chase <drchase@google.com>
2025-10-14 15:09:35 -07:00
David Chase
6d5b13793f Revert "cmd/compile: make 386 float-to-int conversions match amd64"
This reverts commit 78d75b3799.

Reason for revert: we need to do this more carefully, at minimum gated by a module version

(This should follow the softfloat FP conversion revert)

Change-Id: I736bec6cd860285dcc3b11fac85b377a149435c3
Reviewed-on: https://go-review.googlesource.com/c/go/+/711842
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>
2025-10-14 12:46:22 -07:00
David Chase
bb2a14252b Revert "runtime: adjust softfloat corner cases to match amd64/arm64"
This reverts commit b9f3accdcf.

Reason for revert: we need to do this more carefully, at minimum gated by a module version

(This should follow the WASM FP conversion revert)

Change-Id: Ib98ce7d243348f69c9944db8537397b225c2cc33
Reviewed-on: https://go-review.googlesource.com/c/go/+/711841
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Bypass: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@google.com>
2025-10-14 12:45:58 -07:00
David Chase
3bc9d9fa83 Revert "cmd/compile: make wasm match other platforms for FP->int32/64 conversions"
This reverts commit 8d810286b3.

Reason for revert: we need to do this more carefully, at minimum gated by a module version

Change-Id: Ia951e2e5ecdd455ea0f17567963c6fab0f4540dc
Reviewed-on: https://go-review.googlesource.com/c/go/+/711840
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2025-10-14 12:44:32 -07:00
Junyang Shao
fc3bc49337 [dev.simd] simd: clean up mask load comments
Addressing a comment from CL 710915.

Change-Id: Id65f525130b5b626ea7017aebc93a4b3b0c93d84
Reviewed-on: https://go-review.googlesource.com/c/go/+/711780
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-10-14 12:26:48 -07:00
Junyang Shao
416332dba2 [dev.simd] cmd/compile, simd: update DotProd to DotProduct
API naming changes.

This CL also remove AddDotProductPairsSaturated.

Change-Id: I02e6d45268704f3ed4eaf62f0ecb7dc936b42124
Reviewed-on: https://go-review.googlesource.com/c/go/+/710935
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-10-14 12:26:44 -07:00
Junyang Shao
647c790143 [dev.simd] cmd/compile: peephole simd mask load/stores from bits
The added test are manually checked that the peepholes are triggered.

Change-Id: Ibd29eac449869b52c2376f9eafd83410b5266890
Reviewed-on: https://go-review.googlesource.com/c/go/+/710916
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-14 12:26:41 -07:00
Junyang Shao
2e71cf1a2a [dev.simd] cmd/compile, simd: remove mask load and stores
We have convert mask to bits already, the API of mask load and stores
are inconsistent with them, also mask load and stores could just be
hidden behind peepholes. So this CL removes them, the next CL will add
the peephole for them.

Change-Id: Ifa7d23fb52bb0efd1785935ead4d703927f16d2b
Reviewed-on: https://go-review.googlesource.com/c/go/+/710915
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-14 12:26:37 -07:00
Joe Tsai
ee5af46172 encoding/json: avoid misleading errors under goexperiment.jsonv2
The jsontext package represents the location of JSON errors
using a JSON Pointer (RFC 6901). This uses the JSON type system.

Unfortunately the v1 json.UnmarshalTypeError assumes a Go struct-based
mechanism for reporting the location of errors
(and has historically never been implemented correctly since
it was a weird mix of both JSON and Go namespaces; see #43126).
Trying to map a JSON Pointer into UnmarshalTypeError.{Struct,Field}
is difficult to get right without teaching jsontext
about the Go type system.

To reduce the probability of misleading errors,
check whether the last token looks like a JSON array index
and if so, elide the phrase "into Go struct field".

Fixes #74801

Change-Id: Id2088ffb9c339a9238ed38c90223d86a89422842
Reviewed-on: https://go-review.googlesource.com/c/go/+/710676
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
2025-10-14 12:20:23 -07:00
Bill Roberts
11d3d2f77d cmd/internal/obj/arm64: add support for PAC instructions
Add support for the Pointer Authentication Code instructions
required for the ELF ABI when enabling PAC aware binaries.

This allows for assembly writers to add PAC instructions where needed to
support this ABI. Follow up work is to enable the compiler to emit these
instructions in the appropriate places.

The TL;DR for the Linux ABI is that the prologue of a function that
pushes the link register (LR) to the stack, signs the LR with a key
managed by the operating system and hardware using a PAC instruction,
like "paciasp". The function epilog, when restoring the LR from the
stack will verify the signature, using an instruction like "autiasp".

This helps prevents attackers from modifying the return address on the
stack, a common technique for ROP attacks.

Details on PAC can be found here:
  - https://community.arm.com/arm-community-blogs/b/architectures-and-processors-blog/posts/enabling-pac-and-bti-on-aarch64
  - https://developer.arm.com/documentation/109576/0100/Pointer-Authentication-Code

The ABI details can be found here:
  - https://github.com/ARM-software/abi-aa/blob/main/aaelf64/aaelf64.rst

Change-Id: I4516ed1294d19f9ff9d278833d542821b6642aa9
Reviewed-on: https://go-review.googlesource.com/c/go/+/676675
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Joel Sing <joel@sing.id.au>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2025-10-14 12:00:00 -07:00
Mateusz Poliwczak
4dbf1a5a4c cmd/compile/internal/devirtualize: do not track assignments to non-PAUTO
We do not lookup/devirtualize such, so we can skip tracking them.

Change-Id: I8bdb0b11c694e4b2326c236093508a356a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/711160
Reviewed-by: Keith Randall <khr@golang.org>
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@google.com>
2025-10-14 11:31:45 -07:00
Mateusz Poliwczak
0ddb5ed465 cmd/compile/internal/devirtualize: use FatalfAt instead of Fatalf where possible
Change-Id: I5e9e9c89336446720c3c21347969e4126a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/711140
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
2025-10-14 11:31:42 -07:00
Damien Neil
0a239bcc99 Revert "net/url: disallow raw IPv6 addresses in host"
This reverts commit e3be2d1b2b.

Reason for revert: Causes extensive failures in Google-internal testing.

Change-Id: I232f547fc326dff7df959d25f3a89777ea33b201
Reviewed-on: https://go-review.googlesource.com/c/go/+/711800
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-10-14 10:43:46 -07:00
Mateusz Poliwczak
5a9ef44bc0 cmd/compile/internal/devirtualize: fix OCONVNOP assertion
Fixes #75863

Change-Id: I1e5a0f3880dcd5f820a5b6f4540c49b16a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/711141
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Lasse Folger <lassefolger@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-14 09:33:37 -07:00
Robert Griesemer
3765758b96 go/types, types2: minor cleanup (remove TODO)
Follow-up to CL 711420.

Change-Id: If577e96f413e46b98dd86d11605de1004637851a
Reviewed-on: https://go-review.googlesource.com/c/go/+/711540
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-14 08:50:15 -07:00
Filippo Valsorda
f6b9d56aff crypto/internal/fips140/entropy: fix benign race
Fixes #75690
Fixes #75842

Change-Id: I6a6a696420f51f28f48535c34cf347e2cbd4add5
Reviewed-on: https://go-review.googlesource.com/c/go/+/710058
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-14 07:57:03 -07:00
Filippo Valsorda
60f6d2f623 crypto/internal/fips140/entropy: support SHA-384 sizes for ACVP tests
Change-Id: I6a6a6964decc662d753ee3eec357570bd3c95e2d
Reviewed-on: https://go-review.googlesource.com/c/go/+/710056
Auto-Submit: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Nooras Saba‎ <noorassaba@google.com>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
2025-10-14 07:56:59 -07:00
Joe Tsai
6fd8e88d07 encoding/json/v2: restrict presence of default options
Originally, DefaultOptionsV1 and DefaultOptionsV2 represented
the full set of all options with specific ones set to true or false.

However, there are certain options such as WithIndent or WithMarshalers
that are neither v1 or v2 specific.
At some point we removed whitespace related options from the set:
https://github.com/go-json-experiment/json/pull/26

This avoids DefaultOptionsV1 or DefaultOptionsV2 from affecting
any previously set whitespace. However, why are whitespace options
special and thus excluded from the set? What about Marshalers?

As a more principaled way to address this, we restrict
DefaultOptionsV1 and DefaultOptionsV2 to only be the options
where the default setting changes between v1 and v2.
All other options are unpopulated.

This avoids a panic with GetOption(DefaultOptionsV2, WithMarshalers)
since DefaultOptionsV2 previously had the presence bit for
Marshalers set to true, but had no actual value.
Now, the presence bit is set to false, so the value is not consulted.

Fixes #75149

Change-Id: I30b45abd35404578b4135cc3bad1a1a2993cb0cf
Reviewed-on: https://go-review.googlesource.com/c/go/+/710878
Reviewed-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2025-10-13 17:01:45 -07:00
Robert Griesemer
1abc6b0204 go/types, types2: permit type cycles through type parameter lists
Issue #49439 was about a deadlock during type inference inside
a type parameter list of a recursive constraint. As a remedy
we disallowed recursive type parameter lists.

In the meantime we have removed support for type inference for
type arguments to generic types; the Go 1.18 generic release
didn't support it.

As a consequence, the fix for #49439, CL 361922, is probably
not needed anymore: cycles through type parameter lists are ok.

Fixes #68162.
For #49439.

Change-Id: Ie9deb3274914d428e8e45071cee5e68abf8afe9c
Reviewed-on: https://go-review.googlesource.com/c/go/+/711420
Commit-Queue: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Bypass: Robert Griesemer <gri@google.com>
2025-10-13 14:27:13 -07:00
Junyang Shao
c4fbf3b4cf [dev.simd] simd/_gen: add mem peephole with feat mismatches
This CL attempts to add peepholes for Op -> Opload where the Opload has
a different CPU feature than Op. However the new simdgen changes doesn't
do anything because such peepholes do not exist.

Change-Id: I20c3e4b43bb7414c3a309d77786218372ca1b5b8
Reviewed-on: https://go-review.googlesource.com/c/go/+/711380
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-13 13:04:47 -07:00
Russ Cox
9fdd6904da strconv: add tests that Java once mishandled
Change-Id: I372233d8494665b3300f9a186c883a4254435e1c
Reviewed-on: https://go-review.googlesource.com/c/go/+/710617
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-10-13 12:35:20 -07:00
Keith Randall
9b8742f2e7 cmd/compile: don't depend on arch-dependent conversions in the compiler
Leave those constant foldings for runtime, similar to how we do it
for NaN generation.

These are the only instances I could find in cmd/compile/..., using

objdump -d ../pkg/tool/darwin_arm64/compile| egrep "(fcvtz|>:)" | grep -B1 fcvt

(There are instances in other places, like runtime and reflect, but I don't
think those places would affect compiler output.)

Change-Id: I4113fe4570115e4765825cf442cb1fde97cf2f27
Reviewed-on: https://go-review.googlesource.com/c/go/+/711281
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@google.com>
2025-10-13 12:19:32 -07:00
Joe Tsai
0e64ee1286 encoding/json/v2: report EOF for top-level values in UnmarshalDecode
The fully streaming UnmarshalJSONFrom method and UnmarshalFromFunc
introduce an edge case where they can encounter EOF in the stream,
where it should be reported upstream as EOF rather than
ErrUnexpectedEOF or be wrapped within a SemanticError.

This is not possible with other unmarshal methods since the
"json" package would read the appropriate JSON value
before calling the custom method or function.

To avoid custom unmarshal methods from encountering EOF,
check whether the stream is already at EOF for top-level values
before calling the custom method.

Also, when wrapping EOF within a SemanticError, convert it
to ErrUnexpectedEOF to better indicate that this is unexpected.

Fixes #75802

Change-Id: I001396734b7e95b5337f77b71326284974ee730a
Reviewed-on: https://go-review.googlesource.com/c/go/+/710877
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2025-10-13 10:44:23 -07:00
Julien Cretel
6bcd97d9f4 all: replace calls to errors.As with errors.AsType
This change replaces most occurrences (in code as well as in comments) of
errors.As with errors.AsType. It leaves the errors package and vendored
code untouched.

Change-Id: I3bde73f318a0b408bdb8f5a251494af15a13118a
GitHub-Last-Rev: 8aaaa36a5a
GitHub-Pull-Request: golang/go#75698
Reviewed-on: https://go-review.googlesource.com/c/go/+/708495
Auto-Submit: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-10-13 10:12:48 -07:00
David Chase
ba72ee0f30 [dev.simd] cmd/compile: more support for cpufeatures
add hasFeature, also record maximum feature for a function

Change-Id: I68dd063aad1c1dc0ef5310a9f5d970c03dd31a0e
Reviewed-on: https://go-review.googlesource.com/c/go/+/710695
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-13 09:27:28 -07:00
Roland Shoemaker
1cd71689f2 crypto/x509: rework fix for CVE-2025-58187
In CL 709854 we enabled strict validation for a number of properties of
domain names (and their constraints). This caused significant breakage,
since we didn't previously disallow the creation of certificates which
contained these malformed domains.

Rollback a number of the properties we enforced, making domainNameValid
only enforce the same properties that domainToReverseLabels does. Since
this also undoes some of the DoS protections our initial fix enabled,
this change also adds caching of constraints in isValid (which perhaps
is the fix we should've initially chosen).

Updates #75835
Fixes #75828

Change-Id: Ie6ca6b4f30e9b8a143692b64757f7bbf4671ed0e
Reviewed-on: https://go-review.googlesource.com/c/go/+/710735
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2025-10-11 16:12:44 -07:00
Cherry Mui
8aa1efa223 cmd/link: in TestFallocate, only check number of blocks on Darwin
The number-of-blocks check was introduced when fixing a Darwin-
specific bug. On Darwin, the file allocation syscall is a bit
tricky. On Linux and BSDs, it is more straightforward and unlikely
to go wrong.

The test itself, on the other hand, is less reliable on Linux (and
perhaps BSDs), as it is considered less portable and is an
implementation detail of the file system.

Given these two reasons, only check it on Darwin.

Fixes #75795.

Change-Id: I3da891fd60a141c3eca5d0f5ec20c2cad65b8862
Reviewed-on: https://go-review.googlesource.com/c/go/+/711095
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2025-10-11 08:51:54 -07:00
Joe Tsai
b497a29d25 encoding/json: fix regression in quoted numbers under goexperiment.jsonv2
The legacy parsing of quoted numbers in v1 was according to
the Go grammar for a number, rather than
the JSON grammar for a number.
The former is a superset of the latter.

This is a historical mistake, but usages exist that depend on it.
We already have branches for StringifyWithLegacySemantics
to handle quoted nulls, so we can expand it to handle this.

Fixes #75619

Change-Id: Ic07802539b7cbe0e1f53bd0f7e9bb344a8447203
Reviewed-on: https://go-review.googlesource.com/c/go/+/709615
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Joseph Tsai <joetsai@digital-static.net>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-10-10 18:03:36 -07:00
David Chase
48bb7a6114 cmd/compile: repair bisection behavior for float-to-unsigned conversion
My stab at a bisect-reproducer failed, but I verified that
it fixed the problem described in the issue.

Updates #75834

Change-Id: I9e0dfacd2bbd22cbc557e144920ee3417a48088c
Reviewed-on: https://go-review.googlesource.com/c/go/+/710997
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-10-10 16:21:25 -07:00
Michael Anthony Knyszek
e8a53538b4 runtime: fail TestGoroutineLeakProfile on data race
Some of the programs in testdata/testgoroutineleakprofile have data
races because they were taken from a corpus that showcases general Go
concurrency bugs, not just leaked goroutines.

This causes some flakiness as tests might fail due to, for example, a
concurrent map access, even outside of race mode.

Let's just call data races a failure and fix them in the examples. As
far as I can tell, there are only two that show up consistently.

Fixes #75732.

Change-Id: I160b3a1cdce4c2de3f2320b68b4083292e02b557
Reviewed-on: https://go-review.googlesource.com/c/go/+/710756
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-10-10 15:58:20 -07:00
Sean Liao
e3be2d1b2b net/url: disallow raw IPv6 addresses in host
RFC 3986 requires square brackets around IPv6 addresses.
Parse's acceptance of raw IPv6 addresses is non compliant,
and complicates splitting out a port.

Fixes #31024
Fixes #75223

Change-Id: I477dc420a7441cb33156627dbd5e46d88c677f1e
Reviewed-on: https://go-review.googlesource.com/c/go/+/710176
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-10-10 14:47:41 -07:00
Sean Liao
aced4c79a2 net/http: strip request body headers on POST to GET redirects
According to WHATWG Fetch, when the body is dropped in a redirect,
headers that describe the body should also be dropped.
https://fetch.spec.whatwg.org/#http-redirect-fetch

Fixes #57273

Change-Id: I84598f69608e95c1b556ea0ce5953ed43bf2d824
Reviewed-on: https://go-review.googlesource.com/c/go/+/710395
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-10 14:39:53 -07:00
cuishuang
584a89fe74 all: omit unnecessary reassignment
The new version of Go has been optimized, and variables do not need
to be reassigned.

Change-Id: I0374b049271e53510f2b162f6821fb3595f2c8ff
Reviewed-on: https://go-review.googlesource.com/c/go/+/710835
Auto-Submit: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-10-10 14:38:27 -07:00
Sean Liao
69e8279632 net/http: set cookie host to Request.Host when available
When both Request.URL and Request.Host are set, the host in URL
is used for connecting at the transport level, while Host is used
for the request host line. Cookies should be set for the request,
not the underlying connection destination.

Fixes #38988

Change-Id: I09053b87ccac67081f6038d205837d9763701526
Reviewed-on: https://go-review.googlesource.com/c/go/+/710335
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-10 14:38:20 -07:00
Alan Donovan
6f4c63ba63 cmd/go: unify "go fix" and "go vet"
This change unifies the fix and vet subcommands; they use the
same run function, action graph, and external tool (-vettool
for go vet and -fixtool for go fix). go fix runs the tool
with the -fix flag, whereas although go vet also supports
-fix, it is not the default. The two tools have different
(overlapping) suites of analyzers.

The high-level parts are fully parameterized over the
vet/fix distinction; the lower-level parts (the action
graph) continue to use only the "vet" terminology.
The cmd/{vet,fix} executable is referred to as the "tool".

The tool is generally invoked in -json mode, regardless
of whether -json was requested, so that the tool produces
a cacheable JSON blob on stdout. When the go user did not
request -json, this blob is parsed and printed to stderr
by logic in the go vet command. (Formerly the tool would
print diagnostics to stderr, but this interacts poorly
with the build cache.)

go fix's legacy -fix=fixer,... flag is now a no-op that
prints a warning that the flag is obsolete.

The unitchecker's -c=n flag (to display n lines of context
around each diagnostic) is reimplemented in go vet based
on the JSON information, to avoid reliance on the stderr
output of the tool.

cmd/fix is added to dist's prebuilt set of tools since
go fix cannot build it dynamically (though ideally
it would).

Updates #71859
For #75432

Change-Id: I0a84746720b59d05d662ed57826747c5598dca44
Reviewed-on: https://go-review.googlesource.com/c/go/+/700795
Reviewed-by: Michael Matloob <matloob@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
TryBot-Bypass: Alan Donovan <adonovan@google.com>
2025-10-10 13:10:21 -07:00
Julia Lapenko
955a5a0dc5 runtime: support arm64 Neon in async preemption
This is a port of CL 669195 adjusted to save arm64 Neon registers
off stack.

Change-Id: Ia014778a8c9f0c1d05977b04184f51e791ae8495
Reviewed-on: https://go-review.googlesource.com/c/go/+/695916
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-10-10 12:44:25 -07:00
Damien Neil
5368e77429 net/http: run TestRequestWriteTransport with fake time to avoid flakes
This test verifies whether or not we use the chunked encoding when
sending a request with a body like io.NopCloser(strings.NewReader("")).
This depends on whether the transport can read a single byte from the
request body within 200ms, which is flaky on very slow builders.

Use fake time to avoid flakes.

Fixes #52575

Change-Id: Ie11a58ac6bc18d43af1423827887e804242dee30
Reviewed-on: https://go-review.googlesource.com/c/go/+/710737
Auto-Submit: Nicholas Husin <nsh@golang.org>
Reviewed-by: Nicholas Husin <husin@google.com>
Reviewed-by: Nicholas Husin <nsh@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-10 08:39:10 -07:00
WANG Xuerui
c53cb642de internal/buildcfg: enable greenteagc experiment for loong64
The loong64 compiler bug has been resolved, so we can now
unconditionally enable the experiment on the architecture.

Updates #73581
Fixes #75776

Change-Id: I390f8a125d43ca64798ea5b6a408aaf7220fadbf
Reviewed-on: https://go-review.googlesource.com/c/go/+/710476
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: abner chenc <chenguoqi@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-10-09 18:31:01 -07:00
David Chase
be57d94c4c [dev.simd] simd: add emulated Not method
this is to help match other SIMD architectures and to
simplify processing of logical expressions for rewriting
to ternary-logical simd instructions.

Change-Id: I3c83afbb399d32ba2ade5f8ef288d4a07e1f3948
Reviewed-on: https://go-review.googlesource.com/c/go/+/710696
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-10-09 18:09:15 -07:00
WANG Xuerui
954fdcc51a cmd/compile: declare no output register for loong64 LoweredAtomic{And,Or}32 ops
The ICE seen on loong64 while compiling the `(*gcWork).tryStealSpan`
function was due to an `LoweredAtomicAnd32` op (inlined from the
`(pMask).clear` implementation) being incorrectly assigned an output
register while it shouldn't have. Because the op is of mem type, it has
needRegister() == false; hence in the shuffle phase of regalloc, its
bogus output register has no associated `orig` value recorded. The bug
was introduced in CL 482756, but only recently exposed by CL 696035.

Since the old-style atomic ops need no return value (and is even
documented so besides the loong64 ssa op definition), just fix the
register info for both.

While at it, add a note in the ssa op definition file about the
architectural necessity of resultNotInArgs for loong64 atomic ops,
because the practice is not seen in several other arches I have
checked.

Updates #75776

Change-Id: I087f51b8a2825d7b00fc3965b0afcc8b02cad277
Reviewed-on: https://go-review.googlesource.com/c/go/+/710475
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-10-09 18:07:03 -07:00
Michael Matloob
19a30ea3f2 cmd/compile: call generated size-specialized malloc functions directly
This change creates calls to size-specialized malloc functions instead
of calls to newObject when we know the size of the allocation at
compilation time. Most of it is a matter of calling the newObject
function (which will create calls to the size-specialized functions)
rather then the newObjectNonSpecialized function (which won't). In the
newHeapaddr, small, non-pointer case, we'll create a non specialized
newObject and transform that into the appropriate size-specialized
function when we produce the mallocgc in flushPendingHeapAllocations.

We have to update some of the rewrites in generic.rules to also apply to
the size-specialized functions when they apply to newObject.

The messiest thing is we have to adjust the offset we use to save the
memory profiler stack, because the depth of the call to profilealloc is
two frames fewer in the size-specialized malloc functions compared to
when newObject calls mallocgc. A bunch of tests have been adjusted to
account for that.

Change-Id: I6a6a6964c9037fb6719e392c4a498ed700b617d7
Reviewed-on: https://go-review.googlesource.com/c/go/+/707856
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
2025-10-09 14:59:40 -07:00
Michael Anthony Knyszek
80f3bb5516 reflect: remove timeout in TestChanOfGC
This test has an arbitrary 5 second timeout, and this seems to fire on
Darwin with mayMoreStackMove enabled (which is slow). Just rely on the
regular test timeout instead of this arbitrary shorter timeout to
eliminate the possibility that the test is just too slow.

On my Linux VM, I can get this test to take up to 2 seconds with
mayMoreStackMove set on all the same packages dist does, so this failure
mode is actually plausible.

Fixes #75742.

Change-Id: Iebcc859cab26e9205b57b869690162a9a424dfce
Reviewed-on: https://go-review.googlesource.com/c/go/+/710618
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
2025-10-09 14:34:31 -07:00
Roland Shoemaker
9db7e30bb4 net/url: allow IP-literals with IPv4-mapped IPv6 addresses
The security fix we applied in CL709857 was overly broad. It applied
rules from RFC 2732, which disallowed IPv4-mapped IPv6 addresses, but
these were later allowed in RFC 3986, which is the canonical URI syntax
RFC.

Revert the portion of CL709857 which restricted IPv4-mapped addresses,
and update the related tests.

Fixes #75815

Change-Id: I3192f2275ad5c386f5c15006a6716bdb5282919d
Reviewed-on: https://go-review.googlesource.com/c/go/+/710375
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ethan Lee <ethanalee@google.com>
Auto-Submit: Roland Shoemaker <roland@golang.org>
2025-10-09 09:13:29 -07:00
David Chase
8d810286b3 cmd/compile: make wasm match other platforms for FP->int32/64 conversions
this change is for overflows, so that all the platforms agree.

Change-Id: I9f459353615bf24ef8a5de641063d9ce34986241
Reviewed-on: https://go-review.googlesource.com/c/go/+/708358
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>
2025-10-09 08:24:04 -07:00
David Chase
b9f3accdcf runtime: adjust softfloat corner cases to match amd64/arm64
This chooses saturating behavior for over/underflow.

Change-Id: I96a33ef73feacdafe8310f893de445060bc1a536
Reviewed-on: https://go-review.googlesource.com/c/go/+/709595
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
2025-10-09 08:23:39 -07:00
David Chase
78d75b3799 cmd/compile: make 386 float-to-int conversions match amd64
Change-Id: Iff13b4471f94a6a91d8b159603a9338cb9c89747
Reviewed-on: https://go-review.googlesource.com/c/go/+/708295
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-09 08:23:30 -07:00
David Chase
0e466a8d1d cmd/compile: modify float-to-[u]int so that amd64 and arm64 match
Eventual goal is that all the architectures agree, and are
sensible.  The test will be build-tagged to exclude
not-yet-handled platforms.

This change also bisects the conversion change in case of bugs.
(`bisect -compile=convert ...`)

Change-Id: I98528666b0a3fde17cbe8d69b612d01da18dce85
Reviewed-on: https://go-review.googlesource.com/c/go/+/691135
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>
2025-10-09 08:23:21 -07:00
Sean Liao
4837fbe414 net/http/httptest: check whether response bodies are allowed
Fixes #75471

Change-Id: Ie8fc5fae4b2a9285501198d8379bbffe51ee63f7
Reviewed-on: https://go-review.googlesource.com/c/go/+/709335
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-08 14:52:40 -07:00
Federico Guerinoni
ee163197a8 path/filepath: return cleaned path from Rel
As the doc says, Rel should return a cleaned path.

Fixes #75763

Change-Id: Ic0f5a3b1da3cc4cf3c31fdb1a88ebcc4ea6f9169
Reviewed-on: https://go-review.googlesource.com/c/go/+/709675
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Auto-Submit: Sean Liao <sean@liao.dev>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2025-10-08 14:27:39 -07:00
Mateusz Poliwczak
de9da0de30 cmd/compile/internal/devirtualize: improve concrete type analysis
This change improves the concrete type analysis in the devirtualizer,
it not longer relies on ir.Reassigned, it now statically tries to
determine the concrete type of an interface, even when assigned
multiple times, following type assertions and iface conversions.

Alternative to CL 649195

Updates #69521
Fixes #64824

Change-Id: Ib1656e19f3619ab2e1e6b2c78346cc320490b2af
GitHub-Last-Rev: e8fa0b12f0
GitHub-Pull-Request: golang/go#71935
Reviewed-on: https://go-review.googlesource.com/c/go/+/652036
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
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>
2025-10-08 14:09:22 -07:00
Filippo Valsorda
ae094a1397 crypto/internal/fips140test: make entropy file pair names match
Change-Id: I6a6a69642d00e3994277d9b5631d1d7f18f3f356
Reviewed-on: https://go-review.googlesource.com/c/go/+/710055
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-10-08 14:06:44 -07:00
Paul Murphy
941e5917c1 runtime: cleanup comments from asm_ppc64x.s improvements
CL 706395 consolidated the aix and elf startup code, further
update the comments to reflect this.

Change-Id: Iccb98008b3fe4a4b08e55ee822924fad76846cc2
Reviewed-on: https://go-review.googlesource.com/c/go/+/708355
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Paul Murphy <paumurph@redhat.com>
Reviewed-by: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Keith Randall <khr@google.com>
2025-10-08 13:57:01 -07:00
Robbie McMichael
d945600d06 cmd/gofmt: change -d to exit 1 if diffs exist
When using the -d flag, set the exit code to 1 if there is a diff.

Fixes #46289

Change-Id: I802e8ccd1798ed7f4448696bec4bc82835ec71a2
GitHub-Last-Rev: db2207fba9
GitHub-Pull-Request: golang/go#75649
Reviewed-on: https://go-review.googlesource.com/c/go/+/707635
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Auto-Submit: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-08 13:56:57 -07:00
Alan Donovan
d4830c6130 cmd/internal/obj: fix Link.Diag printf errors
go1.26's vet printf checker can associate the printf-wrapper
property with local vars and struct fields if they are assigned
from a printf-like func literal (CL 706635). This leads to better
detection of mistakes.

Change-Id: I604be1e200aa1aba75e09d4f36ab68c1dba3b8a3
Reviewed-on: https://go-review.googlesource.com/c/go/+/710195
Auto-Submit: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-10-08 13:44:19 -07:00
Vlad Saioc
e1ca1de123 net/http: format pprof.go
Properly formatted net/http/pprof.go to correct
inconsistent whitespaces between keys and values
for profileSupportsDelta.

Change-Id: Iea1515b4289de95862d7eb3af5b8d8d13df2b990
GitHub-Last-Rev: 381d2d3ee7
GitHub-Pull-Request: golang/go#75769
Reviewed-on: https://go-review.googlesource.com/c/go/+/709415
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
2025-10-08 10:09:37 -07:00
Damien Neil
e5d004c7a8 net/http: update HTTP/2 documentation to reference new config features
Update the package docs to point users at the modern HTTP/2
configuration APIs.

Mention in the TLSNextProto documentation that this field is
superseded by the Protocols field for most user-facing purposes.

Change-Id: I30cd9a85a27e1174338f0d6b887f98c28eac5b5d
Reviewed-on: https://go-review.googlesource.com/c/go/+/709797
Reviewed-by: Nicholas Husin <nsh@golang.org>
Reviewed-by: Nicholas Husin <husin@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-08 08:49:59 -07:00
Michael Munday
97fd6bdecc cmd/compile: fuse NaN checks with other comparisons
NaN checks can often be merged into other comparisons by inverting them.
For example, `math.IsNaN(x) || x > 0` is equivalent to `!(x <= 0)`.

goos: linux
goarch: amd64
pkg: math
cpu: 12th Gen Intel(R) Core(TM) i7-12700T
            │         sec/op         │    sec/op     vs base                │
Acos                     4.315n ± 0%    4.314n ± 0%        ~ (p=0.642 n=10)
Acosh                    8.398n ± 0%    7.779n ± 0%   -7.37% (p=0.000 n=10)
Asin                     4.203n ± 0%    4.211n ± 0%   +0.20% (p=0.001 n=10)
Asinh                   10.150n ± 0%    9.562n ± 0%   -5.79% (p=0.000 n=10)
Atan                     2.363n ± 0%    2.363n ± 0%        ~ (p=0.801 n=10)
Atanh                    8.192n ± 2%    7.685n ± 0%   -6.20% (p=0.000 n=10)
Atan2                    4.013n ± 0%    4.010n ± 0%        ~ (p=0.073 n=10)
Cbrt                     4.858n ± 0%    4.755n ± 0%   -2.12% (p=0.000 n=10)
Cos                      4.596n ± 0%    4.357n ± 0%   -5.20% (p=0.000 n=10)
Cosh                     5.071n ± 0%    5.071n ± 0%        ~ (p=0.585 n=10)
Erf                      2.802n ± 1%    2.788n ± 0%   -0.54% (p=0.002 n=10)
Erfc                     3.087n ± 1%    3.071n ± 0%        ~ (p=0.320 n=10)
Erfinv                   3.981n ± 0%    3.965n ± 0%   -0.41% (p=0.000 n=10)
Erfcinv                  3.985n ± 0%    3.977n ± 0%   -0.20% (p=0.000 n=10)
ExpGo                    8.721n ± 2%    8.252n ± 0%   -5.38% (p=0.000 n=10)
Expm1                    4.378n ± 0%    4.228n ± 0%   -3.43% (p=0.000 n=10)
Exp2                     8.313n ± 0%    7.855n ± 0%   -5.52% (p=0.000 n=10)
Exp2Go                   8.498n ± 2%    7.921n ± 0%   -6.79% (p=0.000 n=10)
Mod                      15.16n ± 4%    12.20n ± 1%  -19.58% (p=0.000 n=10)
Frexp                    1.780n ± 2%    1.496n ± 0%  -15.96% (p=0.000 n=10)
Gamma                    4.378n ± 1%    4.013n ± 0%   -8.35% (p=0.000 n=10)
HypotGo                  2.655n ± 5%    2.427n ± 1%   -8.57% (p=0.000 n=10)
Ilogb                    1.912n ± 5%    1.749n ± 0%   -8.53% (p=0.000 n=10)
J0                       22.43n ± 9%    20.46n ± 0%   -8.76% (p=0.000 n=10)
J1                       21.03n ± 4%    19.96n ± 0%   -5.09% (p=0.000 n=10)
Jn                       45.40n ± 1%    42.59n ± 0%   -6.20% (p=0.000 n=10)
Ldexp                    2.312n ± 1%    1.944n ± 0%  -15.94% (p=0.000 n=10)
Lgamma                   4.617n ± 1%    4.584n ± 0%   -0.73% (p=0.000 n=10)
Log                      4.226n ± 0%    4.213n ± 0%   -0.31% (p=0.001 n=10)
Logb                     1.771n ± 0%    1.775n ± 0%        ~ (p=0.097 n=10)
Log1p                    5.102n ± 2%    5.001n ± 0%   -1.97% (p=0.000 n=10)
Log10                    4.407n ± 0%    4.408n ± 0%        ~ (p=1.000 n=10)
Log2                     2.416n ± 1%    2.138n ± 0%  -11.51% (p=0.000 n=10)
Modf                     1.669n ± 2%    1.611n ± 0%   -3.50% (p=0.000 n=10)
Nextafter32              2.186n ± 0%    2.185n ± 0%        ~ (p=0.051 n=10)
Nextafter64              2.182n ± 0%    2.184n ± 0%   +0.09% (p=0.016 n=10)
PowInt                   11.39n ± 6%    10.68n ± 2%   -6.24% (p=0.000 n=10)
PowFrac                  26.60n ± 2%    26.12n ± 0%   -1.80% (p=0.000 n=10)
Pow10Pos                0.5067n ± 4%   0.5003n ± 1%   -1.27% (p=0.001 n=10)
Pow10Neg                0.8552n ± 0%   0.8552n ± 0%        ~ (p=0.928 n=10)
Round                    1.181n ± 0%    1.182n ± 0%   +0.08% (p=0.001 n=10)
RoundToEven              1.709n ± 0%    1.710n ± 0%        ~ (p=0.053 n=10)
Remainder                12.54n ± 5%    11.99n ± 2%   -4.46% (p=0.000 n=10)
Sin                      3.933n ± 5%    3.926n ± 0%   -0.17% (p=0.000 n=10)
Sincos                   5.672n ± 0%    5.522n ± 0%   -2.65% (p=0.000 n=10)
Sinh                     5.447n ± 1%    5.444n ± 0%   -0.06% (p=0.029 n=10)
Tan                      4.061n ± 0%    4.058n ± 0%   -0.07% (p=0.005 n=10)
Tanh                     5.599n ± 0%    5.595n ± 0%   -0.06% (p=0.042 n=10)
Y0                       20.75n ± 5%    19.73n ± 1%   -4.92% (p=0.000 n=10)
Y1                       20.87n ± 2%    19.78n ± 1%   -5.20% (p=0.000 n=10)
Yn                       44.50n ± 2%    42.04n ± 2%   -5.53% (p=0.000 n=10)
geomean                  4.989n         4.791n        -3.96%

goos: linux
goarch: riscv64
pkg: math
cpu: Spacemit(R) X60
                    │     sec/op     │    sec/op     vs base                  │
Acos                    159.9n ±  0%   159.9n ±  0%        ~ (p=0.269 n=10)
Acosh                   244.7n ±  0%   235.0n ±  0%   -3.98% (p=0.000 n=10)
Asin                    159.9n ±  0%   159.9n ±  0%        ~ (p=0.154 n=10)
Asinh                   270.8n ±  0%   261.1n ±  0%   -3.60% (p=0.000 n=10)
Atan                    119.1n ±  0%   119.1n ±  0%        ~ (p=0.347 n=10)
Atanh                   260.2n ±  0%   261.8n ±  4%        ~ (p=0.459 n=10)
Atan2                   186.8n ±  0%   186.8n ±  0%        ~ (p=0.487 n=10)
Cbrt                    203.5n ±  0%   198.2n ±  0%   -2.60% (p=0.000 n=10)
Ceil                    31.82n ±  0%   31.81n ±  0%        ~ (p=0.714 n=10)
Copysign                4.894n ±  0%   4.893n ±  0%        ~ (p=0.161 n=10)
Cos                     107.6n ±  0%   103.6n ±  0%   -3.76% (p=0.000 n=10)
Cosh                    259.0n ±  0%   252.8n ±  0%   -2.39% (p=0.000 n=10)
Erf                     133.7n ±  0%   133.7n ±  0%        ~ (p=0.720 n=10)
Erfc                    137.9n ±  0%   137.8n ±  0%   -0.04% (p=0.033 n=10)
Erfinv                  173.7n ±  0%   168.8n ±  0%   -2.82% (p=0.000 n=10)
Erfcinv                 173.7n ±  0%   168.8n ±  0%   -2.82% (p=0.000 n=10)
Exp                     215.3n ±  0%   208.1n ±  0%   -3.34% (p=0.000 n=10)
ExpGo                   226.7n ±  0%   220.6n ±  0%   -2.69% (p=0.000 n=10)
Expm1                   164.8n ±  0%   159.0n ±  0%   -3.52% (p=0.000 n=10)
Exp2                    185.0n ±  0%   182.7n ±  0%   -1.22% (p=0.000 n=10)
Exp2Go                  198.9n ±  0%   196.5n ±  0%   -1.21% (p=0.000 n=10)
Abs                     4.894n ±  0%   4.893n ±  0%        ~ (p=0.262 n=10)
Dim                     16.31n ±  0%   16.31n ±  0%        ~ (p=1.000 n=10)
Floor                   31.81n ±  0%   31.81n ±  0%        ~ (p=0.067 n=10)
Max                     26.11n ±  0%   26.10n ±  0%        ~ (p=0.080 n=10)
Min                     26.10n ±  0%   26.10n ±  0%        ~ (p=0.095 n=10)
Mod                     337.7n ±  0%   291.9n ±  0%  -13.56% (p=0.000 n=10)
Frexp                   50.57n ±  0%   42.41n ±  0%  -16.13% (p=0.000 n=10)
Gamma                   206.3n ±  0%   198.1n ±  0%   -4.00% (p=0.000 n=10)
Hypot                   94.62n ±  0%   94.61n ±  0%        ~ (p=0.437 n=10)
HypotGo                 109.3n ±  0%   109.3n ±  0%        ~ (p=1.000 n=10)
Ilogb                   44.05n ±  0%   44.04n ±  0%   -0.02% (p=0.025 n=10)
J0                      663.1n ±  0%   663.9n ±  0%   +0.13% (p=0.002 n=10)
J1                      663.9n ±  0%   666.4n ±  0%   +0.38% (p=0.000 n=10)
Jn                      1.404µ ±  0%   1.407µ ±  0%   +0.21% (p=0.000 n=10)
Ldexp                   57.10n ±  0%   48.93n ±  0%  -14.30% (p=0.000 n=10)
Lgamma                  185.1n ±  0%   187.6n ±  0%   +1.32% (p=0.000 n=10)
Log                     182.7n ±  0%   170.1n ±  0%   -6.87% (p=0.000 n=10)
Logb                    46.49n ±  0%   46.49n ±  0%        ~ (p=0.675 n=10)
Log1p                   184.3n ±  0%   179.4n ±  0%   -2.63% (p=0.000 n=10)
Log10                   184.3n ±  0%   171.2n ±  0%   -7.08% (p=0.000 n=10)
Log2                    66.05n ±  0%   57.90n ±  0%  -12.34% (p=0.000 n=10)
Modf                    34.25n ±  0%   34.24n ±  0%        ~ (p=0.163 n=10)
Nextafter32             49.33n ±  1%   48.93n ±  0%   -0.81% (p=0.002 n=10)
Nextafter64             43.64n ±  0%   43.23n ±  0%   -0.93% (p=0.000 n=10)
PowInt                  267.6n ±  0%   251.2n ±  0%   -6.11% (p=0.000 n=10)
PowFrac                 672.9n ±  0%   637.9n ±  0%   -5.19% (p=0.000 n=10)
Pow10Pos                13.87n ±  0%   13.87n ±  0%        ~ (p=1.000 n=10)
Pow10Neg                19.58n ± 62%   19.59n ± 62%        ~ (p=0.355 n=10)
Round                   23.65n ±  0%   23.65n ±  0%        ~ (p=1.000 n=10)
RoundToEven             27.73n ±  0%   27.73n ±  0%        ~ (p=0.635 n=10)
Remainder               309.9n ±  0%   280.5n ±  0%   -9.49% (p=0.000 n=10)
Signbit                 13.05n ±  0%   13.05n ±  0%        ~ (p=1.000 n=10) ¹
Sin                     120.7n ±  0%   120.7n ±  0%        ~ (p=1.000 n=10) ¹
Sincos                  148.4n ±  0%   143.5n ±  0%   -3.30% (p=0.000 n=10)
Sinh                    275.6n ±  0%   267.5n ±  0%   -2.94% (p=0.000 n=10)
SqrtIndirect            3.262n ±  0%   3.262n ±  0%        ~ (p=0.263 n=10)
SqrtLatency             19.57n ±  0%   19.57n ±  0%        ~ (p=0.582 n=10)
SqrtIndirectLatency     19.57n ±  0%   19.57n ±  0%        ~ (p=1.000 n=10)
SqrtGoLatency           203.2n ±  0%   197.6n ±  0%   -2.78% (p=0.000 n=10)
SqrtPrime               4.952µ ±  0%   4.952µ ±  0%   -0.01% (p=0.025 n=10)
Tan                     153.3n ±  0%   153.3n ±  0%        ~ (p=1.000 n=10)
Tanh                    280.5n ±  0%   272.4n ±  0%   -2.91% (p=0.000 n=10)
Trunc                   31.81n ±  0%   31.81n ±  0%        ~ (p=1.000 n=10)
Y0                      680.1n ±  0%   664.8n ±  0%   -2.25% (p=0.000 n=10)
Y1                      684.2n ±  0%   669.6n ±  0%   -2.14% (p=0.000 n=10)
Yn                      1.444µ ±  0%   1.410µ ±  0%   -2.35% (p=0.000 n=10)
Float64bits             5.709n ±  0%   5.708n ±  0%        ~ (p=0.573 n=10)
Float64frombits         4.893n ±  0%   4.893n ±  0%        ~ (p=0.734 n=10)
Float32bits             12.23n ±  0%   12.23n ±  0%        ~ (p=0.628 n=10)
Float32frombits         4.893n ±  0%   4.893n ±  0%        ~ (p=0.971 n=10)
FMA                     4.893n ±  0%   4.893n ±  0%        ~ (p=0.736 n=10)
geomean                 88.96n         87.05n         -2.15%
¹ all samples are equal

Change-Id: I8db8ac7b7b3430b946b89e88dd6c1546804125c3
Reviewed-on: https://go-review.googlesource.com/c/go/+/697360
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Michael Munday <mikemndy@gmail.com>
2025-10-08 08:11:17 -07:00
Ian Alexander
78b43037dc cmd/go: refactor usage of workFilePath
This commit refactors usage of the global variable `workFilePath` to
the global LoaderState field of the same name.

This commit is part of the overall effort to eliminate global
modloader state.

[git-generate]
cd src/cmd/go/internal/modload
rf 'ex { workFilePath -> LoaderState.workFilePath }'
rf 'add State.requirements \
// Set to the path to the go.work file, or "" if workspace mode is\
// disabled'
rf 'rm workFilePath'

Change-Id: I53cdbc3cc619914421513db74a74a04ab10b3e33
Reviewed-on: https://go-review.googlesource.com/c/go/+/698062
Reviewed-by: Michael Matloob <matloob@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-07 16:10:28 -07:00
Damien Neil
bb1ca7ae81 cmd/go, testing: add TB.ArtifactDir and -artifacts flag
Add TB.ArtifactDir, which returns a directory for a test to store
output files in. Add a -artifacts testflag which enables persistent
storage of artifacts in the output directory (-outputdir, or the
current directory by default).

Fixes #71287

Change-Id: I5f6515a6cd6c103f88588f4c033d5ea11ffd0c3c
Reviewed-on: https://go-review.googlesource.com/c/go/+/696399
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
2025-10-07 14:39:32 -07:00
Ian Alexander
1623927730 cmd/go: refactor usage of requirements
This commit refactors usage of the global variable `requirements` to
the global LoaderState field of the same name.

This commit is part of the overall effort to eliminate global
modloader state.

[git-generate]
cd src/cmd/go/internal/modload
rf 'ex { requirements -> LoaderState.requirements }'
rf 'add State.MainModules \
// requirements is the requirement graph for the main module.\
//\
// It is always non-nil if the main module'\\\''s go.mod file has been\
// loaded.\
//\
// This variable should only be read from the loadModFile\
// function, and should only be written in the loadModFile and\
// commitRequirements functions.  All other functions that need or\
// produce a *Requirements should accept and/or return an explicit\
// parameter.'
rf 'rm requirements'

Change-Id: I9d7d1d301a9e89f9214ce632fa5b656dd2940f39
Reviewed-on: https://go-review.googlesource.com/c/go/+/698061
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>
2025-10-07 14:08:14 -07:00
David Chase
d2270bccbd [dev.simd] cmd/compile: track which CPU features are in scope
analysis for

- is this block only reached through feature checks?
- does the function signature imply AVX-something?
- is there an instruction in this block which implies AVX-something?

and keep track of which features those are.  Features =
AVX, AVX2, AVX512, etc.

Has a test.

Change-Id: I0b6f2e87d01ec587818db11cf71fac1e4d500650
Reviewed-on: https://go-review.googlesource.com/c/go/+/706337
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-10-07 14:06:28 -07:00
Keith Randall
a1661e776f Revert "crypto/internal/fips140/subtle: add assembly implementation of xorBytes for mips64x"
This reverts commit 49d6777d87.

Reason for revert: doesn't handle unaligned accesses correctly

Fixes #74998

Change-Id: Ia272245a6a2a91b305d411207430bad660ee355b
Reviewed-on: https://go-review.googlesource.com/c/go/+/709757
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-07 13:52:53 -07:00
Keith Randall
cb81270113 Revert "crypto/internal/fips140/subtle: add assembly implementation of xorBytes for mipsx"
This reverts commit 343e486bfd.

Reason for revert: doesn't handle unaligned accesses correctly.

Update #74998

Change-Id: I1d6210eeca9336f2ce311e99944cb270565563aa
Reviewed-on: https://go-review.googlesource.com/c/go/+/709795
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
2025-10-07 13:52:45 -07:00
Ian Alexander
f2d0d05d28 cmd/go: refactor usage of MainModules
This commit refactors usage of the global variable `MainModules` to
the global LoaderState variable of the same name.

This commit is part of the overall effort to eliminate global
modloader state.

[git-generate]
cd src/cmd/go/internal/modload
rf 'mv State.mainModules State.MainModules'
rf 'ex { MainModules -> LoaderState.MainModules }'
for dir in load modcmd modget test tool workcmd ; do
  cd ../${dir}
  rf 'ex {
    import "cmd/go/internal/modload"
    modload.MainModules -> modload.LoaderState.MainModules
  }'
done
cd ../modload
rf 'rm MainModules'

Change-Id: I15644c84190717d62ae953747a288ec6495ef168
Reviewed-on: https://go-review.googlesource.com/c/go/+/698060
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-07 13:41:26 -07:00
Damien Neil
f7a68d3804 archive/tar: set a limit on the size of GNU sparse file 1.0 regions
Sparse files in tar archives contain only the non-zero components
of the file. There are several different encodings for sparse
files. When reading GNU tar pax 1.0 sparse files, archive/tar did
not set a limit on the size of the sparse region data. A malicious
archive containing a large number of sparse blocks could cause
archive/tar to read an unbounded amount of data from the archive
into memory.

Since a malicious input can be highly compressable, a small
compressed input could cause very large allocations.

Cap the size of the sparse block data to the same limit used
for PAX headers (1 MiB).

Thanks to Harshit Gupta (Mr HAX) (https://www.linkedin.com/in/iam-harshit-gupta/)
for reporting this issue.

Fixes CVE-2025-58183
Fixes #75677

Change-Id: I70b907b584a7b8676df8a149a1db728ae681a770
Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/2800
Reviewed-by: Roland Shoemaker <bracewell@google.com>
Reviewed-by: Nicholas Husin <husin@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/709861
Auto-Submit: Michael Pratt <mpratt@google.com>
TryBot-Bypass: Michael Pratt <mpratt@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2025-10-07 12:46:36 -07:00
Damien Neil
463165699d net/mail: avoid quadratic behavior in mail address parsing
RFC 5322 domain-literal parsing built the dtext value one character
at a time with string concatenation, resulting in excessive
resource consumption when parsing very large domain-literal values.

Replace with a subslice.

Benchmark not included in this CL because it's too narrow to be
of general ongoing use, but for:

    ParseAddress("alice@[" + strings.Repeat("a", 0x40000) + "]")

goos: darwin
goarch: arm64
pkg: net/mail
cpu: Apple M4 Pro
                │  /tmp/bench.0  │            /tmp/bench.1             │
                │     sec/op     │   sec/op     vs base                │
ParseAddress-14   1987.732m ± 9%   1.524m ± 5%  -99.92% (p=0.000 n=10)

                │   /tmp/bench.0   │             /tmp/bench.1              │
                │       B/op       │     B/op      vs base                 │
ParseAddress-14   33692.767Mi ± 0%   1.282Mi ± 0%  -100.00% (p=0.000 n=10)

                │  /tmp/bench.0  │            /tmp/bench.1            │
                │   allocs/op    │ allocs/op   vs base                │
ParseAddress-14   263711.00 ± 0%   17.00 ± 0%  -99.99% (p=0.000 n=10)

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

Fixes CVE-2025-61725
Fixes #75680

Change-Id: Id971c2d5b59882bb476e22fceb7e01ec08234bb7
Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/2840
Reviewed-by: Roland Shoemaker <bracewell@google.com>
Reviewed-by: Nicholas Husin <husin@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/709860
Reviewed-by: Carlos Amedee <carlos@golang.org>
TryBot-Bypass: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
2025-10-07 12:46:33 -07:00
Damien Neil
5ede095649 net/textproto: avoid quadratic complexity in Reader.ReadResponse
Reader.ReadResponse constructed a response string from repeated
string concatenation, permitting a malicious sender to cause excessive
memory allocation and CPU consumption by sending a response consisting
of many short lines.

Use a strings.Builder to construct the string instead.

Thanks to Jakub Ciolek for reporting this issue.

Fixes CVE-2025-61724
Fixes #75716

Change-Id: I1a98ce85a21b830cb25799f9ac9333a67400d736
Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/2940
Reviewed-by: Roland Shoemaker <bracewell@google.com>
Reviewed-by: Nicholas Husin <husin@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/709859
TryBot-Bypass: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2025-10-07 12:46:30 -07:00
Roland Shoemaker
5ce8cd16f3 encoding/pem: make Decode complexity linear
Because Decode scanned the input first for the first BEGIN line, and
then the first END line, the complexity of Decode is quadratic. If the
input contained a large number of BEGINs and then a single END right at
the end of the input, we would find the first BEGIN, and then scan the
entire input for the END, and fail to parse the block, so move onto the
next BEGIN, scan the entire input for the END, etc.

Instead, look for the first END in the input, and then the first BEGIN
that precedes the found END. We then process the bytes between the BEGIN
and END, and move onto the bytes after the END for further processing.
This gives us linear complexity.

Fixes CVE-2025-61723
Fixes #75676

Change-Id: I813c4f63e78bca4054226c53e13865c781564ccf
Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/2921
Reviewed-by: Nicholas Husin <husin@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/709858
TryBot-Bypass: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2025-10-07 12:46:27 -07:00
Ethan Lee
f6f4e8b3ef net/url: enforce stricter parsing of bracketed IPv6 hostnames
- Previously, url.Parse did not enforce validation of hostnames within
  square brackets.
- RFC 3986 stipulates that only IPv6 hostnames can be embedded within
  square brackets in a URL.
- Now, the parsing logic should strictly enforce that only IPv6
  hostnames can be resolved when in square brackets. IPv4, IPv4-mapped
  addresses and other input will be rejected.
- Update url_test to add test cases that cover the above scenarios.

Thanks to Enze Wang, Jingcheng Yang and Zehui Miao of Tsinghua
University for reporting this issue.

Fixes CVE-2025-47912
Fixes #75678

Change-Id: Iaa41432bf0ee86de95a39a03adae5729e4deb46c
Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/2680
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Roland Shoemaker <bracewell@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/709857
TryBot-Bypass: Michael Pratt <mpratt@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Michael Pratt <mpratt@google.com>
2025-10-07 12:46:24 -07:00
Michael Pratt
7dd54e1fd7 runtime: make work.spanSPMCs.all doubly-linked
Making this a doubly-linked list allows spanQueue.destroy to immediately
remove and free rings rather than simply marking them as dead and
waiting for the sweeper to deal with them.

For #75771.

Change-Id: I6a6a636c0fb6be08ee967cb6d8f0577511a33c13
Reviewed-on: https://go-review.googlesource.com/c/go/+/709657
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-10-07 12:16:59 -07:00
Michael Pratt
3ee761739b runtime: free spanQueue on P destroy
Span queues must be empty when destroying a P since we are outside of
the mark phase. But we don't actually free them, so they simply sit
around using memory. More importantly, they are still in
work.spanSPMCs.all, so freeDeadSpanSPMCs must continue traversing past
them until the end of time.

Prior to CL 709575, keeping them in work.spanSPMCs.all allowed programs
with low GOMAXPROCS to continue triggering the bug if they ever had high
GOMAXPROCS in the past.

The spanSPMCs list is singly-linked, so it is not efficient to remove a
random element from the middle. Instead, we simply mark it as dead to
all freeDeadSpanSPMCs to free it when it scans the full list.

For #75771.

Change-Id: I6a6a636cfa22a4bdef0c273d083c91553e923fe5
Reviewed-on: https://go-review.googlesource.com/c/go/+/709656
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-10-07 12:16:53 -07:00
Nicholas Husin
8709a41d5e encoding/asn1: prevent memory exhaustion when parsing using internal/saferio
Within parseSequenceOf, reflect.MakeSlice is being used to pre-allocate
a slice that is needed in order to fully validate the given DER payload.
The size of the slice allocated are also multiple times larger than the
input DER:

- When using asn1.Unmarshal directly, the allocated slice is ~28x
  larger.
- When passing in DER using x509.ParseCertificateRequest, the allocated
  slice is ~48x larger.
- When passing in DER using ocsp.ParseResponse, the allocated slice is
  ~137x larger.

As a result, a malicious actor can craft a big empty DER payload,
resulting in an unnecessary large allocation of memories. This can be a
way to cause memory exhaustion.

To prevent this, we now use SliceCapWithSize within internal/saferio to
enforce a memory allocation cap.

Thanks to Jakub Ciolek for reporting this issue.

For #75671
Fixes CVE-2025-58185

Change-Id: Id50e76187eda43f594be75e516b9ca1d2ae6f428
Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/2700
Reviewed-by: Roland Shoemaker <bracewell@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/709856
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
2025-10-07 11:23:23 -07:00
Nicholas Husin
9b9d02c5a0 net/http: add httpcookiemaxnum GODEBUG option to limit number of cookies parsed
When handling HTTP headers, net/http does not currently limit the number
of cookies that can be parsed. The only limitation that exists is for
the size of the entire HTTP header, which is controlled by
MaxHeaderBytes (defaults to 1 MB).

Unfortunately, this allows a malicious actor to send HTTP headers which
contain a massive amount of small cookies, such that as much cookies as
possible can be fitted within the MaxHeaderBytes limitation. Internally,
this causes us to allocate a massive number of Cookie struct.

For example, a 1 MB HTTP header with cookies that repeats "a=;" will
cause an allocation of ~66 MB in the heap. This can serve as a way for
malicious actors to induce memory exhaustion.

To fix this, we will now limit the number of cookies we are willing to
parse to 3000 by default. This behavior can be changed by setting a new
GODEBUG option: GODEBUG=httpcookiemaxnum. httpcookiemaxnum can be set to
allow a higher or lower cookie limit. Setting it to 0 will also allow an
infinite number of cookies to be parsed.

Thanks to jub0bs for reporting this issue.

For #75672
Fixes CVE-2025-58186

Change-Id: Ied58b3bc8acf5d11c880f881f36ecbf1d5d52622
Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/2720
Reviewed-by: Roland Shoemaker <bracewell@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/709855
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
2025-10-07 11:23:20 -07:00
Neal Patel
3fc4c79fdb crypto/x509: improve domain name verification
Don't use domainToReverseLabels to check if domain names are valid,
since it is not particularly performant, and can contribute to DoS
vectors. Instead just iterate over the name and enforce the properties
we care about.

This also enforces that DNS names, both in SANs and name constraints,
are valid. We previously allowed invalid SANs, because some
intermediates had these weird names (see #23995), but there are
currently no trusted intermediates that have this property, and since we
target the web PKI, supporting this particular case is not a high
priority.

Thank you to Jakub Ciolek for reporting this issue.

Fixes CVE-2025-58187
Fixes #75681

Change-Id: I6ebce847dcbe5fc63ef2f9a74f53f11c4c56d3d1
Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/2820
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Roland Shoemaker <bracewell@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/709854
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-07 11:23:16 -07:00
Neal Patel
6e4007e8cf crypto/x509: mitigate DoS vector when intermediate certificate contains DSA public key
An attacker could craft an intermediate X.509 certificate
containing a DSA public key and can crash a remote host
with an unauthenticated call to any endpoint that
verifies the certificate chain.

Thank you to Jakub Ciolek for reporting this issue.

Fixes CVE-2025-58188
Fixes #75675

Change-Id: I2ecbb87b9b8268dbc55c8795891e596ab60f0088
Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/2780
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Roland Shoemaker <bracewell@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/709853
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-07 11:23:13 -07:00
Ian Alexander
6f7926589d cmd/go: refactor usage of modRoots
This commit refactors usage of the global variable `modRoots` to the
global LoaderState field of the same name.

This commit is part of the overall effort to eliminate global
modloader state.

[git-generate]
cd src/cmd/go/internal/modload
rf 'ex { modRoots -> LoaderState.modRoots }'
rf 'add State.RootMode \
// These are primarily used to initialize the MainModules, and should\
// be eventually superseded by them but are still used in cases where\
// the module roots are required but MainModules has not been\
// initialized yet. Set to the modRoots of the main modules.\
// modRoots != nil implies len(modRoots) > 0'
rf 'rm modRoots'

Change-Id: Ie9e1f3d468cfceee25efefaf945b10492318b079
Reviewed-on: https://go-review.googlesource.com/c/go/+/698059
Reviewed-by: Michael Matloob <matloob@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-07 10:55:25 -07:00
Michael Anthony Knyszek
11d5484190 runtime: fix self-deadlock on sbrk platforms
The sbrk mem.go implementation doesn't enforce being called on the
systemstack, but it can call back into itself if there's a stack growth.
Because the sbrk implementation requires acquiring memlock, it can
self-deadlock.

For the most part the mem.go API is called on the system stack, but
there are cases where we call sysAlloc on the regular Go stack. This is
fine in general, except on sbrk platforms because of the aforementioned
deadlock.

This change, rather than adding a new invariant to mem.go, switches to
the systemstack in the mem.go API implementation for sbrk platforms.

Change-Id: Ie0f0ea80a8d7578cdeabc8252107e64a5e633856
Reviewed-on: https://go-review.googlesource.com/c/go/+/709775
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-07 10:33:18 -07:00
Ian Alexander
2e52060084 cmd/go: refactor usage of RootMode
This commit refactors usage of the global variable `RootMode` to the
global LoaderState variable of the same name.

This commit is part of the overall effort to eliminate global
modloader state.

[git-generate]
cd src/cmd/go/internal/modload
rf 'mv State.rootMode State.RootMode'
for dir in load modcmd run tool toolchain work ; do
  cd ../${dir}
  rf 'ex {
    import "cmd/go/internal/modload";
    modload.RootMode -> modload.LoaderState.RootMode
  }'
done
cd ../modload
rf 'ex { RootMode -> LoaderState.RootMode }'
rf 'add State.ForceUseModules \
// RootMode determines whether a module root is needed.'
rf 'rm RootMode'

Change-Id: Ib5e513ee570dfc3b01cc974fe32944e5e391fd82
Reviewed-on: https://go-review.googlesource.com/c/go/+/698058
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2025-10-07 09:56:16 -07:00
Ian Alexander
f86ddb54b5 cmd/go: refactor usage of ForceUseModules
This commit refactors usage of the global variable `ForceUseModules`
to the global LoaderState field of the same name.

This commit is part of the overall effort to eliminate global
modloader state.

[git-generate]
cd src/cmd/go/internal/modload
rf 'mv State.forceUseModules State.ForceUseModules'
rf 'ex { ForceUseModules -> LoaderState.ForceUseModules }'
for dir in load modcmd modget run toolchain work workcmd ; do
  cd ../${dir}
  rf 'ex {
    import "cmd/go/internal/modload";
    modload.ForceUseModules -> modload.LoaderState.ForceUseModules
  }'
done
cd ../modload
rf 'add State.initialized \
// ForceUseModules may be set to force modules to be enabled when\
// GO111MODULE=auto or to report an error when GO111MODULE=off.'
rf 'rm ForceUseModules'

Change-Id: Ibdecfd273ff672516c9eb86279e5dfc6cdecb2ea
Reviewed-on: https://go-review.googlesource.com/c/go/+/698057
Reviewed-by: Michael Matloob <matloob@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-07 09:31:44 -07:00
Keith Randall
c938051dd0 Revert "cmd/compile: redo arm64 LR/FP save and restore"
This reverts commit 719dfcf8a8.

Reason for revert: Causing crashes.

Change-Id: I0b8526dd03d82fa074ce4f97f1789eeac702b3eb
Reviewed-on: https://go-review.googlesource.com/c/go/+/709755
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: David Chase <drchase@google.com>
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>
2025-10-07 08:21:14 -07:00
Michael Pratt
6469954203 runtime: assert p.destroy runs with GC not running
This is already guaranteed by stopTheWorldGC prior to procresize. Thus
the cleanup code here is dead, which is a bit confusing.

Replace it with a throw for clarity.

Change-Id: I6a6a636c8ca1487b720c4fab41b2b86c13d1d9e0
Reviewed-on: https://go-review.googlesource.com/c/go/+/709655
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-10-07 07:33:32 -07:00
Mateusz Poliwczak
4c0fd3a2b4 internal/goexperiment: remove the synctest GOEXPERIMENT
synctest package is enabled by default and the synctest
goexperiment does nothing after CL 709355.

Change-Id: Ia96b070d5f3779ae7c38a9044f754e716a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/709555
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-06 23:51:07 -07:00
thepudds
c1e6e49d5d fmt: reduce Errorf("x") allocations to match errors.New("x")
For unformatted strings, it comes up periodically that there are
more allocations using fmt.Errorf("x") compared to errors.New("x").
People cite it as a reason to switch code using fmt.Errorf to
use errors.New instead.

Three examples from the last few weeks essentially made
this suggestion: #75235, CL 708496, and CL 708618. Prior to that,
it is periodically suggested as a vet check (e.g., proposals #17173
and #52696) or in various CLs to change the standard library
(e.g., CL 403938 and CL 588776).

On the other hand, I believe the position of the core Go team
is that it is usually not worthwhile to make such a change. For example,
in #52696, Russ wrote:

  Thanks for raising the issue, but please don't do this. Using
  fmt.Errorf("foo") is completely fine, especially in a program where
  all the errors are constructed with fmt.Errorf. Having to
  mentally switch between two functions based on the argument
  is unnecessary noise.

This CL attempts to mostly take performance out of the discussion.

We drop from 2 allocations to 0 allocations for a non-escaping error,
and drop from 2 allocations to 1 allocation for an escaping error:

  _ = fmt.Errorf("foo")    // non-escaping error
  sink = fmt.Errorf("foo") // escaping error

This now matches the allocations for errors.New("foo") in both cases.

The CPU cost difference is greatly reduced, though there is still
a small ~4ns difference measurable in these microbenchmarks. Previously,
it was ~64ns vs. ~21ns for fmt.Errorf("x") vs. errors.New("x")
for escaping errors, whereas with this CL it is now ~25ns vs. ~21ns.

When fmt.Errorf("foo") executes with this CL, there are essentially
three optimizations now, in rough order of usefulness:
 (1) we always avoid an allocation inside the doPrintf machinery;
 (2) if the error does not otherwise escape, we can stack allocate
     the errors.errorString struct by virtue of mid-stack inlining
     of fmt.Errorf and the resulting inlining of errors.New, which
     also can be more effective via PGO;
 (3) stringslite.IndexByte is a tiny bit faster than going through the
     for loops looking for '%' inside doPrintf.

See https://blog.filippo.io/efficient-go-apis-with-the-inliner/ for
background on avoiding heap allocations via mid-stack inlining.

The common case here is likely that the string format argument is a
constant when there are no other arguments.

However, one concern could be that by not allocating a copy, we could
now keep a string argument alive longer with this change, which could
be a pessimization if for example that string argument is a
slice of a much bigger string:

  s := bigString[m:n]
  longLivedErr := fmt.Errorf(s)

Aside from that being perhaps unusual code, vet will complain about
s there as a "non-constant format string in call to fmt.Errorf", so that
particular example seems unlikely to occur frequently in practice.

The main benchmark results are below. "old" is prior to this CL, "new"
is with this CL. The non-escaping case is "local", the escaping case is
"sink". In practice, I suspect errors escape the majority of the time.
Benchmark code at https://go.dev/play/p/rlRSO1ehx8O

goos: linux
goarch: amd64
pkg: fmt
cpu: AMD EPYC 7B13
                         │  old-7bd6fac4.txt      │           new-dcd2a72f0.txt    │
                         │      sec/op            │   sec/op     vs base           │
Errorf/no-args/local-16              63.76n ± 1%   4.874n ± 0%  -92.36% (n=120)
Errorf/no-args/sink-16               64.25n ± 1%   25.81n ± 0%  -59.83% (n=120)
Errorf/int-arg/local-16              90.86n ± 1%   90.97n ± 1%        ~ (p=0.713 n=120)
Errorf/int-arg/sink-16               91.81n ± 1%   91.10n ± 1%   -0.76% (p=0.036 n=120)
geomean                              76.46n        31.95n       -58.20%

                         │  old-7bd6fac4.txt      │             new-dcd2a72f0.txt  │
                         │       B/op             │    B/op     vs base            │
Errorf/no-args/local-16               19.00 ± 0%    0.00 ± 0%  -100.00% (n=120)
Errorf/no-args/sink-16                19.00 ± 0%   16.00 ± 0%   -15.79% (n=120)
Errorf/int-arg/local-16               24.00 ± 0%   24.00 ± 0%         ~ (p=1.000 n=120) ¹
Errorf/int-arg/sink-16                24.00 ± 0%   24.00 ± 0%         ~ (p=1.000 n=120) ¹
geomean                               21.35                    ?                        ² ³
¹ all samples are equal

                         │  old-7bd6fac4.txt      │       new-dcd2a72f0.txt        │
                         │     allocs/op          │ allocs/op   vs base            │
Errorf/no-args/local-16               2.000 ± 0%   0.000 ± 0%  -100.00% (n=120)
Errorf/no-args/sink-16                2.000 ± 0%   1.000 ± 0%   -50.00% (n=120)
Errorf/int-arg/local-16               2.000 ± 0%   2.000 ± 0%         ~ (p=1.000 n=120) ¹
Errorf/int-arg/sink-16                2.000 ± 0%   2.000 ± 0%         ~ (p=1.000 n=120) ¹
geomean                               2.000                    ?                        ² ³
¹ all samples are equal

Change-Id: Ib27c52933bec5c2236624c577fbb1741052e792f
Reviewed-on: https://go-review.googlesource.com/c/go/+/708836
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Commit-Queue: t hepudds <thepudds1460@gmail.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
2025-10-06 17:34:52 -07:00
Michael Anthony Knyszek
7fbf54bfeb internal/buildcfg: enable greenteagc experiment by default
Slightly bump the value in Test/wasmmemsize.go. We use 1 additional page
compared to before, and we were already sitting *right* on the edge.

For #73581.

Change-Id: I485df16c3cf59803a8a1fc852b3e90666981ab09
Reviewed-on: https://go-review.googlesource.com/c/go/+/656195
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-10-06 16:01:40 -07:00
Ian Alexander
7bfeb43509 cmd/go: refactor usage of initialized
This commit refactors usage of the global variable `initialized` to
the global LoaderState field of the same name.

This commit is part of the overall effort to eliminate global
modloader state.

[git-generate]
cd src/cmd/go/internal/modload
rf 'ex { initialized -> LoaderState.initialized }'
rf 'rm initialized'

Change-Id: I97e35bab00f4c22661670b01b69425fc25efe6df
Reviewed-on: https://go-review.googlesource.com/c/go/+/698056
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>
2025-10-06 15:05:13 -07:00
Cherry Mui
1d62e92567 test/codegen: make sure assignment results are used.
Some tests make assignments to an argument without reading it.
With CL 708865, they are treated as dead stores and are removed.
Make sure the results are used.

Fixes #75745.
Fixes #75746.

Change-Id: I05580beb1006505ec1550e5fa245b54dcefd10b9
Reviewed-on: https://go-review.googlesource.com/c/go/+/708916
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2025-10-06 14:51:23 -07:00
tony
4fca79833f runtime: delete redundant code in the page allocator
The page allocator's scavenge index has sysGrow called on it twice,
once in pageAlloc.grow, and once in pageAlloc.sysGrow on 64-bit
platforms. Calling it twice is OK since sysGrow is idempotent,
but it's also wasteful. This change removes the call
in pageAlloc.sysGrow.

Change-Id: I5b955b6e2beed5c2b8305ab82b76718ea305792c
Reviewed-on: https://go-review.googlesource.com/c/go/+/707735
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2025-10-06 14:20:22 -07:00
Keith Randall
719dfcf8a8 cmd/compile: redo arm64 LR/FP save and restore
Instead of storing LR (the return address) at 0(SP) and the FP
(parent's frame pointer) at -8(SP), store them at framesize-8(SP)
and framesize-16(SP), respectively.

We push and pop data onto the stack such that we're never accessing
anything below SP.

The prolog/epilog lengths are unchanged (3 insns for a typical prolog,
2 for a typical epilog).

We use 8 bytes more per frame.

Typical prologue:

    STP.W   (FP, LR), -16(SP)
    MOVD    SP, FP
    SUB	    $C, SP

Typical epilogue:

    ADD     $C, SP
    LDP.P   16(SP), (FP, LR)
    RET

The previous word where we stored LR, at 0(SP), is now unused.
We could repurpose that slot for storing a local variable.

The new prolog and epilog instructions are recognized by libunwind,
so pc-sampling tools like perf should now be accurate. (TODO: except
maybe after the first RET instruction? Have to look into that.)

Update #73753 (fixes, for arm64)
Update #57302 (Quim thinks this will help on that issue)

Change-Id: I4800036a9a9a08aaaf35d9f99de79a36cf37ebb8
Reviewed-on: https://go-review.googlesource.com/c/go/+/674615
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
2025-10-06 14:11:41 -07:00
Michael Pratt
f3312124c2 runtime: remove batching from spanSPMC free
Added in CL 700496, freeSomeSpanSPMCs attempts to bound tail latency by
processing at most 64 entries at a time, as well as returning early if
it notices a preemption request. Both of those are attempts to reduce
tail latency, as we cannot preempt the function while it holds the lock.
This scheme is based on a similar scheme in freeSomeWbufs.

freeSomeWbufs has a key difference: all workbufs in its list are
unconditionally freed. So freeSomeWbufs will always make forward
progress in each call (unless it is constantly preempted).

In contrast, freeSomeSpanSPMCs only frees "dead" entries. If the list
contains >64 live entries, a call may make no progress, and the caller
will simply keep calling in a loop forever, until the GC ends at which
point it returns success early. The infinite loop likely restarts at the
next GC cycle.

The queues are used on each P, so it is easy to have 64 permanently live
queues if GOMAXPROCS >= 64. If GOMAXPROCS < 64, it is possible to
transiently have more queues, but spanQueue.drain increases queue size
in an attempt to reach a steady state of one queue per P.

We must drop work.spanSPMCs.lock to allow preemption, but dropping the
lock allows mutation of the linked list, meaning we cannot simply
continue iteration after retaking lock. Since there is no
straightforward resolution to this and we expect this to generally only
be around 1 entry per P, simply remove the batching and process the
entire list without preemption. We may want to revisit this in the
future for very high GOMAXPROCS or if application regularly otherwise
create very long lists.

Fixes #75771.

Change-Id: I6a6a636cd3be443aacde5a678c460aa7066b4c4a
Reviewed-on: https://go-review.googlesource.com/c/go/+/709575
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-06 13:03:02 -07:00
Ian Alexander
24416458c2 cmd/go: export type State
Export the type `State` and add global variable `LoaderState` in
preparation for refactoring usage of other global variables in the
modload package.

This commit is part of the overall effort to eliminate global
modloader state.

[git-generate]
cd src/cmd/go/internal/modload
rf 'mv state State'
rf 'add State func NewState() *State { return &State{} }'
rf 'add init.go:/NewState/+0 var LoaderState = NewState()'

Change-Id: I0ec6199ba3e05927bec12f11a60383d1b51b111a
Reviewed-on: https://go-review.googlesource.com/c/go/+/698055
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-06 12:52:05 -07:00
Sean Liao
c2fb15164b testing/synctest: remove Run
Run (experimental) is replaced by Test.

Fixes #74012

Change-Id: I1721e1edfbcb4f1fe2159dc0430a13685b2d08c4
Reviewed-on: https://go-review.googlesource.com/c/go/+/709355
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
2025-10-06 12:41:59 -07:00
Michael Anthony Knyszek
ac2ec82172 runtime: bump thread count slack for TestReadMetricsSched
This test is *still* flaky, but it appears to be just
mayMoreStackPreempt and the thread count *occasionally* exceeds the
original (and arbitrary) thread count slack by exactly 1.

Bump the thread count slack by one. We can investigate further and bump
it again if it continues to be a problem.

Fixes #75664.

Change-Id: I29c922bba6d2cc99a8c3bf5e04cc512d0694f7fa
Reviewed-on: https://go-review.googlesource.com/c/go/+/708868
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>
2025-10-06 12:27:36 -07:00
Daniel McCarney
e74b224b7c crypto/tls: streamline BoGo testing w/ -bogo-local-dir
If -bogo-local-dir is provided but doesn't exist, populate it with a git
checkout of the BoringSSL repo at the correct SHA.

Without any -bogo-local-dir argument the BoGo TLS handshake test will
fetch the BoringSSL source at a specific SHA as a Go module in a r/o
module directory. When debugging, or extending BoGo coverage, it's
preferable to have a mutable local copy of BoGo that the test will
use.

The pre-existing -bogo-local-dir flag offered a way to use a checkout of
BoGo but it relied on the user fetching the correct repo & revision
manually ahead of time. This commit extends the test to automatically
invoke `git` to clone the repo into the provided local dir at the
correct SHA based on the boringsslModVer const if the local dir doesn't
exist.

This leaves the user ready to make changes in local BoGo dir to aid
debugging, or to upstream as CRs to BoringSSL, and prevents using an
incorrect SHA by mistake.

Updates #72006

Change-Id: I0451a3d35203878cdf02a7587e138c3cd60d15a9
Reviewed-on: https://go-review.googlesource.com/c/go/+/687475
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
TryBot-Bypass: Daniel McCarney <daniel@binaryparadox.net>
2025-10-06 10:42:22 -07:00
Oliver Eikemeier
3a05e7b032 spec: close tag
Close an "a" tag. While we are here, fix some escapes.

Change-Id: I16040eff0d4beeef6230aec8fcf4315f0efd13a4
GitHub-Last-Rev: 3ba7b9f747
GitHub-Pull-Request: golang/go#75760
Reviewed-on: https://go-review.googlesource.com/c/go/+/708517
Reviewed-by: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Sean Liao <sean@liao.dev>
2025-10-06 07:58:34 -07:00
Mateusz Poliwczak
2a71af11fc net/url: improve URL docs
The Raw fields are confusing and easy to use by mistake. Adds more
context in comments to these fields.

Also the current docs (and the names of these fields) of these
boolean fields are not obvious that parser might produce them,
so clarify that

Change-Id: I6a6a69644834c3ccbf657147f771930b6875f721
Reviewed-on: https://go-review.googlesource.com/c/go/+/706515
Reviewed-by: Florian Lehner <lehner.florian86@gmail.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-03 13:51:19 -07:00
qmuntal
ee5369b003 cmd/link: add LIBRARY statement only with -buildmode=cshared
When creating a .def file for Windows linking, add a LIBRARY statement
only when building a DLL with -buildmode=cshared. That statement is
documented to instruct the linker to create a DLL, overriding any
other flag that might indicate building an executable.

Fixes #75734

Change-Id: I0231435df70b71a493a39deb639f6328a8e354f6
Reviewed-on: https://go-review.googlesource.com/c/go/+/708815
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Dominic Della Valle <ddvpublic@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-03 13:50:05 -07:00
David Chase
1bca4c1673 cmd/compile: improve slicemask removal
this will be subsumed by pending changes in local slice
representation, however this was easy and works well.

Cherry-picked from the dev.simd branch. This CL is not
necessarily SIMD specific. Apply early to reduce risk.

Change-Id: I5b6eb10d257f04f906be7a8a6f2b6833992a39e8
Reviewed-on: https://go-review.googlesource.com/c/go/+/704876
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/708866
Reviewed-by: David Chase <drchase@google.com>
2025-10-03 12:31:36 -07:00
Cherry Mui
38b26f29f1 cmd/compile: remove stores to unread parameters
Currently, we remove stores to local variables that are not read.
We don't do that for arguments. But arguments and locals are
essentially the same. Arguments are passed by value, and are not
expected to be read in the caller's frame. So we can remove the
writes to them as well. One exception is the cgo_unsafe_arg
directive, which makes all the arguments effectively address-taken.
cgo_unsafe_arg implies ABI0, so we just skip ABI0 functions'
arguments.

Cherry-picked from the dev.simd branch. This CL is not
necessarily SIMD specific. Apply early to reduce risk.

Change-Id: I8999fc50da6a87f22c1ec23e9a0c15483b6f7df8
Reviewed-on: https://go-review.googlesource.com/c/go/+/705815
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/708865
2025-10-03 12:31:20 -07:00
Junyang Shao
003b5ce1bc cmd/compile: fix SIMD const rematerialization condition
This CL fixes a condition for the previous fix CL 704056.

Cherry-picked from the dev.simd branch. This CL is not
necessarily SIMD specific. Apply early to reduce risk. Test is
SIMD specific so not included for now.

Change-Id: I1f1f8c6f72870403cb3dff14755c43385dc0c933
Reviewed-on: https://go-review.googlesource.com/c/go/+/705499
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/708864
Reviewed-by: David Chase <drchase@google.com>
2025-10-03 12:31:13 -07:00
David Chase
d91148c7a8 cmd/compile: enhance prove to infer bounds in slice len/cap calculations
the example comes up in chunked reslicing, e.g. A[i:] where i
has a relationship with len(A)-K.

Cherry-picked from the dev.simd branch. This CL is not
necessarily SIMD specific. Apply early to reduce risk.

Change-Id: Ib97dede6cfc7bbbd27b4f384988f741760686604
Reviewed-on: https://go-review.googlesource.com/c/go/+/704875
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-on: https://go-review.googlesource.com/c/go/+/708863
Reviewed-by: David Chase <drchase@google.com>
2025-10-03 12:31:07 -07:00
David Chase
20c9377e47 cmd/compile: enhance the chunked indexing case to include reslicing
this helps SIMD, but also helps plain old Go

Cherry-picked from the dev.simd branch. This CL is not
necessarily SIMD specific. Apply early to reduce risk.

Change-Id: Idcdacd54b6776f5c32b497bc94485052611cfa8d
Reviewed-on: https://go-review.googlesource.com/c/go/+/704756
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/708862
Reviewed-by: David Chase <drchase@google.com>
2025-10-03 12:30:57 -07:00
Junyang Shao
ad3db2562e cmd/compile: handle rematerialized op for incompatible reg constraint
This CL fixes an issue raised by contributor dominikh@.

Cherry-picked from the dev.simd branch. This CL is not
necessarily SIMD specific. Apply early to reduce risk. Test is
SIMD specific so not included for now.

Change-Id: I941b330a6ba6f6c120c69951ddd24933f2f0b3ec
Reviewed-on: https://go-review.googlesource.com/c/go/+/704056
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/708861
2025-10-03 12:30:50 -07:00
Cherry Mui
18cd4a1fc7 cmd/compile: use the right type for spill slot
Currently, when shuffling registers, if we need to spill a
register, we always create a spill slot of type int64. The type
doesn't actually matter, as long as it is wide enough to hold the
registers. This is no longer true with SIMD registers, which could
be wider than a int64. Create the slot with the proper type
instead.

Cherry-picked from the dev.simd branch. This CL is not
necessarily SIMD specific. Apply early to reduce risk. Test is
SIMD specific so not included for now.

Change-Id: I85c82e2532001bfdefe98c9446f2dd18583d49b4
Reviewed-on: https://go-review.googlesource.com/c/go/+/704055
TryBot-Bypass: Cherry Mui <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/708860
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-03 12:30:36 -07:00
David Chase
1caa95acfa cmd/compile: enhance prove to deal with double-offset IsInBounds checks
For chunked iterations (useful for, but not exclusive to,
SIMD calculations) it is common to see the combination of
```
for ; i <= len(m)-4; i += 4 {
```
and
```
r0, r1, r2, r3 := m[i], m[i+1], m[i+2], m[i+3]
``

Prove did not handle the case of len-offset1 vs index+offset2
checking, but this change fixes this.  There may be other
similar cases yet to handle -- this worked for the chunked
loops for simd, as well as a handful in std.

Cherry-picked from the dev.simd branch. This CL is not
necessarily SIMD specific. Apply early to reduce risk.

Change-Id: I3785df83028d517e5e5763206653b34b2befd3d0
Reviewed-on: https://go-review.googlesource.com/c/go/+/700696
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/708859
Reviewed-by: David Chase <drchase@google.com>
2025-10-03 12:30:29 -07:00
David Chase
ec70d19023 cmd/compile: rewrite to elide Slicemask from len==c>0 slicing
This might have been something that prove could be educated
into figuring out, but this also works, and it also helps
prove downstream.

Adjusted the prove test, because this change moved a message.

Cherry-picked from the dev.simd branch. This CL is not
necessarily SIMD specific. Apply early to reduce risk.

Change-Id: I5eabe639eff5db9cd9766a6a8666fdb4973829cb
Reviewed-on: https://go-review.googlesource.com/c/go/+/697715
Commit-Queue: David Chase <drchase@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Bypass: David Chase <drchase@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/708858
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-10-03 12:30:21 -07:00
Junyang Shao
10e7968849 cmd/compile: accounts rematerialize ops's output reginfo
This CL implements the check for rematerializeable value's output
regspec at its remateralization site. It has some potential problems,
please see the TODO in regalloc.go.

Fixes #70451.

Cherry-picked from the dev.simd branch. This CL is not
necessarily SIMD specific. Apply early to reduce risk.

Change-Id: Ib624b967031776851136554719e939e9bf116b7c
Reviewed-on: https://go-review.googlesource.com/c/go/+/695315
Reviewed-by: David Chase <drchase@google.com>
TryBot-Bypass: David Chase <drchase@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/708857
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-03 12:30:11 -07:00
David Chase
ab043953cb cmd/compile: minor tweak for race detector
This makes the front-end a little bit less temp-happy
when instrumenting, which repairs the "is it a constant?"
test in the simd intrinsic conversion which is otherwise
broken by race detection.

Also, this will perhaps be better code.

Cherry-picked from the dev.simd branch. This CL is not
necessarily SIMD specific. Apply early to reduce risk.

Change-Id: I84b7a45b7bff62bb2c9f9662466b50858d288645
Reviewed-on: https://go-review.googlesource.com/c/go/+/685637
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/708856
2025-10-03 12:30:00 -07:00
Cherry Mui
ebb72bef44 cmd/compile: don't treat devel compiler as a released compiler
The compiler has a logic to print different messages on internal
compiler error depending on whether this is a released version of
Go. It hides the panic stack trace if it is a released version. It
does this by checking the version and see if it has a "go" prefix.
This includes all the released versions. However, for a non-
released build, if there is no explicit version set, cmd/dist now
sets the toolchain version as go1.X-devel_XXX, which makes it be
treated as a released compiler, and causes the stack trace to be
hidden. Change the logic to not match a devel compiler as a
released compiler.

Cherry-picked from the dev.simd branch. This CL is not
necessarily SIMD specific. Apply early to reduce risk.

Change-Id: I5d3b2101527212f825b6e4000b36030c4f83870b
Reviewed-on: https://go-review.googlesource.com/c/go/+/682975
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/708855
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-10-03 12:29:51 -07:00
David Chase
48756abd3a [dev.simd] cmd/compile: inliner tweaks to favor simd-handling functions
this is partly to ensure that emulations get inlined

Change-Id: I14f1a591081a4c39b61e48957a1474217ed0a399
Reviewed-on: https://go-review.googlesource.com/c/go/+/705975
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-10-03 10:55:51 -07:00
matloob
c54dc1418b runtime: support valgrind (but not asan) in specialized malloc functions
We're adding this so that the compiler doesn't need to know about
valgrind since it's just implemented using a build tag.

Change-Id: I6a6a696452b0379caceca2ae4e49195016f7a90d
Reviewed-on: https://go-review.googlesource.com/c/go/+/708296
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Matloob <matloob@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-10-03 10:09:29 -07:00
Michael Matloob
a7917eed70 internal/buildcfg: enable specializedmalloc experiment
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64_c2s16-perf_vs_parent,gotip-linux-amd64_c3h88-perf_vs_parent,gotip-linux-arm64_c4ah72-perf_vs_parent,gotip-linux-arm64_c4as16-perf_vs_parent
Change-Id: I6a6a6964c4c596bbf4f072b5a44a34c3ce4f6541
Reviewed-on: https://go-review.googlesource.com/c/go/+/696536
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-10-03 09:35:06 -07:00
Daniel McCarney
630799c6c9 crypto/tls: add flag to render HTML BoGo report
Updates the BoGo test runner to add a `-bogo-html-report` flag. When
provided, an HTML report is written to the flag argument path. The
report shows the fail/pass/skip status of run tests and allows
sorting/searching the output.

Change-Id: I8c704a51fbb03500f4134ebfaba06248baa3ca2f
Reviewed-on: https://go-review.googlesource.com/c/go/+/684955
Auto-Submit: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
TryBot-Bypass: Daniel McCarney <daniel@binaryparadox.net>
Commit-Queue: Carlos Amedee <carlos@golang.org>
2025-10-03 08:29:57 -07:00
Cherry Mui
fb1749a3fe [dev.simd] all: merge master (adce7f1) into dev.simd
Conflicts:

- src/internal/goexperiment/flags.go
- src/runtime/export_test.go

Merge List:

+ 2025-10-03 adce7f196e cmd/link: support .def file with MSVC clang toolchain
+ 2025-10-03 d5b950399d cmd/cgo: fix unaligned arguments typedmemmove crash on iOS
+ 2025-10-02 53845004d6 net/http/httputil: deprecate ReverseProxy.Director
+ 2025-10-02 bbdff9e8e1 net/http: update bundled x/net/http2 and delete obsolete http2inTests
+ 2025-10-02 4008e07080 io/fs: move path name documentation up to the package doc comment
+ 2025-10-02 0e4e2e6832 runtime: skip TestGoroutineLeakProfile under mayMoreStackPreempt
+ 2025-10-02 f03c392295 runtime: fix aix/ppc64 library initialization
+ 2025-10-02 707454b41f cmd/go: update `go help mod edit` with the tool and ignore sections
+ 2025-10-02 8c68a1c1ab runtime,net/http/pprof: goroutine leak detection by using the garbage collector
+ 2025-10-02 84db201ae1 cmd/compile: propagate len([]T{}) to make builtin to allow stack allocation
+ 2025-10-02 5799c139a7 crypto/tls: rm marshalEncryptedClientHelloConfigList dead code
+ 2025-10-01 633dd1d475 encoding/json: fix Decoder.InputOffset regression in goexperiment.jsonv2
+ 2025-10-01 8ad27fb656 doc/go_spec.html: update date
+ 2025-10-01 3f451f2c54 testing/synctest: fix inverted test failure message in TestContextAfterFunc
+ 2025-10-01 be0fed8a5f cmd/go/testdata/script/test_fuzz_fuzztime.txt: disable
+ 2025-09-30 eb1c7f6e69 runtime: move loong64 library entry point to os-agnostic file
+ 2025-09-30 c9257151e5 runtime: unify ppc64/ppc64le library entry point
+ 2025-09-30 4ff8a457db test/codegen: codify handling of floating point constants on arm64
+ 2025-09-30 fcb893fc4b cmd/compile/internal/ssa: remove redundant "type:" prefix check
+ 2025-09-30 19cc1022ba mime: reduce allocs incurred by ParseMediaType
+ 2025-09-30 08afc50bea mime: extend "builtinTypes" to include a more complete list of common types
+ 2025-09-30 97da068774 cmd/compile: eliminate nil checks on .dict arg
+ 2025-09-30 300d9d2714 runtime: initialise debug settings much earlier in startup process
+ 2025-09-30 a846bb0aa5 errors: add AsType
+ 2025-09-30 7c8166d02d cmd/link/internal/arm64: support Mach-O ARM64_RELOC_SUBTRACTOR in internal linking
+ 2025-09-30 6e95748335 cmd/link/internal/arm64: support Mach-O ARM64_RELOC_POINTER_TO_GOT in internal linking
+ 2025-09-30 742f92063e cmd/compile, runtime: always enable Wasm signext and satconv features
+ 2025-09-30 db10db6be3 internal/poll: remove operation fields from FD
+ 2025-09-29 75c87df58e internal/poll: pass the I/O mode instead of an overlapped object in execIO
+ 2025-09-29 fc88e18b4a crypto/internal/fips140/entropy: add CPU jitter-based entropy source
+ 2025-09-29 db4fade759 crypto/internal/fips140/mlkem: make CAST conditional
+ 2025-09-29 db3cb3fd9a runtime: correct reference to getStackMap in comment
+ 2025-09-29 690fc2fb05 internal/poll: remove buf field from operation
+ 2025-09-29 eaf2345256 cmd/link: use a .def file to mark exported symbols on Windows
+ 2025-09-29 4b77733565 internal/syscall/windows: regenerate GetFileSizeEx
+ 2025-09-29 4e9006a716 crypto/tls: quote protocols in ALPN error message
+ 2025-09-29 047c2ab841 cmd/link: don't pass -Wl,-S on Solaris
+ 2025-09-29 ae8eba071b cmd/link: use correct length for pcln.cutab
+ 2025-09-29 fe3ba74b9e cmd/link: skip TestFlagW on platforms without DWARF symbol table
+ 2025-09-29 d42d56b764 encoding/xml: make use of reflect.TypeAssert
+ 2025-09-29 6d51f93257 runtime: jump instead of branch in netbsd/arm64 entry point
+ 2025-09-28 5500cbf0e4 debug/elf: prevent offset overflow
+ 2025-09-27 34e67623a8 all:  fix typos
+ 2025-09-27 af6999e60d cmd/compile: implement jump table on loong64
+ 2025-09-26 63cd912083 os/user: simplify go:build
+ 2025-09-26 53009b26dd runtime: use a smaller arena size on Wasm
+ 2025-09-26 3a5df9d2b2 net/http: add HTTP2Config.StrictMaxConcurrentRequests
+ 2025-09-26 16be34df02 net/http: add more tests of transport connection pool
+ 2025-09-26 3e4540b49d os/user: use getgrouplist on illumos && cgo
+ 2025-09-26 15fbe3480b internal/poll: simplify WriteMsg and ReadMsg on Windows
+ 2025-09-26 16ae11a9e1 runtime: move TestReadMetricsSched to testprog
+ 2025-09-26 459f3a3adc cmd/link: don't pass -Wl,-S on AIX
+ 2025-09-26 4631a2d3c6 cmd/link: skip TestFlagW on AIX
+ 2025-09-26 0f31d742cd cmd/compile: fix ICE with new(<untyped expr>)
+ 2025-09-26 7d7cd6e07b internal/poll: don't call SetFilePointerEx in Seek for overlapped handles
+ 2025-09-26 41cba31e66 mime/multipart: percent-encode CR and LF in header values to avoid CRLF injection
+ 2025-09-26 dd1d597c3a Revert "cmd/internal/obj/loong64: use the MOVVP instruction to optimize prologue"
+ 2025-09-26 45d6bc76af runtime: unify arm64 entry point code
+ 2025-09-25 fdea7da3e6 runtime: use common library entry point on windows amd64/386
+ 2025-09-25 e8a4f508d1 lib/fips140: re-seal v1.0.0
+ 2025-09-25 9b7a328089 crypto/internal/fips140: remove key import PCTs, make keygen PCTs fatal
+ 2025-09-25 7f9ab7203f crypto/internal/fips140: update frozen module version to "v1.0.0"
+ 2025-09-25 fb5719cbda crypto/internal/fips140/ecdsa: make TestingOnlyNewDRBG generic
+ 2025-09-25 56067e31f2 std: remove unused declarations

Change-Id: Iecb28fd62c69fbed59da557f46d31bae55889e2c
2025-10-03 10:11:21 -04:00
Cherry Mui
adce7f196e cmd/link: support .def file with MSVC clang toolchain
lld-link supports .def file, but requires a "-def:" (or "/def:")
flag. (MinGW linker, on the other hand, requires no flag.) Pass
the flag when using MSVC-based toolchain.

CL originally authored by Chressie Himpel.

Change-Id: I8c327ab48d36b0bcbb1d127cff544ffdb06be38e
Reviewed-on: https://go-review.googlesource.com/c/go/+/708716
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Chressie Himpel <chressie@google.com>
2025-10-03 06:30:28 -07:00
Tim Cooijmans
d5b950399d cmd/cgo: fix unaligned arguments typedmemmove crash on iOS
Irregularly typedmemmove and bulkBarrierPreWrite crashes on unaligned
arguments. By aligning the arguments this is fixed.

Fixes #46893

Change-Id: I7beb9fdc31053fcb71bee6c6cb906dea31718c56
GitHub-Last-Rev: 46ae8b9688
GitHub-Pull-Request: golang/go#74868
Reviewed-on: https://go-review.googlesource.com/c/go/+/692935
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2025-10-03 04:04:57 -07:00
Damien Neil
53845004d6 net/http/httputil: deprecate ReverseProxy.Director
The Director function has been superseded by Rewrite.
Rewrite avoids fundamental security issues with hop-by-hop header
handling in the Director API and has better default handling
of X-Forwarded-* headers.

Fixes #73161

Change-Id: Iadaf3070e0082458f79fb892ade51cb7ce832802
Reviewed-on: https://go-review.googlesource.com/c/go/+/708615
Reviewed-by: Nicholas Husin <husin@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Nicholas Husin <nsh@golang.org>
2025-10-02 12:53:31 -07:00
Nicholas S. Husin
bbdff9e8e1 net/http: update bundled x/net/http2 and delete obsolete http2inTests
http2inTests is no longer needed after go.dev/cl/708135 and should be
deleted. To prevent errors in future vendored dependency updates,
h2_bundle.go is also updated together in this change.

Change-Id: I7b8c3f6854203fab4ec639a2a268df0cd2b1dee7
Reviewed-on: https://go-review.googlesource.com/c/go/+/708595
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Nicholas Husin <husin@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-02 12:52:26 -07:00
Damien Neil
4008e07080 io/fs: move path name documentation up to the package doc comment
Perhaps surprisingly to users, io/fs path names are slash-separated.
Move the documentation for path names up to the top of the package
rather than burying it in the ValidPath documentation.

Change-Id: Id338df07c74a16be74c687ac4c45e0513ee40a8c
Reviewed-on: https://go-review.googlesource.com/c/go/+/708616
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
2025-10-02 12:36:34 -07:00
Michael Anthony Knyszek
0e4e2e6832 runtime: skip TestGoroutineLeakProfile under mayMoreStackPreempt
This may be the long-term fix, but we first need to understand if this
just makes the tests flaky, or if it's revealing an actual underlying
issue. I'm leaning toward the former. If it is the former, ideally we
just make the tests robust (wait longer, maybe?).

For now, this change will make the longtest builders OK again.

For #75729.

Change-Id: If9b30107d04a8e5af5670850add3a53f9471eec6
Reviewed-on: https://go-review.googlesource.com/c/go/+/708715
Reviewed-by: Roland Shoemaker <roland@golang.org>
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>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2025-10-02 12:33:25 -07:00
qmuntal
f03c392295 runtime: fix aix/ppc64 library initialization
AIX sets the argc and argv parameters in R14 and R15, but
_rt0_ppc64x_lib expects them to be in R3 and R4. Also, call reginit in
_rt0_ppc64x_lib.

These issues were oversights from CL 706395 which went unnoticed because
there if no LUCI aix/ppc64 builder (see #67299).

Change-Id: I93a2798739935fbcead3e6162b4b90db7e740aa5
Reviewed-on: https://go-review.googlesource.com/c/go/+/708255
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Paul Murphy <paumurph@redhat.com>
2025-10-02 11:51:00 -07:00
Daniel Martí
707454b41f cmd/go: update go help mod edit with the tool and ignore sections
The types were added to the docs, but not the fields in GoMod.
While here, I was initially confused about what is the top-level type
given that `type Module` comes first. Move `type GoMod` to the top
as it is the actual top-level type.

Change-Id: I1270154837501f5c7f5b21959b2841fd4ac808d0
Reviewed-on: https://go-review.googlesource.com/c/go/+/700116
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-10-02 11:30:47 -07:00
Vlad Saioc
8c68a1c1ab runtime,net/http/pprof: goroutine leak detection by using the garbage collector
Proposal #74609

Change-Id: I97a754b128aac1bc5b7b9ab607fcd5bb390058c8
GitHub-Last-Rev: 60f2a192ba
GitHub-Pull-Request: golang/go#74622
Reviewed-on: https://go-review.googlesource.com/c/go/+/688335
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: t hepudds <thepudds1460@gmail.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2025-10-02 11:06:21 -07:00
Mateusz Poliwczak
84db201ae1 cmd/compile: propagate len([]T{}) to make builtin to allow stack allocation
Updates #75620

Change-Id: I6a6a6964af4512e30eb4806e1dc7b0fd0835744f
Reviewed-on: https://go-review.googlesource.com/c/go/+/707255
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2025-10-02 11:02:07 -07:00
Daniel McCarney
5799c139a7 crypto/tls: rm marshalEncryptedClientHelloConfigList dead code
This package internal function has no call sites.

Change-Id: I262058199fd2f387ef3b5e21099421720cc5413e
Reviewed-on: https://go-review.googlesource.com/c/go/+/707815
TryBot-Bypass: Daniel McCarney <daniel@binaryparadox.net>
Auto-Submit: Roland Shoemaker <roland@golang.org>
Auto-Submit: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
2025-10-02 10:57:50 -07:00
Joe Tsai
633dd1d475 encoding/json: fix Decoder.InputOffset regression in goexperiment.jsonv2
The Decoder.InputOffset method was always ambiguous about the exact
offset returned since anything between the end of the previous token
to the start of the next token could be a valid result.

Empirically, it seems that the behavior was to report
the end of the previous token unless Decoder.More is called,
in which case it reports the start of the next token.

This is an odd semantic since a relatively side-effect free method
like More is not quite so side-effect free.
However, our goal is to preserve historical v1 semantic when possible
regardless of whether it made sense.

Note that jsontext.Decoder.InputOffset consistently always reports
the end of the previous token. Users can explicitly choose the
exact position they want by inspecting the UnreadBuffer.

Fixes #75468

Change-Id: I1e946e83c9d29dfc09f2913ff8d6b2b80632f292
Reviewed-on: https://go-review.googlesource.com/c/go/+/703856
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-10-01 23:02:56 -07:00
Alan Donovan
8ad27fb656 doc/go_spec.html: update date
(addressing comment from review of CL 704737)

Change-Id: I483dea046f664035e79c51729203c9a9ff0cbc59
Reviewed-on: https://go-review.googlesource.com/c/go/+/708299
Auto-Submit: 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>
2025-10-01 13:00:26 -07:00
Frédéric G. MARAND
3f451f2c54 testing/synctest: fix inverted test failure message in TestContextAfterFunc
Fixes #75685

Change-Id: I5592becfde6aaca3d7f0e2f09bc7a9785228523e
GitHub-Last-Rev: 0ff7bd31ec
GitHub-Pull-Request: golang/go#75687
Reviewed-on: https://go-review.googlesource.com/c/go/+/708275
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Damien Neil <dneil@google.com>
Auto-Submit: Sean Liao <sean@liao.dev>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Sean Liao <sean@liao.dev>
2025-10-01 09:13:30 -07:00
Alan Donovan
be0fed8a5f cmd/go/testdata/script/test_fuzz_fuzztime.txt: disable
This test features a 5s timeout, which is far too close
to the natural variance in scheduling on an overloaded
CI builder machine to make a reliable test. Skipping.

Updates #72104

Change-Id: I52133a2d101808c923e316e0c7fdce9edbb31b10
Reviewed-on: https://go-review.googlesource.com/c/go/+/708075
Auto-Submit: Alan Donovan <adonovan@google.com>
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>
2025-10-01 07:21:24 -07:00
qmuntal
eb1c7f6e69 runtime: move loong64 library entry point to os-agnostic file
The library entry point for loong64 is agnostic to the OS, so move it to
asm_loong64.s. This is similar to what we do for other architectures.

Cq-Include-Trybots: luci.golang.try:gotip-linux-loong64
Change-Id: I6915eb76d3ea72a779e05e78d85f24793169c61f
Reviewed-on: https://go-review.googlesource.com/c/go/+/706416
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-30 23:52:53 -07:00
qmuntal
c9257151e5 runtime: unify ppc64/ppc64le library entry point
Cq-Include-Trybots: luci.golang.try:gotip-linux-ppc64le_power10
Change-Id: Ifd7861488b1b47a5d30163552b51838f2bef7248
Reviewed-on: https://go-review.googlesource.com/c/go/+/706395
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-30 14:49:31 -07:00
Joel Sing
4ff8a457db test/codegen: codify handling of floating point constants on arm64
While here, reorder Float32ConstantStore/Float64ConstantStore for
consistency.

Change-Id: Ic1b3e9f9474965d15bc94518d78d1a4a7bda93f3
Reviewed-on: https://go-review.googlesource.com/c/go/+/703756
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Joel Sing <joel@sing.id.au>
Reviewed-by: Keith Randall <khr@google.com>
2025-09-30 14:49:25 -07:00
Youlin Feng
fcb893fc4b cmd/compile/internal/ssa: remove redundant "type:" prefix check
Remove redundant "type:" prefix check on symbol names in isFixedLoad,
also refactor some duplicate code into methods.

Change-Id: I8358422596eea8c39d1a30a554bd0aae8b570038
Reviewed-on: https://go-review.googlesource.com/c/go/+/701275
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2025-09-30 14:48:08 -07:00
Julien Cretel
19cc1022ba mime: reduce allocs incurred by ParseMediaType
This change is mostly gardening. It simplifies ParseMediaType and its
helper functions and reduces the amount of allocations they incur.

Here are some benchmark results:

goos: darwin
goarch: amd64
pkg: mime
cpu: Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
                      │     old     │                new                 │
                      │   sec/op    │   sec/op     vs base               │
ParseMediaType-8        55.26µ ± 1%   54.54µ ± 1%  -1.30% (p=0.000 n=20)
ParseMediaTypeBogus-8   3.551µ ± 0%   3.427µ ± 0%  -3.48% (p=0.000 n=20)
geomean                 14.01µ        13.67µ       -2.39%

                      │     old      │                 new                 │
                      │     B/op     │     B/op      vs base               │
ParseMediaType-8        38.48Ki ± 0%   37.38Ki ± 0%  -2.85% (p=0.000 n=20)
ParseMediaTypeBogus-8   2.531Ki ± 0%   2.469Ki ± 0%  -2.47% (p=0.000 n=20)
geomean                 9.869Ki        9.606Ki       -2.66%

                      │    old     │                new                 │
                      │ allocs/op  │ allocs/op   vs base                │
ParseMediaType-8        457.0 ± 0%   425.0 ± 0%   -7.00% (p=0.000 n=20)
ParseMediaTypeBogus-8   25.00 ± 0%   21.00 ± 0%  -16.00% (p=0.000 n=20)
geomean                 106.9        94.47       -11.62%

Change-Id: I51198b40396afa51531794a57c50aa88975eae1d
GitHub-Last-Rev: c44e2a2577
GitHub-Pull-Request: golang/go#75565
Reviewed-on: https://go-review.googlesource.com/c/go/+/705715
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Emmanuel Odeke <emmanuel@orijtech.com>
2025-09-30 13:40:32 -07:00
Aidan Welch
08afc50bea mime: extend "builtinTypes" to include a more complete list of common types
Implement all agreed upon types, using IANA's listed media types to decide
when there is a disagreement in type.  Except in the case of `.wav` where
`audio/wav` is used.

Fixes #69530

Change-Id: Iec99a6ceb534073be83c8390f48799bec3e4cfc7
GitHub-Last-Rev: e314c5ec6d
GitHub-Pull-Request: golang/go#69533
Reviewed-on: https://go-review.googlesource.com/c/go/+/614376
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Auto-Submit: Sean Liao <sean@liao.dev>
Reviewed-by: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2025-09-30 13:40:05 -07:00
Jake Bailey
97da068774 cmd/compile: eliminate nil checks on .dict arg
The first arg of a generic function is the dictionary. This dictionary
is never nil, but it gets a nil check becuase the dict arg is treated as
a slice during construction.

cmp.Compare[go.shape.int] was:

00006 (+41) TESTB AX, (AX)
00007 (+52) CMPQ CX, BX
00008 (52) JGT 14
00009 (+55) JGE 12
00010 (+56) MOVL $1, AX
00011 (56) RET
00012 (+58) XORL AX, AX
00013 (58) RET
00014 (+53) MOVQ $-1, AX
00015 (53) RET

Note how the function begins with a TESTB that loads the dict to perform
the nil check.

This CL eliminates that nil check.

For most generic functions, this doesn't matter too much, but not
infrequently are generic functions written which never actually use the
dictionary (like cmp.Compare), so I suspect this might help in hot code
to avoid repeatedly touching the dictionary in memory, and in cases
where the generic function is not inlined (and thus the dict dropped).

compilecmp shows these changes (deduped):

cmp.Compare[go.shape.float64] 73 -> 72  (-1.37%)
cmp.Compare[go.shape.int] 26 -> 24  (-7.69%)
cmp.Compare[go.shape.int32] 25 -> 23  (-8.00%)
cmp.Compare[go.shape.int64] 26 -> 24  (-7.69%)
cmp.Compare[go.shape.string] 142 -> 141  (-0.70%)
cmp.Compare[go.shape.uint16] 26 -> 24  (-7.69%)
cmp.Compare[go.shape.uint] 26 -> 24  (-7.69%)
cmp.Compare[go.shape.uint32] 25 -> 23  (-8.00%)
cmp.Compare[go.shape.uint64] 26 -> 24  (-7.69%)
cmp.Compare[go.shape.uint8] 25 -> 23  (-8.00%)
cmp.Compare[go.shape.uintptr] 26 -> 24  (-7.69%)
cmp.Less[go.shape.float64] 35 -> 34  (-2.86%)
cmp.Less[go.shape.int32] 8 -> 6  (-25.00%)
cmp.Less[go.shape.int64] 9 -> 7  (-22.22%)
cmp.Less[go.shape.int] 9 -> 7  (-22.22%)
cmp.Less[go.shape.string] 112 -> 110  (-1.79%)
cmp.Less[go.shape.uint16] 9 -> 7  (-22.22%)
cmp.Less[go.shape.uint32] 8 -> 6  (-25.00%)
cmp.Less[go.shape.uint64] 9 -> 7  (-22.22%)
internal/synctest.Associate[go.shape.struct 114 -> 113  (-0.88%)
internal/trace.(*dataTable[go.shape.uint64,go.shape.string]).insert 805 -> 791  (-1.74%)
internal/trace.(*dataTable[go.shape.uint64,go.shape.struct 858 -> 852  (-0.70%)
main.(*gState[go.shape.int64]).stop 2111 -> 2085  (-1.23%)
main.(*gState[go.shape.int64]).unblock 941 -> 923  (-1.91%)
runtime.fmax[go.shape.float32] 85 -> 83  (-2.35%)
runtime.fmax[go.shape.float64] 89 -> 87  (-2.25%)
runtime.fmin[go.shape.float32] 85 -> 83  (-2.35%)
runtime.fmin[go.shape.float64] 89 -> 87  (-2.25%)
slices.BinarySearch[go.shape.[]string,go.shape.string] 346 -> 337  (-2.60%)
slices.Concat[go.shape.[]uint8,go.shape.uint8] 462 -> 453  (-1.95%)
slices.ContainsFunc[go.shape.[]*cmd/vendor/github.com/google/pprof/profile.Sample,go.shape.*uint8] 170 -> 169  (-0.59%)
slices.ContainsFunc[go.shape.[]*debug/dwarf.StructField,go.shape.*uint8] 170 -> 169  (-0.59%)
slices.ContainsFunc[go.shape.[]*go/ast.Field,go.shape.*uint8] 170 -> 169  (-0.59%)
slices.ContainsFunc[go.shape.[]string,go.shape.string] 186 -> 181  (-2.69%)
slices.Contains[go.shape.[]*cmd/compile/internal/syntax.BranchStmt,go.shape.*cmd/compile/internal/syntax.BranchStmt] 44 -> 42  (-4.55%)
slices.Contains[go.shape.[]cmd/compile/internal/syntax.Type,go.shape.interface 223 -> 219  (-1.79%)
slices.Contains[go.shape.[]crypto/tls.CurveID,go.shape.uint16] 44 -> 42  (-4.55%)
slices.Contains[go.shape.[]crypto/tls.SignatureScheme,go.shape.uint16] 44 -> 42  (-4.55%)
slices.Contains[go.shape.[]*go/ast.BranchStmt,go.shape.*go/ast.BranchStmt] 44 -> 42  (-4.55%)
slices.Contains[go.shape.[]go/types.Type,go.shape.interface 223 -> 219  (-1.79%)
slices.Contains[go.shape.[]int,go.shape.int] 44 -> 42  (-4.55%)
slices.Contains[go.shape.[]string,go.shape.string] 223 -> 219  (-1.79%)
slices.Contains[go.shape.[]uint16,go.shape.uint16] 44 -> 42  (-4.55%)
slices.Contains[go.shape.[]uint8,go.shape.uint8] 44 -> 42  (-4.55%)
slices.Insert[go.shape.[]string,go.shape.string] 1189 -> 1170  (-1.60%)
slices.medianCmpFunc[go.shape.struct 1118 -> 1113  (-0.45%)
slices.medianCmpFunc[go.shape.struct 1214 -> 1209  (-0.41%)
slices.medianCmpFunc[go.shape.struct 889 -> 887  (-0.22%)
slices.medianCmpFunc[go.shape.struct 901 -> 874  (-3.00%)
slices.order2Ordered[go.shape.float64] 89 -> 87  (-2.25%)
slices.order2Ordered[go.shape.uint16] 75 -> 70  (-6.67%)
slices.partialInsertionSortOrdered[go.shape.string] 1115 -> 1110  (-0.45%)
slices.partialInsertionSortOrdered[go.shape.uint16] 358 -> 352  (-1.68%)
slices.partitionEqualOrdered[go.shape.int] 208 -> 203  (-2.40%)
slices.partitionEqualOrdered[go.shape.int32] 208 -> 198  (-4.81%)
slices.partitionEqualOrdered[go.shape.int64] 208 -> 203  (-2.40%)
slices.partitionEqualOrdered[go.shape.uint32] 208 -> 198  (-4.81%)
slices.partitionEqualOrdered[go.shape.uint64] 208 -> 203  (-2.40%)
slices.partitionOrdered[go.shape.float64] 538 -> 533  (-0.93%)
slices.partitionOrdered[go.shape.int] 437 -> 427  (-2.29%)
slices.partitionOrdered[go.shape.int64] 437 -> 427  (-2.29%)
slices.partitionOrdered[go.shape.uint16] 447 -> 442  (-1.12%)
slices.partitionOrdered[go.shape.uint64] 437 -> 427  (-2.29%)
slices.rotateCmpFunc[go.shape.struct 1045 -> 1029  (-1.53%)
slices.rotateCmpFunc[go.shape.struct 1205 -> 1163  (-3.49%)
slices.rotateCmpFunc[go.shape.struct 1226 -> 1176  (-4.08%)
slices.rotateCmpFunc[go.shape.struct 1322 -> 1272  (-3.78%)
slices.rotateCmpFunc[go.shape.struct 1419 -> 1400  (-1.34%)
slices.rotateCmpFunc[go.shape.*uint8] 549 -> 538  (-2.00%)
slices.rotateLeft[go.shape.string] 603 -> 588  (-2.49%)
slices.rotateLeft[go.shape.uint8] 255 -> 250  (-1.96%)
slices.siftDownOrdered[go.shape.int] 181 -> 171  (-5.52%)
slices.siftDownOrdered[go.shape.int32] 181 -> 171  (-5.52%)
slices.siftDownOrdered[go.shape.int64] 181 -> 171  (-5.52%)
slices.siftDownOrdered[go.shape.string] 614 -> 592  (-3.58%)
slices.siftDownOrdered[go.shape.uint32] 181 -> 171  (-5.52%)
slices.siftDownOrdered[go.shape.uint64] 181 -> 171  (-5.52%)
time.parseRFC3339[go.shape.string] 1774 -> 1758  (-0.90%)
unique.(*canonMap[go.shape.struct 280 -> 276  (-1.43%)
unique.clone[go.shape.struct 311 -> 293  (-5.79%)
weak.Make[go.shape.6880e4598856efac32416085c0172278cf0fb9e5050ce6518bd9b7f7d1662440] 136 -> 134  (-1.47%)
weak.Make[go.shape.struct 136 -> 134  (-1.47%)
weak.Make[go.shape.uint8] 136 -> 134  (-1.47%)

Change-Id: I43dcea5f2aa37372f773e5edc6a2ef1dee0a8db7
Reviewed-on: https://go-review.googlesource.com/c/go/+/706655
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
2025-09-30 11:22:35 -07:00
Steve Muir
300d9d2714 runtime: initialise debug settings much earlier in startup process
This is necessary specifically to set the value of `debug.decoratemappings`
sufficiently early in the startup sequence that all memory ranges allocated
can be named appropriately using the new Linux-specific naming API
introduced in #71546.

Example output (on ARM64):
https://gist.github.com/9muir/3667654b9c3f52e8be92756219371672

Fixes: #75324

Change-Id: Ic0b16233f54a45adef1660c4d0df59af2f5af86a
Reviewed-on: https://go-review.googlesource.com/c/go/+/703476
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-09-30 11:19:26 -07:00
Junyang Shao
703a5fbaad [dev.simd] cmd/compile, simd: add AES instructions
AVXAES is a composite feature set, Intel did listed it as "AVXAES" in
the XED data instead of separating them.

The tests will be in the next CL.

Change-Id: I89c97261f2228b2fdafb48f63e82ef6239bdd5ca
Reviewed-on: https://go-review.googlesource.com/c/go/+/706055
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-09-30 10:37:49 -07:00
Julien Cretel
a846bb0aa5 errors: add AsType
Fixes #51945

Change-Id: Icda169782e796578eba728938134a85b5827d3b6
GitHub-Last-Rev: c6ff335ee1
GitHub-Pull-Request: golang/go#75621
Reviewed-on: https://go-review.googlesource.com/c/go/+/707235
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sean Liao <sean@liao.dev>
2025-09-30 10:22:08 -07:00
qmuntal
7c8166d02d cmd/link/internal/arm64: support Mach-O ARM64_RELOC_SUBTRACTOR in internal linking
ARM64_RELOC_SUBTRACTOR is the arm64 version of X86_64_RELOC_SUBTRACTOR, which
has been recently implemented in CL 660715.

The standard library still doesn't need it, but I've found it necessary
when statically linking against a library I own.

Change-Id: I138281b12f2304e3673f7dc92f7137e48bf68fdd
Reviewed-on: https://go-review.googlesource.com/c/go/+/703316
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-09-30 07:38:03 -07:00
qmuntal
6e95748335 cmd/link/internal/arm64: support Mach-O ARM64_RELOC_POINTER_TO_GOT in internal linking
ARM64_RELOC_POINTER_TO_GOT is the arm64 version of X86_64_RELOC_GOT, which has been support
for many years now.

The standard library still doesn't need it, but I've found it necessary
when statically linking against a library I own.

Change-Id: I8eb7bf3c74aed663a1fc00b5dd986057130f7f7a
Reviewed-on: https://go-review.googlesource.com/c/go/+/703315
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-09-30 07:37:51 -07:00
Cherry Mui
742f92063e cmd/compile, runtime: always enable Wasm signext and satconv features
These features have been standardized since at least Wasm 2.0.
Always enable them.

The corresponding GOWASM settings are now no-op.

Change-Id: I0e59f21696a69a4e289127988aad629a720b002b
Reviewed-on: https://go-review.googlesource.com/c/go/+/707855
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-09-30 06:37:45 -07:00
qmuntal
db10db6be3 internal/poll: remove operation fields from FD
Use a sync.Pool to reuse the overlapped object passed to the different
Windows syscalls instead of keeping two of them in the FD struct.

This reduces the size of the FD struct from 248 to 152 bytes.

While here, pin the overlapped object for the duration of the overlapped
IO operation to comply with the memory safety rules.

Cq-Include-Trybots: luci.golang.try:gotip-windows-amd64-longtest,gotip-windows-amd64-race
Change-Id: I0161d163f681fe94b822c0c885aaa42c449e5342
Reviewed-on: https://go-review.googlesource.com/c/go/+/704235
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-09-30 00:16:48 -07:00
qmuntal
75c87df58e internal/poll: pass the I/O mode instead of an overlapped object in execIO
execIO callers should be agnostic to the fact that it uses an overlapped
object. This will unlock future optimizations and simplifications.

Change-Id: I0a58d992101fa74ac75e3538af04cbc44156f0d6
Reviewed-on: https://go-review.googlesource.com/c/go/+/704175
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-09-29 22:07:23 -07:00
Filippo Valsorda
fc88e18b4a crypto/internal/fips140/entropy: add CPU jitter-based entropy source
Heavily inspired by the BoringSSL implementation.

Change-Id: I6a6a6964b22826d54700c8b3d555054163cef5fe
Co-authored-by: Daniel Morsing <daniel.morsing@gmail.com>
Cq-Include-Trybots: luci.golang.try:gotip-linux-s390x,gotip-linux-ppc64_power10,gotip-linux-ppc64le_power10,gotip-linux-ppc64le_power8,gotip-linux-arm,gotip-darwin-arm64_15,gotip-windows-arm64,gotip-freebsd-amd64
Reviewed-on: https://go-review.googlesource.com/c/go/+/703015
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-09-29 14:06:02 -07:00
Filippo Valsorda
db4fade759 crypto/internal/fips140/mlkem: make CAST conditional
It taks north of 130µs on my machine, which is enough to be worth
shaving off at init time.

Change-Id: I6a6a696463de228bc3e7b9ca10c12ddbaabdf384
Reviewed-on: https://go-review.googlesource.com/c/go/+/707695
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2025-09-29 14:04:36 -07:00
Ian Lance Taylor
db3cb3fd9a runtime: correct reference to getStackMap in comment
Change-Id: I9b1fa390434dbda7d49a36b0114c68f942c11d3f
Reviewed-on: https://go-review.googlesource.com/c/go/+/707575
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-29 14:04:32 -07:00
qmuntal
690fc2fb05 internal/poll: remove buf field from operation
WSASend and WSARecv functions capture the WSABuf structure before
returning, so there is no need to keep a copy of it in the
operation structure.

Write and Read functions don't need it, they can operate directly
on the byte slice.

To be on the safe side, pin the input byte slice so that stack-allocated
slices don't get moved while overlapped I/O is in progress.

Cq-Include-Trybots: luci.golang.try:gotip-windows-amd64-longtest,gotip-windows-amd64-race
Change-Id: I474bed94e11acafa0bdd8392b5dcf8993d8e1ed5
Reviewed-on: https://go-review.googlesource.com/c/go/+/704155
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2025-09-29 12:26:28 -07:00
qmuntal
eaf2345256 cmd/link: use a .def file to mark exported symbols on Windows
Binutils defaults to exporting all symbols when building a Windows DLL.
To avoid that we were marking symbols with __declspec(dllexport) in
the cgo-generated headers, which instructs ld to export only those
symbols. However, that approach makes the headers hard to reuse when
importing the resulting DLL into other projects, as imported symbols
should be marked with __declspec(dllimport).

A better approach is to generate a .def file listing the symbols to
export, which gets the same effect without having to modify the headers.

Updates #30674
Fixes #56994

Change-Id: I22bd0aa079e2be4ae43b13d893f6b804eaeddabf
Reviewed-on: https://go-review.googlesource.com/c/go/+/705776
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Than McIntosh <thanm@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-29 12:24:13 -07:00
qmuntal
4b77733565 internal/syscall/windows: regenerate GetFileSizeEx
GetFileSizeEx was generated before mkwinsyscall was updated to use
SyscallN. Regenerate to use the new style.

Fixes #75642

Change-Id: Ia473a167633b67fb75b5762d693848ecee425a7e
Reviewed-on: https://go-review.googlesource.com/c/go/+/707615
Reviewed-by: Roland Shoemaker <roland@golang.org>
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: Dmitri Shuralyov <dmitshur@golang.org>
2025-09-29 11:56:25 -07:00
Roland Shoemaker
4e9006a716 crypto/tls: quote protocols in ALPN error message
Quote the protocols sent by the client when returning the ALPN
negotiation error message.

Fixes CVE-2025-58189
Fixes #75652

Change-Id: Ie7b3a1ed0b6efcc1705b71f0f1e8417126661330
Reviewed-on: https://go-review.googlesource.com/c/go/+/707776
Auto-Submit: Roland Shoemaker <roland@golang.org>
Reviewed-by: Neal Patel <nealpatel@google.com>
Reviewed-by: Nicholas Husin <nsh@golang.org>
Auto-Submit: Nicholas Husin <nsh@golang.org>
Reviewed-by: Nicholas Husin <husin@google.com>
TryBot-Bypass: Roland Shoemaker <roland@golang.org>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
2025-09-29 11:28:17 -07:00
Cherry Mui
047c2ab841 cmd/link: don't pass -Wl,-S on Solaris
Solaris linker's -S has a different meaning.

Fixes #75637.

Change-Id: I51e641d5bc6d7f64ab5aa280090c70ec787a1fbf
Reviewed-on: https://go-review.googlesource.com/c/go/+/707096
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-09-29 10:10:22 -07:00
Ian Lance Taylor
ae8eba071b cmd/link: use correct length for pcln.cutab
The pcln.cutab slice holds uint32 elements, as can be seen in the
runtime.moduledata type. The slice was being created with the len
(and cap) set to the size of the slice, which means that the count
was four times too large. This patch sets the correct len/cap.

This doesn't matter for the runtime because nothing looks at
the len of cutab. Since the incorrect len is larger, all valid
indexes remain valid. Using the correct length means that more
invalid indexes will be caught at run time, but such cases are unlikely.
Still, using the correct len is less confusing.

While we're here use the simpler sliceSym for pcln.pclntab.

Change-Id: I09f680b3287467120d994b171c86c784085e3d27
Reviewed-on: https://go-review.googlesource.com/c/go/+/707595
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
2025-09-29 10:06:19 -07:00
David Chase
1c961c2fb2 [dev.simd] simd: use new data movement instructions to do "fast" transposes
This is a test/example/performance-comparison.  Looking at the
generated code shows that there is still a lot of checking that
perhaps we can figure out how to optimize away.

$b/go test -bench=B -benchtime=5x .
goos: linux
goarch: amd64
pkg: simd/internal/simd_test
cpu: Intel(R) Xeon(R) Platinum 8481C CPU @ 2.70GHz
BenchmarkPlainTranspose-88        	       5	3143116414 ns/op
BenchmarkTiled4Transpose-88       	       5	1127457328 ns/op
BenchmarkTiled8Transpose-88       	       5	 671788993 ns/op
Benchmark2BlockedTranspose-88     	       5	1665429657 ns/op
Benchmark3BlockedTranspose-88     	       5	1208767441 ns/op
Benchmark4BlockedTranspose-88     	       5	 910212696 ns/op
Benchmark5aBlockedTranspose-88    	       5	 939205670 ns/op
Benchmark5bBlockedTranspose-88    	       5	1018286871 ns/op

Change-Id: I78bae0fd2ff4f511dac4291b898bbb79b0114741
Reviewed-on: https://go-review.googlesource.com/c/go/+/700695
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-09-29 08:41:41 -07:00
Richard Miller
fe3ba74b9e cmd/link: skip TestFlagW on platforms without DWARF symbol table
As with other DWARF tests, don't run TestFlagW on platforms
where executables don't have a DWARF symbol table.

Fixes #75585

Change-Id: I81014bf59b15e30ac1b2a7d24a52f9647db46c26
Reviewed-on: https://go-review.googlesource.com/c/go/+/706418
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2025-09-29 07:59:10 -07:00
apocelipes
d42d56b764 encoding/xml: make use of reflect.TypeAssert
To make the code more readable and improve performance:

goos: darwin
goarch: arm64
pkg: encoding/xml
cpu: Apple M4
                 │     old     │                 new                 │
                 │   sec/op    │   sec/op     vs base                │
Marshal-10         1.902µ ± 1%   1.496µ ± 1%  -21.37% (p=0.000 n=10)
Unmarshal-10       3.877µ ± 1%   3.418µ ± 2%  -11.84% (p=0.000 n=10)
HTMLAutoClose-10   1.314µ ± 3%   1.333µ ± 1%        ~ (p=0.270 n=10)
geomean            2.132µ        1.896µ       -11.07%

                 │     old      │                  new                  │
                 │     B/op     │     B/op      vs base                 │
Marshal-10         5.570Ki ± 0%   5.570Ki ± 0%       ~ (p=1.000 n=10) ¹
Unmarshal-10       7.586Ki ± 0%   7.555Ki ± 0%  -0.41% (p=0.000 n=10)
HTMLAutoClose-10   3.496Ki ± 0%   3.496Ki ± 0%       ~ (p=1.000 n=10) ¹
geomean            5.286Ki        5.279Ki       -0.14%
¹ all samples are equal

                 │    old     │                 new                 │
                 │ allocs/op  │ allocs/op   vs base                 │
Marshal-10         23.00 ± 0%   23.00 ± 0%       ~ (p=1.000 n=10) ¹
Unmarshal-10       185.0 ± 0%   184.0 ± 0%  -0.54% (p=0.000 n=10)
HTMLAutoClose-10   93.00 ± 0%   93.00 ± 0%       ~ (p=1.000 n=10) ¹
geomean            73.42        73.28       -0.18%
¹ all samples are equal

Updates #62121

Change-Id: Ie458e7458d4358c380374571d380ca3b65ca87bb
GitHub-Last-Rev: bb6bb30393
GitHub-Pull-Request: golang/go#75483
Reviewed-on: https://go-review.googlesource.com/c/go/+/704215
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2025-09-29 07:53:08 -07:00
qmuntal
6d51f93257 runtime: jump instead of branch in netbsd/arm64 entry point
CL 706175 removed the NOFRAME directive from _rt0_arm64_netbsd but
did not change the BL instruction to a JMP instruction. This causes the
frame pointer to be stored on the stack, this making direct load from
RSP to be off by 8 bytes.

Cq-Include-Trybots: luci.golang.try:gotip-netbsd-arm64
Change-Id: I0c212fbaba74cfce508f961090dc6e66154c3054
Reviewed-on: https://go-review.googlesource.com/c/go/+/707675
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-09-29 07:16:14 -07:00
Jes Cok
5500cbf0e4 debug/elf: prevent offset overflow
When applying relocations, a malformed ELF file can provide an offset
that, when added to the relocation size, overflows. This wrapped-around
value could then incorrectly pass the bounds check, leading to a panic
when the slice is accessed with the original large offset.

This change eliminates the manual bounds and overflow checks
and writes a relocation to slice by calling putUint.

The putUint helper function centralizes the logic for validating slice
access, correctly handling both out-of-bounds and integer overflow conditions.
This simplifies the relocation code and improves robustness when parsing
malformed ELF files.

Fixes #75516

Change-Id: I00d806bf5501a9bf70200585ba4fd0475d7b2ddc
GitHub-Last-Rev: 49144311d3
GitHub-Pull-Request: golang/go#75522
Reviewed-on: https://go-review.googlesource.com/c/go/+/705075
Reviewed-by: Florian Lehner <lehner.florian86@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Commit-Queue: Ian Lance Taylor <iant@golang.org>
2025-09-28 21:38:57 -07:00
AN Long
34e67623a8 all: fix typos
Change-Id: I290812905b6b5c52f289f7f8524f93aef19e6efe
Reviewed-on: https://go-review.googlesource.com/c/go/+/706775
Auto-Submit: Sean Liao <sean@liao.dev>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Sean Liao <sean@liao.dev>
2025-09-27 09:46:36 -07:00
limeidan
af6999e60d cmd/compile: implement jump table on loong64
Following CL 357330, use jump tables on Loong64.

goos: linux
goarch: loong64
pkg: cmd/compile/internal/test
cpu: Loongson-3A6000-HV @ 2500.00MHz
                                 │     old     │                 new                 │
                                 │   sec/op    │   sec/op     vs base                │
Switch8Predictable                 2.352n ± 0%   2.101n ± 0%  -10.65% (p=0.000 n=10)
Switch8Unpredictable               11.99n ± 0%   10.25n ± 0%  -14.51% (p=0.000 n=10)
Switch32Predictable                3.153n ± 0%   1.887n ± 1%  -40.14% (p=0.000 n=10)
Switch32Unpredictable              12.47n ± 0%   10.22n ± 0%  -18.00% (p=0.000 n=10)
SwitchStringPredictable            3.162n ± 0%   3.352n ± 0%   +6.01% (p=0.000 n=10)
SwitchStringUnpredictable          14.70n ± 0%   13.31n ± 0%   -9.46% (p=0.000 n=10)
SwitchTypePredictable              3.702n ± 0%   2.201n ± 0%  -40.55% (p=0.000 n=10)
SwitchTypeUnpredictable            16.18n ± 0%   14.48n ± 0%  -10.51% (p=0.000 n=10)
SwitchInterfaceTypePredictable     7.654n ± 0%   9.680n ± 0%  +26.47% (p=0.000 n=10)
SwitchInterfaceTypeUnpredictable   22.04n ± 0%   22.44n ± 0%   +1.81% (p=0.000 n=10)
geomean                            7.441n        6.469n       -13.07%

Change-Id: Id6f30fa73349c60fac17670084daee56973a955f
Reviewed-on: https://go-review.googlesource.com/c/go/+/705396
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
2025-09-27 05:02:58 -07:00
Kir Kolyshkin
63cd912083 os/user: simplify go:build
The go:build constraint for these files is way too complicated,
and can be simplified by using unix tag.

Change-Id: Id8278db0ba799a4e951d3c976f77c7402bebb332
Reviewed-on: https://go-review.googlesource.com/c/go/+/703155
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-26 19:38:54 -07:00
Cherry Mui
53009b26dd runtime: use a smaller arena size on Wasm
On Wasm, some programs have very small heap. Currently,
we use 4 MB arena size (like all other 32-bit platforms).
For a very small program, it needs to allocate one heap
arena, 4 MB size at a 4 MB aligned address. So we'll
need 8 MB of linear memory, whereas only a smaller
portion is actually used by the program. On Wasm, samll
programs are not uncommon (e.g. WASI plugins), and
users are concerned about the memory usage.

This CL switches to a smaller arena size, as well as a
smaller page allocator chunk size (both are now 512 KB).
So the heap will be grown in 512 KB granularity. For a
helloworld program, it now uses less than 3 MB of
linear memory, instead of 8 MB.

Change-Id: Ibd66c1fa6e794a12c00906cbacc8f2e410f196c4
Reviewed-on: https://go-review.googlesource.com/c/go/+/683296
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-26 17:13:31 -07:00
Damien Neil
3a5df9d2b2 net/http: add HTTP2Config.StrictMaxConcurrentRequests
Add a field to HTTP2Config controlling how we behave when an HTTP/2
connection reaches its concurrency limit.

This field will have no effect until golang.org/x/net/http2 is
updated to make use of it, and h2_bundle.go is updated with the
new http2 package.

For #67813

Change-Id: Ic72a0986528abb21649f28e9fe7cf6e1236b388d
Reviewed-on: https://go-review.googlesource.com/c/go/+/615875
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Nicholas Husin <nsh@golang.org>
Reviewed-by: Nicholas Husin <husin@google.com>
2025-09-26 16:14:14 -07:00
Damien Neil
16be34df02 net/http: add more tests of transport connection pool
Add a variety of addtional tests exercising client connection pooling,
in particular HTTP/2 connection behavior.

Change-Id: I7609d36db5865f1b95c903cfadb0c3233e046c09
Reviewed-on: https://go-review.googlesource.com/c/go/+/615896
Reviewed-by: Nicholas Husin <husin@google.com>
Reviewed-by: Nicholas Husin <nsh@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Damien Neil <dneil@google.com>
2025-09-26 15:06:09 -07:00
David Chase
fe4af1c067 [dev.simd] simd: repair broken comments in generated ops_amd64.go
these are for concatSelectedConstant and concatSelectedConstantGrouped

Change-Id: I15211596615b42908cdf11182a05b004b6a17950
Reviewed-on: https://go-review.googlesource.com/c/go/+/706975
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-09-26 14:35:20 -07:00
David Chase
ea3b2ecd28 [dev.simd] cmd/compile, simd: add 64-bit select-from-pair methods
these are in the same style as the 32-bit select-from-pair,
including the grouped variant.  This does not quite capture
the full awesome power of VSHUFPD where it can select
differently in each group; that will be some other method,
that is more complex.

Change-Id: I807ddd7c1256103b5b0d7c5d60bd70b185e3aaf0
Reviewed-on: https://go-review.googlesource.com/c/go/+/705695
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-09-26 13:11:24 -07:00
David Chase
25c36b95d1 [dev.simd] simd, cmd/compile: add 128 bit select-from-pair
Using this name until a better one appears:
   x.Select128FromPair(3, 2, y)

Includes test for constant and variable case.
Checks for unexpected immediates (using the zeroing flag,
which is not supported for this intrinsic) and panics.

Change-Id: I9249475d6572968c127b4ee9e00328d717c07578
Reviewed-on: https://go-review.googlesource.com/c/go/+/705496
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-26 13:11:10 -07:00
Kir Kolyshkin
3e4540b49d os/user: use getgrouplist on illumos && cgo
The getgrouplist call is available on Illumos since December 2020:

    f2c438c505

We can assume it is available for users now. Let's switch to using it
when cgo is enabled.

Since neither LUCY nor legacy trybots provide illumos, I tested this
locally in a OpenIndiana VM, with and without osusergo, with cgo enabled
and disabled.

This is a continuation of CL 315278.

Fixes #14709

Change-Id: I922049e7ea5f450f6900914b30967e522e56cfc9
Reviewed-on: https://go-review.googlesource.com/c/go/+/702975
Reviewed-by: Andrew Stormont <andyjstormont@gmail.com>
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Kirill Kolyshkin <kolyshkin@gmail.com>
TryBot-Bypass: Kirill Kolyshkin <kolyshkin@gmail.com>
2025-09-26 12:11:42 -07:00
Cherry Mui
f0e281e693 [dev.simd] cmd/compile: don't require single use for SIMD load/store folding
For load and store on scalar values, we fold the address to the
load/stoer instruction without requiring the address having one
use. Do the same for SIMD, and remove the single use check.

Change-Id: Ie7d1bbae1b32bb8c069548197632edae36b419b9
Reviewed-on: https://go-review.googlesource.com/c/go/+/707137
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-26 12:03:26 -07:00
qmuntal
15fbe3480b internal/poll: simplify WriteMsg and ReadMsg on Windows
Let newWSAMsg retrieve the socket from the sync pool for unconnected
sockets instead of forcing the caller to do it.

Change-Id: I9b3d30bf3f5be187cbde5735d519b3b14f7b3008
Reviewed-on: https://go-review.googlesource.com/c/go/+/704116
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-09-26 11:37:26 -07:00
Cherry Mui
b4d1e018a8 [dev.simd] cmd/compile: remove unnecessary code from early simd prototype
The code overwrites a SIMD vector's register numbers is from an
early prototype. Now CalcStructSize and simdify take care of it.

Change-Id: I15415f796ddb04623b8cabdd2e39cb9c9593c72e
Reviewed-on: https://go-review.googlesource.com/c/go/+/707136
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-26 11:06:35 -07:00
Michael Anthony Knyszek
16ae11a9e1 runtime: move TestReadMetricsSched to testprog
There are just too many flakes resulting from background pollution by
the testing package and other tests. Run in a subprocess where at least
the environment can be more tightly controlled.

Fixes #75049.

Change-Id: Iad59edaaf31268f1fcb77273f01317d963708fa6
Reviewed-on: https://go-review.googlesource.com/c/go/+/707155
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
2025-09-26 10:55:30 -07:00
Junyang Shao
578777bf7c [dev.simd] cmd/compile: make condtion of CanSSA smarter for SIMD fields
This CL tires to improve a situation pointed out by
https://github.com/golang/go/issues/73787#issuecomment-3305494947.

Change-Id: Ic23c80fe71344fc25383ab238ad6631e0f0cd22e
Reviewed-on: https://go-review.googlesource.com/c/go/+/705416
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-26 10:53:39 -07:00
David Chase
c28b2a0ca1 [dev.simd] simd: generalize select-float32-from-pair
This adds methods SelectFromPair for {Int,Uint,Float}32x4
and SelectFromPairGrouped for {Int,Uint,Float}32x8.

Each of these has the signature
```
 func(x T32xK.Method(a,b,c,d uint8, y T32xK) T32xK)
```
where a, b, c, d can be 0-7 and each one specifies an
element from the concatenated elements of x (0-3) and
y (4-7).  When a, b, c, d are constants, 1 or 2
instructions are generated, otherwise, it's done the
harder-slower way with a function call.

Change-Id: I05eb9342e90edb9d83a4d0f5b924bcd2cfd4d12e
Reviewed-on: https://go-review.googlesource.com/c/go/+/703575
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-26 10:48:41 -07:00
Cherry Mui
459f3a3adc cmd/link: don't pass -Wl,-S on AIX
The AIX linker's -S flag has a different meaning. Don't pass it.

Updates #75618.

Change-Id: I98faabea3435cde255f4c2d25f34dde9f69b7ec9
Reviewed-on: https://go-review.googlesource.com/c/go/+/707097
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-09-26 10:15:40 -07:00
Cherry Mui
4631a2d3c6 cmd/link: skip TestFlagW on AIX
The internal/xcoff can only parse XCOFF with symbol table. This
test creates executables without symbol table. Skip the test.

(It might be possible to make internal/xcoff work with binaries
without symbol table? Leave it for the future.)

Fixes #75618.

Change-Id: I273ffefee5376d987accd5aa48c9473d2b3df055
Reviewed-on: https://go-review.googlesource.com/c/go/+/707095
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2025-09-26 10:15:33 -07:00
Cuong Manh Le
0f31d742cd cmd/compile: fix ICE with new(<untyped expr>)
Fixes #75617

Change-Id: Iaee7d4556db54b9999f5ba8458e7c05c11ccfc36
Reviewed-on: https://go-review.googlesource.com/c/go/+/707075
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
2025-09-26 10:10:03 -07:00
qmuntal
7d7cd6e07b internal/poll: don't call SetFilePointerEx in Seek for overlapped handles
Overlapped handles don't have the file pointer updated when performing
I/O operations, so there is no need to call syscall.SetFilePointerEx in
FD.Seek. Updating the in-memory offset is sufficient.

Updates #74951 (provides a more complete fix)

Change-Id: Ibede6625cdbd501fc92cfdf8ce2782ec291af2b6
Reviewed-on: https://go-review.googlesource.com/c/go/+/698035
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
2025-09-26 09:22:11 -07:00
Damien Neil
41cba31e66 mime/multipart: percent-encode CR and LF in header values to avoid CRLF injection
When provided with a field or file name containing newlines,
multipart.FileContentDisposition and other header-producing functions
could create an invalid header value.

In some scenarios, this could permit a malicious input to perform
a CRLF injection attack:

  field := "field"
  evilFile := "name\"\r\nEvil-Header: \"evil"
  fmt.Printf("Content-Disposition: %v\r\n", multipart.FileContentDisposition(field, evilFile))
  // Prints:
  // Content-Disposition: form-data; name="field"; filename="name"
  // Evil-Header: "evil"

Percent-endode \r and \n characters in headers, as recommended by
https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#multipart/form-data-encoding-algorithm

The above algorithm also recommends using percent-encoding for quotes,
but preserve the existing backslash-escape behavior for now.
Empirically, browsers understand backslash-escape in attribute values.

Fixes #75557

Change-Id: Ia203df6ef45a098070f3ebb17f9b6cf80c520ed4
Reviewed-on: https://go-review.googlesource.com/c/go/+/706677
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Nicholas Husin <nsh@golang.org>
Reviewed-by: Nicholas Husin <husin@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-26 09:04:26 -07:00
abner chenc
dd1d597c3a Revert "cmd/internal/obj/loong64: use the MOVVP instruction to optimize prologue"
This reverts commit eb7c67fdc9.

Reason for revert: Causes x/tools/gopls/internal/filecache/TestConcurrency failures, See issue 75571.

Fixes #75571
Fixes #75572

Change-Id: Ife328dce917c63c872da35f4a9e9f7ef8f88c712
Reviewed-on: https://go-review.googlesource.com/c/go/+/706035
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
2025-09-26 07:49:00 -07:00
qmuntal
45d6bc76af runtime: unify arm64 entry point code
There is a lot of duplication in how arm64 OSes handle entry points.
Do as amd64, have all the logic in a common function.

Cq-Include-Trybots: luci.golang.try:gotip-darwin-arm64-longtest,gotip-windows-arm64
Change-Id: I370c25c3c4b107b525aba14e9dcac34a02d9872e
Reviewed-on: https://go-review.googlesource.com/c/go/+/706175
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Quim Muntal <quimmuntal@gmail.com>
2025-09-26 00:30:55 -07:00
qmuntal
fdea7da3e6 runtime: use common library entry point on windows amd64/386
Windows can reuse the common library entry point instead of implementing
a its own version. Note that windows/arm64 already uses the common one.

Change-Id: I1a27bbec04bfd1d58a136638bafcdc0583bd106f
Reviewed-on: https://go-review.googlesource.com/c/go/+/706235
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-09-25 23:48:32 -07:00
Filippo Valsorda
e8a4f508d1 lib/fips140: re-seal v1.0.0
Exceptionally, we decided to make a compliance-related change following
CMVP's updated Implementation Guidance on September 2nd.

The Security Policy will be updated to reflect the new zip hash.

mkzip.go has been modified to accept versions of the form vX.Y.Z-hash,
where the -hash suffix is ignored for fips140.Version() but used to
name the zip file and the unpacked cache directory.

The new zip is generated with

	go run ../../src/cmd/go/internal/fips140/mkzip.go -b c2097c7c v1.0.0-c2097c7c

from c2097c7c which is the current release-branch.go1.24 head.

The full diff between the zip file contents is included below.

For #74947
Updates #69536


$ diff -ru golang.org/fips140@v1.0.0/fips140/v1.0.0/ golang.org/fips140@v1.0.0-c2097c7c/fips140/v1.0.0-c2097c7c

diff -ru golang.org/fips140@v1.0.0/fips140/v1.0.0/cast.go golang.org/fips140@v1.0.0-c2097c7c/fips140/v1.0.0-c2097c7c/cast.go
--- golang.org/fips140@v1.0.0/fips140/v1.0.0/cast.go	1980-01-10 00:00:00.000000000 +0100
+++ golang.org/fips140@v1.0.0-c2097c7c/fips140/v1.0.0-c2097c7c/cast.go	1980-01-10 00:00:00.000000000 +0100
@@ -56,9 +56,10 @@
 }

 // PCT runs the named Pairwise Consistency Test (if operated in FIPS mode) and
-// returns any errors. If an error is returned, the key must not be used.
+// aborts the program (stopping the module input/output and entering the "error
+// state") if the test fails.
 //
-// PCTs are mandatory for every key pair that is generated/imported, including
+// PCTs are mandatory for every generated (but not imported) key pair, including
 // ephemeral keys (which effectively doubles the cost of key establishment). See
 // Implementation Guidance 10.3.A Additional Comment 1.
 //
@@ -66,17 +67,23 @@
 //
 // If a package p calls PCT during key generation, an invocation of that
 // function should be added to fipstest.TestConditionals.
-func PCT(name string, f func() error) error {
+func PCT(name string, f func() error) {
 	if strings.ContainsAny(name, ",#=:") {
 		panic("fips: invalid self-test name: " + name)
 	}
 	if !Enabled {
-		return nil
+		return
 	}

 	err := f()
 	if name == failfipscast {
 		err = errors.New("simulated PCT failure")
 	}
-	return err
+	if err != nil {
+		fatal("FIPS 140-3 self-test failed: " + name + ": " + err.Error())
+		panic("unreachable")
+	}
+	if debug {
+		println("FIPS 140-3 PCT passed:", name)
+	}
 }
diff -ru golang.org/fips140@v1.0.0/fips140/v1.0.0/ecdh/ecdh.go golang.org/fips140@v1.0.0-c2097c7c/fips140/v1.0.0-c2097c7c/ecdh/ecdh.go
--- golang.org/fips140@v1.0.0/fips140/v1.0.0/ecdh/ecdh.go	1980-01-10 00:00:00.000000000 +0100
+++ golang.org/fips140@v1.0.0-c2097c7c/fips140/v1.0.0-c2097c7c/ecdh/ecdh.go	1980-01-10 00:00:00.000000000 +0100
@@ -161,6 +161,27 @@
 		if err != nil {
 			continue
 		}
+
+		// A "Pairwise Consistency Test" makes no sense if we just generated the
+		// public key from an ephemeral private key. Moreover, there is no way to
+		// check it aside from redoing the exact same computation again. SP 800-56A
+		// Rev. 3, Section 5.6.2.1.4 acknowledges that, and doesn't require it.
+		// However, ISO 19790:2012, Section 7.10.3.3 has a blanket requirement for a
+		// PCT for all generated keys (AS10.35) and FIPS 140-3 IG 10.3.A, Additional
+		// Comment 1 goes out of its way to say that "the PCT shall be performed
+		// consistent [...], even if the underlying standard does not require a
+		// PCT". So we do it. And make ECDH nearly 50% slower (only) in FIPS mode.
+		fips140.PCT("ECDH PCT", func() error {
+			p1, err := c.newPoint().ScalarBaseMult(privateKey.d)
+			if err != nil {
+				return err
+			}
+			if !bytes.Equal(p1.Bytes(), privateKey.pub.q) {
+				return errors.New("crypto/ecdh: public key does not match private key")
+			}
+			return nil
+		})
+
 		return privateKey, nil
 	}
 }
@@ -188,28 +209,6 @@
 		panic("crypto/ecdh: internal error: public key is the identity element")
 	}

-	// A "Pairwise Consistency Test" makes no sense if we just generated the
-	// public key from an ephemeral private key. Moreover, there is no way to
-	// check it aside from redoing the exact same computation again. SP 800-56A
-	// Rev. 3, Section 5.6.2.1.4 acknowledges that, and doesn't require it.
-	// However, ISO 19790:2012, Section 7.10.3.3 has a blanket requirement for a
-	// PCT for all generated keys (AS10.35) and FIPS 140-3 IG 10.3.A, Additional
-	// Comment 1 goes out of its way to say that "the PCT shall be performed
-	// consistent [...], even if the underlying standard does not require a
-	// PCT". So we do it. And make ECDH nearly 50% slower (only) in FIPS mode.
-	if err := fips140.PCT("ECDH PCT", func() error {
-		p1, err := c.newPoint().ScalarBaseMult(key)
-		if err != nil {
-			return err
-		}
-		if !bytes.Equal(p1.Bytes(), publicKey) {
-			return errors.New("crypto/ecdh: public key does not match private key")
-		}
-		return nil
-	}); err != nil {
-		panic(err)
-	}
-
 	k := &PrivateKey{d: bytes.Clone(key), pub: PublicKey{curve: c.curve, q: publicKey}}
 	return k, nil
 }
diff -ru golang.org/fips140@v1.0.0/fips140/v1.0.0/ecdsa/cast.go golang.org/fips140@v1.0.0-c2097c7c/fips140/v1.0.0-c2097c7c/ecdsa/cast.go
--- golang.org/fips140@v1.0.0/fips140/v1.0.0/ecdsa/cast.go	1980-01-10 00:00:00.000000000 +0100
+++ golang.org/fips140@v1.0.0-c2097c7c/fips140/v1.0.0-c2097c7c/ecdsa/cast.go	1980-01-10 00:00:00.000000000 +0100
@@ -51,8 +51,8 @@
 	}
 }

-func fipsPCT[P Point[P]](c *Curve[P], k *PrivateKey) error {
-	return fips140.PCT("ECDSA PCT", func() error {
+func fipsPCT[P Point[P]](c *Curve[P], k *PrivateKey) {
+	fips140.PCT("ECDSA PCT", func() error {
 		hash := testHash()
 		drbg := newDRBG(sha512.New, k.d, bits2octets(P256(), hash), nil)
 		sig, err := sign(c, k, drbg, hash)
diff -ru golang.org/fips140@v1.0.0/fips140/v1.0.0/ecdsa/ecdsa.go golang.org/fips140@v1.0.0-c2097c7c/fips140/v1.0.0-c2097c7c/ecdsa/ecdsa.go
--- golang.org/fips140@v1.0.0/fips140/v1.0.0/ecdsa/ecdsa.go	1980-01-10 00:00:00.000000000 +0100
+++ golang.org/fips140@v1.0.0-c2097c7c/fips140/v1.0.0-c2097c7c/ecdsa/ecdsa.go	1980-01-10 00:00:00.000000000 +0100
@@ -166,11 +166,6 @@
 		return nil, err
 	}
 	priv := &PrivateKey{pub: *pub, d: d.Bytes(c.N)}
-	if err := fipsPCT(c, priv); err != nil {
-		// This can happen if the application went out of its way to make an
-		// ecdsa.PrivateKey with a mismatching PublicKey.
-		return nil, err
-	}
 	return priv, nil
 }

@@ -203,10 +198,7 @@
 		},
 		d: k.Bytes(c.N),
 	}
-	if err := fipsPCT(c, priv); err != nil {
-		// This clearly can't happen, but FIPS 140-3 mandates that we check it.
-		panic(err)
-	}
+	fipsPCT(c, priv)
 	return priv, nil
 }

diff -ru golang.org/fips140@v1.0.0/fips140/v1.0.0/ecdsa/hmacdrbg.go golang.org/fips140@v1.0.0-c2097c7c/fips140/v1.0.0-c2097c7c/ecdsa/hmacdrbg.go
--- golang.org/fips140@v1.0.0/fips140/v1.0.0/ecdsa/hmacdrbg.go	1980-01-10 00:00:00.000000000 +0100
+++ golang.org/fips140@v1.0.0-c2097c7c/fips140/v1.0.0-c2097c7c/ecdsa/hmacdrbg.go	1980-01-10 00:00:00.000000000 +0100
@@ -121,7 +121,7 @@
 //
 // This should only be used for ACVP testing. hmacDRBG is not intended to be
 // used directly.
-func TestingOnlyNewDRBG(hash func() fips140.Hash, entropy, nonce []byte, s []byte) *hmacDRBG {
+func TestingOnlyNewDRBG[H fips140.Hash](hash func() H, entropy, nonce []byte, s []byte) *hmacDRBG {
 	return newDRBG(hash, entropy, nonce, plainPersonalizationString(s))
 }

diff -ru golang.org/fips140@v1.0.0/fips140/v1.0.0/ed25519/cast.go golang.org/fips140@v1.0.0-c2097c7c/fips140/v1.0.0-c2097c7c/ed25519/cast.go
--- golang.org/fips140@v1.0.0/fips140/v1.0.0/ed25519/cast.go	1980-01-10 00:00:00.000000000 +0100
+++ golang.org/fips140@v1.0.0-c2097c7c/fips140/v1.0.0-c2097c7c/ed25519/cast.go	1980-01-10 00:00:00.000000000 +0100
@@ -12,8 +12,8 @@
 	"sync"
 )

-func fipsPCT(k *PrivateKey) error {
-	return fips140.PCT("Ed25519 sign and verify PCT", func() error {
+func fipsPCT(k *PrivateKey) {
+	fips140.PCT("Ed25519 sign and verify PCT", func() error {
 		return pairwiseTest(k)
 	})
 }
diff -ru golang.org/fips140@v1.0.0/fips140/v1.0.0/ed25519/ed25519.go golang.org/fips140@v1.0.0-c2097c7c/fips140/v1.0.0-c2097c7c/ed25519/ed25519.go
--- golang.org/fips140@v1.0.0/fips140/v1.0.0/ed25519/ed25519.go	1980-01-10 00:00:00.000000000 +0100
+++ golang.org/fips140@v1.0.0-c2097c7c/fips140/v1.0.0-c2097c7c/ed25519/ed25519.go	1980-01-10 00:00:00.000000000 +0100
@@ -69,10 +69,7 @@
 	fips140.RecordApproved()
 	drbg.Read(priv.seed[:])
 	precomputePrivateKey(priv)
-	if err := fipsPCT(priv); err != nil {
-		// This clearly can't happen, but FIPS 140-3 requires that we check.
-		panic(err)
-	}
+	fipsPCT(priv)
 	return priv, nil
 }

@@ -88,10 +85,6 @@
 	}
 	copy(priv.seed[:], seed)
 	precomputePrivateKey(priv)
-	if err := fipsPCT(priv); err != nil {
-		// This clearly can't happen, but FIPS 140-3 requires that we check.
-		panic(err)
-	}
 	return priv, nil
 }

@@ -137,12 +130,6 @@

 	copy(priv.prefix[:], h[32:])

-	if err := fipsPCT(priv); err != nil {
-		// This can happen if the application messed with the private key
-		// encoding, and the public key doesn't match the seed anymore.
-		return nil, err
-	}
-
 	return priv, nil
 }

diff -ru golang.org/fips140@v1.0.0/fips140/v1.0.0/fips140.go golang.org/fips140@v1.0.0-c2097c7c/fips140/v1.0.0-c2097c7c/fips140.go
--- golang.org/fips140@v1.0.0/fips140/v1.0.0/fips140.go	1980-01-10 00:00:00.000000000 +0100
+++ golang.org/fips140@v1.0.0-c2097c7c/fips140/v1.0.0-c2097c7c/fips140.go	1980-01-10 00:00:00.000000000 +0100
@@ -62,6 +62,10 @@
 	return "Go Cryptographic Module"
 }

+// Version returns the formal version (such as "v1.0.0") if building against a
+// frozen module with GOFIPS140. Otherwise, it returns "latest".
 func Version() string {
-	return "v1.0"
+	// This return value is replaced by mkzip.go, it must not be changed or
+	// moved to a different file.
+	return "v1.0.0"
 }
diff -ru golang.org/fips140@v1.0.0/fips140/v1.0.0/mlkem/mlkem1024.go golang.org/fips140@v1.0.0-c2097c7c/fips140/v1.0.0-c2097c7c/mlkem/mlkem1024.go
--- golang.org/fips140@v1.0.0/fips140/v1.0.0/mlkem/mlkem1024.go	1980-01-10 00:00:00.000000000 +0100
+++ golang.org/fips140@v1.0.0-c2097c7c/fips140/v1.0.0-c2097c7c/mlkem/mlkem1024.go	1980-01-10 00:00:00.000000000 +0100
@@ -118,10 +118,7 @@
 	var z [32]byte
 	drbg.Read(z[:])
 	kemKeyGen1024(dk, &d, &z)
-	if err := fips140.PCT("ML-KEM PCT", func() error { return kemPCT1024(dk) }); err != nil {
-		// This clearly can't happen, but FIPS 140-3 requires us to check.
-		panic(err)
-	}
+	fips140.PCT("ML-KEM PCT", func() error { return kemPCT1024(dk) })
 	fips140.RecordApproved()
 	return dk, nil
 }
@@ -149,10 +146,6 @@
 	d := (*[32]byte)(seed[:32])
 	z := (*[32]byte)(seed[32:])
 	kemKeyGen1024(dk, d, z)
-	if err := fips140.PCT("ML-KEM PCT", func() error { return kemPCT1024(dk) }); err != nil {
-		// This clearly can't happen, but FIPS 140-3 requires us to check.
-		panic(err)
-	}
 	fips140.RecordApproved()
 	return dk, nil
 }
diff -ru golang.org/fips140@v1.0.0/fips140/v1.0.0/mlkem/mlkem768.go golang.org/fips140@v1.0.0-c2097c7c/fips140/v1.0.0-c2097c7c/mlkem/mlkem768.go
--- golang.org/fips140@v1.0.0/fips140/v1.0.0/mlkem/mlkem768.go	1980-01-10 00:00:00.000000000 +0100
+++ golang.org/fips140@v1.0.0-c2097c7c/fips140/v1.0.0-c2097c7c/mlkem/mlkem768.go	1980-01-10 00:00:00.000000000 +0100
@@ -177,10 +177,7 @@
 	var z [32]byte
 	drbg.Read(z[:])
 	kemKeyGen(dk, &d, &z)
-	if err := fips140.PCT("ML-KEM PCT", func() error { return kemPCT(dk) }); err != nil {
-		// This clearly can't happen, but FIPS 140-3 requires us to check.
-		panic(err)
-	}
+	fips140.PCT("ML-KEM PCT", func() error { return kemPCT(dk) })
 	fips140.RecordApproved()
 	return dk, nil
 }
@@ -208,10 +205,6 @@
 	d := (*[32]byte)(seed[:32])
 	z := (*[32]byte)(seed[32:])
 	kemKeyGen(dk, d, z)
-	if err := fips140.PCT("ML-KEM PCT", func() error { return kemPCT(dk) }); err != nil {
-		// This clearly can't happen, but FIPS 140-3 requires us to check.
-		panic(err)
-	}
 	fips140.RecordApproved()
 	return dk, nil
 }
diff -ru golang.org/fips140@v1.0.0/fips140/v1.0.0/rsa/keygen.go golang.org/fips140@v1.0.0-c2097c7c/fips140/v1.0.0-c2097c7c/rsa/keygen.go
--- golang.org/fips140@v1.0.0/fips140/v1.0.0/rsa/keygen.go	1980-01-10 00:00:00.000000000 +0100
+++ golang.org/fips140@v1.0.0-c2097c7c/fips140/v1.0.0-c2097c7c/rsa/keygen.go	1980-01-10 00:00:00.000000000 +0100
@@ -105,7 +105,28 @@
 		// negligible chance of failure we can defer the check to the end of key
 		// generation and return an error if it fails. See [checkPrivateKey].

-		return newPrivateKey(N, 65537, d, P, Q)
+		k, err := newPrivateKey(N, 65537, d, P, Q)
+		if err != nil {
+			return nil, err
+		}
+
+		if k.fipsApproved {
+			fips140.PCT("RSA sign and verify PCT", func() error {
+				hash := []byte{
+					0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
+					0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
+					0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
+					0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20,
+				}
+				sig, err := signPKCS1v15(k, "SHA-256", hash)
+				if err != nil {
+					return err
+				}
+				return verifyPKCS1v15(k.PublicKey(), "SHA-256", hash, sig)
+			})
+		}
+
+		return k, nil
 	}
 }

diff -ru golang.org/fips140@v1.0.0/fips140/v1.0.0/rsa/rsa.go golang.org/fips140@v1.0.0-c2097c7c/fips140/v1.0.0-c2097c7c/rsa/rsa.go
--- golang.org/fips140@v1.0.0/fips140/v1.0.0/rsa/rsa.go	1980-01-10 00:00:00.000000000 +0100
+++ golang.org/fips140@v1.0.0-c2097c7c/fips140/v1.0.0-c2097c7c/rsa/rsa.go	1980-01-10 00:00:00.000000000 +0100
@@ -310,26 +310,6 @@
 		return errors.New("crypto/rsa: d too small")
 	}

-	// If the key is still in scope for FIPS mode, perform a Pairwise
-	// Consistency Test.
-	if priv.fipsApproved {
-		if err := fips140.PCT("RSA sign and verify PCT", func() error {
-			hash := []byte{
-				0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
-				0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
-				0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
-				0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20,
-			}
-			sig, err := signPKCS1v15(priv, "SHA-256", hash)
-			if err != nil {
-				return err
-			}
-			return verifyPKCS1v15(priv.PublicKey(), "SHA-256", hash, sig)
-		}); err != nil {
-			return err
-		}
-	}
-
 	return nil
 }


Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest
Change-Id: I6a6a6964b1780f19ec2b5202052de58b47d9342c
Reviewed-on: https://go-review.googlesource.com/c/go/+/701520
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Commit-Queue: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-25 12:53:19 -07:00
Filippo Valsorda
9b7a328089 crypto/internal/fips140: remove key import PCTs, make keygen PCTs fatal
CMVP clarified with the September 2nd changes to IG 10.3.A that PCTs
don't need to run on imported keys.

However, PCT failure must enter the error state (which for us is fatal).

Thankfully, now that PCTs only run on key generation, we can be assured
they will never fail.

This change should only affect FIPS 140-3 mode.

While at it, make the CAST/PCT testing more robust, checking
TestConditional is terminated by a fatal error (and not by t.Fatal).

Fixes #74947
Updates #69536

Change-Id: I6a6a696439e1560c10f3cce2cb208fd40c5bc641
Reviewed-on: https://go-review.googlesource.com/c/go/+/701517
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
TryBot-Bypass: Filippo Valsorda <filippo@golang.org>
2025-09-25 12:06:35 -07:00
Filippo Valsorda
7f9ab7203f crypto/internal/fips140: update frozen module version to "v1.0.0"
We are re-sealing the .zip file anyway for another reason, might as well
take the opportunity to fix the "v1.0" mistake.

Note that the actual returned version change will happen when re-sealing
the .zip, as the latest mkzip.go will inject "v1.0.0" instead of "v1.0".

This reapplies CL 701518, reverted in CL 702255.

Change-Id: Ib5b3721bda35c32dd48293b3d1193c12661662dd
Reviewed-on: https://go-review.googlesource.com/c/go/+/702316
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Bypass: Filippo Valsorda <filippo@golang.org>
2025-09-25 12:06:18 -07:00
Filippo Valsorda
fb5719cbda crypto/internal/fips140/ecdsa: make TestingOnlyNewDRBG generic
We are re-sealing the .zip file anyway for another reason, might as well
take the opportunity to remove the fips140.Hash type indirection.

Change-Id: I6a6a6964fdb312cc2c64e327f845c398c0f6279b
Reviewed-on: https://go-review.googlesource.com/c/go/+/701519
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: Mark Freeman <markfreeman@google.com>
TryBot-Bypass: Filippo Valsorda <filippo@golang.org>
2025-09-25 12:05:50 -07:00
Alan Donovan
56067e31f2 std: remove unused declarations
One function was unused by mistake, and is now used as intended.

Change-Id: I42ae7481c6f794b310bdac656ea525bd882f146e
Reviewed-on: https://go-review.googlesource.com/c/go/+/706815
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: 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>
2025-09-25 11:38:17 -07:00
Cherry Mui
a693ae1e9a [dev.simd] all: merge master (d70ad4e) into dev.simd
Conflicts:

- src/cmd/compile/internal/types2/stdlib_test.go
- src/go/types/stdlib_test.go

Merge List:

+ 2025-09-25 d70ad4e740 sync/atomic: correct Uintptr.Or return doc
+ 2025-09-25 d7abfe4f0d runtime: acquire/release C TSAN lock when calling cgo symbolizer/tracebacker
+ 2025-09-25 393d91aea0 cmd/fix: remove all functionality
+ 2025-09-25 6dceff8bad cmd/link: handle -w flag in external linking mode
+ 2025-09-25 76d088eb74 cmd/internal/obj/riscv: remove ACFLWSP/ACFSWSP and ACFLW/ACFSW
+ 2025-09-25 5225e9dc49 doc/next: document new image/jpeg DCT in release notes
+ 2025-09-25 81a83bba21 cmd: update x/tools@4df13e3
+ 2025-09-25 6b32c613ca go/types: make typeset return an iterator
+ 2025-09-25 fbba930271 image/jpeg: replace fdct.go and idct.go with new implementation in dct.go
+ 2025-09-25 92e093467f image/jpeg: correct and test reference slowFDCT and slowIDCT
+ 2025-09-25 27c7bbc51c image/jpeg: prepare for new FDCT/IDCT implementations
+ 2025-09-24 f15cd63ec4 cmd/compile: don't rely on loop info when there are irreducible loops
+ 2025-09-24 371c1d2fcb cmd/internal/obj/riscv: add support for vector unit-stride fault-only-first load instructions
+ 2025-09-23 411c250d64 runtime: add specialized malloc functions for sizes up to 512 bytes
+ 2025-09-23 d7a38adf4c runtime: eliminate global span queue [green tea]
+ 2025-09-23 7bc1935db5 cmd/compile/internal: support new(expr)
+ 2025-09-23 eb78f13c9f doc/go_spec.html: document new(expr)
+ 2025-09-23 74cc463f9e go/token: add TestRemovedFileFileReturnsNil test
+ 2025-09-23 902dc27ae9 go/token: clear cache after grabbing the mutex in RemoveFile
+ 2025-09-23 a13d085a5b cmd/cgo: don't hardcode section name in TestNumberOfExportedFunctions
+ 2025-09-23 61bf26a9ee cmd/link: fix Macho-O X86_64_RELOC_SUBTRACTOR in internal linking
+ 2025-09-23 4b787c8c2b reflect: remove stale comment in unpackEface
+ 2025-09-23 3df27cd21a cmd/compile: fix typo in comment
+ 2025-09-23 684e8d3363 reflect: allocate memory in TypeAssert[I] only when the assertion succeeds
+ 2025-09-23 a5866ebe40 cmd/compile: prevent shapifying of pointer shape type
+ 2025-09-23 a27261c42f go/types,types2: allow new(expr)
+ 2025-09-23 e93f439ac4 runtime/cgo: retry when CreateThread fails with ERROR_ACCESS_DENIED
+ 2025-09-23 69e74b0aac runtime: deduplicate pMask resize code
+ 2025-09-23 fde10c4ce7 runtime: split gcMarkWorkAvailable into two separate conditions
+ 2025-09-23 5d040df092 runtime: use scan kernels in scanSpan [green tea]
+ 2025-09-23 7e0251bf58 runtime: don't report non-blocked goroutines as "(durable)" in stacks
+ 2025-09-23 22ac328856 cmd/link: make -w behavior consistent on Windows

Change-Id: Id76b5a30a3b6f6669437f97e3320c9bca65a1e96
2025-09-25 13:33:59 -04:00
Cherry Mui
5a78e1a4a1 [dev.simd] simd, cmd/compile: mark simd vectors uncomparable
SIMD vector types are opqaue, and are expected to be operated with
methods. It is not always possible to compare the two vectors
efficiently. Instead of adding more magic to the compiler to
handle the == operator, mark the vector types uncomparable.

Change-Id: I4ca5d5e80ca7d8992dffa7b3c0386b75eb19cfa8
Reviewed-on: https://go-review.googlesource.com/c/go/+/705855
Reviewed-by: Junyang Shao <shaojunyang@google.com>
TryBot-Bypass: Cherry Mui <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
2025-09-25 10:32:03 -07:00
Michael Pratt
d70ad4e740 sync/atomic: correct Uintptr.Or return doc
Uintptr.Or returns the old value, just like all of the other Or
functions. This was a typo in the original CL 544455.

Fixes #75607.

Change-Id: I260959e7e32e51f1152b5271df6cc51adfa02a4d
Reviewed-on: https://go-review.googlesource.com/c/go/+/706816
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
2025-09-25 10:29:41 -07:00
Michael Pratt
d7abfe4f0d runtime: acquire/release C TSAN lock when calling cgo symbolizer/tracebacker
When calling into C via cmd/cgo, the generated code calls
_cgo_tsan_acquire / _cgo_tsan_release around the C call to report a
dummy lock to the C/C++ TSAN runtime. This is necessary because the
C/C++ TSAN runtime does not understand synchronization within Go and
would otherwise report false positive race reports. See the comment in
cmd/cgo/out.go for more details.

Various C functions in runtime/cgo also contain manual calls to
_cgo_tsan_acquire/release where necessary to suppress race reports.

However, the cgo symbolizer and cgo traceback functions called from
callCgoSymbolizer and cgoContextPCs, respectively, do not have any
instrumentation [1]. They call directly into user C functions with no
TSAN instrumentation.

This means they have an opportunity to report false race conditions. The
most direct way is via their argument. Both are passed a pointer to a
struct stored on the Go stack, and both write to fields of the struct.
If two calls are passed the same pointer from different threads, the C
TSAN runtime will think this is a race.

This is simple to achieve for the cgo symbolizer function, which the
new regression test does. callCgoSymbolizer is called on the standard
goroutine stack, so the argument is a pointer into the goroutine stack.
If the goroutine moves Ms between two calls, it will look like a race.

On the other hand, cgoContextPCs is called on the system stack. Each M
has a unique system stack, so for it to pass the same argument pointer
on different threads would require the first M to exit, free its stack,
and the same region of address space to be used as the stack for a new
M. Theoretically possible, but quite unlikely.

Both of these are addressed by providing a C wrapper in runtime/cgo that
calls _cgo_tsan_acquire/_cgo_tsan_release around calls to the symbolizer
and traceback functions.

There is a lot of room for future cleanup here. Most runtime/cgo
functions have manual instrumentation in their C implementation. That
could be removed in favor of instrumentation in the runtime. We could
even theoretically remove the instrumentation from cmd/cgo and move it
to cgocall. None of these are necessary, but may make things more
consistent and easier to follow.

[1] Note that the cgo traceback function called from the signal handler
via x_cgo_callers _does_ have manual instrumentation.

Fixes #73949.

Cq-Include-Trybots: luci.golang.try:gotip-freebsd-amd64,gotip-linux-amd64-longtest,gotip-windows-amd64-longtest
Change-Id: I6a6a636c9daa38f7fd00694af76b75cb93ba1886
Reviewed-on: https://go-review.googlesource.com/c/go/+/677955
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-25 10:22:54 -07:00
Alan Donovan
393d91aea0 cmd/fix: remove all functionality
The buildtag fixer has been incorporated into the vet analyzer
of the same name; all other fixers were already no-ops since
CL 695855.

Fixes #73605
Updates #71859

Change-Id: I90b6c730849a5ecbac3e6fb6fc0e062b5de74831
Reviewed-on: https://go-review.googlesource.com/c/go/+/706758
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-25 10:01:21 -07:00
Cherry Mui
6dceff8bad cmd/link: handle -w flag in external linking mode
Currently, when the -w flag is set, it doesn't actually disable
the debug info generation with in external linking mode. (It does
make the Go object have no debug info, but C objects may still
have.) Pass "-Wl,-S" to let the external linker disable debug info
generation.

Change-Id: I0fce56b9f23a45546b69b9e6dd027c5527b1bc87
Reviewed-on: https://go-review.googlesource.com/c/go/+/705857
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2025-09-25 09:24:46 -07:00
Joel Sing
76d088eb74 cmd/internal/obj/riscv: remove ACFLWSP/ACFSWSP and ACFLW/ACFSW
These are RV32-only instructions that will not be implemented.

Updates #71105

Change-Id: Ie386fe36e56f1151bb8756088dd79804584317c0
Reviewed-on: https://go-review.googlesource.com/c/go/+/702395
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
Reviewed-by: Mark Ryan <markdryan@rivosinc.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-09-25 09:17:13 -07:00
Russ Cox
5225e9dc49 doc/next: document new image/jpeg DCT in release notes
Fixes #75603.

Change-Id: I0b4b93af467b97c2d4b5703e31605ff4f7970260
Reviewed-on: https://go-review.googlesource.com/c/go/+/706736
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Russ Cox <rsc@golang.org>
2025-09-25 08:49:17 -07:00
Alan Donovan
81a83bba21 cmd: update x/tools@4df13e3
This includes only a couple of minor cmd/vet fixes for new(expr).

    export GOWORK=off
    cd src/cmd
    go get golang.org/x/tools@4df13e3
    go mod tidy
    go mod vendor

For #45624

Change-Id: Iafba4350d321d6cd1fcc91a062e2c150e3f4d553
Reviewed-on: https://go-review.googlesource.com/c/go/+/706735
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
2025-09-25 08:01:03 -07:00
Alan Donovan
6b32c613ca go/types: make typeset return an iterator
typeset(t) now returns a func equivalent to iter.Seq2[Type, Type]
for the sequence over (type, underlying) pairs in the typeset of t.

underIs was modified to take advantage of the underlying iteration
primitive, all, which computes the desired boolean conjunction
directly.

Change-Id: I3e17d5970fd2908c5dca0754db3e251bf1200af2
Reviewed-on: https://go-review.googlesource.com/c/go/+/688876
Auto-Submit: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2025-09-25 08:00:44 -07:00
Russ Cox
fbba930271 image/jpeg: replace fdct.go and idct.go with new implementation in dct.go
The fdct.go and idct.go files were derived from the MPEG-SSG and
JPEG-IJG reference code and therefore carry licenses specific to those
groups. Various license checkers flag these files as potentially
problematic. The code is also not terribly well documented.

This CL fixes the license problem by adding a new, from-scratch
implementation using a different algorithm. As a bonus, the new code
is both faster and more accurate than the old encumbered code.

On speed, the new code is up to 20% faster; benchmarks below.

On accuracy, in the set of blocks used in the test, we can measure
the number of output values that are off-by-one from the exact rounded answer.
The old FDCT was off in 8.6% of values; the new one is off in 2.5%.
The old IDCT was off in 1.4% of values; the new one is off in 1.2%.

goos: darwin
goarch: arm64
pkg: image/jpeg
cpu: Apple M3 Pro
                     │     old     │                 new                 │
                     │   sec/op    │   sec/op     vs base                │
FDCT-12                619.6n ± 3%   586.5n ± 1%   -5.34% (p=0.000 n=10)
IDCT-12                752.4n ± 4%   628.0n ± 1%  -16.54% (p=0.000 n=10)

goos: linux
goarch: amd64
cpu: Intel(R) Xeon(R) CPU @ 2.30GHz
               │     old     │                 new                 │
               │   sec/op    │   sec/op     vs base                │
FDCT-16          1.817µ ± 0%   1.542µ ± 0%  -15.11% (p=0.000 n=10)
IDCT-16          1.897µ ± 0%   1.514µ ± 0%  -20.22% (p=0.000 n=10)

goos: linux
goarch: arm64
cpu: whatever gotip-linux-arm64 has
              │     old     │                new                 │
              │   sec/op    │   sec/op     vs base               │
FDCT-8          1.844µ ± 0%   1.847µ ± 0%  +0.14% (p=0.000 n=10)
IDCT-8          2.127µ ± 0%   1.973µ ± 0%  -7.26% (p=0.000 n=10)

Change-Id: Ie6d14103c8478ba5a779f234da84f345828eb925
Reviewed-on: https://go-review.googlesource.com/c/go/+/705518
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>
Reviewed-by: Nigel Tao <nigeltao@google.com>
2025-09-25 07:54:32 -07:00
Russ Cox
92e093467f image/jpeg: correct and test reference slowFDCT and slowIDCT
The reference implementations slowFDCT and slowIDCT were not
rounding correctly, making the test not as good as it could be.
Before, the real implementations were required to always produce
values within ±2 of the reference; now, with no changes,
the real implementations produce values within ±1 of the (corrected)
reference.

Also tighten the test to return an error not just on a single value
exceeding tolerance but also on too many values at exactly that
tolerance.

Change-Id: I3dd6ca7582178fef972fb812d848f7a0158a6ed8
Reviewed-on: https://go-review.googlesource.com/c/go/+/705517
Auto-Submit: Russ Cox <rsc@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
2025-09-25 07:54:28 -07:00
Russ Cox
27c7bbc51c image/jpeg: prepare for new FDCT/IDCT implementations
Preparation for a new unencumbered implementation of fdct.go and idct.go.

- Change benchmark not to allocate O(b.N) storage.
- Make tests point out where differences are.
- Parameterize differ tolerance.

Change-Id: Id5dfee40f86de894bad72dd6178ba61ec81ea2da
Reviewed-on: https://go-review.googlesource.com/c/go/+/705516
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
2025-09-25 07:12:44 -07:00
Keith Randall
f15cd63ec4 cmd/compile: don't rely on loop info when there are irreducible loops
Loop information is sketchy when there are irreducible loops.
Sometimes blocks inside 2 loops can be recorded as only being part of
the outer loop. That causes tighten to move values that want to move
into such a block to move out of the loop altogether, breaking the
invariant that operations have to be scheduled after their args.

Fixes #75569

Change-Id: Idd80e6d2268094b8ae6387563081fdc1e211856a
Reviewed-on: https://go-review.googlesource.com/c/go/+/706355
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
2025-09-24 15:24:36 -07:00
wangboyao
371c1d2fcb cmd/internal/obj/riscv: add support for vector unit-stride fault-only-first load instructions
Add support for vector unit-stride fault-only-first load instructions to the RISC-V
assembler. This includes vle8ff, vle16ff, vle32ff and vle64ff.

Change-Id: I5575a1ea155663852f92194fb79f08b5d52203de
Reviewed-on: https://go-review.googlesource.com/c/go/+/690115
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Joel Sing <joel@sing.id.au>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-24 06:21:53 -07:00
Michael Matloob
411c250d64 runtime: add specialized malloc functions for sizes up to 512 bytes
This CL adds a generator function in runtime/_mkmalloc to generate
specialized mallocgc functions for sizes up throuht 512 bytes. (That's
the limit where it's possible to end up in the no header case when there
are scan bits, and where the benefits of the specialized functions
significantly diminish according to microbenchmarks). If the
specializedmalloc GOEXPERIMENT is turned on, mallocgc will call one of
these functions in the no header case.

malloc_generated.go is the generated file containing the specialized
malloc functions.

malloc_stubs.go contains the templates that will be stamped to create
the specialized malloc functions.

malloc_tables_generated contains the tables that mallocgc will use to
select the specialized function to call.

I've had to update the two stdlib_test.go files to account for the new
submodule mkmalloc is in. mprof_test accounts for the changes in the
stacks since different functions can be called in some cases.
I still need to investigate heapsampling.go.

Change-Id: Ia0f68dccdf1c6a200554ae88657cf4d686ace819
Reviewed-on: https://go-review.googlesource.com/c/go/+/665835
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-23 21:34:36 -07:00
Michael Anthony Knyszek
d7a38adf4c runtime: eliminate global span queue [green tea]
This change removes the locked global span queue and replaces the
fixed-size local span queue with a variable-sized local span queue. The
variable-sized local span queue grows as needed to accomodate local
work. With no global span queue either, GC workers balance work amongst
themselves by stealing from each other.

The new variable-sized local span queues are inspired by the P-local
deque underlying sync.Pool. Unlike the sync.Pool deque, however, both
the owning P and stealing Ps take spans from the tail, making this
incarnation a strict queue, not a deque. This is intentional, since we
want a queue-like order to encourage objects to accumulate on each span.

These variable-sized local span queues are crucial to mark termination,
just like the global span queue was. To avoid hitting the ragged barrier
too often, we must check whether any Ps have any spans on their
variable-sized local span queues. We maintain a per-P atomic bitmask
(another pMask) that contains this state. We can also use this to speed
up stealing by skipping Ps that don't have any local spans.

The variable-sized local span queues are slower than the old fixed-size
local span queues because of the additional indirection, so this change
adds a non-atomic local fixed-size queue. This risks getting work stuck
on it, so, similarly to how workbufs work, each worker will occasionally
dump some spans onto its local variable-sized queue. This scales much
more nicely than dumping to a global queue, but is still visible to all
other Ps.

For #73581.

Change-Id: I814f54d9c3cc7fa7896167746e9823f50943ac22
Reviewed-on: https://go-review.googlesource.com/c/go/+/700496
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-23 16:36:08 -07:00
David Chase
bf00f5dfd6 [dev.simd] simd, cmd/compile: added simd methods for VSHUFP[DS]
These are package private, and will be hidden behind
other methods in a following CL with a more general
interface.

Change-Id: Id090a5de06a0e2aed5cc60a11ff627c5e3b9c52d
Reviewed-on: https://go-review.googlesource.com/c/go/+/698577
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-23 13:25:22 -07:00
Alan Donovan
7bc1935db5 cmd/compile/internal: support new(expr)
This CL adds compiler support for new(expr),
a feature of go1.26 that allows the user to specify
the initial value of the variable instead of its
type.

Also, a basic test of dynamic behavior.

See CL 704737 for spec change and CL 704935 for
type-checker changes.

For #45624

Change-Id: I65d27de1ee3aabb819b57cce8ea77f3073447757
Reviewed-on: https://go-review.googlesource.com/c/go/+/705157
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Mateusz Poliwczak <mpoliwczak34@gmail.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
2025-09-23 13:12:12 -07:00
Alan Donovan
eb78f13c9f doc/go_spec.html: document new(expr)
Also, add a release note.

For #45624

Change-Id: I1a0e111e00885c9640c073000afb72731d0930fc
Reviewed-on: https://go-review.googlesource.com/c/go/+/704737
Auto-Submit: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2025-09-23 12:08:27 -07:00
Mateusz Poliwczak
74cc463f9e go/token: add TestRemovedFileFileReturnsNil test
While debugging test issue in the previous CL i noted that we don't have
a proper test for RemoveFile.

Change-Id: I6a6a6964426ed3cf6725a58ec377686c2900c626
Reviewed-on: https://go-review.googlesource.com/c/go/+/705757
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-09-23 11:49:54 -07:00
Mateusz Poliwczak
902dc27ae9 go/token: clear cache after grabbing the mutex in RemoveFile
This fixes a race, that was possible to hit in RemoveFile.
The file cache could have been populated concurrently just before
grabbing of the mutex.

Change-Id: I6a6a696452d8bd79ac4ac6574297390978353444
Reviewed-on: https://go-review.googlesource.com/c/go/+/705756
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
2025-09-23 11:49:50 -07:00
qmuntal
a13d085a5b cmd/cgo: don't hardcode section name in TestNumberOfExportedFunctions
TestNumberOfExportedFunctions checks the number of exported functions
announced in the PE export table, getting it from the .edata section.
If the section is not found, the test is skipped. However, the PE spec
doesn't mandate that the export table be in a section named .edata,
making this test prone to being skipped unnecessarily.

While here, remove a check in cmd/go.testBuildmodePIE that was testing
the same thing in order to verify that the binary had a relocation table
. Not only the test is duplicated, but also it in unnecessary because
it already testing that the PE characteristics doesn't contain the
IMAGE_FILE_RELOCS_STRIPPED flag.

Closes #46719

Cq-Include-Trybots: luci.golang.try:gotip-windows-arm64
Change-Id: I28d1e261b38388868dd3c19ef6ddddad7bf105ef
Reviewed-on: https://go-review.googlesource.com/c/go/+/705755
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-23 11:49:41 -07:00
qmuntal
61bf26a9ee cmd/link: fix Macho-O X86_64_RELOC_SUBTRACTOR in internal linking
X86_64_RELOC_SUBTRACTOR is handled as a generic R_PCREL relocations,
which gets the relocation size subtracted from the relocated value.

This is not supposed to happen for this particular relocation, so
compensate by adding the size to the addend.

Cq-Include-Trybots: luci.golang.try:gotip-darwin-amd64-race
Change-Id: I6e6889d63bb03b8076e3e409722601dfebec57e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/703776
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-09-23 11:48:39 -07:00
Mateusz Poliwczak
4b787c8c2b reflect: remove stale comment in unpackEface
e.word (or more properly e.Data) is always a pointer now.

Change-Id: I6a6a6964b17797e234829691ced842ab431ec38f
Reviewed-on: https://go-review.googlesource.com/c/go/+/705535
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-23 11:47:57 -07:00
mohanson
3df27cd21a cmd/compile: fix typo in comment
Fix typo for omitted.

Change-Id: Ia633abe7f3d28f15f1f538425cdce9e6d9ef48c0
Reviewed-on: https://go-review.googlesource.com/c/go/+/705735
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@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
2025-09-23 11:45:30 -07:00
Mateusz Poliwczak
684e8d3363 reflect: allocate memory in TypeAssert[I] only when the assertion succeeds
goos: linux
goarch: amd64
pkg: reflect
cpu: 11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz
                                                                        │ /tmp/before │              /tmp/after               │
                                                                        │   sec/op    │   sec/op     vs base                  │
TypeAssert/TypeAssert[int](int)-8                                         2.599n ± 1%   2.558n ± 0%  -1.56% (p=0.000 n=30)
TypeAssert/TypeAssert[uint8](int)-8                                       2.506n ± 1%   2.579n ± 2%  +2.93% (p=0.008 n=30)
TypeAssert/TypeAssert[fmt.Stringer](reflect_test.testTypeWithMethod)-8    7.449n ± 2%   7.776n ± 2%  +4.39% (p=0.000 n=30)
TypeAssert/TypeAssert[fmt.Stringer](*reflect_test.testTypeWithMethod)-8   7.220n ± 2%   7.439n ± 1%  +3.04% (p=0.000 n=30)
TypeAssert/TypeAssert[interface_{}](int)-8                                4.015n ± 1%   4.207n ± 1%  +4.79% (p=0.000 n=30)
TypeAssert/TypeAssert[interface_{}](reflect_test.testTypeWithMethod)-8    4.003n ± 1%   4.190n ± 2%  +4.66% (p=0.000 n=30)
TypeAssert/TypeAssert[time.Time](time.Time)-8                             2.933n ± 1%   2.942n ± 1%       ~ (p=0.327 n=20+30)
TypeAssert/TypeAssert[func()_string](func()_string)-8                                   111.5n ± 1%
geomean                                                                   4.004n        6.208n       +2.62%

Change-Id: I6a6a6964d6f9c794adc15dc5ff3dc8634b30df89
Reviewed-on: https://go-review.googlesource.com/c/go/+/705255
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Mateusz Poliwczak <mpoliwczak34@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-23 11:45:25 -07:00
Cuong Manh Le
a5866ebe40 cmd/compile: prevent shapifying of pointer shape type
CL 641955 changes the Unified IR reader to not doing shapify when
reading reshaping expression, prevent losing of the original type.

This is an oversight, as the main problem isn't about shaping during the
reshaping process itself, but about the specific case of shaping a
pointer shape type. This bug occurs when instantiating a generic
function within another generic function with a pointer shape type as
type parameter, which will convert `*[]go.shape.T` to `*go.shape.uint8`,
resulting in the loss of the original expression's type.

This commit changes Unified IR reader to avoid pointer shaping for
`*[]go.shape.T`, ensures that the original type is preserved when
processing reshaping expressions.

Updates #71184
Updates #73947
Fixes #74260
Fixes #75461

Change-Id: Icede6b73247d0d367bb485619f2dafb60ad66806
Reviewed-on: https://go-review.googlesource.com/c/go/+/704095
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: David Chase <drchase@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-09-23 11:43:48 -07:00
Alan Donovan
a27261c42f go/types,types2: allow new(expr)
For #45624

Change-Id: I6d77a2a1d6095cac0edc36060cbf98c72b749404
Reviewed-on: https://go-review.googlesource.com/c/go/+/704935
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-23 11:36:46 -07:00
David Chase
8e60feeb41 [dev.simd] cmd/compile: improve slicemask removal
this will be subsumed by pending changes in local slice
representation, however this was easy and works well.

Change-Id: I5b6eb10d257f04f906be7a8a6f2b6833992a39e8
Reviewed-on: https://go-review.googlesource.com/c/go/+/704876
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
2025-09-23 11:30:11 -07:00
qmuntal
e93f439ac4 runtime/cgo: retry when CreateThread fails with ERROR_ACCESS_DENIED
_cgo_beginthread used to retry _beginthread only when it failed with
EACCESS, but CL 651995 switched to CreateThread and incorrectly mapped
EACCESS to ERROR_NOT_ENOUGH_MEMORY. The correct mapping is
ERROR_ACCESS_DENIED.

Fixes #72814
Fixes #75381

Change-Id: I8ba060114aae4e8249576f11a21eff613caa8001
Reviewed-on: https://go-review.googlesource.com/c/go/+/706075
Reviewed-by: 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>
2025-09-23 09:53:14 -07:00
Michael Anthony Knyszek
69e74b0aac runtime: deduplicate pMask resize code
Change-Id: I04a9a69904710a488c685cb9eee9c3313ed8e97b
Reviewed-on: https://go-review.googlesource.com/c/go/+/701896
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>
2025-09-23 09:18:09 -07:00
Michael Anthony Knyszek
fde10c4ce7 runtime: split gcMarkWorkAvailable into two separate conditions
Right now, gcMarkWorkAvailable is used in two scenarios. The first is
critical: we use it to determine whether we're approaching mark
termination, and it's crucial to reaching a fixed point across the
ragged barrier in gcMarkDone. The second is a heuristic: should we spin
up another GC worker?

This change splits gcMarkWorkAvailable into these two separate
conditions. This change also deduplicates the logic for updating
work.nwait into more abstract helpers "gcBeginWork" and "gcEndWork."

This change is solely refactoring, and should be a no-op. There are only
two functional changes:
- work.nwait is incremented after setting pp.gcMarkWorkerMode in the
  background worker code. I don't believe this change is observable
  except if the code fails to update work.nwait (either it results in a
  non-sensical number, or the stack is corrupted) in which case the
  goroutine may not be labeled as a mark worker in the resulting stack
  trace (it should be obvious from the stack frames though).
- endCheckmarks also checks work.nwait == work.nproc, which should be
  fine since we never mutate work.nwait on that path. That extra check
  should be a no-op.

Splitting these two use-cases for gcMarkWorkAvailable is conceptually
helpful, and the checks may also diverge from Green Tea once we get rid
of the global span queue.

Change-Id: I0bec244a14ee82919c4deb7c1575589c0dca1089
Reviewed-on: https://go-review.googlesource.com/c/go/+/701176
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>
2025-09-23 09:18:03 -07:00
Michael Anthony Knyszek
5d040df092 runtime: use scan kernels in scanSpan [green tea]
This is an extra 15-20% faster over the current sparse span scanning
when AVX512+GFNI is available and there's sufficient density.

For #73581.

Change-Id: I9688e09885dd76c5ccab7c492c85a7e14e18ee04
Reviewed-on: https://go-review.googlesource.com/c/go/+/665495
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
2025-09-23 09:17:50 -07:00
Damien Neil
7e0251bf58 runtime: don't report non-blocked goroutines as "(durable)" in stacks
Only append the " (durable)" suffix to a goroutine's status
when the goroutine is waiting.

Avoids reporting a goroutine as "runnable (durable)".

Change-Id: Id679692345afab6e63362ca3eeff16808367e50f
Reviewed-on: https://go-review.googlesource.com/c/go/+/705995
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-09-23 08:52:35 -07:00
Cherry Mui
2b50ffe172 [dev.simd] cmd/compile: remove stores to unread parameters
Currently, we remove stores to local variables that are not read.
We don't do that for arguments. But arguments and locals are
essentially the same. Arguments are passed by value, and are not
expected to be read in the caller's frame. So we can remove the
writes to them as well. One exception is the cgo_unsafe_arg
directive, which makes all the arguments effectively address-taken.
cgo_unsafe_arg implies ABI0, so we just skip ABI0 functions'
arguments.

Change-Id: I8999fc50da6a87f22c1ec23e9a0c15483b6f7df8
Reviewed-on: https://go-review.googlesource.com/c/go/+/705815
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-09-23 08:05:41 -07:00
Cherry Mui
22ac328856 cmd/link: make -w behavior consistent on Windows
On UNIX-like platforms, the -w flag disables DWARF, and the -s
flag implies -w (so it disables both the symbol table and DWARF).
The implied -w can be negated with -w=0, i.e. -s -w=0 disables the
symbol table but keeps the DWARF. Currently, this negation doesn't
work on Windows. This CL makes it so, so it is consistent on all
platforms (that support DWARF).

Change-Id: I19764a15768433afe333b37061cea16f06cb901b
Reviewed-on: https://go-review.googlesource.com/c/go/+/703998
Reviewed-by: Than McIntosh <thanm@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-09-23 07:58:08 -07:00
Cherry Mui
2d8cb80d7c [dev.simd] all: merge master (9b2d39b) into dev.simd
Conflicts:

- src/internal/buildcfg/exp.go

Merge List:

+ 2025-09-22 9b2d39b75b cmd/compile/internal/ssa: match style and formatting
+ 2025-09-22 e23edf5e55 runtime: don't re-read metrics before check in TestReadMetricsSched
+ 2025-09-22 177cd8d763 log/slog: use a pooled json encoder
+ 2025-09-22 2353c15785 cmd/cgo/internal/test: skip TestMultipleAssign when using UCRT on Windows
+ 2025-09-22 32dfd69282 cmd/dist: disable FIPS 140-3 mode when testing maphash with purego
+ 2025-09-19 7f6ff5ec3e cmd/compile: fix doc word
+ 2025-09-19 9693b94be0 runtime: include stderr when objdump fails
+ 2025-09-19 8616981ce6 log/slog: optimize slog Level.String() to avoid fmt.Sprintf
+ 2025-09-19 b8af744360 testing: fix example for unexported identifier
+ 2025-09-19 51dc5bfe6c Revert "cmd/go: disable cgo by default if CC unset and  DefaultCC doesn't exist"
+ 2025-09-19 ee7bf06cb3 time: improve ParseDuration performance for invalid input
+ 2025-09-19 f9e61a9a32 cmd/compile: duplicate nil check to two branches of write barrier
+ 2025-09-18 3cf1aaf8b9 runtime: use futexes with 64-bit time on Linux
+ 2025-09-18 0ab038af62 cmd/compile/internal/abi: use clear built-in
+ 2025-09-18 00bf24fdca bytes: use clear in test
+ 2025-09-18 f9701d21d2 crypto: use clear built-in
+ 2025-09-18 a58afe44fa net: fix testHookCanceledDial race
+ 2025-09-18 3203a5da29 net/http: avoid connCount underflow race
+ 2025-09-18 8ca209ec39 context: don't return a non-nil from Err before Done is closed
+ 2025-09-18 3032894e04 runtime: make explicit nil check in heapSetTypeSmallHeader
+ 2025-09-17 ef05b66d61 cmd/internal/obj/riscv: add support for Zicond instructions
+ 2025-09-17 78ef487a6f cmd/compile: fix the issue of shift amount exceeding the valid range
+ 2025-09-17 77aac7bb75 runtime: don't enable heap randomization if MSAN or ASAN is enabled
+ 2025-09-17 465b85eb76 runtime: fix CheckScavengedBitsCleared with randomized heap base
+ 2025-09-17 909704b85e encoding/json/v2: fix typo in comment
+ 2025-09-17 3db5979e8c testing: use reflect.TypeAssert and reflect.TypeFor
+ 2025-09-17 6a8dbbecbf path/filepath: fix EvalSymlinks to return ENOTDIR on plan9
+ 2025-09-17 bffe7ad9f1 go/parser: Add TestBothLineAndLeadComment
+ 2025-09-17 02a888e820 go/ast: document that (*ast.File).Comments is sorted by position
+ 2025-09-16 594deca981 cmd/link: simplify PE relocations mapping
+ 2025-09-16 9df1a289ac go/parser: simplify expectSemi
+ 2025-09-16 72ba117bda internal/buildcfg: enable randomizedHeapBase64 by default
+ 2025-09-16 796ea3bc2e os/user: align test file name and build tags
+ 2025-09-16 a69395eab2 runtime/_mkmalloc: add a copy of cloneNode
+ 2025-09-16 cbdad4fc3c cmd/go: check pattern for utf8 validity before call regexp.MustCompile
+ 2025-09-16 c2d85eb999 cmd/go: disable cgo by default if CC unset and  DefaultCC doesn't exist
+ 2025-09-16 ac82fe68aa bytes,strings: remove reference to non-existent SplitFunc
+ 2025-09-16 0b26678db2 cmd/compile: fix mips zerorange implementation
+ 2025-09-16 e2cfc1eb3a cmd/internal/obj/riscv: improve handling of float point moves
+ 2025-09-16 281c632e6e crypto/x509/internal/macos: standardize package name
+ 2025-09-16 61dc7fe30d iter: document that calling yield after terminated range loop causes runtime panic

Change-Id: Ic06019efc855913632003f41eb10c746b3410b0a
2025-09-23 10:32:03 -04:00
Junyang Shao
63a09d6d3d [dev.simd] cmd/compile: fix SIMD const rematerialization condition
This CL fixes a condition for the previous fix CL 704056.

Change-Id: I1f1f8c6f72870403cb3dff14755c43385dc0c933
Reviewed-on: https://go-review.googlesource.com/c/go/+/705499
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-09-22 16:19:02 -07:00
Will Faught
9b2d39b75b cmd/compile/internal/ssa: match style and formatting
Format final sentence in paragraph and make sentence case to match style.

Change-Id: I991729257fea202509f59a928b943e10ef1761f4
GitHub-Last-Rev: 770bbf5e75
GitHub-Pull-Request: golang/go#75550
Reviewed-on: https://go-review.googlesource.com/c/go/+/705519
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
2025-09-22 11:37:46 -07:00
Michael Anthony Knyszek
e23edf5e55 runtime: don't re-read metrics before check in TestReadMetricsSched
The two remaining popular flakes in TestReadMetricsSched are with
waiting and not-in-go goroutines. I believe the reason for both of these
is pollution due to other goroutines in the test binary, and we can be a
little bit more robust to them.

In particular, both of these tests spin until there's a particular
condition met in the metrics. Then they both immediately re-read the
metrics. The metrics being checked are not guaranteed to stay that way
in the re-read. For example, for the waiting case, it's possible for
>1000 to be waiting, but then some leftover goroutines from a previous
test wake up off of some condition, causing the number to dip again on
the re-read. This is supported by the fact that in some of these
failures, the test takes very little time to execute (the condition that
there are at least 1000 waiting goroutines is almost immediately
satisfied) but it still fails (the re-read causes us to notice that there
are <1000 waiting goroutines).

This change makes the test more robust by not performing this re-read.
This means more possible false negatives, but the error cases we're
looking for (bad metrics) should still show up with some reasonable
probability when something *is* truly wrong.

For #75049.

Change-Id: Idc3a8030bed8da51f24322efe15f3ff13da05623
Reviewed-on: https://go-review.googlesource.com/c/go/+/705875
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>
2025-09-22 11:00:25 -07:00
Sean Liao
177cd8d763 log/slog: use a pooled json encoder
goos: linux
goarch: amd64
pkg: log/slog/internal/benchmarks
cpu: 12th Gen Intel(R) Core(TM) i7-1260P
                                 │   old.txt   │               new.txt               │
                                 │   sec/op    │   sec/op     vs base                │
Attrs/JSON_discard/5_args-16       217.4n ± 8%   217.7n ± 5%        ~ (p=0.971 n=10)
Attrs/JSON_discard/5_args_ctx-16   217.8n ± 8%   219.0n ± 6%        ~ (p=0.723 n=10)
Attrs/JSON_discard/10_args-16      482.8n ± 4%   418.5n ± 1%  -13.33% (p=0.000 n=10)
Attrs/JSON_discard/40_args-16      1.709µ ± 1%   1.413µ ± 1%  -17.33% (p=0.000 n=10)
geomean                            444.5n        409.7n        -7.84%

                                 │    old.txt     │                new.txt                 │
                                 │      B/op      │     B/op      vs base                  │
Attrs/JSON_discard/5_args-16         0.000 ± 0%       0.000 ± 0%        ~ (p=1.000 n=10) ¹
Attrs/JSON_discard/5_args_ctx-16     0.000 ± 0%       0.000 ± 0%        ~ (p=1.000 n=10) ¹
Attrs/JSON_discard/10_args-16        498.0 ± 0%       273.0 ± 0%  -45.18% (p=0.000 n=10)
Attrs/JSON_discard/40_args-16      2.383Ki ± 0%     1.614Ki ± 0%  -32.25% (p=0.000 n=10)
geomean                                         ²                 -21.94%                ²
¹ all samples are equal
² summaries must be >0 to compute geomean

                                 │    old.txt    │               new.txt                │
                                 │   allocs/op   │ allocs/op   vs base                  │
Attrs/JSON_discard/5_args-16        0.000 ± 0%     0.000 ± 0%        ~ (p=1.000 n=10) ¹
Attrs/JSON_discard/5_args_ctx-16    0.000 ± 0%     0.000 ± 0%        ~ (p=1.000 n=10) ¹
Attrs/JSON_discard/10_args-16       7.000 ± 0%     3.000 ± 0%  -57.14% (p=0.000 n=10)
Attrs/JSON_discard/40_args-16      22.000 ± 0%     8.000 ± 0%  -63.64% (p=0.000 n=10)
geomean                                        ²               -37.17%                ²
¹ all samples are equal
² summaries must be >0 to compute geomean

Fixes #74645

Change-Id: I185667cd6caa6a8251e75233eb659c1fd449deaa
Reviewed-on: https://go-review.googlesource.com/c/go/+/705555
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-09-22 09:06:29 -07:00
qmuntal
2353c15785 cmd/cgo/internal/test: skip TestMultipleAssign when using UCRT on Windows
The Universal C Runtime (UCRT) default behavior is to crash the program
when strtol is called with an invalid base (that is, not 0 or 2..36).
This an invalid base (that is, not 0 or 2..36). This changes the test to
skip when running on Windows and linking with UCRT.

When using external linking mode this test passes if using the Mingw-w64
toolchain, even when linking with UCRT. That's because the Mingw-w64
linker adds a _set_invalid_parameter_handler call at startup that
overrides the default UCRT behavior. However, other toolchains, like
MSVC and LLVM, doesn't override the default behavior.

Overriding the default behavior is out of the scope for this test, so
the test is skipped instead.

Fixes #62887

Change-Id: I60f140faf0eda80a2de4e10876be25e0dbe442d2
Reviewed-on: https://go-review.googlesource.com/c/go/+/705455
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-09-22 08:26:41 -07:00
qmuntal
32dfd69282 cmd/dist: disable FIPS 140-3 mode when testing maphash with purego
hash/maphash can't be built with FIPS 140-3 mode and the purego tag
since CL 703095. That change precludes running "GODEBUG=fips140=on go
dist test" with, as there is a test variant that tests maphash with the
purego tag.

Change-Id: Iaedfaf3bb79281a799ef95283310c96d2e64207f
Reviewed-on: https://go-review.googlesource.com/c/go/+/705775
Auto-Submit: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-09-22 08:07:18 -07:00
David Chase
2ca96d218d [dev.simd] cmd/compile: enhance prove to infer bounds in slice len/cap calculations
the example comes up in chunked reslicing, e.g. A[i:] where i
has a relationship with len(A)-K.

Change-Id: Ib97dede6cfc7bbbd27b4f384988f741760686604
Reviewed-on: https://go-review.googlesource.com/c/go/+/704875
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
2025-09-20 14:28:01 -07:00
Will Faught
7f6ff5ec3e cmd/compile: fix doc word
"using" -> "uses"

Change-Id: I2bcefc6128dafd4fd05d7ce291b1afb28465a25c
GitHub-Last-Rev: bf9006eeb6
GitHub-Pull-Request: golang/go#75548
Reviewed-on: https://go-review.googlesource.com/c/go/+/705515
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2025-09-19 17:06:23 -07:00
Michael Pratt
9693b94be0 runtime: include stderr when objdump fails
If objdump panics, we want the panic included in the test log.

Change-Id: I6a6a636c13c5ba08acaa1c6c8714541a8e91542b
Reviewed-on: https://go-review.googlesource.com/c/go/+/704338
Reviewed-by: Florian Lehner <lehner.florian86@gmail.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-19 12:34:15 -07:00
mohanson
8616981ce6 log/slog: optimize slog Level.String() to avoid fmt.Sprintf
No more overhead of fmt.Sprintf, especially beneficial for
high-frequency logging.

goos: linux
goarch: amd64
pkg: log/slog
cpu: Intel(R) Xeon(R) Gold 6133 CPU @ 2.50GHz
              │ /tmp/old.txt │            /tmp/new.txt             │
              │    sec/op    │   sec/op     vs base                │
LevelString-4   1006.5n ± 2%   334.2n ± 1%  -66.80% (p=0.000 n=10)

              │ /tmp/old.txt │            /tmp/new.txt            │
              │     B/op     │    B/op     vs base                │
LevelString-4     56.00 ± 0%   48.00 ± 0%  -14.29% (p=0.000 n=10)

              │ /tmp/old.txt │          /tmp/new.txt          │
              │  allocs/op   │ allocs/op   vs base            │
LevelString-4     7.000 ± 0%   7.000 ± 0%  ~ (p=1.000 n=10) ¹

Change-Id: I6585d4aaa4da55d72ac70bc66dff45500eccd056
Reviewed-on: https://go-review.googlesource.com/c/go/+/704975
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Auto-Submit: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-09-19 09:59:42 -07:00
Sean Liao
b8af744360 testing: fix example for unexported identifier
Fixes #75540

Change-Id: I925f893d33660f0b08996d53cc9c564017232b39
Reviewed-on: https://go-review.googlesource.com/c/go/+/705456
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-09-19 09:54:12 -07:00
Michael Matloob
51dc5bfe6c Revert "cmd/go: disable cgo by default if CC unset and DefaultCC doesn't exist"
This reverts commit c2d85eb999.

Reason for revert: change was incorrect. ignores setting of CGO_ENABLED in some cases

Change-Id: I8e6e68dd600be5306a247a3314f4b57175f1aa56
Reviewed-on: https://go-review.googlesource.com/c/go/+/705495
Auto-Submit: Michael Matloob <matloob@google.com>
Reviewed-by: Michael Matloob <matloob@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Ian Alexander <jitsu@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-19 09:49:38 -07:00
apocelipes
ee7bf06cb3 time: improve ParseDuration performance for invalid input
Add "parseDurationError" to reduce memory allocation in the error path of
"ParseDuration" and delay the generation of error messages. This improves
the performance when dealing with invalid input.

The format of the error message remains unchanged.

Benchmarks:

                      │     old      │                 new                 │
                      │    sec/op    │   sec/op     vs base                │
ParseDurationError-10   132.10n ± 4%   45.93n ± 2%  -65.23% (p=0.000 n=10)

                      │     old     │                new                 │
                      │    B/op     │    B/op     vs base                │
ParseDurationError-10   192.00 ± 0%   64.00 ± 0%  -66.67% (p=0.000 n=10)

                      │    old     │                new                 │
                      │ allocs/op  │ allocs/op   vs base                │
ParseDurationError-10   6.000 ± 0%   2.000 ± 0%  -66.67% (p=0.000 n=10)

Fixes #75521

Change-Id: I0dc9f28c9601b6be07b70d0a98613757d76e2c97
GitHub-Last-Rev: 737273936a
GitHub-Pull-Request: golang/go#75531
Reviewed-on: https://go-review.googlesource.com/c/go/+/705195
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-19 08:33:55 -07:00
Cherry Mui
c0f031fcc3 [dev.simd] cmd/compile: spill the correct SIMD register for morestack
If a SIMD value is passed in a register, make sure to spill/reload
with the right width.

Change-Id: I360e7b7a030bcd87c96e4c04ad42d87e7fd1bac6
Reviewed-on: https://go-review.googlesource.com/c/go/+/705415
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-19 08:06:23 -07:00
David Chase
58fa1d023e [dev.simd] cmd/compile: enhance the chunked indexing case to include reslicing
this helps SIMD, but also helps plain old Go

Change-Id: Idcdacd54b6776f5c32b497bc94485052611cfa8d
Reviewed-on: https://go-review.googlesource.com/c/go/+/704756
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-19 07:21:03 -07:00
Cherry Mui
f9e61a9a32 cmd/compile: duplicate nil check to two branches of write barrier
Currently, for a write of a pointer (e.g. *p = x where x is a
pointer), we generate an explicit nil check of p, despite that the
store instruction may have the same faulting behavior as the nil
check. This is because the write needs a write barrier, which
creates a control flow, which prevents the nil check being removed
as it is in a differnt block as the actual store.

This CL duplicates the nil check to two branches, so it is likely
that they will be followed by the actual store and the write
barrier load, which may have the same faulting behavior, so they
can be removed.

Change-Id: Ied9480de5dd6a8fcbd5affc5f6e029944943cc07
Reviewed-on: https://go-review.googlesource.com/c/go/+/705156
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
2025-09-19 07:13:32 -07:00
Daniel Maslowski
3cf1aaf8b9 runtime: use futexes with 64-bit time on Linux
Linux introduced new syscalls to fix the year 2038 issue.
To still be able to use the old ones, the Kconfig option
COMPAT_32BIT_TIME would be necessary.

Use the new syscall with 64-bit values for futex by default.
Define _ENOSYS for detecting if it's not available.
Add a fallback to use the older syscall in case the new one is
not available, since Go runs on Linux from 2.6.32 on, per
https://go.dev/wiki/MinimumRequirements.

Updates #75133

Change-Id: I65daff0a3d06b55440ff05d8f5a9aa1c07eb201d
GitHub-Last-Rev: 96dd1bd84b
GitHub-Pull-Request: golang/go#75306
Reviewed-on: https://go-review.googlesource.com/c/go/+/701615
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-18 21:04:12 -07:00
Kir Kolyshkin
0ab038af62 cmd/compile/internal/abi: use clear built-in
Replace for loop with clear, available since Go 1.21.

Change-Id: I949da08b2a11845cc8a02b2639af78835e316970
Reviewed-on: https://go-review.googlesource.com/c/go/+/704879
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-09-18 15:31:10 -07:00
Kir Kolyshkin
00bf24fdca bytes: use clear in test
Replace for loop with clear built-in, available since Go 1.21.

Change-Id: I66d0124b9004ffd0b52abb679ccff86bb600c1e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/704878
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sean Liao <sean@liao.dev>
2025-09-18 15:30:59 -07:00
Kir Kolyshkin
f9701d21d2 crypto: use clear built-in
Replace for loops with clear built-in, available since Go 1.21.

Change-Id: I16a2691a68042e9c5cd9bc4197690fa541a081eb
Reviewed-on: https://go-review.googlesource.com/c/go/+/704877
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-18 15:30:53 -07:00
database64128
a58afe44fa net: fix testHookCanceledDial race
Loading and calling testHookCanceledDial in the function passed to
context.AfterFunc is racey, because the function runs in a separate
goroutine, and is not synchronized with the test code that restores
the original testHookCanceledDial value.

We could add a channel and wait for the "AfterFunc" to return in
the deferred function, but that's a lot of synchronization overhead
just for a bit of test code. Instead we simply load
testHookCanceledDial into a local variable synchronously. This fixes
the race without introducing any overhead.

Fixes #75474

Change-Id: If8fbd0f5f65375577c2ded64a13a15b406c45ecc
Reviewed-on: https://go-review.googlesource.com/c/go/+/704455
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2025-09-18 14:54:17 -07:00
Damien Neil
3203a5da29 net/http: avoid connCount underflow race
Remove a race condition in counting the number of connections per host,
which can cause a connCount underflow and a panic.

The race occurs when:

  - A RoundTrip call attempts to use a HTTP/2 roundtripper (pconn.alt != nil)
    and receives an isNoCachedConn error. The call removes the pconn from
    the idle conn pool and decrements the connCount for its host.
  - A second RoundTrip call on the same pconn succeeds,
    and delivers the pconn to a third RoundTrip waiting for a conn.
  - The third RoundTrip receives the pconn at the same moment its request
    context is canceled. It places the pconn back into the idle conn pool.

At this time, the connCount is incorrect, because the conn returned to
the idle pool is not matched by an increment in the connCount.

Fix this by not adding HTTP/2 pconns back to the idle pool in
wantConn.cancel.

Fixes #61474

Change-Id: I104d6cf85a54d0382eebf3fcf5dda99c69a7c3f6
Reviewed-on: https://go-review.googlesource.com/c/go/+/703936
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Nicholas Husin <husin@google.com>
Reviewed-by: Nicholas Husin <nsh@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-18 14:36:53 -07:00
Damien Neil
8ca209ec39 context: don't return a non-nil from Err before Done is closed
The Context.Err documentation states that it returns nil if the
context's done channel is not closed. Fix a race condition introduced
by CL 653795 where Err could return a non-nil error slightly before
the Done channel is closed.

No impact on Err performance when returning nil.

Slows down Err when returning non-nil by about 3x,
but that's still almost 2x faster than before CL 653795
and the performance of this path is less important.
(A tight loop checking Err for doneness will be terminated
by the first Err call to return a non-nil result.)

    goos: darwin
    goarch: arm64
    pkg: context
    cpu: Apple M4 Pro
                   │ /tmp/bench.0 │            /tmp/bench.1             │
                   │    sec/op    │   sec/op     vs base                │
    ErrOK-14          1.806n ± 1%   1.774n ± 0%    -1.77% (p=0.000 n=8)
    ErrCanceled-14    1.821n ± 1%   7.525n ± 3%  +313.23% (p=0.000 n=8)
    geomean           1.813n        3.654n       +101.47%

Fixes #75533

Change-Id: Iea22781a199ace7e7f70cf65168c36e090cd2e2a
Reviewed-on: https://go-review.googlesource.com/c/go/+/705235
TryBot-Bypass: Damien Neil <dneil@google.com>
Reviewed-by: Nicholas Husin <husin@google.com>
Reviewed-by: Nicholas Husin <nsh@golang.org>
Auto-Submit: Damien Neil <dneil@google.com>
2025-09-18 14:34:14 -07:00
Cherry Mui
7ae0eb2e80 [dev.simd] cmd/compile: remove Add32x4 generic op
This was for my early prototype, not used in real code.

Change-Id: I154a027ae2335d12e44625c0e3ce42a7b7d84976
Reviewed-on: https://go-review.googlesource.com/c/go/+/705335
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-18 13:36:42 -07:00
David Chase
31b664d40b [dev.simd] cmd/compile: widen index for simd intrinsics jumptable
Feeding an unconverted uint8 to the jumptable can cause
problems either in constant propagation or later at runtime,
depending on details of the input code.

Change-Id: I5fa2299a77a73172349a165f773cf9d1198212bc
Reviewed-on: https://go-review.googlesource.com/c/go/+/702755
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-09-18 12:35:38 -07:00
Junyang Shao
e34ad6de42 [dev.simd] cmd/compile: optimize VPTEST for 2-operand cases
Change-Id: Ica2d5ee48082c69e86b12b519ba8df7a2556392f
Reviewed-on: https://go-review.googlesource.com/c/go/+/704355
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-09-18 11:07:23 -07:00
Junyang Shao
f1e3651c33 [dev.simd] cmd/compile, simd: add VPTEST
Change-Id: Ia5103100eca2747fd10917ee2f32e3403e68e844
Reviewed-on: https://go-review.googlesource.com/c/go/+/702175
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Rob Lee <leerob7691@gmail.com>
2025-09-18 11:07:18 -07:00
Junyang Shao
d9751166a6 [dev.simd] cmd/compile: handle rematerialized op for incompatible reg constraint
This CL fixes an issue raised by contributor dominikh@.

Change-Id: I941b330a6ba6f6c120c69951ddd24933f2f0b3ec
Reviewed-on: https://go-review.googlesource.com/c/go/+/704056
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-09-18 11:06:57 -07:00
Junyang Shao
4eb5c6e07b [dev.simd] cmd/compile, simd/_gen: add rewrite for const load ops
This CL adds rewrite rules for ops with const imm8 that takes a load to
its memory form.

Change-Id: I74d0df48715ab48b88b04c8e1bfb3c6b8e528aeb
Reviewed-on: https://go-review.googlesource.com/c/go/+/704635
TryBot-Bypass: Junyang Shao <shaojunyang@google.com>
Reviewed-by: David Chase <drchase@google.com>
2025-09-18 11:06:52 -07:00
Junyang Shao
443b7aeddb [dev.simd] cmd/compile, simd/_gen: make rewrite rules consistent on CPU Features
The previous CL left a bug in the xed parser so that the generator can
generate rules rewriting an AVX instruction to AVX512 instruction.

This CL fixes that.

Change-Id: I0df7e7dc6c936ce7add24a757ce7f44a15917fef
Reviewed-on: https://go-review.googlesource.com/c/go/+/703399
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-18 11:06:42 -07:00
Michael Pratt
3032894e04 runtime: make explicit nil check in heapSetTypeSmallHeader
This is another case very similar to CL 684015 and #74375.

In spans with type headers, mallocgc always writes to the page before
returning the allocated memory. This initial write is done by
runtime.heapSetTypeSmallHeader. Prior to the write, the compiler inserts
a nil check, implemented as a dummy instruction reading from memory.

On a freshly mapped page, this read triggers a page fault, mapping the
zero page read-only. Immediately afterwards, the write triggers another
page fault, copying to a writeable page and performing a TLB flush.

This problem is exacerbated as the process scales up. At GOMAXPROCS=6,
the tile38 sweet benchmark spends around 0.1% of cycles directly
handling these page faults. On the same machine at GOMAXPROCS=192, it
spends about 2.7% of cycles directly handling these page faults.

Replacing the read with an explicit nil check reduces the direct cost of
these page faults down to around 0.1% at GOMAXPROCS=192. There are
additional positive side-effects due to reduced contention, so the
overall time spent in page faults drops from around 12.8% to 6.8%. Most
of the remaining time in page faults is spent on automatic NUMA page
migration (completely unrelated to this issue).

Impact on the tile38 benchmark results:

                    │  baseline   │             cl704755              │
                    │   sec/op    │   sec/op     vs base              │
Tile38QueryLoad-192   1.638m ± 3%   1.494m ± 5%  -8.79% (p=0.002 n=6)

                    │     baseline      │              cl704755              │
                    │ average-RSS-bytes │ average-RSS-bytes  vs base         │
Tile38QueryLoad-192        5.384Gi ± 3%        5.399Gi ± 3%  ~ (p=0.818 n=6)

                    │    baseline    │            cl704755             │
                    │ peak-RSS-bytes │ peak-RSS-bytes  vs base         │
Tile38QueryLoad-192     5.818Gi ± 1%     5.864Gi ± 2%  ~ (p=0.394 n=6)

                    │   baseline    │            cl704755            │
                    │ peak-VM-bytes │ peak-VM-bytes  vs base         │
Tile38QueryLoad-192    7.121Gi ± 1%    7.180Gi ± 2%  ~ (p=0.818 n=6)

                    │    baseline     │               cl704755                │
                    │ p50-latency-sec │ p50-latency-sec  vs base              │
Tile38QueryLoad-192       343.2µ ± 1%       313.2µ ± 3%  -8.73% (p=0.002 n=6)

                    │    baseline     │             cl704755             │
                    │ p90-latency-sec │ p90-latency-sec  vs base         │
Tile38QueryLoad-192       1.662m ± 2%       1.603m ± 5%  ~ (p=0.093 n=6)

                    │    baseline     │                cl704755                │
                    │ p99-latency-sec │ p99-latency-sec  vs base               │
Tile38QueryLoad-192       41.56m ± 8%      35.26m ± 18%  -15.17% (p=0.026 n=6)

                    │  baseline   │             cl704755              │
                    │    ops/s    │    ops/s     vs base              │
Tile38QueryLoad-192   87.89k ± 3%   96.36k ± 4%  +9.64% (p=0.002 n=6)

Updates #74375.

Change-Id: I6a6a636c1a16261b6d5076f2e1b08524a6544d33
Reviewed-on: https://go-review.googlesource.com/c/go/+/704755
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
2025-09-18 10:00:29 -07:00
lxq015
ef05b66d61 cmd/internal/obj/riscv: add support for Zicond instructions
This patch implement assembler for the Zicond extension: CZEROEQZ and CZERONEZ.

Follow-up to CL 631576
Updates #75350

Change-Id: Icf4be131fe61c3b7a3bde4811cf42dc807660907
GitHub-Last-Rev: 6539cc86cb
GitHub-Pull-Request: golang/go#75408
Reviewed-on: https://go-review.googlesource.com/c/go/+/702677
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Joel Sing <joel@sing.id.au>
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Mark Ryan <markdryan@rivosinc.com>
TryBot-Bypass: Joel Sing <joel@sing.id.au>
2025-09-17 18:54:30 -07:00
Xiaolin Zhao
78ef487a6f cmd/compile: fix the issue of shift amount exceeding the valid range
Fixes #75479

Change-Id: I362d3e49090e94f91a840dd5a475978b59222a00
Reviewed-on: https://go-review.googlesource.com/c/go/+/704135
Reviewed-by: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
2025-09-17 18:05:31 -07:00
Roland Shoemaker
77aac7bb75 runtime: don't enable heap randomization if MSAN or ASAN is enabled
MSAN and ASAN do confusing things to the memory layout, which are likely
to conflict with heap base randomization, so if they are enabled,
ignore randomizedHeapBase64.

We already didn't turn it on when TSAN was enabled.

Change-Id: I41e59dfc33d8bb059c208a9595442571fb31eea3
Reviewed-on: https://go-review.googlesource.com/c/go/+/704856
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Roland Shoemaker <roland@golang.org>
2025-09-17 17:10:14 -07:00
Roland Shoemaker
465b85eb76 runtime: fix CheckScavengedBitsCleared with randomized heap base
We cannot easily determine the base address of the arena we added the
random padding pages to, which can cause confusing
TestScavengedBitsCleared failures when the arena we padded does not have
the lowest address of all of the arenas.

Instead of attempting to determine the correct arena to ignore when
checking the scav and alloc bits, switch to just tolerating _one_ arena
having mismatches, which is expected when randomizedHeapBase64 is
enabled. Any other number of arenas having mismatches is likely a real
error.

Fixes #75502

Change-Id: Iacc445b2905824f9f71970c7abd33f187793cf39
Reviewed-on: https://go-review.googlesource.com/c/go/+/704855
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-17 17:10:11 -07:00
mohanson
909704b85e encoding/json/v2: fix typo in comment
Use the correct spelling of the Gregorian calendar.

Change-Id: I7e1d2974d38d5d3ded64f98852ee726c7b84be22
Reviewed-on: https://go-review.googlesource.com/c/go/+/704595
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Emmanuel Odeke <emmanuel@orijtech.com>
2025-09-17 14:09:35 -07:00
apocelipes
3db5979e8c testing: use reflect.TypeAssert and reflect.TypeFor
To simplify the code.

Updates #62121
Updates #60088

Change-Id: I1cef27b19961721b89a965c708320072a052d9af
GitHub-Last-Rev: ffd07a74da
GitHub-Pull-Request: golang/go#75494
Reviewed-on: https://go-review.googlesource.com/c/go/+/704575
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-17 08:48:07 -07:00
Kir Kolyshkin
6a8dbbecbf path/filepath: fix EvalSymlinks to return ENOTDIR on plan9
CL 155597 added a test to check EvalSymlinks returns ENOTDIR
for existing path which ends with a slash.

CL 404954 added a separate evalSymlinks implementation for plan9,
which has a kludge to ensure the ENOTDIR is returned in the above case.

Apparently the added kludge is not working now (and maybe never worked),
as seen in [1]:

=== RUN   TestIssue29372
    path_test.go:1730: test#0: want "not a directory", got "stat /tmp/TestIssue293724085649913/001/file.txt/: not a directory: '/tmp/TestIssue293724085649913/001/file.txt/'"
--- FAIL: TestIssue29372 (0.00s)

This happens because on plan9 errors are strings and they contain the
file name after the error text, and the check assumes the "not a
directory" text is at the end of the message.

The fix is to check whether the error is somewhere in the error text,
not ends with it (as it is done in other plan9 code, for example, see
checkErrMessageContent added in CL 163058).

This should fix the above test failure.

PS perhaps the kludge should be moved up the call chain to os.Stat/Lstat?

[1]: https://ci.chromium.org/ui/p/golang/builders/try/gotip-plan9-amd64/b8704772617873749345/test-results?q=ExactID%3Apath%2Ffilepath.TestIssue29372+VHash%3Aa63f5798e9f8f502
Change-Id: I6afb68be5f65a28929b2f717247ab34ff3b4a812
Reviewed-on: https://go-review.googlesource.com/c/go/+/700775
Auto-Submit: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Richard Miller <millerresearch@gmail.com>
TryBot-Bypass: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2025-09-17 08:47:59 -07:00
Mateusz Poliwczak
bffe7ad9f1 go/parser: Add TestBothLineAndLeadComment
I was wondering whether is is expected that both p.lineComment
and p.leadComment might be populated at the same time.

i.e. whether parser.go:275 can be changed from:

if p.lineFor(p.pos) != endline || p.tok == token.SEMICOLON || p.tok == token.EOF

to:

if (p.tok != token.COMMENT && p.lineFor(p.pos) != endline) || p.tok == token.SEMICOLON || p.tok == token.EOF

It turns out that we cannot do so. So while i am here, add a test
case for that, since nothing else failed with that change.


Change-Id: I6a6a6964f760237c068098db8a7b4b7aaf26c651
Reviewed-on: https://go-review.googlesource.com/c/go/+/703915
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
2025-09-17 06:43:57 -07:00
Mateusz Poliwczak
02a888e820 go/ast: document that (*ast.File).Comments is sorted by position
This is the way that go/parser produces it and in every AST manipulation
that we do, we preserve such property. Also printer expects it is such
order.

Change-Id: I6a6a696424a679a2cf1f9bb7eb41bdd47523efa9
Reviewed-on: https://go-review.googlesource.com/c/go/+/704255
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
2025-09-17 06:33:19 -07:00
qmuntal
594deca981 cmd/link: simplify PE relocations mapping
The code for mapping Windows PE relocations to Go relocations was
difficult to follow and contains some duplicated code. Also, it was
mapping IMAGE_REL_AMD64_ADDR32 to R_PCREL instead of R_ADDR.

This CL commit simplifies the code and fixes the mapping. I haven't been
able to coerce mingw-w64 to generate IMAGE_REL_AMD64_ADDR32 relocations,
so I haven't been able to test this change. However, the previous
implementation was clearly wrong.

While here, remove code supporting the unsupported windows/arm support.

Updates #71671
Updates #75485

Change-Id: Id0d6f352fa7d5df9e00509fcdf09ca0cb91ca524
Reviewed-on: https://go-review.googlesource.com/c/go/+/672155
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-16 22:23:36 -07:00
Mateusz Poliwczak
9df1a289ac go/parser: simplify expectSemi
Move the outer if statement, directly into the switch.

Change-Id: I6a6a6964ff15dbcda4f4c9ae1c15423adbfb0ae5
Reviewed-on: https://go-review.googlesource.com/c/go/+/703835
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-16 22:22:30 -07:00
Roland Shoemaker
72ba117bda internal/buildcfg: enable randomizedHeapBase64 by default
Change-Id: If2493546cd9c4e5bb6736fe3c029e60957716f6a
Reviewed-on: https://go-review.googlesource.com/c/go/+/690296
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-09-16 13:50:17 -07:00
Kir Kolyshkin
796ea3bc2e os/user: align test file name and build tags
TestNegativeUid tests code in cgo_lookup_unix.go, so let's use
the very same go:build line for the test file, and rename
the test file accordingly.

Change-Id: Iee3dbc25aeb8a7659c734d97dde3e9c670e80fae
Reviewed-on: https://go-review.googlesource.com/c/go/+/702976
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-09-16 13:15:03 -07:00
Michael Matloob
a69395eab2 runtime/_mkmalloc: add a copy of cloneNode
cloneNode is defined in golang.org/x/tools/internal/astutil. Make a copy
of it so we can easily clone AST nodes.

Change-Id: I6a6a6964132e663e64faa00fa6037cf6e8d4cbc6
Reviewed-on: https://go-review.googlesource.com/c/go/+/703396
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>
2025-09-16 13:13:54 -07:00
Youlin Feng
cbdad4fc3c cmd/go: check pattern for utf8 validity before call regexp.MustCompile
Do not panic if the package path or the package version contains
invalid UTF-8 characters.

Fixes #75251

Change-Id: Ib787e74277cf814253857b911d378ea5e53d8824
Reviewed-on: https://go-review.googlesource.com/c/go/+/700815
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Alexander <jitsu@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2025-09-16 12:31:12 -07:00
qiulaidongfeng
c2d85eb999 cmd/go: disable cgo by default if CC unset and DefaultCC doesn't exist
CL 621995 disrupted the behavior
introduced by CL 450739, now restore it.

Fixes #75340

Change-Id: Icd1a0eb970876995f9446e0547ceb9e78990f6ed
Reviewed-on: https://go-review.googlesource.com/c/go/+/703555
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>
Reviewed-by: Ian Alexander <jitsu@google.com>
Reviewed-by: Sean Liao <sean@liao.dev>
2025-09-16 12:23:37 -07:00
Sean Liao
ac82fe68aa bytes,strings: remove reference to non-existent SplitFunc
Fixes #75462
Updates #72841

Change-Id: Ie2cbbdb031578a3138ecc6e60c0025807f1990e6
Reviewed-on: https://go-review.googlesource.com/c/go/+/703675
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
2025-09-16 09:42:15 -07:00
Keith Randall
0b26678db2 cmd/compile: fix mips zerorange implementation
A +8 was missed when simplifying this code in CL 700936.

Fixes #75477

Change-Id: Ic7b83322dc1373432b44f0b63607141195220380
Reviewed-on: https://go-review.googlesource.com/c/go/+/703937
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Julian Zhu <jz531210@gmail.com>
Auto-Submit: Keith Randall <khr@google.com>
Reviewed-by: Tianon Gravi <admwiggin@gmail.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-09-16 09:14:31 -07:00
Joel Sing
e2cfc1eb3a cmd/internal/obj/riscv: improve handling of float point moves
Translate moves from an integer register to a floating point register, or
from a floating point register to an integer register, to the appropriate
move instruction (i.e. FMVXW/FMVWX/FMVXD/FMVDX).

Add support for MOVF with a constant - we previously added support for MOVD
but not for MOVF. Add special handling for 0.0, which we can translate to
a move from the zero register to a floating point register (leveraging the
above mentioned change).

Change-Id: If8df2f5610e69b4ec0af85efb884951024685f5b
Reviewed-on: https://go-review.googlesource.com/c/go/+/703216
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Ryan <markdryan@rivosinc.com>
2025-09-16 08:43:10 -07:00
Oleksandr Redko
281c632e6e crypto/x509/internal/macos: standardize package name
Rename "macOS" to "macos".

Change-Id: I33ca7afaa14c910a97a19ead518894fb4917662c
Reviewed-on: https://go-review.googlesource.com/c/go/+/688695
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: Roland Shoemaker <roland@golang.org>
2025-09-16 08:03:59 -07:00
Vladimir Varankin
61dc7fe30d iter: document that calling yield after terminated range loop causes runtime panic
The existing documentation isn't clear about the behaviour of when
the iterator function ignores the value returned from the yield function.

The changes here update the documentation, to explicitly explain
that.

Change-Id: I24a8198c3da63429358554169697fa466345b8fd
GitHub-Last-Rev: 86c8a2dd89
GitHub-Pull-Request: golang/go#74561
Reviewed-on: https://go-review.googlesource.com/c/go/+/687215
Auto-Submit: Sean Liao <sean@liao.dev>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
2025-09-16 07:40:30 -07:00
Cherry Mui
bdd30e25ca [dev.simd] all: merge master (ca0e035) into dev.simd
Conflicts:

- src/internal/goexperiment/flags.go

Merge List:

+ 2025-09-15 ca0e03560d cmd/link: remove support for windows/arm relocations
+ 2025-09-15 17a0fabc43 cmd/link: remove support for darwin/386 relocations
+ 2025-09-15 eb7c67fdc9 cmd/internal/obj/loong64: use the MOVVP instruction to optimize prologue
+ 2025-09-15 6b8d507508 cmd/internal/obj/riscv: implement vector segment load/store instructions
+ 2025-09-15 7ddbf4d820 cmd/asm: add double precision comparision testcases for riscv64
+ 2025-09-15 c39abe0658 runtime: fix TestSehUnwind
+ 2025-09-15 e3ed0fbe6a all: replace strings.Split with strings.SplitSeq
+ 2025-09-15 10bfddc91d all: remove redundant words in comment
+ 2025-09-15 2469e92d8c cmd/compile: combine doubling with shift on riscv64
+ 2025-09-15 aa83aee7de net/http: clarify panic conditions in Handle, HandleFunc, AddInsecureBypassPattern
+ 2025-09-15 b9e2977f1d crypto/internal/cryptotest: use linux-amd64_avx512 builder for SHA-NI
+ 2025-09-15 8105d0ccc2 cmd/go,crypto/internal/fips140: prevent using FIPS 140-3 mode with purego tag
+ 2025-09-15 7f70ca8726 crypto/internal/cryptotest: add MustSupportFIPS140
+ 2025-09-15 9e71d8a9f7 cmd/internal/testdir: re-enable default all codegen flag on linux-amd64
+ 2025-09-15 004858ccdd all: replace os.Getenv("GO_BUILDER_NAME") with testenv.Builder in tests
+ 2025-09-15 dbde15800c cmd: vendor x/tools@9fccddc
+ 2025-09-15 8ace10dad2 os: add (*Process).WithHandle
+ 2025-09-15 3573227fe3 os: add and use errProcessReleased
+ 2025-09-15 68c6a73380 internal/syscall/unix: add KernelVersionGE
+ 2025-09-15 e603e9834e cmd/link: support race mode with MSVC clang
+ 2025-09-15 e5ee1f2600 test/codegen: check zerobase for newobject on 0-sized types
+ 2025-09-15 77b93d41d5 net/http: add comments for transport gzip reader
+ 2025-09-15 30d510ca2d cmd/compile,cmd/gofmt: use reflect.TypeFor
+ 2025-09-15 8320fe8f0e runtime: deduplicate syscall assembly for darwin
+ 2025-09-14 080882a928 net: use context.AfterFunc in connect
+ 2025-09-12 ac803b5949 cmd/go/internal/work: copy vet tool's stdout to our stdout
+ 2025-09-12 889e71c2ac runtime: move Windows types and consts to internal/runtime/syscall/windows
+ 2025-09-12 cc8a6780ac vendor: update x/tools to 3adf0e9, and other repos
+ 2025-09-12 911455fe18 cmd/link: don't count tbss section in TestFlagD
+ 2025-09-12 f1fd13016a cmd/compile: optimize abi.Type.GCData loads
+ 2025-09-12 dc960d0bfe cmd/compile, reflect: further allow inlining of TypeFor
+ 2025-09-12 7acb0d0446 runtime: fix syscall9 on darwin/arm64
+ 2025-09-12 60c1ee9183 internal/goexperiment: add a sizespecializedmalloc goexperiment setting
+ 2025-09-12 c70713da82 cmd/link: support MSVC clang
+ 2025-09-12 9271bbbb80 internal/testenv: update Builder docs with LUCI builder names
+ 2025-09-12 a4e25c3d65 net,internal/poll: skip TestAllocs when race is enabled on Windows
+ 2025-09-12 dd8276657f cmd/asm, cmd/internal/obj: add riscv64 generic CSR ops
+ 2025-09-11 f37d75472d runtime: move mksizeclasses.go to runtime/_mkmalloc
+ 2025-09-11 73676e3223 cmd/go: run cgo and cgo compiles in their own actions
+ 2025-09-11 0e1b98993e testing: exit B.Loop early upon saturation
+ 2025-09-11 84e9ab3984 cmd/go/internal/work: remove deps[1]="fmt" vet hack

Change-Id: I1424228bcd9291c9ff29f6ae843d5b90652f237e
2025-09-16 10:22:34 -04:00
Cherry Mui
0e590a505d [dev.simd] cmd/compile: use the right type for spill slot
Currently, when shuffling registers, if we need to spill a
register, we always create a spill slot of type int64. The type
doesn't actually matter, as long as it is wide enough to hold the
registers. This is no longer true with SIMD registers, which could
be wider than a int64. Create the slot with the proper type
instead.

Change-Id: I85c82e2532001bfdefe98c9446f2dd18583d49b4
Reviewed-on: https://go-review.googlesource.com/c/go/+/704055
TryBot-Bypass: Cherry Mui <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-09-16 07:21:17 -07:00
qmuntal
ca0e03560d cmd/link: remove support for windows/arm relocations
The windows/arm port is no longer supported. We can remove the
related code from cmd/link/internal/arm.

For #71671

Change-Id: I00de1231482cc2f28ec5fc9dc62e81f0ba3fe481
Reviewed-on: https://go-review.googlesource.com/c/go/+/703778
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-09-15 21:59:15 -07:00
qmuntal
17a0fabc43 cmd/link: remove support for darwin/386 relocations
The darwin/386 port has been unsupported for years, but some
relocation handling specific to it has managed to survive till now.

Updates #37610

Change-Id: I27ae2ac5462c5f3ec219e9cb5dce6f83b037b816
Reviewed-on: https://go-review.googlesource.com/c/go/+/703777
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Than McIntosh <thanm@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-15 21:59:07 -07:00
Xiaolin Zhao
eb7c67fdc9 cmd/internal/obj/loong64: use the MOVVP instruction to optimize prologue
The MOVVP instruction has a larger offset range, and removes 928
instructions from the go binary on loong64.

	file        before      after       Δ
	go          1634208     1634064    -144
	gofmt       323324      323240     -84
	asm         567870      567778     -92
	cgo         487694      487598     -96
	compile     2500266     2500142    -124
	cover       530590      530498     -92
	link        723804      723692     -112
	preprofile  240562      240474     -88
	vet         819672      819576     -96

Change-Id: Ib0efcb006d3ae3f2bceec0d6e88f3794d5e99831
Reviewed-on: https://go-review.googlesource.com/c/go/+/702715
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-15 19:13:50 -07:00
wangboyao
6b8d507508 cmd/internal/obj/riscv: implement vector segment load/store instructions
https://github.com/riscv/riscv-opcodes/pull/361. After this pr was
merged, riscv-opcode can generate RVV segment load/store instructions
for Go. Implement vector segment load/store instuctions.

Change-Id: I154bb75be70c0a45e2279a75c67f68b5bb57c36e
Reviewed-on: https://go-review.googlesource.com/c/go/+/691695
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-15 18:57:04 -07:00
Meng Zhuo
7ddbf4d820 cmd/asm: add double precision comparision testcases for riscv64
Change-Id: If8e03dfdb332a22ec9c6a0021d7e7955520f3ddc
Reviewed-on: https://go-review.googlesource.com/c/go/+/702136
Reviewed-by: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Ryan <markdryan@rivosinc.com>
Reviewed-by: Joel Sing <joel@sing.id.au>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-09-15 18:00:48 -07:00
qmuntal
c39abe0658 runtime: fix TestSehUnwind
The various TestSehUnwind tests recently started to fail due an
unrelated refactor (in CL 698098) that made the stack frames to
not match the expected pattern. This CL updates the tests to
be more robust to such changes.

Fixes #75467

Change-Id: I7950332bb6ca54e4bf693d13e2490b3d9d901dde
Reviewed-on: https://go-review.googlesource.com/c/go/+/703779
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-09-15 17:36:12 -07:00
1911860538
e3ed0fbe6a all: replace strings.Split with strings.SplitSeq
In Go 1.25+, strings.SplitSeq offers better
performance. Here are the benchmark results comparing
strings.Split and strings.SplitSeq in a for-loop, with the
benchmark code located in src/strings/iter_test.go:

goos: darwin
goarch: amd64
pkg: cmd/go/internal/auth
cpu: Intel(R) Core(TM) i7-8569U CPU @ 2.80GHz
                         │   old.txt   │               new.txt                │
                         │   sec/op    │    sec/op     vs base                │
ParseGitAuth/standard-8    281.4n ± 1%   218.0n ± 11%  -22.54% (p=0.000 n=10)
ParseGitAuth/with_url-8    549.1n ± 1%   480.5n ± 13%  -12.48% (p=0.002 n=10)
ParseGitAuth/minimal-8     235.4n ± 1%   197.3n ±  7%  -16.20% (p=0.000 n=10)
ParseGitAuth/complex-8     797.6n ± 2%   805.2n ±  4%        ~ (p=0.481 n=10)
ParseGitAuth/empty-8       87.48n ± 3%   63.25n ±  6%  -27.71% (p=0.000 n=10)
ParseGitAuth/malformed-8   228.8n ± 1%   171.2n ±  3%  -25.17% (p=0.000 n=10)
geomean                    288.9n        237.7n        -17.72%

                         │   old.txt   │              new.txt               │
                         │    B/op     │    B/op     vs base                │
ParseGitAuth/standard-8    192.00 ± 0%   96.00 ± 0%  -50.00% (p=0.000 n=10)
ParseGitAuth/with_url-8     400.0 ± 0%   288.0 ± 0%  -28.00% (p=0.000 n=10)
ParseGitAuth/minimal-8     144.00 ± 0%   80.00 ± 0%  -44.44% (p=0.000 n=10)
ParseGitAuth/complex-8      528.0 ± 0%   400.0 ± 0%  -24.24% (p=0.000 n=10)
ParseGitAuth/empty-8        32.00 ± 0%   16.00 ± 0%  -50.00% (p=0.000 n=10)
ParseGitAuth/malformed-8   176.00 ± 0%   80.00 ± 0%  -54.55% (p=0.000 n=10)
geomean                     179.0        102.1       -42.96%

                         │  old.txt   │              new.txt               │
                         │ allocs/op  │ allocs/op   vs base                │
ParseGitAuth/standard-8    3.000 ± 0%   2.000 ± 0%  -33.33% (p=0.000 n=10)
ParseGitAuth/with_url-8    4.000 ± 0%   3.000 ± 0%  -25.00% (p=0.000 n=10)
ParseGitAuth/minimal-8     3.000 ± 0%   2.000 ± 0%  -33.33% (p=0.000 n=10)
ParseGitAuth/complex-8     4.000 ± 0%   3.000 ± 0%  -25.00% (p=0.000 n=10)
ParseGitAuth/empty-8       2.000 ± 0%   1.000 ± 0%  -50.00% (p=0.000 n=10)
ParseGitAuth/malformed-8   3.000 ± 0%   2.000 ± 0%  -33.33% (p=0.000 n=10)
geomean                    3.086        2.040       -33.91%

Updates #69315.

Change-Id: Id0219edea45d9658d527b863162ebe917e7821d9
GitHub-Last-Rev: 392b315e12
GitHub-Pull-Request: golang/go#75259
Reviewed-on: https://go-review.googlesource.com/c/go/+/701015
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Emmanuel Odeke <emmanuel@orijtech.com>
2025-09-15 17:34:45 -07:00
cuishuang
10bfddc91d all: remove redundant words in comment
Change-Id: I8e6be76f24a7b1bb21cc244d5117fa60efff03b3
Reviewed-on: https://go-review.googlesource.com/c/go/+/703317
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Sean Liao <sean@liao.dev>
Reviewed-by: Than McIntosh <thanm@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Auto-Submit: Emmanuel Odeke <emmanuel@orijtech.com>
2025-09-15 17:31:59 -07:00
Meng Zhuo
2469e92d8c cmd/compile: combine doubling with shift on riscv64
Change-Id: I4bee2770fedf97e35b5a5b9187a8ba3c41f9ec2e
Reviewed-on: https://go-review.googlesource.com/c/go/+/702697
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Joel Sing <joel@sing.id.au>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Keith Randall <khr@google.com>
2025-09-15 17:31:56 -07:00
Cole Garien
aa83aee7de net/http: clarify panic conditions in Handle, HandleFunc, AddInsecureBypassPattern
Add explicit mention that these methods panic on both pattern conflict
and invalid syntax.

Fixes #75226

Change-Id: If7dbfc44e1ec4624ab156f0e5d7e66cee2c2fef3
GitHub-Last-Rev: acc9a9c333
GitHub-Pull-Request: golang/go#75297
Reviewed-on: https://go-review.googlesource.com/c/go/+/701016
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Mark Freeman <markfreeman@google.com>
2025-09-15 17:31:50 -07:00
Filippo Valsorda
b9e2977f1d crypto/internal/cryptotest: use linux-amd64_avx512 builder for SHA-NI
Updates #74772
Fixes #69592

Change-Id: I6a6a69647ab1785ed953f3ed2dfa04cd55576f2b
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64_avx512
Reviewed-on: https://go-review.googlesource.com/c/go/+/701315
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-09-15 17:29:27 -07:00
Filippo Valsorda
8105d0ccc2 cmd/go,crypto/internal/fips140: prevent using FIPS 140-3 mode with purego tag
Change-Id: I6a6a696414f8d5d9dc77c65b0ac9edfc982c2798
Reviewed-on: https://go-review.googlesource.com/c/go/+/703095
Auto-Submit: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-09-15 17:13:32 -07:00
Filippo Valsorda
7f70ca8726 crypto/internal/cryptotest: add MustSupportFIPS140
Change-Id: Iccb3ffdb7c1e15f8f0d889fdc4a27e62870cd58e
Reviewed-on: https://go-review.googlesource.com/c/go/+/702776
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-09-15 17:13:28 -07:00
Michael Anthony Knyszek
9e71d8a9f7 cmd/internal/testdir: re-enable default all codegen flag on linux-amd64
This was limited to just the mainline linux-amd64 builder, but we don't
use that name anymore. Use the LUCI name instead, gotip-linux-amd64.

Change-Id: Ib4377ad336c529512d9939ff9dce0ea242528b74
Reviewed-on: https://go-review.googlesource.com/c/go/+/703136
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: 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>
2025-09-15 15:38:29 -07:00
Michael Anthony Knyszek
004858ccdd all: replace os.Getenv("GO_BUILDER_NAME") with testenv.Builder in tests
Some tests still reach for GO_BUILDER_NAME directly. This change makes
it so that they go through testenv.Builder.

There are a couple more, but changing them may also cause tests to start
failing. Done in a follow-up.

Change-Id: Id2453b7b62f5ebf3594e92fa53724a577a97440f
Reviewed-on: https://go-review.googlesource.com/c/go/+/703135
Reviewed-by: 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>
2025-09-15 14:21:33 -07:00
Alan Donovan
dbde15800c cmd: vendor x/tools@9fccddc
(This brings in CL 703995.)

For #71859

Change-Id: I823f2da9ebbdbef943cb37123d44a7ad2e6d708b
Reviewed-on: https://go-review.googlesource.com/c/go/+/703896
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Michael Matloob <matloob@google.com>
2025-09-15 14:07:17 -07:00
Kir Kolyshkin
8ace10dad2 os: add (*Process).WithHandle
Implement (*Process).WithHandle, add tests for all platforms.

Fixes #70352

Change-Id: I7a8012fb4e1e1b4ce1e75a59403ff6e77504fc56
Reviewed-on: https://go-review.googlesource.com/c/go/+/699615
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Auto-Submit: Kirill Kolyshkin <kolyshkin@gmail.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-09-15 12:17:42 -07:00
Kir Kolyshkin
3573227fe3 os: add and use errProcessReleased
This error is already used in three places, so let's define it.

Change-Id: I73565d94aebcf3d5a278201d96839d82db85a2d4
Reviewed-on: https://go-review.googlesource.com/c/go/+/702436
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-09-15 11:58:58 -07:00
Kir Kolyshkin
68c6a73380 internal/syscall/unix: add KernelVersionGE
There are a few places in the code which checks that the running kernel
is greater than or equal to x.y. The check takes a few lines and the
checking code is somewhat distracting.

Let's abstract this check into a simple function, KernelVersionGE,
and convert the users accordingly.

Add a test case (I'm not sure it has much value, can be dropped).

Change-Id: I8ec91dcc7452363361f95e46794701c0ae57d956
Reviewed-on: https://go-review.googlesource.com/c/go/+/700796
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
2025-09-15 11:46:39 -07:00
Cherry Mui
e603e9834e cmd/link: support race mode with MSVC clang
I couldn't make --print-file-name work with -msvc clang. (The
library name is synchronization.lib, but even with that name it
still doesn't print the full path.) Assume it always
synchronization.lib.

Change-Id: I22e8f14824f7f7e96b71b913217b1f604f1e2da7
Reviewed-on: https://go-review.googlesource.com/c/go/+/703398
Reviewed-by: Than McIntosh <thanm@golang.org>
Reviewed-by: Florian Zenker <floriank@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-15 10:59:16 -07:00
Junyang Shao
dabe2bb4fb [dev.simd] cmd/compile: fix holes in mask peepholes
It turns out that ".Masked" is implemented by VPANDQ *and* VPANDD.
The shape of bitwise AND doesn't matter, the correctness of the rules is
guaranteed by the way the mask is generated.

This CL fix the holes in the peephole rules.

Change-Id: I2d15c4d17afed6fdbb2f3905a51b2c5c2f673348
Reviewed-on: https://go-review.googlesource.com/c/go/+/703257
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-09-15 09:40:42 -07:00
Meng Zhuo
e5ee1f2600 test/codegen: check zerobase for newobject on 0-sized types
This CL also adds riscv64 checks

Change-Id: I693e4e606f470615f6b49085592d6d5ca61473d3
Reviewed-on: https://go-review.googlesource.com/c/go/+/703716
Reviewed-by: Pengcheng Wang <wangpengcheng.pp@bytedance.com>
Auto-Submit: Keith Randall <khr@google.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Joel Sing <joel@sing.id.au>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
2025-09-15 07:47:55 -07:00
Alexander Yastrebov
77b93d41d5 net/http: add comments for transport gzip reader
Add back comments dropped in CL 510255

Updates #61353

Change-Id: Ie84610b830599e178140bb5c2a11be74b2ad461e
GitHub-Last-Rev: d6cd890dd1
GitHub-Pull-Request: golang/go#75293
Reviewed-on: https://go-review.googlesource.com/c/go/+/701395
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
2025-09-15 05:14:17 -07:00
apocelipes
30d510ca2d cmd/compile,cmd/gofmt: use reflect.TypeFor
Use "reflect.TypeFor" to simplify the code.

Updates #60088

Change-Id: I93db6cbd4f02813d9a81f5d02996db8128cb81a9
GitHub-Last-Rev: 2aee64dac6
GitHub-Pull-Request: golang/go#75349
Reviewed-on: https://go-review.googlesource.com/c/go/+/701676
Reviewed-by: Mark Freeman <markfreeman@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-15 05:13:05 -07:00
qmuntal
8320fe8f0e runtime: deduplicate syscall assembly for darwin
The darwin port provides different syscall functions that only
differ on how they handle the errors, and they are all written
in assembly.

This duplication can be removed by factoring out the error handling
logic to arch-agnostic Go code and leaving the assembly functions
with the only reponsibility of making the syscall and mapping
parameters between ABIs.

Updates #51087

Cq-Include-Trybots: luci.golang.try:gotip-darwin-arm64-longtest,gotip-darwin-amd64-longtest
Change-Id: I9524377f3ef9c9a638412c7e87c8f46a33ee3453
Reviewed-on: https://go-review.googlesource.com/c/go/+/699135
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-15 01:16:22 -07:00
database64128
080882a928 net: use context.AfterFunc in connect
This saves a goroutine when ctx can be but is not canceled during
the connect call.

The redundant fd.Close() call is removed, because the caller closes
the fd on error.

Change-Id: I124d7e480294a48ef74d5650d8ef0489bdfc64d6
Reviewed-on: https://go-review.googlesource.com/c/go/+/699256
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Sean Liao <sean@liao.dev>
Reviewed-by: Mark Freeman <markfreeman@google.com>
2025-09-14 17:12:25 -07:00
Alan Donovan
ac803b5949 cmd/go/internal/work: copy vet tool's stdout to our stdout
The go command connects both the stdout and stderr files of
its child commands (cmd/compile, cmd/vet, etc) to the go
command's own stderr. If the child command is supposed to
produce structure output on stderr, as is the case for
go vet -json or go fix -diff, it will be merged with the
error stream, making it useless.

This change to the go vet <-> unitchecker protocol specifies
the name of a file into which the vet tool should write its
stdout. On success, the go command will then copy the entire
content of that file to its own stdout, under a lock.
This ensures that partial writes to stdout in case of failure,
concurrent writes to stdout by parallel vet tasks, or other
junk on stderr, cannot interfere with the integrity of the
go command's structure output on stdout.

CL 702835 is the corresponding change on the x/tools side.

For #75432

Change-Id: Ib4db25b6b0095d359152d7543bd9bf692551bbfa
Reviewed-on: https://go-review.googlesource.com/c/go/+/702815
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
2025-09-12 14:16:27 -07:00
qmuntal
889e71c2ac runtime: move Windows types and consts to internal/runtime/syscall/windows
This CL doesn't change any behavior, it just moves code around to reduce
the size of the runtime package and remove some duplicated symbols.

Updates #51087.

Cq-Include-Trybots: luci.golang.try:gotip-windows-arm64
Change-Id: I3d3e5f214f045c24fb5d4050d56e7b0822a6e4b5
Reviewed-on: https://go-review.googlesource.com/c/go/+/698098
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-09-12 12:00:33 -07:00
Alan Donovan
cc8a6780ac vendor: update x/tools to 3adf0e9, and other repos
Notably, the x/tools update includes CL 702835.

Also, pacify copyright_test report of missing copyright
header in generated h2_bundle.

Updates golang/go#75432

Change-Id: I428278e50dbcef5dcaa661004da0da9ab8f2c924
Reviewed-on: https://go-review.googlesource.com/c/go/+/702955
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>
2025-09-12 10:25:29 -07:00
Cherry Mui
911455fe18 cmd/link: don't count tbss section in TestFlagD
TestFlagD looks for a data-like section at the lowest address.
On OpenBSD, the .tbss section matches the current condition, which
has address 0, causing the test fail. Don't count TLS sections.

Also, print the section name on error.

Fixes #75444.

Change-Id: Ic0aa1a2bb7c6bd5c0023d4482405a482095ff68b
Reviewed-on: https://go-review.googlesource.com/c/go/+/703375
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-12 10:20:07 -07:00
Junyang Shao
3ec0b25ab7 [dev.simd] cmd/compile, simd/_gen/simdgen: add const load mops
This CL adds the load + const imm8 variants ofr many instructions.

Change-Id: I46116906077e33eabccc111be6d16019002f3474
Reviewed-on: https://go-review.googlesource.com/c/go/+/703395
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-09-12 10:16:24 -07:00
Junyang Shao
1e5631d4e0 [dev.simd] cmd/compile: peephole simd load
Some convenient peepholes, might not have big impact on performances.

Change-Id: I25574dba95fcf1d5fda14472175e556737b51584
Reviewed-on: https://go-review.googlesource.com/c/go/+/702997
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-12 10:16:17 -07:00
Jake Bailey
f1fd13016a cmd/compile: optimize abi.Type.GCData loads
This fires in just one place; stkframe.go's stkobjinit. But, it does
make the struct literal entirely constants.

Change-Id: Ice76cb3cddd97adee011fdaab40597839da2e89f
Reviewed-on: https://go-review.googlesource.com/c/go/+/701300
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
2025-09-12 09:39:29 -07:00
Jake Bailey
dc960d0bfe cmd/compile, reflect: further allow inlining of TypeFor
Previous CLs optimized direct use of abi.Type, but reflect.Type is
indirected, so was not benefiting.

For TypeFor, we can use toRType directly without a nil check because the
types are statically known.

Normally, I'd think SSA would remove the nil check, but due to some
oddity (specifically, late fuse being required to remove the nil check,
but opt doesn't run that late) means that the nil check persists and
gets in the way.

Manually writing the code in this instance seems to fix the problem.

It also exposed another problem; depending on the ordering, writeType
could get to a type symbol before SSA, thereby preventing Extra from
being created on the symbol for later lookups that don't go through
TypeLinksym directly. In writeType, for non-shape types, call
TypeLinksym to ensure that the type is set up for later callers. That
change itself passed toolstash -cmp.

All up, this stack put through compilecmp shows a lot of improvement in
various reflect-using packages, and reflect itself. It is too big to fit
in the commit message but here's some info:

compilecmp master -> HEAD
master (d767064170): cmd/compile: mark abi.PtrType.Elem sym as used
HEAD (846a94c568): cmd/compile, reflect: further allow inlining of TypeFor

file      before    after     Δ       %
addr2line 3735911   3735391   -520    -0.014%
asm       6382235   6382091   -144    -0.002%
buildid   3608568   3608360   -208    -0.006%
cgo       5951816   5951480   -336    -0.006%
compile   28362080  28339772  -22308  -0.079%
cover     6668686   6661414   -7272   -0.109%
dist      4311961   4311425   -536    -0.012%
fix       3771706   3771474   -232    -0.006%
link      8686073   8684993   -1080   -0.012%
nm        3715923   3715459   -464    -0.012%
objdump   6074366   6073774   -592    -0.010%
pack      3025653   3025277   -376    -0.012%
pprof     18269485  18261653  -7832   -0.043%
test2json 3442726   3438390   -4336   -0.126%
trace     16984831  16981767  -3064   -0.018%
vet       10701931  10696355  -5576   -0.052%
total     133693951 133639075 -54876  -0.041%

runtime
runtime.stkobjinit 240 -> 165  (-31.25%)

runtime [cmd/compile]
runtime.stkobjinit 240 -> 165  (-31.25%)

reflect
reflect.Value.Seq2.func3 309 -> 245  (-20.71%)
reflect.Value.Seq2.func1.1 281 -> 198  (-29.54%)
reflect.Value.Seq.func1.1 242 -> 165  (-31.82%)
reflect.Value.Seq2.func2 360 -> 285  (-20.83%)
reflect.Value.Seq.func4 281 -> 239  (-14.95%)
reflect.Value.Seq2.func4 399 -> 284  (-28.82%)
reflect.Value.Seq.func2 271 -> 230  (-15.13%)
reflect.TypeFor[go.shape.uint64] 33 -> 18  (-45.45%)
reflect.Value.Seq.func3 219 -> 178  (-18.72%)

reflect [cmd/compile]
reflect.Value.Seq2.func2 360 -> 285  (-20.83%)
reflect.Value.Seq.func4 281 -> 239  (-14.95%)
reflect.Value.Seq.func2 271 -> 230  (-15.13%)
reflect.Value.Seq.func1.1 242 -> 165  (-31.82%)
reflect.Value.Seq2.func1.1 281 -> 198  (-29.54%)
reflect.Value.Seq2.func3 309 -> 245  (-20.71%)
reflect.Value.Seq.func3 219 -> 178  (-18.72%)
reflect.TypeFor[go.shape.uint64] 33 -> 18  (-45.45%)
reflect.Value.Seq2.func4 399 -> 284  (-28.82%)

fmt
fmt.(*pp).fmtBytes 1723 -> 1691  (-1.86%)

database/sql/driver
reflect.TypeFor[go.shape.interface 33 -> 18  (-45.45%)
database/sql/driver.init 72 -> 57  (-20.83%)

Change-Id: I9eb750cf0b7ebf532589f939431feb0a899e42ff
Reviewed-on: https://go-review.googlesource.com/c/go/+/701301
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-12 09:34:43 -07:00
qmuntal
7acb0d0446 runtime: fix syscall9 on darwin/arm64
The aarch64 ABI says that only the first 8 arguments should be
passed as registers, subsequent  arguments should be put on
the stack.

Syscall9 is not putting the 9th argument on the stack, and it should.

The standard library hasn't hit this issue because it uses Syscall9
for functions that only require 7 or 8 parameters.

Change-Id: I1fafca5b16f977ea856e3f08b4ff3d0a2a7a4dfe
Reviewed-on: https://go-review.googlesource.com/c/go/+/702297
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-12 08:39:47 -07:00
Michael Matloob
60c1ee9183 internal/goexperiment: add a sizespecializedmalloc goexperiment setting
Change-Id: I6a6a696497f2a0b0d403bbb11d7502f62edec78b
Reviewed-on: https://go-review.googlesource.com/c/go/+/696535
Auto-Submit: Michael Matloob <matloob@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-12 08:23:06 -07:00
Cherry Mui
c70713da82 cmd/link: support MSVC clang
Currently on Windows, for cgo, we support MinGW-based C toolchain,
that is, with a -windows-gnu target. This CL makes it work with
clang with a -windows-msvc target. The LLVM toolchain bundled in
MSVC (https://learn.microsoft.com/en-us/cpp/build/clang-support-msbuild)
is such an example.

Currently it is expecting lld-link as the C linker, which is also
bundled in MSVC, can be requested with -fuse-ld=lld, but is not
the default.

This is the first step, which makes it generate a working cgo
binary. There are still more work to do, e.g. there are some
linker warnings, and the binary doesn't have symbol table.
all.bat doesn't pass with this setting.

Change-Id: I54d33f7dd5f5eeeafa0735cd52f4127fe4865636
Reviewed-on: https://go-review.googlesource.com/c/go/+/703055
Reviewed-by: Than McIntosh <thanm@golang.org>
Reviewed-by: Florian Zenker <floriank@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-12 07:30:16 -07:00
Michael Anthony Knyszek
9271bbbb80 internal/testenv: update Builder docs with LUCI builder names
Also include some advice to avoid using this when possible. It makes
tests more prone to breaking under infrastructure changes.

Change-Id: Ifb2848742347eb0c937547dd888ab2cad3343f2d
Reviewed-on: https://go-review.googlesource.com/c/go/+/703115
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2025-09-12 07:19:46 -07:00
qmuntal
a4e25c3d65 net,internal/poll: skip TestAllocs when race is enabled on Windows
The Windows implementation of several network protocols make use of
sync.Pool, which randomly drops cached items when race is enabled.

While here, zero out the control buffer to allow it to be garbage
collected.

Fixes #75341

Change-Id: Ie20e21adef2edc02ca7b4a78012dd5f3a9f03bee
Reviewed-on: https://go-review.googlesource.com/c/go/+/703195
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>
2025-09-12 07:12:50 -07:00
Mark Ryan
dd8276657f cmd/asm, cmd/internal/obj: add riscv64 generic CSR ops
Support is added for the generic RISC-V CSR operations; CSRRC, CSRRCI,
CSRRS, CSRRSI, CSRRW, CSRRWI.  These instructions require special
handling as their second operand is a symbolic CSR register name and
not an immediate value or a register.  CSR names are implemented as
special operands.

RISC-V CSRs are not currently saved and restored when a go routine is
asynchronously pre-empted so it is only safe to use these instructions
in hand written assembler.  Note that CSRRS was already partially
supported by the assembler so this restriction predates this commit.
We mention it here as this commit makes CSRRS much easier to use.

Change-Id: I9ff8d804328b418a879d463e7d9cc31f489c7a00
Reviewed-on: https://go-review.googlesource.com/c/go/+/630519
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Joel Sing <joel@sing.id.au>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-09-12 01:12:45 -07:00
Junyang Shao
48f366d826 [dev.simd] cmd/compile: add memop peephole rules
Change-Id: I442da7964ca8b4b9012ed206ccb92f5e68b0d42b
Reviewed-on: https://go-review.googlesource.com/c/go/+/701695
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-11 20:43:13 -07:00
matloob
f37d75472d runtime: move mksizeclasses.go to runtime/_mkmalloc
This will allow us to share code with the specialized malloc code
generator.

Change-Id: I6a6a696450a5039a957811fb06228122d494ddce
Reviewed-on: https://go-review.googlesource.com/c/go/+/700495
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>
2025-09-11 14:33:19 -07:00
Michael Matloob
73676e3223 cmd/go: run cgo and cgo compiles in their own actions
This change splits package builds further into even more actions.

Between the cache action (and cover action, if present) and the actual
build action we insert three layers of actions:

              Check Cache Action
              |      |
              |      V
              | Run Cover Action (if cover requested)
              |      |
              |      V
 New Layer 1  | Run Cgo Action (if package is built with cgo)
              |      | | | (multiple arrows representing fan-out to
              |      V V V  multiple actions)
 New Layer 2  | gcc Compile Action for each C/C++/S/F/M file (if cgo)
              |      |/    (arrow represeting fan-in to single action)
              |      V
 New Layer 3  | Cgo collect action (if cgo)
              |      |
              \      V
                Build action

The first run cgo action takes the input source files and runs cgo on
them to produce the cgo-processed go files, which are given to the
compiler, and to produce additional C files to compile and headers to
use in the following compilations. The action also takes care of running
SWIG before running cgo if there are swig files. This will produce
additional cgo sources that are inputs to cgo.

The run cgo action action fans out to multiple actions to do each of the
C/C++/Obj-C/assembly/Fortran compilations for the non-Go files in the
package, as well as those produced as outputs by the cgo command
invocation.

These actions then join into a single noop "collect" action which
primarily exists so that we don't pollute the build action's
dependencies with a bunch of non-go compile actions. (The build action
expects its dependencies to mostly be other build actions).

All of this work in the new actions was previously being done in the
build action itself. There's still a remnant of the original cgo logic
left in the build action to run the cgo command with -dynimport to
produce a go file to be built with the rest of the package, and do some
checks.

Most of this CL consists of moving code around. Just like the previous
CL breaking out the coverage logic into a separate action, we don't
cache the outputs of the cgo actions, and just treat all the actions
used to build a single package as one cacheable unit. This makes things
a bit simpler. If we decide in a future CL to cache the outputs
separately, we could remove the dependency on the cover action on the
check cache action (which in turn depends on all the package's
dependencies) and could start non-go compilation pretty much as early as
we want in the build.

The 'cgoAction' function in action.go takes care of creating the layers
of cgo action dependencies, which are inserted as dependencies of the
build action. It's mostly straightforward, except for the fact that we
need to tell each non-go compile action which non-go file to compile, so
we need to compute the names of the generated files. (Alternatively we
could give each action a number and have it build the nth file produced
by the run cgo action, but that seems even more complicated). The actors
produced to run the action logic are pretty light wrappers around the
execution logic in exec.go.

In the 'build' function in exec.go, most of the new code mainly checks
for the information from the cgo actions to use instead of running it,
and then passes it to the processCgoOutputs function. The only other
weird thing in the build functian is that we we call the logic to
compute the nonGoOverlay separately just for the C files that are being
built with gccgo. We compute the overlay for the non-go files used in a
cgo build in the run cgo action.

The 'cgo' function that previously ran the cgo logic for the build has
now been split into three: the first half, which runs cgo is now in the
runCgo function, the center part, which compiles the non-go files is now
partly in creating the invididual non-go compile actions, as well as the
cgoCompileActor's Act function. And the final part, which runs
cgo -dynimport is now in processCgoOutputs. These parts communicate with
each other through the providers that are set on the cgo actions.

One further improvement we can make to this change in the future is to
compile the dynimport file separately from the build action: its output
is only needed by the linker. This would remove any dependencies from
dependent packages' build actions on the cgo compile actions, allowing
more flexibility for scheduling actions.

Fixes #9887

Change-Id: Ie3c70bbf985148ba73094cddfc78c39dc6faad6e
Reviewed-on: https://go-review.googlesource.com/c/go/+/694475
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@google.com>
2025-09-11 14:25:41 -07:00
David Finkel
0e1b98993e testing: exit B.Loop early upon saturation
There's a cap of 1 billion benchmark iterations because more than that
is usually not going to give more useful data. Unfortunately, the
existing implementation neglected to check whether the 1e9 cap had
already been exceeded when it adjusted the number of iterations in the
B.Loop slow path (stopOrScaleBLoop), since it's only when that cap is hit
that it needed to terminate early.

As a result, for _very_ cheap benchmarks (e.g. testing assembly
implementations with just a few instructions), the B.Loop would stop
incrementing the number of iterations, but wouldn't terminate early,
making it re-enter the slow-path _every_ iteration until the benchmark
time was exhausted.

This wasn't normally visible with the default -benchtime 2s, but when
raised to 5s, it would cause benchmarks that took <5ns/op to be reported
as exactly 5ns/op. (which looks a bit suspicious)

Notably, one can use -count for larger groupings to compute statistics.
golang.org/x/perf/cmd/benchstat is valuable for coalescing larger
run-counts from -count into more useful statistics.

Add a test which allows for fewer iterations on slow/contended
platforms but guards against reintroducing a bug of this nature.

Fixes #75210

Change-Id: Ie7f0b2e6c737b064448434f3ed565bfef8c4f020
Reviewed-on: https://go-review.googlesource.com/c/go/+/700275
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Auto-Submit: Sean Liao <sean@liao.dev>
2025-09-11 14:24:47 -07:00
Alan Donovan
84e9ab3984 cmd/go/internal/work: remove deps[1]="fmt" vet hack
The Builder.vet operation has not needed an artificial
dependency on the fmt package since CL 176439 in 2019.
Remove it now.

Change-Id: I398a6d2d57175c12843520d9f19ffd023e676123
Reviewed-on: https://go-review.googlesource.com/c/go/+/702856
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-11 12:37:57 -07:00
Cherry Mui
9a349f8e72 [dev.simd] all: merge master (cf5e993) into dev.simd
Merge List:

+ 2025-09-11 cf5e993177 cmd/link: allow one to specify the data section in the internal linker
+ 2025-09-11 cdb3d467fa encoding/gob: make use of reflect.TypeAssert
+ 2025-09-11 fef360964c archive/tar: fix typo in benchmark name
+ 2025-09-11 7d562b8460 syscall: actually remove unreachable code
+ 2025-09-11 c349582344 crypto/rsa: don't test CL 687836 against v1.0.0 FIPS 140-3 module
+ 2025-09-11 253dd08f5d debug/macho: filter non-external symbols when reading imported symbols without LC_DYSYMTAB
+ 2025-09-10 2009e6c596 internal/runtime/maps: remove redundant package docs
+ 2025-09-10 de5d7eccb9 runtime/internal/maps: only conditionally clear groups when sparse
+ 2025-09-10 8098b99547 internal/runtime/maps: speed up Clear
+ 2025-09-10 fe5420b054 cmd: delete some more windows/arm remnants
+ 2025-09-10 fad1dc608d runtime: don't artificially limit TestReadMetricsSched
+ 2025-09-10 b1f3e38e41 cmd/compile: when CSEing two values, prefer the statement marked one
+ 2025-09-10 00824f5ff5 types2: better documentation for resolve()
+ 2025-09-10 5cf8ca42e3 internal/trace/raw: use strings.Cut instead of strings.SplitN 2
+ 2025-09-10 80a2aae922 Revert "cmd/compile: improve stp merging for non-sequent cases"
+ 2025-09-10 f327a05419 go/token, syscall: annotate if blocks that defeat vet's unreachable pass
+ 2025-09-10 9650c97d0f syscall: remove unreachable code
+ 2025-09-10 f1c4b860d4 Revert "crypto/internal/fips140: update frozen module version to "v1.0.0""
+ 2025-09-10 30686c4cc8 encoding/json/v2: document context annotation with SemanticError
+ 2025-09-09 c5737dc21b runtime: when using cgo on 386, call C sigaction function
+ 2025-09-09 b9a4a09b0f runtime: remove duff support for riscv64
+ 2025-09-09 4dac9e093f cmd/compile: use generated loops instead of DUFFCOPY on riscv64
+ 2025-09-09 879ff736d3 cmd/compile: use generated loops instead of DUFFZERO on riscv64
+ 2025-09-09 77643dc63f cmd/compile: simplify zerorange on riscv64
+ 2025-09-09 e6605a1bcc encoding/json: use reflect.TypeAssert
+ 2025-09-09 4c20f7f15a cmd/cgo: run gcc to get errors and debug info in parallel
+ 2025-09-09 5dcedd6550 runtime: lock mheap_.speciallock when allocating synctest specials
+ 2025-09-09 d3be949ada runtime: don't negate eventfd errno
+ 2025-09-09 836fa74518 syscall: optimise cgo clearenv
+ 2025-09-09 ce39174482 crypto/rsa: check PrivateKey.D for consistency with Dp and Dq
+ 2025-09-09 5d9d0513dc crypto/rsa: check for post-Precompute changes in Validate
+ 2025-09-09 968a5107a9 crypto/internal/fips140: update frozen module version to "v1.0.0"
+ 2025-09-09 645ee44492 crypto/ecdsa: deprecate direct use of big.Int fields in keys
+ 2025-09-09 a67977da5e cmd/compile/internal/inline: ignore superfluous slicing
+ 2025-09-09 a5fa5ea51c cmd/compile/internal/ssa: expand runtime.memequal for length {3,5,6,7}
+ 2025-09-09 4c63d798cb cmd/compile: improve stp merging for non-sequent cases
+ 2025-09-09 bdd51e7855 cmd/compile: use constant zero register instead of specialized zero instructions on mips64x
+ 2025-09-09 10ac80de77 cmd/compile: introduce CCMP generation
+ 2025-09-09 3b3b16957c Revert "cmd/go: use os.Rename to move files on Windows"
+ 2025-09-09 e3223518b8 cmd/go: split generating cover files into its own action
+ 2025-09-09 af03343f93 cmd/compile: fix bounds check report
+ 2025-09-08 6447ff409a cmd/compile: fold constant in ADDshift op on loong64
+ 2025-09-08 5b218461f9 cmd/compile: optimize loads from abi.Type.{Size_,PtrBytes,Kind_}
+ 2025-09-08 b915e14490 cmd/compile: consolidate logic for rewriting fixed loads
+ 2025-09-08 06e791c0cd cmd/compile: simplify zerorange on mips
+ 2025-09-08 cf42b785b7 cmd/cgo: run recordTypes for each of the debugs at the end of Translate
+ 2025-09-08 5e6296f3f8 archive/tar: optimize nanosecond parsing in parsePAXTime
+ 2025-09-08 ea00650784 debug/pe: permit symbols with no name
+ 2025-09-08 4cc7cc74c3 crypto: update Hash comments to point to crypto/sha3
+ 2025-09-08 ff45d5d53c encoding/json/internal/jsonflags: fix comment with wrong field name
+ 2025-09-06 861c90c907 net/http: pool transport gzip readers
+ 2025-09-06 57769b5532 os: reject OpenDir of a non-directory file in Plan 9
+ 2025-09-06 a6144613d3 crypto/tls: use context.AfterFunc in handshakeContext
+ 2025-09-05 e8126bce9e runtime/cgo: save and restore R31 for crosscall1 on loong64
+ 2025-09-05 d767064170 cmd/compile: mark abi.PtrType.Elem sym as used
+ 2025-09-05 0b1eed09a3 vendor/golang.org/x/tools: update to a09a2fb
+ 2025-09-05 f5b20689e9 cmd/compile: optimize loads from readonly globals into constants on loong64
+ 2025-09-05 3492e4262b cmd/compile: simplify specific addition operations using the ADDV16 instruction
+ 2025-09-05 459b85ccaa cmd/fix: remove all functionality except for buildtag
+ 2025-09-05 87e72769fa runtime: simplify openbsd check in usesLibcall and mStackIsSystemAllocated
+ 2025-09-05 bb48272e24 cmd/compile: simplify zerorange on mips64
+ 2025-09-05 d52a56cce1 cmd/link/internal/ld: unconditionally use posix_fallocate on FreeBSD
+ 2025-09-04 9d0829963c net/http: fix cookie value of "" being interpreted as empty string.
+ 2025-09-04 ddce0522be cmd/internal/obj/loong64: add ADDU16I.D instruction support
+ 2025-09-04 00b8474e47 cmd/trace: don't filter events for profile by whether they have stack
+ 2025-09-04 e36c5aead6 log/slog: add multiple handlers support for logger
+ 2025-09-04 150fae714e crypto/x509: don't force system roots load in SetFallbackRoots
+ 2025-09-04 4f7bbc62c7 runtime, cmd/compile, cmd/internal/obj: remove duff support for loong64
+ 2025-09-04 b8cc907425 cmd/internal/obj/loong64: fix the usage of offset in the instructions [X]VLDREPL.{B/H/W/D}
+ 2025-09-04 8c27a80890 path{,/filepath}: speed up Match
+ 2025-09-04 b7c20413c5 runtime: remove obsolete osArchInit function
+ 2025-09-04 df29038486 cmd/compile/internal/ssa: load constant values from abi.PtrType.Elem
+ 2025-09-04 4373754bc9 cmd/compile: add store to load forwarding rules on riscv64
+ 2025-09-03 80038586ed cmd/compile: export to DWARF types only referenced through interfaces
+ 2025-09-03 91e76a513b cmd/compile: use generated loops instead of DUFFCOPY on loong64
+ 2025-09-03 c552ad913f cmd/compile: simplify memory load and store operations on loong64
+ 2025-09-03 e8f9127d1f net/netip: export Prefix.Compare, fix ordering
+ 2025-09-03 731e546166 cmd/compile: simplify the support for 32bit high multiply on loong64

Change-Id: I2c124fb8071e2972d39804867cafb6806e601aba
2025-09-11 15:09:34 -04:00
Junyang Shao
5a0446d449 [dev.simd] simd/_gen/simdgen, cmd/compile: add memory op machine ops
This CL adds the machine ops for memory-op and also their prog writing
logic.

This CL also fixes a bug in the XED parser. Previously the
merge of machine ops is not checking the CPU feature, so some AVX
instruction might have their "memFeatures" field set incorrectly.
However since that field is not used until this CL, putting the fix here
should be ok.

Change-Id: I91031cbbf63453257473dd1d2ff47f7496d1a01d
Reviewed-on: https://go-review.googlesource.com/c/go/+/701198
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-09-11 12:08:53 -07:00
Kevaundray Wedderburn
cf5e993177 cmd/link: allow one to specify the data section in the internal linker
Fixes #74945

Change-Id: Ia73a8dcdf707222e822522daaa7f31a38b1c31e6
GitHub-Last-Rev: da1526ad8c
GitHub-Pull-Request: golang/go#75117
Reviewed-on: https://go-review.googlesource.com/c/go/+/698355
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-11 10:59:06 -07:00
apocelipes
cdb3d467fa encoding/gob: make use of reflect.TypeAssert
Use "reflect.TypeAssert" to simplify the code.

There are also some performance gains:

goarch: arm64
pkg: encoding/gob
cpu: Apple M4
                         │     old     │                 new                 │
                         │   sec/op    │   sec/op     vs base                │
EncodeComplex128Slice-10   1.048µ ± 3%   1.048µ ± 1%        ~ (p=0.986 n=10)
EncodeFloat64Slice-10      481.5n ± 0%   538.1n ± 0%  +11.75% (p=0.000 n=10)
EncodeInt32Slice-10        560.0n ± 1%   562.2n ± 1%        ~ (p=0.239 n=10)
EncodeStringSlice-10       713.1n ± 2%   690.1n ± 1%   -3.24% (p=0.000 n=10)
EncodeInterfaceSlice-10    16.10µ ± 3%   16.89µ ± 3%   +4.94% (p=0.004 n=10)
DecodeComplex128Slice-10   5.507µ ± 2%   5.488µ ± 2%        ~ (p=0.617 n=10)
DecodeFloat64Slice-10      3.359µ ± 1%   3.365µ ± 1%        ~ (p=0.403 n=10)
DecodeInt32Slice-10        3.296µ ± 1%   3.290µ ± 2%        ~ (p=0.926 n=10)
DecodeStringSlice-10       8.397µ ± 2%   8.459µ ± 1%        ~ (p=0.796 n=10)
DecodeStringsSlice-10      18.47µ ± 1%   11.14µ ± 1%  -39.69% (p=0.000 n=10)
DecodeBytesSlice-10        5.038µ ± 1%   5.039µ ± 1%        ~ (p=0.956 n=10)
DecodeInterfaceSlice-10    40.14µ ± 1%   40.60µ ± 1%   +1.16% (p=0.001 n=10)
DecodeMap-10               43.43µ ± 1%   44.09µ ± 1%   +1.51% (p=0.000 n=10)
geomean                    4.451µ        4.335µ        -2.62%

                         │      old       │                  new                   │
                         │      B/op      │     B/op      vs base                  │
EncodeComplex128Slice-10    1.0000 ±  ?      0.5000 ±  ?        ~ (p=0.350 n=10)
EncodeFloat64Slice-10        0.000 ± 0%       0.000 ± 0%        ~ (p=1.000 n=10) ¹
EncodeInt32Slice-10          0.000 ± 0%       0.000 ± 0%        ~ (p=1.000 n=10) ¹
EncodeStringSlice-10         0.000 ± 0%       0.000 ± 0%        ~ (p=1.000 n=10) ¹
EncodeInterfaceSlice-10      19.00 ± 5%       20.00 ± 5%   +5.26% (p=0.002 n=10)
DecodeComplex128Slice-10   24.55Ki ± 0%     24.53Ki ± 0%   -0.10% (p=0.000 n=10)
DecodeFloat64Slice-10      10.56Ki ± 0%     10.54Ki ± 0%   -0.22% (p=0.000 n=10)
DecodeInt32Slice-10        9.539Ki ± 0%     9.516Ki ± 0%   -0.25% (p=0.000 n=10)
DecodeStringSlice-10       38.18Ki ± 0%     38.16Ki ± 0%   -0.06% (p=0.000 n=10)
DecodeStringsSlice-10      63.96Ki ± 0%     40.51Ki ± 0%  -36.65% (p=0.000 n=10)
DecodeBytesSlice-10        22.58Ki ± 0%     22.58Ki ± 0%        ~ (p=1.000 n=10)
DecodeInterfaceSlice-10    80.47Ki ± 0%     80.47Ki ± 0%        ~ (p=1.000 n=10)
DecodeMap-10               48.81Ki ± 0%     48.81Ki ± 0%        ~ (p=1.000 n=10) ¹
geomean                                 ²                  -8.15%                ²
¹ all samples are equal
² summaries must be >0 to compute geomean

                         │      old      │                  new                  │
                         │   allocs/op   │  allocs/op   vs base                  │
EncodeComplex128Slice-10    0.000 ± 0%      0.000 ± 0%        ~ (p=1.000 n=10) ¹
EncodeFloat64Slice-10       0.000 ± 0%      0.000 ± 0%        ~ (p=1.000 n=10) ¹
EncodeInt32Slice-10         0.000 ± 0%      0.000 ± 0%        ~ (p=1.000 n=10) ¹
EncodeStringSlice-10        0.000 ± 0%      0.000 ± 0%        ~ (p=1.000 n=10) ¹
EncodeInterfaceSlice-10     0.000 ± 0%      0.000 ± 0%        ~ (p=1.000 n=10) ¹
DecodeComplex128Slice-10    149.0 ± 0%      148.0 ± 0%   -0.67% (p=0.000 n=10)
DecodeFloat64Slice-10       150.0 ± 0%      149.0 ± 0%   -0.67% (p=0.000 n=10)
DecodeInt32Slice-10         149.0 ± 0%      148.0 ± 0%   -0.67% (p=0.000 n=10)
DecodeStringSlice-10       1.150k ± 0%     1.149k ± 0%   -0.09% (p=0.000 n=10)
DecodeStringsSlice-10      2.158k ± 0%     1.158k ± 0%  -46.34% (p=0.000 n=10)
DecodeBytesSlice-10         149.0 ± 0%      149.0 ± 0%        ~ (p=1.000 n=10) ¹
DecodeInterfaceSlice-10    3.158k ± 0%     3.158k ± 0%        ~ (p=1.000 n=10) ¹
DecodeMap-10                160.0 ± 0%      160.0 ± 0%        ~ (p=1.000 n=10) ¹
geomean                                ²                 -4.83%                ²
¹ all samples are equal
² summaries must be >0 to compute geomean

Updates #62121

Change-Id: I1d3534e5001ca185bc8ba5a7ed4ddbc00f85a17e
GitHub-Last-Rev: c0209f8c50
GitHub-Pull-Request: golang/go#75409
Reviewed-on: https://go-review.googlesource.com/c/go/+/702735
Reviewed-by: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-09-11 10:56:37 -07:00
Joe Tsai
fef360964c archive/tar: fix typo in benchmark name
This was accidentally introduced in CL 662835.

Change-Id: I5c7ac67337e33e82037414377912b57d2a45be91
Reviewed-on: https://go-review.googlesource.com/c/go/+/702275
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-11 10:52:43 -07:00
Dmitri Shuralyov
7d562b8460 syscall: actually remove unreachable code
CL 702415 claimed to remove unreachable code, but in reality merely hid
it from vet's unreachable pass. Since the unreachable code isn't serving
an active role in the test, do remove it to simplify code.

Change-Id: I5905b8b566e4ca013bdd1202d1492e3eae6a5ede
Reviewed-on: https://go-review.googlesource.com/c/go/+/702575
Reviewed-by: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2025-09-11 10:50:00 -07:00
Filippo Valsorda
c349582344 crypto/rsa: don't test CL 687836 against v1.0.0 FIPS 140-3 module
Fixes #75343 (again)
Updates #74115

Change-Id: I6a6a696431d12e45ec9e302e63ed18990c5ee9d9
Reviewed-on: https://go-review.googlesource.com/c/go/+/702615
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
2025-09-11 10:30:33 -07:00
qmuntal
253dd08f5d debug/macho: filter non-external symbols when reading imported symbols without LC_DYSYMTAB
File.ImportedSymbols will return symbols with a type that has one of the
N_STAB (0xe0) bits set and no section. That's not the expected behavior,
as those symbols might not be external.

We should expand the type check to also account for the N_EXT bit.
The section check is not necessary, as N_EXT symbols never have it set.

I have found this issue in the wild by running "go tool cgo -dynimport",
but unfortuantely I couldn't get a minimal C code that generates
N_STAB symbols without section, so this CL doesn't add any new test.

Change-Id: Ib0093ff66b50c7cc2f39d83936314fc293236917
Reviewed-on: https://go-review.googlesource.com/c/go/+/702296
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>
2025-09-11 02:40:28 -07:00
xieyuschen
2009e6c596 internal/runtime/maps: remove redundant package docs
This CL removes redundant package docs comments under different files
as all of them will be shown in pkgsite.

As of now, package docs 'Package maps implements Go's builtin map type'
appears 3 times in pkgsite.

See: https://pkg.go.dev/internal/runtime/maps

Change-Id: I2f0696dd4f860afea5cc346532bca59135bec798
Reviewed-on: https://go-review.googlesource.com/c/go/+/702135
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
2025-09-10 17:40:53 -07:00
Keith Randall
de5d7eccb9 runtime/internal/maps: only conditionally clear groups when sparse
We only want to do the work of clearing slots
if they are full. But we also don't want to do too
much work to figure out whether a slot is full or not,
especially if clearing a slot is cheap.
 1) We decide group-by-group instead of slot-by-slot.
    If any slot in a group is full, we zero the whole group.
 2) If groups are unlikely to be empty, don't bother
    testing for it.
 3) If groups are 50%/50% likely to be empty, also don't
    bother testing, as it confuses the branch predictor. See #75097.
 4) But if a group is really large, do the test anyway, as
    clearing is expensive.

Fixes #75097

Change-Id: I9191865dd3e0fe887751cffe6082ac27d8d8439c
Reviewed-on: https://go-review.googlesource.com/c/go/+/697876
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@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Youlin Feng <fengyoulin@live.com>
2025-09-10 15:06:16 -07:00
Keith Randall
8098b99547 internal/runtime/maps: speed up Clear
We don't need to know the actual full slots, just whether there
are any or not.

The test for any full slots is simpler on amd64. We don't have to
use PMOVMSKB and do the intreg->floatreg transfer.

Fixes #75097

Change-Id: Iace1c100618d7fc2ac5ddd5fe9e8fe5c9595243f
Reviewed-on: https://go-review.googlesource.com/c/go/+/697875
Reviewed-by: Youlin Feng <fengyoulin@live.com>
Auto-Submit: Keith Randall <khr@google.com>
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>
2025-09-10 15:06:08 -07:00
Kir Kolyshkin
fe5420b054 cmd: delete some more windows/arm remnants
Updates #71671

Amends CL 699176, CL 698415, CL 698036, CL 648795.

Change-Id: I69adff73d1c9631e07df63fc84c80ec0204d49d5
Reviewed-on: https://go-review.googlesource.com/c/go/+/700835
Reviewed-by: 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: Dmitri Shuralyov <dmitshur@golang.org>
2025-09-10 14:57:07 -07:00
qmuntal
fad1dc608d runtime: don't artificially limit TestReadMetricsSched
TestReadMetricsSched/running can take some time to enter in steady state
on busy systems. We currently only allow 1 second for that, we should
let it run unlimitedly until success or the test time's out.

Fixes #75049

Change-Id: I452059e1837caf12a2d2d9cae1f70a0ef2d4f518
Reviewed-on: https://go-review.googlesource.com/c/go/+/702295
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-09-10 13:57:50 -07:00
Keith Randall
b1f3e38e41 cmd/compile: when CSEing two values, prefer the statement marked one
Fixes #75249

Change-Id: Ifd61bf5341f23ce2c9735e607e00d987489caacf
Reviewed-on: https://go-review.googlesource.com/c/go/+/701295
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Alexander Musman <alexander.musman@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-10 13:31:18 -07:00
Mark Freeman
00824f5ff5 types2: better documentation for resolve()
Change-Id: Iece109dfbdc98d436b845148612f4943598697fe
Reviewed-on: https://go-review.googlesource.com/c/go/+/697697
Reviewed-by: Robert Findley <rfindley@google.com>
Commit-Queue: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-10 13:15:29 -07:00
1911860538
5cf8ca42e3 internal/trace/raw: use strings.Cut instead of strings.SplitN 2
Replace strings.SplitN with strings.Cut for better performance and readability.

Change-Id: Ia245db62d8c2d1686887cb455f492db15606b57a
GitHub-Last-Rev: e00e164688
GitHub-Pull-Request: golang/go#75257
Reviewed-on: https://go-review.googlesource.com/c/go/+/700915
Reviewed-by: 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 Pratt <mpratt@google.com>
2025-09-10 13:06:00 -07:00
Keith Randall
80a2aae922 Revert "cmd/compile: improve stp merging for non-sequent cases"
This reverts commit 4c63d798cb.

Reason for revert: Causes miscompilations. See issue 75365.

Change-Id: Icd1fcfeb23d2ec524b16eb556030f43875e1c90d
Reviewed-on: https://go-review.googlesource.com/c/go/+/702455
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Mark Freeman <markfreeman@google.com>
2025-09-10 11:11:11 -07:00
Dmitri Shuralyov
f327a05419 go/token, syscall: annotate if blocks that defeat vet's unreachable pass
Since putting code in an "if true" block is unusual, make it easier
for readers to understand the purpose of doing this.

For #73998.

Change-Id: I3fd8d65130211c7c01d424366a3c662482d80add
Reviewed-on: https://go-review.googlesource.com/c/go/+/702416
Reviewed-by: Alan Donovan <adonovan@google.com>
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>
2025-09-10 08:29:00 -07:00
Dmitri Shuralyov
9650c97d0f syscall: remove unreachable code
Reported by go vet:

	$ go vet syscall
	# syscall_test
	# [syscall_test]
	syscall/env_unix_test.go💯4: unreachable code

The TestVetStdlib test in golang.org/x/tools/go/analysis/unitchecker
also ran into this.

Fixes #73998.

Change-Id: I7f2842a42835a38163433a09a3311be9c30f8a14
Cq-Include-Trybots: luci.golang.try:x_tools-gotip-linux-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/702415
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
TryBot-Bypass: Dmitri Shuralyov <dmitshur@golang.org>
2025-09-10 08:28:56 -07:00
Filippo Valsorda
f1c4b860d4 Revert "crypto/internal/fips140: update frozen module version to "v1.0.0""
This reverts CL 701518. This should land just before CL 701520 to avoid
breaking the builders for long.

Fixes #75343

Change-Id: If1ae1fe933fe443ca9776888967d80875b02f41a
Reviewed-on: https://go-review.googlesource.com/c/go/+/702255
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: 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>
2025-09-10 03:17:56 -07:00
Joe Tsai
30686c4cc8 encoding/json/v2: document context annotation with SemanticError
When the json package calls
Marshaler, MarshalerTo, Unmarshaler, or UnmarshalerFrom methods
and a SemanticError is returned, it will automatically
annotate the error with context.

Document this behavior.

Change-Id: Id8e775a7c1c2a6ffc29ea518913591915e8aff87
Reviewed-on: https://go-review.googlesource.com/c/go/+/701956
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>
2025-09-10 00:58:35 -07:00
Ian Lance Taylor
c5737dc21b runtime: when using cgo on 386, call C sigaction function
On 386 the C sigaction function assumes that the caller does not set
the SA_RESTORER flag. It does not copy the C sa_restorer field to
the kernel sa_restorer field. The effect is that the kernel sees
the SA_RESTORER flag but a NULL sa_restorer field, and the program
crashes when returning from a signal handler.

On the other hand, the C sigaction function will return the SA_RESTORER
flag and the sa_restorer field stored in the kernel.

This means that if the Go runtime installs a signal handler,
with SA_RESTORER as is required when calling the kernel,
and the Go program calls C code that calls the C sigaction function
to query the current signal handler, that C code will get a result
that it can't pass back to sigaction.

This CL fixes the problem by using the C sigaction function
for 386 programs that use cgo. This reuses the functionality
used on amd64 and other GOARCHs to support the race detector.

See #75253, or runtime/testdata/testprogcgo/eintr.go, for sample
code that used to fail on 386. No new test case is required,
we just remove the skip we used to have for eintr.go.

Fixes #75253

Change-Id: I803059b1fb9e09e9fbb43f68eccb6a59a92c2991
Reviewed-on: https://go-review.googlesource.com/c/go/+/701375
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
2025-09-09 20:29:11 -07:00
Meng Zhuo
b9a4a09b0f runtime: remove duff support for riscv64
Change-Id: I987d9f49fbd2650eef4224f72271bf752c54d39c
Reviewed-on: https://go-review.googlesource.com/c/go/+/700538
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Ryan <markdryan@rivosinc.com>
2025-09-09 19:42:25 -07:00
Meng Zhuo
4dac9e093f cmd/compile: use generated loops instead of DUFFCOPY on riscv64
MemmoveKnownSize112-4            632.1Mi ± 1%   1288.5Mi ± 0%  +103.85% (p=0.000 n=10)
MemmoveKnownSize128-4            636.1Mi ± 0%   1280.9Mi ± 1%  +101.36% (p=0.000 n=10)
MemmoveKnownSize192-4            645.3Mi ± 0%   1306.9Mi ± 1%  +102.53% (p=0.000 n=10)
MemmoveKnownSize248-4            650.2Mi ± 2%   1312.5Mi ± 1%  +101.87% (p=0.000 n=10)
MemmoveKnownSize256-4            650.7Mi ± 0%   1303.6Mi ± 1%  +100.33% (p=0.000 n=10)
MemmoveKnownSize512-4            658.2Mi ± 1%   1293.9Mi ± 0%   +96.60% (p=0.000 n=10)
MemmoveKnownSize1024-4           662.1Mi ± 0%   1312.6Mi ± 0%   +98.26% (p=0.000 n=10)

Change-Id: I43681ca029880025558b33ddc4295da3947c9b28
Reviewed-on: https://go-review.googlesource.com/c/go/+/700537
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Mark Freeman <markfreeman@google.com>
2025-09-09 19:42:09 -07:00
Meng Zhuo
879ff736d3 cmd/compile: use generated loops instead of DUFFZERO on riscv64
MemclrKnownSize112-4          5.602Gi ± 0%    5.601Gi ± 0%         ~ (p=0.363 n=10)
MemclrKnownSize128-4          6.933Gi ± 1%    6.545Gi ± 1%    -5.59% (p=0.000 n=10)
MemclrKnownSize192-4          8.055Gi ± 1%    7.804Gi ± 0%    -3.12% (p=0.000 n=10)
MemclrKnownSize248-4          8.489Gi ± 0%    8.718Gi ± 0%    +2.69% (p=0.000 n=10)
MemclrKnownSize256-4          8.762Gi ± 0%    8.763Gi ± 0%         ~ (p=0.494 n=10)
MemclrKnownSize512-4          9.514Gi ± 1%    9.514Gi ± 0%         ~ (p=0.529 n=10)
MemclrKnownSize1024-4         9.940Gi ± 0%    9.939Gi ± 1%         ~ (p=0.989 n=10)
ClearFat3-4                   1.300Gi ± 0%    1.301Gi ±  0%         ~ (p=0.447 n=10)
ClearFat4-4                   3.902Gi ± 0%    3.902Gi ±  0%         ~ (p=0.971 n=10)
ClearFat5-4                   665.8Mi ± 0%   1331.5Mi ±  0%  +100.01% (p=0.000 n=10)
ClearFat6-4                   665.8Mi ± 0%   1330.5Mi ±  0%   +99.82% (p=0.000 n=10)
ClearFat7-4                   490.7Mi ± 0%   1331.9Mi ±  0%  +171.45% (p=0.000 n=10)
ClearFat8-4                   5.201Gi ± 0%    5.202Gi ±  0%         ~ (p=0.123 n=10)
ClearFat9-4                   856.1Mi ± 0%   1331.6Mi ±  0%   +55.54% (p=0.000 n=10)
ClearFat10-4                  887.8Mi ± 0%   1331.9Mi ±  0%   +50.03% (p=0.000 n=10)
ClearFat11-4                  915.3Mi ± 0%   1331.1Mi ±  0%   +45.42% (p=0.000 n=10)
ClearFat12-4                  5.202Gi ± 0%    5.202Gi ±  0%         ~ (p=0.481 n=10)
ClearFat13-4                  961.5Mi ± 0%   1331.8Mi ±  0%   +38.50% (p=0.000 n=10)
ClearFat14-4                  981.0Mi ± 0%   1331.8Mi ±  0%   +35.76% (p=0.000 n=10)
ClearFat15-4                  951.3Mi ± 0%   1331.4Mi ±  0%   +39.96% (p=0.000 n=10)
ClearFat16-4                  1.600Gi ± 0%    5.202Gi ±  0%  +225.10% (p=0.000 n=10)
ClearFat18-4                  1.018Gi ± 0%    1.300Gi ±  0%   +27.77% (p=0.000 n=10)
ClearFat20-4                  2.601Gi ± 0%    4.938Gi ± 12%   +89.87% (p=0.000 n=10)
ClearFat24-4                  2.601Gi ± 0%    5.201Gi ±  0%   +99.96% (p=0.000 n=10)
ClearFat32-4                  1.982Gi ± 0%    5.203Gi ±  0%  +162.55% (p=0.000 n=10)
ClearFat40-4                  3.467Gi ± 0%    4.338Gi ±  0%   +25.11% (p=0.000 n=10)
ClearFat48-4                  3.671Gi ± 0%    5.201Gi ±  0%   +41.69% (p=0.000 n=10)
ClearFat56-4                  3.640Gi ± 0%    5.201Gi ±  0%   +42.88% (p=0.000 n=10)
ClearFat64-4                  2.250Gi ± 0%    5.202Gi ±  0%  +131.25% (p=0.000 n=10)
ClearFat72-4                  4.064Gi ± 0%    5.201Gi ±  0%   +27.97% (p=0.000 n=10)
ClearFat128-4                 4.496Gi ± 0%    5.203Gi ±  0%   +15.71% (p=0.000 n=10)
ClearFat256-4                 4.756Gi ± 0%    5.201Gi ±  0%    +9.36% (p=0.000 n=10)
ClearFat512-4                 2.512Gi ± 0%    5.201Gi ±  0%  +107.03% (p=0.000 n=10)
ClearFat1024-4                4.255Gi ± 0%    5.202Gi ±  0%   +22.26% (p=0.000 n=10)
ClearFat1032-4                4.260Gi ± 0%    5.201Gi ±  0%   +22.09% (p=0.000 n=10)
ClearFat1040-4                4.285Gi ± 1%    5.203Gi ±  0%   +21.41% (p=0.000 n=10)
geomean                       2.005Gi         3.020Gi         +50.58%

Change-Id: Iea1da734ff8eaf1b5a2822ae2bdb7f4fd9b65651
Reviewed-on: https://go-review.googlesource.com/c/go/+/699635
Reviewed-by: Mark Ryan <markdryan@rivosinc.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
2025-09-09 19:41:39 -07:00
Meng Zhuo
77643dc63f cmd/compile: simplify zerorange on riscv64
Drop large zeroing cases, part of removing duff support.

Change-Id: Ia2936f649901886f3eb1d7ba1f90e3bf40ea2dee
Reviewed-on: https://go-review.googlesource.com/c/go/+/697615
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Julian Zhu <jz531210@gmail.com>
Reviewed-by: Mark Ryan <markdryan@rivosinc.com>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Joel Sing <joel@sing.id.au>
2025-09-09 19:41:30 -07:00
Joe Tsai
e6605a1bcc encoding/json: use reflect.TypeAssert
Updates #62121

Change-Id: Ic3c4fe84a5dacfd8270aba0d5dd59f83f0a9030f
Reviewed-on: https://go-review.googlesource.com/c/go/+/701955
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-09 17:22:28 -07:00
matloob
4c20f7f15a cmd/cgo: run gcc to get errors and debug info in parallel
This change kicks off the work to load the debug info when processing
each file, and then waits for all the files to be processed before
starting the single-goroutined part that processes them. The processing
is very order dependent so we won't try to make it concurrent. Though
in a later CL we can wait for only the relevant package to have been
processed concurrently before doing the single-goroutined processing for
it instead of waiting for all packages to be processed concurrently
before the single goroutine section.

We use a par.Queue to make sure we're not running too many gcc compiles
at the same time. The change to cmd/dist makes the par package available
to cgo.

Fixes #75167

Change-Id: I6a6a6964fb7f3a3684118b5ee66f1ad856b3ee59
Reviewed-on: https://go-review.googlesource.com/c/go/+/699020
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-09-09 16:41:05 -07:00
Damien Neil
5dcedd6550 runtime: lock mheap_.speciallock when allocating synctest specials
Avoid racing use of mheap_.specialBubbleAlloc.

Fixes #75134

Change-Id: I0c9140c18d2bca1e1c3387cd81230f0e8c9ac23e
Reviewed-on: https://go-review.googlesource.com/c/go/+/699255
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-09 14:46:30 -07:00
Michael Pratt
d3be949ada runtime: don't negate eventfd errno
The Linux syscall package does this for us.

Fixes #75337.

Change-Id: I6a6a636c9bb5fe25fdc6f80dc8b538ebed60d00b
Reviewed-on: https://go-review.googlesource.com/c/go/+/701796
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>
2025-09-09 14:05:36 -07:00
Aleksa Sarai
836fa74518 syscall: optimise cgo clearenv
For programs with very large environments, calling unsetenv(3) for each
environment variable can be very expensive because of CGo overhead, but
clearenv(3) is much faster. The only thing we have to track is whether
GODEBUG is being unset by the operation, which can be done very quickly
without resorting to doing unsetenv(3) for every variable.

This change makes syscall.Clearenv() >98% faster when run in an
environment with as little as 100 environment variables. (Note that due
to golang/go#27217, it is necessary to modify BenchmarkClearenv to use
t.StopTimer() and -benchtime=100x in order to get these benchmark times
-- otherwise syscall.Setenv() time is included and the benchmarks give a
more pessimistic 50% performance improvement.)

    goos: linux
    goarch: amd64
    pkg: syscall
    cpu: AMD Ryzen 7 7840U w/ Radeon  780M Graphics
                      │      before      │                after                │
                      │      sec/op      │   sec/op     vs base                │
    Clearenv/100-16        22276.5n ± 5%   285.8n ± 3%  -98.72% (p=0.000 n=10)
    Clearenv/1000-16     1414104.0n ± 1%   783.1n ± 8%  -99.94% (p=0.000 n=10)
    Clearenv/10000-16   143827.554µ ± 1%   7.591µ ± 5%  -99.99% (p=0.000 n=10)
    geomean                  1.655m        1.193µ       -99.93%

The above benchmarks are CGo builds, which require CGo overhead for
every setenv(2). If you run the same benchmarks for a non-CGo package
(i.e., outside of the "syscall" package), you get slightly more modest
performance improvements:

    goos: linux
    goarch: amd64
    pkg: clearenv_nocgo
    cpu: AMD Ryzen 7 7840U w/ Radeon  780M Graphics
                      │     before     │                after                 │
                      │     sec/op     │    sec/op     vs base                │
    Clearenv/100-16       1106.0n ± 3%   230.7n ±  8%  -79.14% (p=0.000 n=10)
    Clearenv/1000-16     11222.0n ± 1%   305.4n ±  6%  -97.28% (p=0.000 n=10)
    Clearenv/10000-16   195676.5n ± 6%   759.9n ± 10%  -99.61% (p=0.000 n=10)
    geomean                13.44µ        376.9n        -97.20%

(As above, this requires modifying the benchmarks to use t.StopTimer()
and -benchtime=100x.)

Change-Id: I53b96a75f189e91affbde423c907888b7e0fafcd
GitHub-Last-Rev: f8d7a8140d
GitHub-Pull-Request: golang/go#70672
Reviewed-on: https://go-review.googlesource.com/c/go/+/633515
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Kirill Kolyshkin <kolyshkin@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
2025-09-09 12:48:31 -07:00
Filippo Valsorda
ce39174482 crypto/rsa: check PrivateKey.D for consistency with Dp and Dq
This unfortunately nearly doubles the runtime of
NewPrivateKeyWithPrecomputation. It would be nice to find an alternative
way to check it.

fips140: off
goos: darwin
goarch: arm64
pkg: crypto/rsa
cpu: Apple M2
                            │ 6aeb841faf  │             62ec3e34f3              │
                            │   sec/op    │    sec/op     vs base               │
ParsePKCS8PrivateKey/2048-8   70.28µ ± 0%   116.16µ ± 0%  +65.28% (p=0.002 n=6)

Fixes #74115

Change-Id: I6a6a6964091817d9aee359cc48932167e55184b9
Reviewed-on: https://go-review.googlesource.com/c/go/+/687836
Auto-Submit: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-09-09 12:32:59 -07:00
Filippo Valsorda
5d9d0513dc crypto/rsa: check for post-Precompute changes in Validate
Updates #74115

Change-Id: I6a6a6964be55cff5131d99235f621b4ff2a93d2b
Reviewed-on: https://go-review.googlesource.com/c/go/+/687835
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
2025-09-09 12:31:46 -07:00
Filippo Valsorda
968a5107a9 crypto/internal/fips140: update frozen module version to "v1.0.0"
We are re-sealing the .zip file anyway for another reason, might as well
take the opportunity to fix the "v1.0" mistake.

Change-Id: I6a6a69646b3188984c865031ff9393ccaaaa9479
Reviewed-on: https://go-review.googlesource.com/c/go/+/701518
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-09-09 12:23:21 -07:00
Filippo Valsorda
645ee44492 crypto/ecdsa: deprecate direct use of big.Int fields in keys
Updates #63963

Change-Id: I6a6a69645e625cde1ac1c6abf698a5fd3d52b4cf
Reviewed-on: https://go-review.googlesource.com/c/go/+/701516
Auto-Submit: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-09-09 12:20:39 -07:00
Jake Bailey
a67977da5e cmd/compile/internal/inline: ignore superfluous slicing
When slicing, ignore expressions which could be elided, as in slicing
starting at 0 or ending at len(v).

Fixes #75278

Change-Id: I9c18e29c3d4da9bef89bd25bb261d3cb60e66392
Reviewed-on: https://go-review.googlesource.com/c/go/+/701216
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Mark Freeman <markfreeman@google.com>
2025-09-09 12:10:10 -07:00
Youlin Feng
a5fa5ea51c cmd/compile/internal/ssa: expand runtime.memequal for length {3,5,6,7}
This CL slightly speeds up strings.HasPrefix when testing constant
prefixes of length {3,5,6,7}.

goos: linux
goarch: amd64
cpu: Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz
                │      old     │                 new                 │
                │    sec/op    │   sec/op     vs base                │
StringPrefix3-8   11.125n ± 2%   8.539n ± 1%  -23.25% (p=0.000 n=20)
StringPrefix5-8   11.170n ± 2%   8.700n ± 1%  -22.11% (p=0.000 n=20)
StringPrefix6-8   11.190n ± 2%   8.655n ± 1%  -22.65% (p=0.000 n=20)
StringPrefix7-8   11.095n ± 1%   8.878n ± 1%  -19.98% (p=0.000 n=20)

Change-Id: I510a80d59cf78680b57d68780d35d212d24030e2
Reviewed-on: https://go-review.googlesource.com/c/go/+/700816
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
2025-09-09 12:10:07 -07:00
Melnikov Denis
4c63d798cb cmd/compile: improve stp merging for non-sequent cases
Original algorithm merges stores with the first
mergeable store in the chain, but it misses some
cases. Additional reordering stores in increasing order
of memory access in the chain allows merging in these cases.

Fixes #71987

There are the results of sweet benchmarks and
the difference between sizes of sections .text

                        │ old.results │            new.results             │
                        │   sec/op    │   sec/op     vs base               │
BleveIndexBatch100-4      7.614 ± 2%    7.548 ± 1%       ~ (p=0.190 n=10)
ESBuildThreeJS-4         821.3m ± 0%   819.0m ± 1%       ~ (p=0.165 n=10)
ESBuildRomeTS-4          206.2m ± 1%   204.4m ± 1%  -0.90% (p=0.023 n=10)
EtcdPut-4                64.89m ± 1%   64.94m ± 2%       ~ (p=0.684 n=10)
EtcdSTM-4                318.4m ± 0%   319.2m ± 1%       ~ (p=0.631 n=10)
GoBuildKubelet-4          157.4 ± 0%    157.6 ± 0%       ~ (p=0.105 n=10)
GoBuildKubeletLink-4      12.42 ± 2%    12.41 ± 1%       ~ (p=0.529 n=10)
GoBuildIstioctl-4         124.4 ± 0%    124.4 ± 0%       ~ (p=0.579 n=10)
GoBuildIstioctlLink-4     8.700 ± 1%    8.693 ± 1%       ~ (p=0.912 n=10)
GoBuildFrontend-4         46.52 ± 0%    46.50 ± 0%       ~ (p=0.971 n=10)
GoBuildFrontendLink-4     2.282 ± 1%    2.272 ± 1%       ~ (p=0.529 n=10)
GoBuildTsgo-4             75.02 ± 1%    75.31 ± 1%       ~ (p=0.436 n=10)
GoBuildTsgoLink-4         1.229 ± 1%    1.219 ± 1%  -0.82% (p=0.035 n=10)
GopherLuaKNucleotide-4    34.77 ± 5%    34.31 ± 1%  -1.33% (p=0.015 n=10)
MarkdownRenderXHTML-4    286.6m ± 0%   285.7m ± 1%       ~ (p=0.315 n=10)
Tile38QueryLoad-4        657.2µ ± 1%   660.3µ ± 0%       ~ (p=0.436 n=10)
geomean                   2.570         2.563       -0.24%

Executable            Old .text  New .text     Change
-------------------------------------------------------
benchmark               6504820    6504020     -0.01%
bleve-index-bench       3903860    3903636     -0.01%
esbuild                 4801012    4801172     +0.00%
esbuild-bench           1256404    1256340     -0.01%
etcd                    9188148    9187076     -0.01%
etcd-bench              6462228    6461524     -0.01%
go                      5924468    5923892     -0.01%
go-build-bench          1282004    1281940     -0.00%
gopher-lua-bench        1639540    1639348     -0.01%
markdown-bench          1478452    1478356     -0.01%
tile38-bench            2753524    2753300     -0.01%
tile38-server          10241380   10240068     -0.01%

Change-Id: Ieb4fdfd656aca458f65fc45938de70550632bd13
Reviewed-on: https://go-review.googlesource.com/c/go/+/698097
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Keith Randall <khr@google.com>
2025-09-09 12:10:01 -07:00
Julian Zhu
bdd51e7855 cmd/compile: use constant zero register instead of specialized zero instructions on mips64x
Refer to CL 633075, mips64x has a constant zero register that can be used to do this.

Change-Id: I7b60f9a9fe0015299f48b9219ba0eddd3c02e07a
Reviewed-on: https://go-review.googlesource.com/c/go/+/700935
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
2025-09-09 12:08:27 -07:00
Ch1n-ch1nless
10ac80de77 cmd/compile: introduce CCMP generation
Introduce new aux type "ARM64ConditionalParams", which contains condition code, NZCV flags and constant with indicator of using it for CCMP instructions

Updates #71268

Change-Id: I322a6cb7077c9a2c4415893c5eb7ff7692d5a2de
Reviewed-on: https://go-review.googlesource.com/c/go/+/698037
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
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>
2025-09-09 12:08:19 -07:00
Quim Muntal
3b3b16957c Revert "cmd/go: use os.Rename to move files on Windows"
This reverts CL 691255.

Reason for revert: SetNamedSecurityInfo sometimes fails when the path contains symbolic links.

Fixes #74864

Change-Id: Iaf1a5692b35d58c523fd513f27bad9a2e7a334cb
Reviewed-on: https://go-review.googlesource.com/c/go/+/702155
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
2025-09-09 11:02:22 -07:00
matloob
e3223518b8 cmd/go: split generating cover files into its own action
This change breaks up the build action into multiple actions: a first
action checks to see what's cached and determines what the following
actions need to do. Then the optional cover action will generate cover
instrumented files if this is a cover build. Finally the build action
does the rest of this work. For simplicity of implementation, the new
actions do not cache their outputs separately from the build action
itself. It might be better to make changes in future CLs to enable that,
but it does add a reasonable amount of complexity. The purpose of this
CL is to split up the cover and build actions, so that in the next CL we
can insert cgo actions in the middle to enable running the cgo compile
actions in parallel.

For #9887

Change-Id: I6a6a696459feade17a144e5341096475676ae99f
Reviewed-on: https://go-review.googlesource.com/c/go/+/697135
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@google.com>
2025-09-09 10:49:10 -07:00
Keith Randall
af03343f93 cmd/compile: fix bounds check report
For constant-index, variable length situations.

Inadvertant shadowing of the yVal variable. Oops.

Fixes #75327

Change-Id: I3403066fc39b7664222a3098cf0f22b5761ea66a
Reviewed-on: https://go-review.googlesource.com/c/go/+/702015
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-09 07:37:40 -07:00
Junyang Shao
c39b2fdd1e [dev.simd] cmd/compile, simd: add VPLZCNT[DQ]
Change-Id: Ifd6d8c12deac9c41722fdf2511d860a334e83438
Reviewed-on: https://go-review.googlesource.com/c/go/+/701915
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Bypass: Junyang Shao <shaojunyang@google.com>
2025-09-08 13:53:52 -07:00
Xiaolin Zhao
6447ff409a cmd/compile: fold constant in ADDshift op on loong64
Removes 918 instructions from the go binary on loong64.

        file        before      after       Δ
        go          1633120     1632948    -172
        gofmt       323470      323334     -136
        asm         568024      568024     -0
        cgo         488030      487890     -140
        compile     2501050     2500728    -322
        cover       530124      530124     -0
        link        723532      723520     -12
        preprofile  240568      240568     -0
        vet         819392      819256     -136

Change-Id: Id4015c66b2073323b7ad257b3ed05bb99f81e9a1
Reviewed-on: https://go-review.googlesource.com/c/go/+/701655
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Mark Freeman <markfreeman@google.com>
2025-09-08 13:34:13 -07:00
Jake Bailey
5b218461f9 cmd/compile: optimize loads from abi.Type.{Size_,PtrBytes,Kind_}
With the previous CL in place, we can now pretty easily optimize a few
more loads from abi.Type. I've done Size_, PtrBytes, and Kind_, which
are easily calculated.

Among std/cmd, this rule fires a number of times:

     75 abi.Type field Kind_
     50 abi.PtrType field Elem
     14 abi.Type field Hash
      4 abi.Type field Size_
      2 abi.Type field PtrBytes

The other ones that show up when compiling std/cmd are TFlag and GCData,
but these are not trivially calculated. Doing TFlag would probably be a
decent help given it's often used in things like switches where
statically knowing the kind could eliminate a bunch of dead code.

Change-Id: Ic7fd2113fa7479af914d06916edbca60cc71819f
Reviewed-on: https://go-review.googlesource.com/c/go/+/701298
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-08 13:34:06 -07:00
Jake Bailey
b915e14490 cmd/compile: consolidate logic for rewriting fixed loads
Many CLs have worked with this bit of code, extending the cases more and
more for various fixed addresses and constants. But, I find that it's
getting duplicitive, and I don't find the current setup very clear that
something like isFixed32 _only_ works for a specific element within the
type data.

This CL rewrites these rules (pun unintended) into a single set of
rewrite rules with shared logic, which stops hardcoding offsets and type
compatibility checks.

This should open the door to optimizing further type:... field loads, of
which most can be done entirely statically but are not yet today outside
Hash and Elem.

Passes toolstash -cmp.

Change-Id: I754138ce1785c6036eada9ed53f0ce2ad2a58b63
Reviewed-on: https://go-review.googlesource.com/c/go/+/701297
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Florian Lehner <lehner.florian86@gmail.com>
2025-09-08 13:34:03 -07:00
Julian Zhu
06e791c0cd cmd/compile: simplify zerorange on mips
Change-Id: I9feffa3906f1e1e9fd54f24113130322411cc9d4
Reviewed-on: https://go-review.googlesource.com/c/go/+/701155
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
2025-09-08 13:32:51 -07:00
matloob
cf42b785b7 cmd/cgo: run recordTypes for each of the debugs at the end of Translate
Save the debug information in a slice and then process all of them at
the end of the loop.

For #75167

Change-Id: I6a6a6964dffa784b0aa776334562333ecf247023
Reviewed-on: https://go-review.googlesource.com/c/go/+/699019
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@google.com>
Auto-Submit: Michael Matloob <matloob@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-09-08 13:14:03 -07:00
1911860538
5e6296f3f8 archive/tar: optimize nanosecond parsing in parsePAXTime
Modified parsePAXTime to use a byte array for nanosecond parsing, providing a more straightforward implementation with better performance when handling decimal fraction part.
Here are benchmark results:
goos: darwin
goarch: amd64
pkg: archive/tar
cpu: Intel(R) Core(TM) i7-8569U CPU @ 2.80GHz
                                │   old.txt    │               new.txt                │
                                │    sec/op    │    sec/op     vs base                │
ParsePAXTIme/NoNanos-8            20.55n ±  4%   20.45n ± 12%        ~ (p=1.000 n=10)
ParsePAXTIme/ExactNanos-8         52.42n ±  2%   42.16n ±  3%  -19.57% (p=0.000 n=10)
ParsePAXTIme/WithNanoPadding-8    99.33n ±  2%   39.58n ±  2%  -60.16% (p=0.000 n=10)
ParsePAXTIme/WithNanoTruncate-8   54.78n ±  1%   43.64n ±  4%  -20.34% (p=0.000 n=10)
ParsePAXTIme/TrailingError-8      31.87n ±  4%   17.55n ±  2%  -44.94% (p=0.000 n=10)
ParsePAXTIme/LeadingError-8       31.03n ±  2%   15.81n ±  6%  -49.03% (p=0.000 n=10)

Change-Id: If05ef512137d0115db9cb6d3ab432335230628bb
GitHub-Last-Rev: 106d25e5cf
GitHub-Pull-Request: golang/go#73164
Reviewed-on: https://go-review.googlesource.com/c/go/+/662835
Auto-Submit: Michael Pratt <mpratt@google.com>
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>
2025-09-08 10:08:20 -07:00
Ian Lance Taylor
ea00650784 debug/pe: permit symbols with no name
They are reportedly generated by llvm-mingw clang21.

Fixes #75219

Change-Id: I7fa7e13039bc7eee826cc19826985ca0e357a9ff
Reviewed-on: https://go-review.googlesource.com/c/go/+/700137
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Quim Muntal <quimmuntal@gmail.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
2025-09-08 09:44:16 -07:00
Filippo Valsorda
4cc7cc74c3 crypto: update Hash comments to point to crypto/sha3
Updates #65269

Change-Id: I6a6a6964060f587ec8c918f16b7c776d47e91f5a
Reviewed-on: https://go-review.googlesource.com/c/go/+/701515
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2025-09-08 07:00:10 -07:00
Weerasak Chongnguluam
ff45d5d53c encoding/json/internal/jsonflags: fix comment with wrong field name
Flags struct has field Values but in the comments use Value.
Fix it to correct name Values.

Change-Id: Ib47e62538599a788c69fda27a7e2a97b8cf73263
Reviewed-on: https://go-review.googlesource.com/c/go/+/701415
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Joseph Tsai <joetsai@digital-static.net>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2025-09-08 07:00:06 -07:00
David Chase
832c1f76dc [dev.simd] cmd/compile: enhance prove to deal with double-offset IsInBounds checks
For chunked iterations (useful for, but not exclusive to,
SIMD calculations) it is common to see the combination of
```
for ; i <= len(m)-4; i += 4 {
```
and
```
r0, r1, r2, r3 := m[i], m[i+1], m[i+2], m[i+3]
``

Prove did not handle the case of len-offset1 vs index+offset2
checking, but this change fixes this.  There may be other
similar cases yet to handle -- this worked for the chunked
loops for simd, as well as a handful in std.

Change-Id: I3785df83028d517e5e5763206653b34b2befd3d0
Reviewed-on: https://go-review.googlesource.com/c/go/+/700696
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-07 03:20:39 -07:00
Junyang Shao
0b323350a5 [dev.simd] simd/_gen/simdgen: merge memory ops
This CL merges pure vreg ops with their memory variant(full vec and
broadcasting).

No changes on generated codes.

Change-Id: I362994c2620939d25c766abe0eff8f3db7f289ea
Reviewed-on: https://go-review.googlesource.com/c/go/+/700756
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-09-06 13:46:41 -07:00
Junyang Shao
f42c9261d3 [dev.simd] simd/_gen/simdgen: parse memory operands
This CL has no change in the generated code.

Change-Id: Iacb65b9b401503b8b44dd19d5f4cbced862572d3
Reviewed-on: https://go-review.googlesource.com/c/go/+/700675
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-06 13:46:36 -07:00
Alexander Yastrebov
861c90c907 net/http: pool transport gzip readers
goos: linux
goarch: amd64
pkg: net/http
             │   HEAD~1    │              HEAD              │
             │   sec/op    │    sec/op     vs base          │
ClientGzip-8   621.0µ ± 2%   616.3µ ± 10%  ~ (p=0.971 n=10)

             │    HEAD~1     │                 HEAD                 │
             │     B/op      │     B/op      vs base                │
ClientGzip-8   49.765Ki ± 0%   9.514Ki ± 2%  -80.88% (p=0.000 n=10)

             │   HEAD~1   │               HEAD                │
             │ allocs/op  │ allocs/op   vs base               │
ClientGzip-8   57.00 ± 0%   52.00 ± 0%  -8.77% (p=0.000 n=10)

Allocation saving comes from absent compress/flate.(*dictDecoder).init

This change also improves concurrent body read detection by returning an explicit error.

Updates #61353

Change-Id: I380acfca912dc009b3b9c8283e27b3526cedd546
GitHub-Last-Rev: df12f6a48af4854ba686fe431a9aeb6d9ba3c303
GitHub-Pull-Request: golang/go#61390
Reviewed-on: https://go-review.googlesource.com/c/go/+/510255
Reviewed-by: Sean Liao <sean@liao.dev>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-09-06 03:00:56 -07:00
Richard Miller
57769b5532 os: reject OpenDir of a non-directory file in Plan 9
Check that the path argument to OpenDir in Plan 9 is a directory,
and return error syscall.ENOTDIR if it is not.

Fixes #75196

Change-Id: I3bec6b6b40a38c21264b5d22ff3e7dfbf8c1c6d7
Reviewed-on: https://go-review.googlesource.com/c/go/+/700855
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: David du Colombier <0intro@gmail.com>
2025-09-06 02:24:38 -07:00
database64128
a6144613d3 crypto/tls: use context.AfterFunc in handshakeContext
This saves a goroutine when ctx can be canceled but is not canceled
during the handshakeContext call.

Use ctx consistently, because in this path (c.quic == nil) handshakeCtx
will only be canceled when ctx is canceled.

Change-Id: I7f4565119f30d589dce026b0d7ef3c324220525a
Reviewed-on: https://go-review.googlesource.com/c/go/+/699895
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-09-06 02:20:36 -07:00
Guoqi Chen
e8126bce9e runtime/cgo: save and restore R31 for crosscall1 on loong64
According to the Loong64 procedure call standard [1], R31 is a static
register and therefore needs to be saved and restored.

Also, the R2 (thread pointer) register has been removed here, as it is
not involved in allocation.

[1]: https://github.com/loongson/la-abi-specs/blob/release/lapcs.adoc

Change-Id: I02e5d4bedf131e491f1a262aa3cbc0896cbc9488
Reviewed-on: https://go-review.googlesource.com/c/go/+/700817
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-09-05 18:11:42 -07:00
Jake Bailey
d767064170 cmd/compile: mark abi.PtrType.Elem sym as used
CL 700336 let the compiler see into the abi.PtrType.Elem field,
but forgot the MarkTypeSymUsedInInterface to ensure that the symbol
is marked as referenced.

I am not sure how to write a test for this, but I noticed this when
working on further optimizations where I "fixed" this issue and
confusingly failed toolstash -cmp, with diffs like:

@@ -70582,6 +70582,7 @@ reflect.groupAndSlotOf<1> STEXT size=696 args=0x20 locals=0x1e0 funcid=0x0 align
 	rel 3+0 t=R_USEIFACE type:*reflect.rtype<0>+0
 	rel 3+0 t=R_USEIFACE type:*reflect.rtype<0>+0
 	rel 3+0 t=R_USEIFACE type:*uint64<0>+0
+	rel 3+0 t=R_USEIFACE type:uint64<0>+0
 	rel 71+0 t=R_CALLIND +0
 	rel 92+4 t=R_PCREL go:itab.*reflect.rtype,reflect.Type<0>+0
 	rel 114+4 t=R_CALL reflect.(*rtype).ptrTo<1>+0

Updates #75203

Change-Id: Ib8de8a32aeb8a7ea6fcf5d728a2e4944ef227ab2
Reviewed-on: https://go-review.googlesource.com/c/go/+/701296
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Keith Randall <khr@google.com>
2025-09-05 13:52:20 -07:00
Cherry Mui
356c48d8e9 [dev.simd] cmd/compile, simd: add ClearAVXUpperBits
Intended for transitioning from AVX to SSE, this helps early
adopters benchmarking. The compiler should take care of that,
one day.

Change-Id: I9d7413f22f30f8dc0c632e8e806386d9ca8e8308
Reviewed-on: https://go-review.googlesource.com/c/go/+/701199
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: David Chase <drchase@google.com>
2025-09-05 10:19:03 -07:00
Alan Donovan
0b1eed09a3 vendor/golang.org/x/tools: update to a09a2fb
Notably, this includes unitchecker's -fix flag.

Also, fix one vet test that failed due to new diagnostic wording.

Change-Id: I87751083dcd9cc4b1d8dce7d54bb796c745436d0
Reviewed-on: https://go-review.googlesource.com/c/go/+/701195
Reviewed-by: 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>
2025-09-05 09:33:49 -07:00
Xiaolin Zhao
f5b20689e9 cmd/compile: optimize loads from readonly globals into constants on loong64
Ref: CL 141118
Update #26498

Change-Id: I9c4ad2bedc4d50bd273bbe9119a898d4fca95e45
Reviewed-on: https://go-review.googlesource.com/c/go/+/700875
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-05 08:42:28 -07:00
Xiaolin Zhao
3492e4262b cmd/compile: simplify specific addition operations using the ADDV16 instruction
On loong64, the addi.d instruction can only directly handle 12-bit
immediate numbers. If a larger immediate number needs to be processed,
it must first be placed in a register, and then the add.d instruction
is used to complete the processing of the larger immediate number.
If a larger immediate number c satisfies is32Bit(c) && c&0xffff == 0,
then the ADDV16 instruction can be used to complete the addition operation.

Removes 164 instructions from the go binary on loong64.

Change-Id: I404de93cc4eaaa12fe424f5a0d61b03231215d1a
Reviewed-on: https://go-review.googlesource.com/c/go/+/700536
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-09-05 08:18:04 -07:00
qiulaidongfeng
459b85ccaa cmd/fix: remove all functionality except for buildtag
For #73605

Change-Id: I4b46b5eb72471c215f2cc208c1b0cdd1fbdbf81a
Reviewed-on: https://go-review.googlesource.com/c/go/+/695855
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
2025-09-05 08:15:02 -07:00
Tobias Klauser
87e72769fa runtime: simplify openbsd check in usesLibcall and mStackIsSystemAllocated
The openbsd/mips64 runtime code was removed in CL 649659.

For #61546

Change-Id: I03f16c3396baddb0ee9aa751dd6f699a835e7586
Reviewed-on: https://go-review.googlesource.com/c/go/+/700976
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Joel Sing <joel@sing.id.au>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-05 08:11:42 -07:00
Julian Zhu
bb48272e24 cmd/compile: simplify zerorange on mips64
Change-Id: I488b55a21eaaf74373c2789a34bf9b3945ced072
Reviewed-on: https://go-review.googlesource.com/c/go/+/700936
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
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>
2025-09-05 08:06:50 -07:00
Tobias Klauser
d52a56cce1 cmd/link/internal/ld: unconditionally use posix_fallocate on FreeBSD
Now that Go 1.24 is the minimum bootstrap toolchain we can drop the
version dependent use of posix_fallocate on FreeBSD.

For #69315

Change-Id: Ie0c7ca67e3c21138d690e1e11a12172d52619493
Reviewed-on: https://go-review.googlesource.com/c/go/+/699735
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2025-09-05 06:41:24 -07:00
Nicholas S. Husin
9d0829963c net/http: fix cookie value of "" being interpreted as empty string.
In issue #46443, we have established that double-quotes in cookie values
should be kept as part of the value, rather than being discarded.
However, we have missed the edge case of "" until now. This CL fixes
said edge case.

Fixes #75244

Change-Id: I627ad2376931514aa5dcc8961ad804e42b7d9434
Reviewed-on: https://go-review.googlesource.com/c/go/+/700755
Reviewed-by: Nicholas Husin <husin@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Nicholas Husin <husin@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
2025-09-04 14:56:13 -07:00
Xiaolin Zhao
ddce0522be cmd/internal/obj/loong64: add ADDU16I.D instruction support
Go asm syntax:
	ADDV16		$(1<<16), R4, R5

Equivalent platform assembler syntax:
	addu16i.d	r5, r4, $1

Change-Id: Ica4a4e779d0a107cda3eade86027abd6458779a4
Reviewed-on: https://go-review.googlesource.com/c/go/+/699056
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
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: Cherry Mui <cherryyz@google.com>
2025-09-04 12:24:25 -07:00
Michael Anthony Knyszek
00b8474e47 cmd/trace: don't filter events for profile by whether they have stack
Right now the profile-from-trace code blindly discards events that don't
have a stack, but this means it can discard 'end' events for goroutine
time ranges that don't have stacks, like when a goroutine exits a
syscall. This means we drop stack samples we *do* have, because we
correctly already only use the stack trace of the corresponding 'start'
event for a time-range-of-interest anyway.

This change means that some events will be tracked that have no stack in
their start event, but that's fine. It won't end up in the profile
anyway because the stack is empty! And the rest of the code appears to
be robust to an empty stack already.

Thank you to Rhys Hiltner for reporting this issue and for the
reproducer, which I have worked into a test for this change.

Fixes #74850.

Change-Id: I943b97ecf6b82803e4a778a0f83a14473d32254e
Reviewed-on: https://go-review.googlesource.com/c/go/+/694156
Reviewed-by: Rhys Hiltner <rhys.hiltner@gmail.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2025-09-04 11:12:32 -07:00
Jes Cok
e36c5aead6 log/slog: add multiple handlers support for logger
Fixes #65954

Change-Id: Ib01c6f47126ce290108b20c07479c82ef17c427c
GitHub-Last-Rev: 34a36ea4bf
GitHub-Pull-Request: golang/go#74840
Reviewed-on: https://go-review.googlesource.com/c/go/+/692237
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
2025-09-04 11:07:44 -07:00
Mateusz Poliwczak
150fae714e crypto/x509: don't force system roots load in SetFallbackRoots
This change removes the need from SetFallbackRoots to force loading
of all system CAs, it postpones that to initSystemRoots.

This change also introduces few tests for SetFallbackRoots (linux only),
with the use of user and mount namespaces, such that we can control
the system CAs in the test.

Updates #73691

Change-Id: Ic37270f7825b96d5c3ed8358bbf1895a760a1312
Reviewed-on: https://go-review.googlesource.com/c/go/+/677496
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
2025-09-04 10:20:54 -07:00
limeidan
4f7bbc62c7 runtime, cmd/compile, cmd/internal/obj: remove duff support for loong64
Change-Id: I44d6452933c8010f7dfbf821a32053f9d1cf151e
Reviewed-on: https://go-review.googlesource.com/c/go/+/700096
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
2025-09-04 09:24:12 -07:00
Xiaolin Zhao
b8cc907425 cmd/internal/obj/loong64: fix the usage of offset in the instructions [X]VLDREPL.{B/H/W/D}
The previously defined usage of offset was ambiguous and not easy to understand.
For example, to fetch 4 bytes of data from the address base+8 and
broadcast it to each word element of vector register V5, the assembly
implementation is as follows:
	previous: VMOVQ 2(base), V5.W4
	current:  VMOVQ 8(base), V5.W4

Change-Id: I8bc84e35033ab63bd10f4c61618789f94314f78c
Reviewed-on: https://go-review.googlesource.com/c/go/+/699875
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-04 09:22:33 -07:00
Julien Cretel
8c27a80890 path{,/filepath}: speed up Match
This change adds benchmarks for Match and speeds it up by simplifying
scanChunk (to the point of making it inlineable) and eliminating some
branches in matchChunk.

Here are some benchmark results (no change to allocations):

goos: darwin
goarch: amd64
pkg: path
cpu: Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
                                          │     old      │                 new2                 │
                                          │    sec/op    │    sec/op     vs base                │
Match/"abc"_"abc"-8                          24.64n ± 6%   21.30n ±  1%  -13.53% (p=0.000 n=10)
Match/"*"_"abc"-8                            9.117n ± 3%   8.345n ±  2%   -8.47% (p=0.000 n=10)
Match/"*c"_"abc"-8                           29.59n ± 3%   29.86n ±  3%        ~ (p=0.055 n=10)
Match/"a*"_"a"-8                             22.88n ± 2%   20.66n ±  1%   -9.68% (p=0.000 n=10)
Match/"a*"_"abc"-8                           23.57n ± 1%   21.59n ±  0%   -8.40% (p=0.000 n=10)
Match/"a*"_"ab/c"-8                          23.18n ± 1%   21.48n ±  1%   -7.35% (p=0.000 n=10)
Match/"a*/b"_"abc/b"-8                       54.96n ± 1%   52.06n ±  0%   -5.29% (p=0.000 n=10)
Match/"a*/b"_"a/c/b"-8                       34.50n ± 3%   31.42n ±  2%   -8.91% (p=0.000 n=10)
Match/"a*b*c*d*e*/f"_"axbxcxdxe/f"-8         125.4n ± 1%   114.9n ±  1%   -8.45% (p=0.000 n=10)
Match/"a*b*c*d*e*/f"_"axbxcxdxexxx/f"-8      151.1n ± 1%   149.4n ±  1%   -1.09% (p=0.001 n=10)
Match/"a*b*c*d*e*/f"_"axbxcxdxe/xxx/f"-8     127.8n ± 4%   115.6n ±  3%   -9.51% (p=0.000 n=10)
Match/"a*b*c*d*e*/f"_"axbxcxdxexxx/fff"-8    155.6n ± 1%   168.0n ± 11%        ~ (p=0.143 n=10)
Match/"a*b?c*x"_"abxbbxdbxebxczzx"-8         189.2n ± 1%   193.5n ±  6%        ~ (p=1.000 n=10)
Match/"a*b?c*x"_"abxbbxdbxebxczzy"-8         196.3n ± 1%   190.6n ±  2%   -2.93% (p=0.001 n=10)
Match/"ab[c]"_"abc"-8                        39.50n ± 1%   37.84n ±  1%   -4.20% (p=0.000 n=10)
Match/"ab[b-d]"_"abc"-8                      47.94n ± 1%   45.99n ±  1%   -4.06% (p=0.000 n=10)
Match/"ab[e-g]"_"abc"-8                      49.48n ± 1%   47.57n ±  1%   -3.85% (p=0.000 n=10)
Match/"ab[^c]"_"abc"-8                       41.55n ± 1%   38.01n ±  2%   -8.51% (p=0.000 n=10)
Match/"ab[^b-d]"_"abc"-8                     50.48n ± 1%   46.35n ±  0%   -8.17% (p=0.000 n=10)
Match/"ab[^e-g]"_"abc"-8                     50.12n ± 3%   47.37n ±  2%   -5.47% (p=0.000 n=10)
Match/"a\\*b"_"a*b"-8                        24.59n ± 0%   21.77n ±  1%  -11.47% (p=0.000 n=10)
Match/"a\\*b"_"ab"-8                         26.14n ± 1%   24.52n ±  3%   -6.18% (p=0.000 n=10)
Match/"a?b"_"a☺b"-8                          25.66n ± 2%   23.40n ±  1%   -8.81% (p=0.000 n=10)
Match/"a[^a]b"_"a☺b"-8                       41.14n ± 0%   38.97n ±  3%   -5.29% (p=0.001 n=10)
Match/"a???b"_"a☺b"-8                        39.66n ± 6%   36.63n ±  6%   -7.63% (p=0.003 n=10)
Match/"a[^a][^a][^a]b"_"a☺b"-8               85.07n ± 8%   84.97n ±  1%        ~ (p=0.971 n=10)
Match/"[a-ζ]*"_"α"-8                         49.45n ± 4%   48.34n ±  2%   -2.23% (p=0.001 n=10)
Match/"*[a-ζ]"_"A"-8                         67.67n ± 3%   70.53n ±  2%   +4.23% (p=0.000 n=10)
Match/"a?b"_"a/b"-8                          26.61n ± 5%   25.92n ±  1%   -2.59% (p=0.000 n=10)
Match/"a*b"_"a/b"-8                          29.38n ± 3%   26.61n ±  2%   -9.46% (p=0.000 n=10)
Match/"[\\]a]"_"]"-8                         40.75n ± 3%   39.31n ±  2%   -3.52% (p=0.000 n=10)
Match/"[\\-]"_"-"-8                          30.58n ± 1%   30.53n ±  2%        ~ (p=0.565 n=10)
Match/"[x\\-]"_"x"-8                         41.02n ± 2%   39.32n ±  1%   -4.13% (p=0.000 n=10)
Match/"[x\\-]"_"-"-8                         40.74n ± 2%   39.82n ±  1%   -2.25% (p=0.000 n=10)
Match/"[x\\-]"_"z"-8                         42.19n ± 1%   40.47n ±  1%   -4.08% (p=0.001 n=10)
Match/"[\\-x]"_"x"-8                         40.77n ± 1%   39.61n ±  3%   -2.86% (p=0.000 n=10)
Match/"[\\-x]"_"-"-8                         40.94n ± 2%   39.39n ±  0%   -3.79% (p=0.000 n=10)
Match/"[\\-x]"_"a"-8                         42.12n ± 2%   42.11n ±  1%        ~ (p=0.954 n=10)
Match/"[]a]"_"]"-8                           23.73n ± 2%   21.67n ±  2%   -8.72% (p=0.000 n=10)
Match/"[-]"_"-"-8                            21.28n ± 1%   19.96n ±  1%   -6.16% (p=0.000 n=10)
Match/"[x-]"_"x"-8                           28.96n ± 1%   27.98n ±  3%   -3.37% (p=0.000 n=10)
Match/"[x-]"_"-"-8                           29.46n ± 2%   29.27n ±  7%        ~ (p=0.796 n=10)
Match/"[x-]"_"z"-8                           29.14n ± 0%   30.78n ±  9%        ~ (p=0.468 n=10)
Match/"[-x]"_"x"-8                           23.62n ± 3%   22.08n ±  1%   -6.54% (p=0.000 n=10)
Match/"[-x]"_"-"-8                           23.70n ± 2%   22.11n ±  2%   -6.69% (p=0.000 n=10)
Match/"[-x]"_"a"-8                           23.71n ± 0%   22.09n ±  3%   -6.83% (p=0.000 n=10)
Match/"\\"_"a"-8                            11.845n ± 2%   9.496n ±  3%  -19.83% (p=0.000 n=10)
Match/"[a-b-c]"_"a"-8                        39.85n ± 1%   40.69n ±  1%   +2.10% (p=0.000 n=10)
Match/"["_"a"-8                              18.57n ± 3%   16.47n ±  3%  -11.33% (p=0.000 n=10)
Match/"[^"_"a"-8                             20.30n ± 3%   17.96n ±  1%  -11.53% (p=0.000 n=10)
Match/"[^bc"_"a"-8                           36.81n ± 7%   32.87n ±  2%  -10.72% (p=0.000 n=10)
Match/"a["_"a"-8                             20.11n ± 1%   19.41n ±  1%   -3.46% (p=0.000 n=10)
Match/"a["_"ab"-8                            23.19n ± 2%   21.80n ±  1%   -6.02% (p=0.000 n=10)
Match/"a["_"x"-8                             20.79n ± 1%   19.51n ±  1%   -6.13% (p=0.000 n=10)
Match/"a/b["_"x"-8                           29.80n ± 0%   28.36n ±  0%   -4.82% (p=0.000 n=10)
Match/"*x"_"xxx"-8                           30.77n ± 2%   28.55n ±  2%   -7.23% (p=0.000 n=10)
geomean                                      37.11n        35.15n         -5.29%

pkg: path/filepath
                                          │      old      │                new2                 │
                                          │    sec/op     │   sec/op     vs base                │
Match/"abc"_"abc"-8                          22.79n ±  3%   21.62n ± 1%   -5.11% (p=0.000 n=10)
Match/"*"_"abc"-8                           11.410n ±  3%   9.595n ± 1%  -15.91% (p=0.000 n=10)
Match/"*c"_"abc"-8                           29.69n ±  2%   29.09n ± 0%   -2.00% (p=0.001 n=10)
Match/"a*"_"a"-8                             23.69n ±  1%   21.12n ± 1%  -10.83% (p=0.000 n=10)
Match/"a*"_"abc"-8                           25.38n ±  4%   22.41n ± 5%  -11.70% (p=0.000 n=10)
Match/"a*"_"ab/c"-8                          24.73n ±  1%   21.85n ± 3%  -11.65% (p=0.000 n=10)
Match/"a*/b"_"abc/b"-8                       53.73n ±  2%   53.30n ± 2%   -0.82% (p=0.037 n=10)
Match/"a*/b"_"a/c/b"-8                       32.97n ±  2%   31.64n ± 0%   -4.02% (p=0.000 n=10)
Match/"a*b*c*d*e*/f"_"axbxcxdxe/f"-8         120.7n ±  0%   124.0n ± 1%   +2.82% (p=0.000 n=10)
Match/"a*b*c*d*e*/f"_"axbxcxdxexxx/f"-8      149.4n ±  2%   160.0n ± 6%   +7.13% (p=0.009 n=10)
Match/"a*b*c*d*e*/f"_"axbxcxdxe/xxx/f"-8     121.8n ±  2%   122.8n ± 9%        ~ (p=0.898 n=10)
Match/"a*b*c*d*e*/f"_"axbxcxdxexxx/fff"-8    149.7n ±  1%   151.2n ± 2%   +1.04% (p=0.005 n=10)
Match/"a*b?c*x"_"abxbbxdbxebxczzx"-8         187.8n ±  1%   184.8n ± 1%   -1.57% (p=0.001 n=10)
Match/"a*b?c*x"_"abxbbxdbxebxczzy"-8         195.6n ±  1%   191.2n ± 2%   -2.22% (p=0.018 n=10)
Match/"ab[c]"_"abc"-8                        40.30n ±  4%   37.31n ± 3%   -7.41% (p=0.000 n=10)
Match/"ab[b-d]"_"abc"-8                      47.92n ±  4%   45.92n ± 4%   -4.17% (p=0.002 n=10)
Match/"ab[e-g]"_"abc"-8                      47.58n ±  4%   45.22n ± 0%   -4.98% (p=0.000 n=10)
Match/"ab[^c]"_"abc"-8                       40.33n ±  2%   36.95n ± 2%   -8.38% (p=0.000 n=10)
Match/"ab[^b-d]"_"abc"-8                     48.68n ±  2%   46.49n ± 3%   -4.50% (p=0.001 n=10)
Match/"ab[^e-g]"_"abc"-8                     49.11n ±  2%   48.42n ± 2%   -1.42% (p=0.014 n=10)
Match/"a\\*b"_"a*b"-8                        26.79n ±  9%   23.70n ± 1%  -11.53% (p=0.000 n=10)
Match/"a\\*b"_"ab"-8                         23.84n ± 11%   25.99n ± 1%   +9.02% (p=0.015 n=10)
Match/"a?b"_"a☺b"-8                          25.72n ±  2%   23.70n ± 1%   -7.87% (p=0.000 n=10)
Match/"a[^a]b"_"a☺b"-8                       41.72n ±  2%   39.24n ± 2%   -5.94% (p=0.000 n=10)
Match/"a???b"_"a☺b"-8                        35.94n ±  1%   35.30n ± 3%   -1.78% (p=0.009 n=10)
Match/"a[^a][^a][^a]b"_"a☺b"-8               82.17n ±  0%   84.56n ± 3%   +2.91% (p=0.000 n=10)
Match/"[a-ζ]*"_"α"-8                         52.01n ±  3%   49.78n ± 0%   -4.30% (p=0.000 n=10)
Match/"*[a-ζ]"_"A"-8                         65.62n ±  1%   66.91n ± 3%   +1.97% (p=0.000 n=10)
Match/"a?b"_"a/b"-8                          24.60n ±  2%   25.60n ± 1%   +4.07% (p=0.001 n=10)
Match/"a*b"_"a/b"-8                          28.00n ±  1%   26.50n ± 1%   -5.37% (p=0.000 n=10)
Match/"[\\]a]"_"]"-8                         40.72n ±  1%   39.55n ± 2%   -2.86% (p=0.002 n=10)
Match/"[\\-]"_"-"-8                          30.52n ±  2%   30.15n ± 1%   -1.18% (p=0.003 n=10)
Match/"[x\\-]"_"x"-8                         40.69n ±  1%   40.41n ± 2%        ~ (p=0.105 n=10)
Match/"[x\\-]"_"-"-8                         40.50n ±  2%   40.69n ± 2%        ~ (p=0.109 n=10)
Match/"[x\\-]"_"z"-8                         40.80n ±  3%   39.92n ± 2%   -2.17% (p=0.002 n=10)
Match/"[\\-x]"_"x"-8                         40.73n ±  2%   43.78n ± 5%   +7.49% (p=0.003 n=10)
Match/"[\\-x]"_"-"-8                         40.86n ±  2%   39.58n ± 9%        ~ (p=0.105 n=10)
Match/"[\\-x]"_"a"-8                         40.67n ±  0%   40.85n ± 3%        ~ (p=0.288 n=10)
Match/"[]a]"_"]"-8                           22.71n ±  1%   20.35n ± 2%  -10.37% (p=0.000 n=10)
Match/"[-]"_"-"-8                            20.98n ±  2%   19.71n ± 2%   -6.10% (p=0.000 n=10)
Match/"[x-]"_"x"-8                           30.78n ±  1%   26.29n ± 1%  -14.56% (p=0.000 n=10)
Match/"[x-]"_"-"-8                           30.79n ±  2%   26.38n ± 3%  -14.29% (p=0.000 n=10)
Match/"[x-]"_"z"-8                           30.77n ±  0%   26.47n ± 1%  -13.97% (p=0.000 n=10)
Match/"[-x]"_"x"-8                           23.73n ±  1%   21.08n ± 1%  -11.19% (p=0.000 n=10)
Match/"[-x]"_"-"-8                           23.68n ±  1%   21.11n ± 3%  -10.81% (p=0.000 n=10)
Match/"[-x]"_"a"-8                           23.74n ±  3%   21.04n ± 0%  -11.37% (p=0.000 n=10)
Match/"\\"_"a"-8                             11.57n ±  0%   10.35n ± 0%  -10.63% (p=0.000 n=10)
Match/"[a-b-c]"_"a"-8                        42.46n ±  1%   38.97n ± 3%   -8.23% (p=0.000 n=10)
Match/"["_"a"-8                              18.03n ±  7%   15.95n ± 1%  -11.51% (p=0.000 n=10)
Match/"[^"_"a"-8                             19.20n ± 11%   17.96n ± 3%   -6.41% (p=0.000 n=10)
Match/"[^bc"_"a"-8                           32.82n ±  3%   32.34n ± 0%   -1.45% (p=0.000 n=10)
Match/"a["_"a"-8                             19.48n ±  2%   19.48n ± 2%        ~ (p=0.670 n=10)
Match/"a["_"ab"-8                            22.19n ±  3%   22.09n ± 1%        ~ (p=0.148 n=10)
Match/"a["_"x"-8                             20.32n ±  3%   19.66n ± 1%   -3.27% (p=0.001 n=10)
Match/"a/b["_"x"-8                           28.68n ±  1%   28.52n ± 1%        ~ (p=0.315 n=10)
Match/"*x"_"xxx"-8                           29.95n ±  3%   29.27n ± 3%   -2.27% (p=0.006 n=10)
geomean                                      36.76n         35.10n        -4.51%

Change-Id: I02d07b7a066e5789587035180fa15ae07a9579a6
GitHub-Last-Rev: 8b314b4309
GitHub-Pull-Request: golang/go#75211
Reviewed-on: https://go-review.googlesource.com/c/go/+/700315
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Kirill Kolyshkin <kolyshkin@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-04 09:19:45 -07:00
aimuz
b7c20413c5 runtime: remove obsolete osArchInit function
The osArchInit function was introduced as a workaround for a Linux kernel bug
that corrupted vector registers on x86 CPUs during signal delivery.
The bug was introduced in Linux 5.2 and fixed in 5.3.15, 5.4.2, and all 5.5 and later kernels.
The fix was also back-ported by major distros.

Change-Id: I59990a7df104843955301c5cb8a547614eba145b
GitHub-Last-Rev: 8425af458b
GitHub-Pull-Request: golang/go#75246
Reviewed-on: https://go-review.googlesource.com/c/go/+/700555
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
2025-09-04 07:30:42 -07:00
Youlin Feng
df29038486 cmd/compile/internal/ssa: load constant values from abi.PtrType.Elem
This CL makes the generated code for reflect.TypeFor as simple as an
intrinsic function.

Fixes #75203

Change-Id: I7bb48787101f07e77ab5c583292e834c28a028d6
Reviewed-on: https://go-review.googlesource.com/c/go/+/700336
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: Michael Pratt <mpratt@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
2025-09-04 07:25:26 -07:00
Michael Munday
4373754bc9 cmd/compile: add store to load forwarding rules on riscv64
Adds the equivalent integer variants of the floating point rules
added in CL 599235.

Change-Id: Ibe03c26383059821d99cea2337799e6416b4c581
Reviewed-on: https://go-review.googlesource.com/c/go/+/700175
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Julian Zhu <jz531210@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2025-09-04 07:24:05 -07:00
Alessandro Arzilli
80038586ed cmd/compile: export to DWARF types only referenced through interfaces
Delve and viewcore use DWARF type DIEs to display and explore the
runtime value of interface variables.
This has always been slightly problematic since the runtime type of an
interface variable might only be reachable through interfaces and thus
be missing from debug_info (see issue #46670).
Prior to commit f4de2ecf this was not a severe problem since a struct
literal caused the allocation of a struct into an autotemp variable,
which was then used by dwarfgen to make sure that the DIE for that type
would be generated.
After f4de2ecf such autotemps are no longer being generated and
go1.25.0 ends up having many more instances of interfaces with
unreadable runtime type  (https://github.com/go-delve/delve/issues/4080).
This commit fixes this problem by scanning the relocation of the
function symbol and adding to the function's DIE symbol references to
all types used by the function to create interfaces.

Fixes go-delve/delve#4080
Updates #46670

Change-Id: I3e9db1c0d1662905373239816a72604ac533b09e
Reviewed-on: https://go-review.googlesource.com/c/go/+/696955
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Than McIntosh <thanm@golang.org>
Reviewed-by: Florian Lehner <lehner.florian86@gmail.com>
2025-09-03 15:13:15 -07:00
limeidan
91e76a513b cmd/compile: use generated loops instead of DUFFCOPY on loong64
Change-Id: If9da2b5681e5d05d7c3d51f003f1fe662d3feaec
Reviewed-on: https://go-review.googlesource.com/c/go/+/699855
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-09-03 15:11:55 -07:00
Xiaolin Zhao
c552ad913f cmd/compile: simplify memory load and store operations on loong64
If the memory load and store operations use the same ptr, they are
combined into a direct move operation between registers, like riscv64.

Change-Id: I889e51a5146aee7f15340114bc4abd12eb6b8a1f
Reviewed-on: https://go-review.googlesource.com/c/go/+/700535
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
2025-09-03 15:10:19 -07:00
database64128
e8f9127d1f net/netip: export Prefix.Compare, fix ordering
Fixes #61642

Co-authored-by: David Anderson <dave@natulte.net>
Change-Id: I54795763bdc5f62da469c2ae20618c36b64396f3
Reviewed-on: https://go-review.googlesource.com/c/go/+/700355
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-09-03 15:10:15 -07:00
Xiaolin Zhao
731e546166 cmd/compile: simplify the support for 32bit high multiply on loong64
Removes 152 instructions from the Go binary on loong64.

Change-Id: Icf8ead4f4ca965f51add85ac5e45c3cca8916401
Reviewed-on: https://go-review.googlesource.com/c/go/+/700335
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
2025-09-03 15:07:48 -07:00
Cherry Mui
7c8b9115bc [dev.simd] all: merge master (4c4cefc) into dev.simd
Merge List:

+ 2025-09-03 4c4cefc19a cmd/gofmt: simplify logic to process arguments
+ 2025-09-03 925a3cdcd1 unicode/utf8: make DecodeRune{,InString} inlineable
+ 2025-09-03 3e596d448f math: rename Modf parameter int to integer
+ 2025-09-02 2a7f1d47b0 runtime: use one more address bit for tagged pointers
+ 2025-09-02 b09068041a cmd/dist: run racebench tests only in longtest mode
+ 2025-09-02 355370ac52 runtime: add comment for concatstring2
+ 2025-09-02 1eec830f54 go/doc: linkify interface methods
+ 2025-08-31 7bba745820 cmd/compile: use generated loops instead of DUFFZERO on loong64
+ 2025-08-31 882335e2cb cmd/internal/obj/loong64: add LDPTR.{W/D} and STPTR.{W/D} instructions support
+ 2025-08-31 d4b17f5869 internal/runtime/atomic: reset wrong jump target in Cas{,64} on loong64
+ 2025-08-31 6a08e80399 net/http: skip redirecting in ServeMux when URL path for CONNECT is empty
+ 2025-08-29 8bcda6c79d runtime/race: add race detector support for linux/riscv64
+ 2025-08-29 8377adafc5 cmd/cgo: split loadDWARF into two parts
+ 2025-08-29 a7d9d5a80a cmd/cgo: move typedefs and typedefList out of Package
+ 2025-08-29 1d459c4357 all: delete more windows/arm remnants
+ 2025-08-29 27ce6e4e26 cmd/compile: remove sign extension before MULW on riscv64
+ 2025-08-29 84b070bfb1 cmd/compile/internal/ssa: make oneBit function generic
+ 2025-08-29 fe42628dae internal/cpu: inline DebugOptions
+ 2025-08-29 94b7d519bd net: update document on limitation of iprawsock on Windows
+ 2025-08-29 ba9e1ddccf testing: allow specify temp dir by GOTMPDIR environment variable
+ 2025-08-29 9f6936b8da cmd/link: disallow linkname of runtime.addmoduledata
+ 2025-08-29 89d41d254a bytes, strings: speed up TrimSpace
+ 2025-08-29 38204e0872 testing/synctest: call out common issues with tests
+ 2025-08-29 252c901125 os,syscall: pass file flags to CreateFile on Windows
+ 2025-08-29 53515fb0a9 crypto/tls: use hash.Cloner
+ 2025-08-28 13bb48e6fb go/constant: fix complex != unknown comparison
+ 2025-08-28 ba1109feb5 net: remove redundant cgoLookupCNAME return parameter
+ 2025-08-28 f74ed44ed9 net/http/httputil: remove redundant pw.Close() call in DumpRequestOut
+ 2025-08-28 a9689d2e0b time: skip TestLongAdjustTimers in short mode on single CPU systems
+ 2025-08-28 ebc763f76d syscall: only get parent PID if SysProcAttr.Pdeathsig is set
+ 2025-08-28 7f1864b0a8 strings: remove redundant "runs" from string.Fields docstring
+ 2025-08-28 90c21fa5b6 net/textproto: eliminate some bounds checks
+ 2025-08-27 e47d88beae os: return nil slice when ReadDir is used with a file on file_windows
+ 2025-08-27 6b837a64db cmd/internal/obj/loong64: simplify buildop
+ 2025-08-27 765905e3bd debug/elf: don't panic if symtab too small
+ 2025-08-27 2ee4b31242 net/http: Ensure that CONNECT proxied requests respect MaxResponseHeaderBytes
+ 2025-08-27 b21867b1a2 net/http: require exact match for CrossSiteProtection bypass patterns
+ 2025-08-27 d19e377f6e cmd/cgo: make it safe to run gcc in parallel
+ 2025-08-27 49a2f3ed87 net: allow zero value destination address in WriteMsgUDPAddrPort
+ 2025-08-26 afc51ed007 internall/poll: remove bufs field from Windows' poll.operation
+ 2025-08-26 801b74eb95 internal/poll: remove rsa field from Windows' poll.operation
+ 2025-08-26 fa18c547cd syscall: sort Windows env block in StartProcess
+ 2025-08-26 bfd130db02 internal/poll: don't use stack-allocated WSAMsg parameters
+ 2025-08-26 dae9e456ae runtime: identify virtual memory layout for riscv64
+ 2025-08-25 25c2d4109f math: use Trunc to implement Modf
+ 2025-08-25 4e05a070c4 math: implement IsInf using Abs
+ 2025-08-25 1eed4f32a0 math: optimize Signbit implementation slightly
+ 2025-08-25 bd71b94659 cmd/compile/internal: optimizing add+sll rule using ALSLV instruction on loong64
+ 2025-08-25 ea55ca3600 runtime: skip doInit of plugins in runtime.main
+ 2025-08-25 9ae2f1fb57 internal/trace: skip async preempt off tests on low end systems
+ 2025-08-25 bbd5342a62 net: fix cgoResSearch
+ 2025-08-25 ed7f804775 os: set full name for Roots created with Root.OpenRoot
+ 2025-08-25 a21249436b internal/poll: use fdMutex to provide read/write locking on Windows
+ 2025-08-24 44c5956bf7 test/codegen: add Mul2 and DivPow2 test for loong64
+ 2025-08-24 0aa8019e94 test/codegen: add Mul* test for loong64
+ 2025-08-24 83420974b7 test/codegen: add sqrt* abs and copysign test for loong64
+ 2025-08-23 f2db0dca0b net/http/httptest: redirect example.com requests to server
+ 2025-08-22 d86ec92499 internal/syscall/windows: increase internal Windows O_ flags values
+ 2025-08-22 9d3f7fda70 crypto/tls: fix quic comment typo
+ 2025-08-22 78a05c541f internal/poll: don't pass non-nil WSAMsg.Name with 0 namelen on windows
+ 2025-08-22 52c3f73fda runtime/metrics: improve doc
+ 2025-08-22 a076f49757 os: fix Root.MkdirAll to handle race of directory creation
+ 2025-08-22 98238fd495 all: delete remaining windows/arm code
+ 2025-08-21 1ad30844d9 cmd/asm: process forward jump to PCALIGN
+ 2025-08-21 13c082601d internal/poll: permit nil destination address in WriteMsg{Inet4,Inet6}
+ 2025-08-21 9b0a507735 runtime: remove remaining windows/arm files and comments
+ 2025-08-21 1843f1e9c0 cmd/compile: use zero register instead of specialized *zero instructions on loong64
+ 2025-08-21 e0870a0a12 cmd/compile: simplify zerorange on loong64
+ 2025-08-21 fb8bbe46d5 cmd/compile/internal/ssa: eliminate unnecessary extension operations
+ 2025-08-21 9632ba8160 cmd/compile: optimize some patterns into revb2h/revb4h instruction on loong64
+ 2025-08-21 8dcab6f450 syscall: simplify execve handling on libc platforms
+ 2025-08-21 ba840c1bf9 cmd/compile: deduplication in the source code generated by mknode
+ 2025-08-21 fa706ea50f cmd/compile: optimize rule (x + x) << c to x << c+1 on loong64
+ 2025-08-21 ffc85ee1f1 cmd/internal/objabi,cmd/link: add support for additional riscv64 relocations

Change-Id: I3896f74b1a3cc0a52b29ca48767bb0ba84620f71
2025-09-03 11:19:43 -04:00
Daniel Martí
4c4cefc19a cmd/gofmt: simplify logic to process arguments
Rather than stat-ing each argument and taking different code paths
depending on whether it's a directory or not, we can leverage
the fact that filepath.WalkDir works on regular files and already
has to figure out whether each file it walks is a directory or not.

We can then implement "always format non-directory arguments"
by looking at whether the path we are walking is the original argument,
meaning we are walking the top file.

For full clarity, we expand the skipping logic with a switch,
as before it was a bit confusing how we could `return err`
on directories and other non-Go files.

Given that we discard directories separately now,
simplify isGoFile to just be about filenames.

While here, also note that we called AddReport inside WalkDir;
this is unnecessary, as we can return the error for the same effect.

Change-Id: I50ab94710143f19bd8dd95a69e01a3dd228e397e
Reviewed-on: https://go-review.googlesource.com/c/go/+/700115
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-03 07:26:07 -07:00
Julien Cretel
925a3cdcd1 unicode/utf8: make DecodeRune{,InString} inlineable
This change makes the fast path for ASCII characters inlineable in
DecodeRune and DecodeRuneInString and removes most instances of manual
inlining at call sites.

Here are some benchmark results (no change to allocations):

goos: darwin
goarch: amd64
pkg: unicode/utf8
cpu: Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
                             │     old      │                 new                  │
                             │    sec/op    │    sec/op     vs base                │
DecodeASCIIRune-8              2.4545n ± 2%   0.6253n ± 2%  -74.52% (p=0.000 n=20)
DecodeJapaneseRune-8            3.988n ± 1%    4.023n ± 1%   +0.86% (p=0.050 n=20)
DecodeASCIIRuneInString-8      2.4675n ± 1%   0.6264n ± 2%  -74.61% (p=0.000 n=20)
DecodeJapaneseRuneInString-8    3.992n ± 1%    4.001n ± 1%        ~ (p=0.625 n=20)
geomean                         3.134n         1.585n       -49.43%

Note: when #61502 gets resolved, DecodeRune and DecodeRuneInString should
be reverted to their idiomatic implementations.

Fixes #31666
Updates #48195

Change-Id: I4be25c4f52417dc28b3a7bd72f1b04018470f39d
GitHub-Last-Rev: 2e352a0045
GitHub-Pull-Request: golang/go#75181
Reviewed-on: https://go-review.googlesource.com/c/go/+/699675
Reviewed-by: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-09-03 07:04:47 -07:00
Michael Munday
3e596d448f math: rename Modf parameter int to integer
Avoid using int as a parameter name. Also, rename frac to
fractional for consistency.

Addresses comment on CL 694896:
https://go-review.googlesource.com/c/go/+/694896/comment/a9723a07_8352e3aa/

Change-Id: Icedeecf65ad2f51d4e8d5bcf6e64c0eae9885dec
Reviewed-on: https://go-review.googlesource.com/c/go/+/699035
Auto-Submit: Sean Liao <sean@liao.dev>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Joel Sing <joel@sing.id.au>
2025-09-03 06:50:43 -07:00
Keith Randall
2a7f1d47b0 runtime: use one more address bit for tagged pointers
We use one extra bit to placate systems which simulate amd64 binaries on
an arm64 host. Allocated arm64 addresses could be as high as 1<<48-1,
which would be invalid if we assumed 48-bit sign-extended addresses.

(Note that this does not help the other way around, simluating arm64
on amd64, but we don't have that problem at the moment.)

Fixes #69255

Change-Id: Iace17a5d41a65e34abf201d03d8b0ff6f7bf1150
Reviewed-on: https://go-review.googlesource.com/c/go/+/700515
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-09-02 16:27:43 -07:00
Michael Anthony Knyszek
b09068041a cmd/dist: run racebench tests only in longtest mode
The racebench tests represent a significant portion of the race
builders' runtimes, but these tests aren't providing a lot of value.
Disable them and run them only on -longtest-race builders.

For #32032.

Change-Id: Ic4383c3f3b51d123ae9f5c377bc0e2ec02f2ddd7
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-race,gotip-linux-amd64-longtest-race
Reviewed-on: https://go-review.googlesource.com/c/go/+/700455
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Bypass: Michael Knyszek <mknyszek@google.com>
2025-09-02 15:17:38 -07:00
Cherry Mui
9125351583 [dev.simd] internal/cpu: report AVX1 and 2 as supported on macOS 15 Rosetta 2
Apparently, on macOS 15 or newer, Rosetta 2 supports AVX1 and 2.
However, neither CPUID nor the Apple-recommended sysctl says it
has AVX. If AVX is used without checking the CPU feature, it may
run fine without SIGILL, but the runtime doesn't know AVX is
available therefore save and restore its states. This may lead to
value corruption.

Check if we are running under Rosetta 2 on macOS 15 or newer. If so,
report AVX1 and 2 as supported.

Change-Id: Ib981379405b1ae28faa378f051096827d760a4cc
Reviewed-on: https://go-review.googlesource.com/c/go/+/700055
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-09-02 14:17:26 -07:00
Youlin Feng
355370ac52 runtime: add comment for concatstring2
People always want to remove concatstring{2,3,4,5} for performance,
but we keep them to make the binary smaller. So, add a comment to
document why.

Updates #65020

Change-Id: I819976b700d45ce4d0846bf4481b2654b85708da
Reviewed-on: https://go-review.googlesource.com/c/go/+/700095
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
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>
2025-09-02 13:28:23 -07:00
David Chase
b509516b2e [dev.simd] simd, cmd/compile: add Interleave{Hi,Lo} (VPUNPCK*)
these are building blocks for transpose, not sure of their
best names yet.

Change-Id: I3800a55de9fa7fde2590ca822894c8a75387dec3
Reviewed-on: https://go-review.googlesource.com/c/go/+/698576
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-02 10:50:46 -07:00
David Chase
6890aa2e20 [dev.simd] cmd/compile: add instructions and rewrites for scalar-> vector moves
This required changes to the assembler so that VMOVSS and VMOVSD
could handle FP constants.

Change-Id: Iaa2f8df71867a3283bc058b7ec691b56a3e73621
Reviewed-on: https://go-review.googlesource.com/c/go/+/698240
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-02 10:50:34 -07:00
Damien Neil
1eec830f54 go/doc: linkify interface methods
Create doc links for references to interface methods,
such as "[Context.Err]".

This does not attempt to handle embedded interfaces:
The linked-to method must be declared within the named type.

Fixes #54033

Change-Id: I4d7a132affe682c85958ca785bcc96571404e6c1
Reviewed-on: https://go-review.googlesource.com/c/go/+/687395
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-02 09:37:43 -07:00
limeidan
7bba745820 cmd/compile: use generated loops instead of DUFFZERO on loong64
Change-Id: Id43ee4353d4bac96627f8b0f54545cdd3d2a1d1b
Reviewed-on: https://go-review.googlesource.com/c/go/+/699695
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
2025-08-31 19:18:22 -07:00
Xiaolin Zhao
882335e2cb cmd/internal/obj/loong64: add LDPTR.{W/D} and STPTR.{W/D} instructions support
Go asm syntax:
	MOVWP		4(R4), R5
	MOVVP		8(R4), R5
	MOVWP		R4, 12(R5)
	MOVVP		R4, 16(R5)

Equivalent platform assembler syntax:
	ldptr.w		r5, r4, $1
	ldptr.d		r5, r4, $2
	stptr.w		r4, r5, $3
	stptr.d		r4, r5, $4

Change-Id: I50a341cee2d875cb7c5da9db08b23799c9dc6c64
Reviewed-on: https://go-review.googlesource.com/c/go/+/699055
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-08-31 18:33:38 -07:00
Guoqi Chen
d4b17f5869 internal/runtime/atomic: reset wrong jump target in Cas{,64} on loong64
The implementation here needs to be consistent with ssa.OpLOONG64LoweredAtomicCas{32,64},
which was ignored in CL 613396.

Change-Id: I72e8d2318e0c1935cc3a35ab5098f8a84e48bcd5
Reviewed-on: https://go-review.googlesource.com/c/go/+/699395
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
2025-08-31 18:32:58 -07:00
Nicholas Husin
6a08e80399 net/http: skip redirecting in ServeMux when URL path for CONNECT is empty
In 1.21 ServeMux, we had a special-case to skip redirection when a given
path is empty for CONNECT requests:
https://go.googlesource.com/go/+/refs/tags/go1.24.4/src/net/http/servemux121.go#205.

This special case seems to not have been carried over to 1.22 ServeMux.
This causes needless redirection, which this CL fixes.

Fixes #74422

Change-Id: I3cc5b4d195ab0591a9139225b632cbe17f4290db
Reviewed-on: https://go-review.googlesource.com/c/go/+/699915
Reviewed-by: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Sean Liao <sean@liao.dev>
Reviewed-by: Damien Neil <dneil@google.com>
2025-08-31 05:18:41 -07:00
Joel Sing
8bcda6c79d runtime/race: add race detector support for linux/riscv64
This enables support for the race detector on linux/riscv64.

Fixes #64345

Cq-Include-Trybots: luci.golang.try:gotip-linux-riscv64
Change-Id: I98962827e91455404858549b0f9691ee438f104b
Reviewed-on: https://go-review.googlesource.com/c/go/+/690497
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2025-08-29 23:57:12 -07:00
matloob
8377adafc5 cmd/cgo: split loadDWARF into two parts
The first part runs gcc to get the debug information, and the second
part processes the debug information. The first part doesn't touch the
global and package level information that's computed so we can run it
earlier and concurrently in a later CL.

For #75167

Change-Id: I6a6a6964769a47792892066d06c16f239f532858
Reviewed-on: https://go-review.googlesource.com/c/go/+/699018
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-08-29 16:58:58 -07:00
matloob
a7d9d5a80a cmd/cgo: move typedefs and typedefList out of Package
Theyre moved into a new fileTypedefs type so we can better keep track of
their lifetime.

For #75167

Change-Id: I6a6a696491d00eb4b1cc56dfcb9e94ed53573a7a
Reviewed-on: https://go-review.googlesource.com/c/go/+/699015
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@google.com>
2025-08-29 16:58:30 -07:00
Tobias Klauser
1d459c4357 all: delete more windows/arm remnants
Updates #71671

Change-Id: I663c4a659ad45bcebfc03d6eb4783e5f5d3afa0d
Reviewed-on: https://go-review.googlesource.com/c/go/+/699176
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-29 10:57:46 -07:00
Michael Munday
27ce6e4e26 cmd/compile: remove sign extension before MULW on riscv64
These sign extensions aren't necessary.

Change-Id: Id68ea596a18b30949d4605b2885f02e49e42d8e1
Reviewed-on: https://go-review.googlesource.com/c/go/+/699595
Reviewed-by: Keith Randall <khr@golang.org>
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@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-08-29 10:50:58 -07:00
Michael Munday
84b070bfb1 cmd/compile/internal/ssa: make oneBit function generic
Allows rewrite rules using oneBit to be made more compact.

Change-Id: I986715f77db5b548759d809fe668e1893048f25c
Reviewed-on: https://go-review.googlesource.com/c/go/+/699295
Reviewed-by: Youlin Feng <fengyoulin@live.com>
Commit-Queue: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-29 10:02:33 -07:00
Tobias Klauser
fe42628dae internal/cpu: inline DebugOptions
internal/cpu.DebugOptions is only ever set in runtime.cpuinit on
unix-like platforms. DebugOptions itself is only used in
MustHaveDebugOptionsSupport, so inline the GOOS check there.

Change-Id: I6a35d6b8afcdadfc59585258002f53c20026116c
Reviewed-on: https://go-review.googlesource.com/c/go/+/699775
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Florian Lehner <lehner.florian86@gmail.com>
2025-08-29 10:01:06 -07:00
AN Long
94b7d519bd net: update document on limitation of iprawsock on Windows
Fixed: #23209

Change-Id: I3bfe9f5192cbacf387386efda72f04eeec5ff3be
GitHub-Last-Rev: 660a62d139
GitHub-Pull-Request: golang/go#74857
Reviewed-on: https://go-review.googlesource.com/c/go/+/692895
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Sean Liao <sean@liao.dev>
2025-08-29 09:56:14 -07:00
AN Long
ba9e1ddccf testing: allow specify temp dir by GOTMPDIR environment variable
Allow change the default temp directory returned by t.TempDir()
by environment variable GOTMPDIR.

Fixes #61585

Change-Id: Iba969bb02744e106cf15d80e0eda0245a55fc290
GitHub-Last-Rev: aeacea0095
GitHub-Pull-Request: golang/go#74844
Reviewed-on: https://go-review.googlesource.com/c/go/+/692455
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Sean Liao <sean@liao.dev>
Reviewed-by: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-08-29 09:56:10 -07:00
zuojunwei.1024
9f6936b8da cmd/link: disallow linkname of runtime.addmoduledata
Although a comment on addmoduledata warns that it should not be
called from Go code, the linker still allow it to be accessed via
go:linkname. Using linkname on this function will cause a linker
crash when building with buildmode=plugin.

Fixes #75180

Change-Id: Ib72c367a8afaef712ca5e29b1d0a4fc98ed8f40f
Reviewed-on: https://go-review.googlesource.com/c/go/+/699655
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-29 09:36:19 -07:00
Julien Cretel
89d41d254a bytes, strings: speed up TrimSpace
This change lifts bounds checks out of loops in the TrimSpace functions,
among other micro-optimizations. Here are some benchmark results
(no change to allocations):

goos: darwin
goarch: amd64
pkg: bytes
cpu: Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
                         │     old     │                 new                 │
                         │   sec/op    │   sec/op     vs base                │
TrimSpace/NoTrim-8         4.406n ± 0%   3.829n ± 1%  -13.11% (p=0.000 n=20)
TrimSpace/ASCII-8          7.688n ± 1%   5.872n ± 1%  -23.61% (p=0.000 n=20)
TrimSpace/SomeNonASCII-8   82.25n ± 1%   81.00n ± 1%   -1.51% (p=0.001 n=20)
TrimSpace/JustNonASCII-8   131.6n ± 8%   132.2n ± 1%        ~ (p=0.899 n=20)
geomean                    24.61n        22.15n        -9.99%

pkg: strings
                         │     old     │                 new                 │
                         │   sec/op    │   sec/op     vs base                │
TrimSpace/NoTrim-8         4.178n ± 0%   3.857n ± 2%   -7.68% (p=0.001 n=20)
TrimSpace/ASCII-8          7.708n ± 0%   5.585n ± 1%  -27.55% (p=0.000 n=20)
TrimSpace/SomeNonASCII-8   98.70n ± 1%   88.54n ± 1%  -10.30% (p=0.000 n=20)
TrimSpace/JustNonASCII-8   132.8n ± 2%   123.2n ± 0%   -7.16% (p=0.000 n=20)
geomean                    25.49n        22.02n       -13.61%

Change-Id: I523f03a909c82a51940b44c7b2634985b7447982
GitHub-Last-Rev: 35163f04c6
GitHub-Pull-Request: golang/go#75127
Reviewed-on: https://go-review.googlesource.com/c/go/+/698735
Reviewed-by: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Sean Liao <sean@liao.dev>
Reviewed-by: Keith Randall <khr@google.com>
2025-08-29 09:34:38 -07:00
Sean Liao
38204e0872 testing/synctest: call out common issues with tests
While each point is explained their respective sections for Time,
Blocking, and Isolation, these appear to be the most common
issues worth calling out up front.

Fixes #75052

Change-Id: I916b559075ee4d1d23810a08459e037e21690193
Reviewed-on: https://go-review.googlesource.com/c/go/+/696736
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
2025-08-29 07:39:28 -07:00
qmuntal
252c901125 os,syscall: pass file flags to CreateFile on Windows
Add support for FILE_FLAG_* constants in the flag argument of
os.OpenFile and syscall.Open on Windows.

Passing invalid flags will result in an error.

Updates #73676

Change-Id: Ie215a3dd14f0d74141533f0a07865a02a67a3846
Reviewed-on: https://go-review.googlesource.com/c/go/+/699415
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-29 07:25:08 -07:00
qmuntal
53515fb0a9 crypto/tls: use hash.Cloner
A hash object needs to be cloned when doing certain steps in a
TLS 1.3 server handshake. It is more efficient to use the
hash.Cloner interface to clone a hash than to encode and decode
the hash object using the binary encoding interfaces.

We still need to support the binary encoding path in case the
hash objects come from the fips140 v1.0.0 module, given that
this module doesn't support the hash.Cloner interface.

Change-Id: I8425e14e481dcefafc9aa1e5bfd63b61c22675ad
Reviewed-on: https://go-review.googlesource.com/c/go/+/682597
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-29 06:13:57 -07:00
goto1134
13bb48e6fb go/constant: fix complex != unknown comparison
By the contract of Compare, if one operand is Unknown, the result must be
false.

Fixes #75137

Change-Id: I56420fae808395f89769f5e5d448f9e1df9a622f
GitHub-Last-Rev: 858ba89a91
GitHub-Pull-Request: golang/go#75140
Reviewed-on: https://go-review.googlesource.com/c/go/+/698955
Reviewed-by: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Sean Liao <sean@liao.dev>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
2025-08-28 17:14:30 -07:00
database64128
ba1109feb5 net: remove redundant cgoLookupCNAME return parameter
`completed bool` just means `err == nil` after CL 446179.

While here, add a test for cgoLookupCNAME.

Co-authored-by: Mateusz Poliwczak <mpoliwczak34@gmail.com>
Change-Id: I6081a089fde3cb27af4fbde6f04301fc3755272c
Reviewed-on: https://go-review.googlesource.com/c/go/+/698615
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Sean Liao <sean@liao.dev>
Reviewed-by: Mateusz Poliwczak <mpoliwczak34@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-08-28 16:10:24 -07:00
1911860538
f74ed44ed9 net/http/httputil: remove redundant pw.Close() call in DumpRequestOut
pw.Close() is already deferred earlier in DumpRequestOut.

Change-Id: Icdc9366c816848ed0bb444022d2aa14e4ceaabac
GitHub-Last-Rev: 7c38f9f2b6
GitHub-Pull-Request: golang/go#75029
Reviewed-on: https://go-review.googlesource.com/c/go/+/696415
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Auto-Submit: Sean Liao <sean@liao.dev>
2025-08-28 16:10:19 -07:00
Joel Sing
a9689d2e0b time: skip TestLongAdjustTimers in short mode on single CPU systems
The OpenBSD armv7 port does not support SMP - on this platform the
TestLongAdjustTimers test passes in ~46 seconds on the openbsd/arm
builder when there is no other CPU contention, however it will almost
always fail when there is any other load.

Change-Id: Idf1c47b40376c749886843cdae11289c0984f714
Reviewed-on: https://go-review.googlesource.com/c/go/+/698556
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Commit-Queue: Cherry Mui <cherryyz@google.com>
Run-TryBot: Joel Sing <joel@sing.id.au>
Reviewed-by: 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>
2025-08-28 10:52:45 -07:00
Tobias Klauser
ebc763f76d syscall: only get parent PID if SysProcAttr.Pdeathsig is set
The value of the parent PID is only used to check against get value
returned by getppid(2) in case SysProcAttr.Pdeathsig is non-zero. Avoid
the useless getpid(2) system call otherwise.

Cq-Include-Trybots: luci.golang.try:gotip-freebsd-amd64
Change-Id: If89f9c7acc82016ec359c79bd861d41460f42218
Reviewed-on: https://go-review.googlesource.com/c/go/+/699175
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2025-08-28 01:56:41 -07:00
Brad
7f1864b0a8 strings: remove redundant "runs" from string.Fields docstring
Change-Id: I502b24af186fc56fe953acf7ab7d29f8eefb9c07
GitHub-Last-Rev: 1a4edf4312
GitHub-Pull-Request: golang/go#75156
Reviewed-on: https://go-review.googlesource.com/c/go/+/699215
Reviewed-by: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Sean Liao <sean@liao.dev>
Reviewed-by: Florian Lehner <lehner.florian86@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-08-28 01:55:16 -07:00
Julien Cretel
90c21fa5b6 net/textproto: eliminate some bounds checks
This change lifts bounds checks out of loops in the trim function.
Here are some benchmark results (no change to allocations):

goos: darwin
goarch: amd64
pkg: net/textproto
cpu: Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
                                │     old     │                new                 │
                                │   sec/op    │   sec/op     vs base               │
ReadMIMEHeader/client_headers-8   3.531µ ± 3%   3.506µ ± 1%       ~ (p=0.068 n=20)
ReadMIMEHeader/server_headers-8   2.409µ ± 0%   2.384µ ± 1%  -1.02% (p=0.000 n=20)
Uncommon-8                        545.2n ± 1%   536.7n ± 0%  -1.58% (p=0.000 n=20)
geomean                           1.667µ        1.649µ       -1.10%

Change-Id: Ia6d4ac516497fd3521122ce9b97173a285b61e12
GitHub-Last-Rev: 580f35afce
GitHub-Pull-Request: golang/go#75126
Reviewed-on: https://go-review.googlesource.com/c/go/+/698715
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Auto-Submit: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2025-08-28 01:55:11 -07:00
qmuntal
e47d88beae os: return nil slice when ReadDir is used with a file on file_windows
ReadDir should return (nil, ENOTDIR) when the path points to a file
instead of a directory. That's the behavior on Unix systems, and it also
used to be the behavior on Windows. However, Windows currently returns
([]DirEntry{}, ENOTDIR).

We should change the implementation to match the expected behavior.

Fixed #75157

Change-Id: I3a3ddb71b5cd6e51dbca435a1585f01116844d4a
Reviewed-on: https://go-review.googlesource.com/c/go/+/699375
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Steven Hartland <stevenmhartland@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-27 21:44:39 -07:00
Xiaolin Zhao
6b837a64db cmd/internal/obj/loong64: simplify buildop
The length of array optab is readily available, remove the sentinel and
sentinel scan, like arm64.

Change-Id: Iceeed22587ce2beeedeb5babdde3474e75d70f89
Reviewed-on: https://go-review.googlesource.com/c/go/+/699095
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
2025-08-27 19:53:35 -07:00
Ian Lance Taylor
765905e3bd debug/elf: don't panic if symtab too small
No test case because the problem can only happen for invalid data.
Let the fuzzer find cases like this.

For #47653
Fixes #75130

Change-Id: Ie6015564bb98334377383bbc16d79119dc4e36f9
Reviewed-on: https://go-review.googlesource.com/c/go/+/698855
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Florian Lehner <lehner.florian86@gmail.com>
2025-08-27 19:46:19 -07:00
Nicholas Husin
2ee4b31242 net/http: Ensure that CONNECT proxied requests respect MaxResponseHeaderBytes
Currently, CONNECT proxied requests use an unlimited Reader. As a
result, a malicious or misbehaving proxy server can send an unlimited
number of bytes to a client; causing the client to indefinitely receive bytes
until it runs out of memory.

To prevent this, we now use a LimitedReader that limits the number of
bytes according to MaxResponseHeaderBytes in Transport. If
MaxResponseHeaderBytes is not provided, we use the default value of 10
MB that has historically been used (see #26315).

Fixes #74633

Change-Id: I0b03bb354139dbc64318874402f7f29cc0fb42ce
Reviewed-on: https://go-review.googlesource.com/c/go/+/698915
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-27 13:40:17 -07:00
Filippo Valsorda
b21867b1a2 net/http: require exact match for CrossSiteProtection bypass patterns
Fixes #75054
Fixes CVE-2025-47910

Change-Id: I6a6a696440c45c450d2cd681f418b01aa0422a60
Reviewed-on: https://go-review.googlesource.com/c/go/+/699275
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2025-08-27 08:03:34 -07:00
matloob
d19e377f6e cmd/cgo: make it safe to run gcc in parallel
Use a new filename for each invocation so invocations run
concurrently don't overwrite the same file.

Change-Id: I6a6a696478b596a4819f41b3ac738263d41bbabf
Reviewed-on: https://go-review.googlesource.com/c/go/+/699017
Reviewed-by: Michael Matloob <matloob@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-27 05:49:15 -07:00
database64128
49a2f3ed87 net: allow zero value destination address in WriteMsgUDPAddrPort
The existing address validity checks already cover both connected and
non-connected sockets. Pass a nil sockaddr just like WriteMsgUDP, when
the address is zero value.

TestWriteToUDP is extended to cover the netip APIs.

Fixes #74841

Change-Id: I2708e7747e224958198fe7abb3fcd8d59bc5a88a
Reviewed-on: https://go-review.googlesource.com/c/go/+/692437
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Damien Neil <dneil@google.com>
2025-08-27 01:05:25 -07:00
qmuntal
afc51ed007 internall/poll: remove bufs field from Windows' poll.operation
The bufs field is used to avoid allocating it every time it is needed.
We can do better by using a sync.Pool to reuse allocations across
operations and FDs instead of the field.

A side benefit is that FD is now 16 bytes smaller and operation more
stateless.

Change-Id: I5d686d1526f6c63e7ca1ae84da1fbf2044b24703
Reviewed-on: https://go-review.googlesource.com/c/go/+/698798
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-08-26 23:54:57 -07:00
qmuntal
801b74eb95 internal/poll: remove rsa field from Windows' poll.operation
The rsa field was added to the operation structure to avoid allocating
it every time it is needed. We can do better by using a sync.Pool to
reuse allocations across operations and FDs instead of the field.

A side benefit is that FD is now 16 bytes smaller and operation more
stateless.

Change-Id: I3b69a59e36b27f2cdd076cebd8d27a2a350b9c43
Reviewed-on: https://go-review.googlesource.com/c/go/+/698875
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2025-08-26 23:54:35 -07:00
Brad Fitzpatrick
fa18c547cd syscall: sort Windows env block in StartProcess
Fixes #29530

Change-Id: Ia28c78274b9288bfa5de9ccb142a452d291a5b66
Reviewed-on: https://go-review.googlesource.com/c/go/+/694435
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
Auto-Submit: Brad Fitzpatrick <bradfitz@golang.org>
2025-08-26 19:39:36 -07:00
qmuntal
bfd130db02 internal/poll: don't use stack-allocated WSAMsg parameters
WSAMsg parameters should be passed to Windows as heap pointers instead
of stack pointers. This is because Windows might access the memory
after the syscall returned in case of a non-blocking operation (which
is the common case), and if the WSAMsg is on the stack, the Go
runtime might have moved it around.

Use a sync.Pool to cache WSAMsg structures to avoid a heap allocation
every time a WSAMsg is needed.

Fixes #74933

Cq-Include-Trybots: luci.golang.try:x_net-gotip-windows-amd64
Change-Id: I075e2ceb25cd545224ab3a10d404340faf19fc01
Reviewed-on: https://go-review.googlesource.com/c/go/+/698797
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-26 03:49:59 -07:00
Joel Sing
dae9e456ae runtime: identify virtual memory layout for riscv64
Identify sv39, sv48 and sv57 based on the system stack address.
The current approach to memory allocation is less than ideal on
RISC-V hardware that is using sv39 mode. On sv39 we currently end
up doing around 85 mmap and 66 munmap, since we are trying to map
an unusable range. With this change we do 22 mmap and 0 munmap at
runtime initialisation.

This will also be necessary to support the race detector on sv39.

Updates #64345

Cq-Include-Trybots: luci.golang.try:gotip-linux-riscv64
Change-Id: I4f8ba6763b5ecfedfad5438e025d633820e8265c
Reviewed-on: https://go-review.googlesource.com/c/go/+/690495
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-26 01:38:57 -07:00
Michael Munday
25c2d4109f math: use Trunc to implement Modf
By implementing Modf using Trunc, rather than the other way round,
we can get a significant performance improvement on platforms where
Trunc is implemented as an intrinsic.

Trunc is implemented as an intrinsic on ppc64x and arm64 so the assembly
implementations of Modf are no longer needed (the compiler can generate
very similar code that can now potentially be inlined).

GOAMD64=v1

goos: linux
goarch: amd64
pkg: math
cpu: 12th Gen Intel(R) Core(TM) i7-12700T
        │       sec/op       │    sec/op     vs base                │
Gamma            4.257n ± 0%    3.890n ± 0%   -8.61% (p=0.000 n=10)
Modf            1.6110n ± 0%   0.4243n ± 0%  -73.67% (p=0.000 n=10)
geomean          2.619n         1.285n       -50.94%

GOAMD64=v2

goos: linux
goarch: amd64
pkg: math
cpu: 12th Gen Intel(R) Core(TM) i7-12700T
        │       sec/op       │    sec/op     vs base                │
Gamma            4.100n ± 1%    3.717n ± 0%   -9.35% (p=0.000 n=10)
Modf            1.6070n ± 0%   0.2158n ± 1%  -86.57% (p=0.000 n=10)
geomean          2.567n        0.8957n       -65.11%

Change-Id: I689a560c344cf1d39ef002b540749bacc3179786
Reviewed-on: https://go-review.googlesource.com/c/go/+/694896
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@google.com>
2025-08-25 12:46:11 -07:00
Michael Munday
4e05a070c4 math: implement IsInf using Abs
Abs is an intrinsic (or a relatively cheap operation) on most
architectures. Using it in IsInf typically saves a branch when
`sign` is 0 (note the `sign` variable is typically a constant).

This change doesn't make a huge difference on amd64 (these
benchmarks are fairly noisy too) but removing the branch will
allow rewrite rules to detect and optimize infinity checks on
other architectures. For example, riscv64 can check for
infinities with the FCLASSD instruction and s390x can use the
TCDB instruction.

goos: linux
goarch: amd64
pkg: math
cpu: 12th Gen Intel(R) Core(TM) i7-12700T
                    │          sec/op          │    sec/op      vs base                │
Acos                              4.317n ±  1%    4.321n ±  0%        ~ (p=0.466 n=10)
Acosh                             8.857n ±  1%    8.411n ±  2%   -5.05% (p=0.001 n=10)
Asin                              4.260n ±  1%    4.204n ±  6%   -1.31% (p=0.021 n=10)
Asinh                             10.63n ±  2%    10.37n ±  0%   -2.49% (p=0.000 n=10)
Atan                              2.493n ±  1%    2.368n ±  0%   -5.01% (p=0.000 n=10)
Atanh                             8.820n ±  4%    8.770n ±  2%        ~ (p=0.579 n=10)
Atan2                             4.212n ±  1%    4.066n ± 11%   -3.45% (p=0.023 n=10)
Cbrt                              4.859n ±  0%    4.845n ±  0%   -0.29% (p=0.000 n=10)
Ceil                             0.3877n ±  3%   0.2514n ±  0%  -35.17% (p=0.000 n=10)
Copysign                         0.3479n ±  2%   0.4179n ±  0%  +20.14% (p=0.000 n=10)
Cos                               4.734n ±  2%    4.486n ±  0%   -5.26% (p=0.000 n=10)
Cosh                              5.244n ±  0%    5.071n ±  0%   -3.29% (p=0.000 n=10)
Erf                               2.975n ±  1%    2.788n ±  0%   -6.29% (p=0.000 n=10)
Erfc                              3.259n ±  1%    3.121n ±  0%   -4.23% (p=0.000 n=10)
Erfinv                            4.015n ±  1%    3.904n ±  0%   -2.76% (p=0.000 n=10)
Erfcinv                           4.166n ±  1%    4.039n ±  0%   -3.04% (p=0.000 n=10)
Exp                               3.567n ±  1%    3.429n ±  0%   -3.87% (p=0.000 n=10)
ExpGo                             9.173n ±  1%    8.368n ±  2%   -8.78% (p=0.000 n=10)
Expm1                             4.466n ±  3%    4.419n ±  0%   -1.05% (p=0.000 n=10)
Exp2                              8.328n ±  0%    8.046n ±  0%   -3.39% (p=0.000 n=10)
Exp2Go                            8.796n ±  5%    8.237n ±  2%   -6.36% (p=0.000 n=10)
Abs                              0.2400n ±  2%   0.2144n ±  0%  -10.71% (p=0.000 n=10)
Dim                              0.4077n ±  3%   0.3795n ±  1%   -6.91% (p=0.000 n=10)
Floor                            0.3616n ±  2%   0.2528n ±  3%  -30.10% (p=0.000 n=10)
Max                               1.401n ±  1%    1.344n ±  1%   -4.14% (p=0.000 n=10)
Min                               1.391n ±  1%    1.345n ±  1%   -3.27% (p=0.000 n=10)
Mod                               15.45n ±  1%    15.62n ±  2%        ~ (p=0.066 n=10)
Frexp                             1.838n ±  2%    1.605n ±  1%  -12.70% (p=0.000 n=10)
Gamma                             4.465n ±  1%    4.458n ±  1%        ~ (p=0.256 n=10)
Hypot                             2.237n ±  1%    2.208n ±  0%   -1.32% (p=0.000 n=10)
HypotGo                           2.610n ±  3%    2.663n ±  5%        ~ (p=0.280 n=10)
Ilogb                             1.793n ±  1%    1.566n ±  1%  -12.66% (p=0.000 n=10)
J0                                22.11n ±  1%    21.45n ±  1%   -2.99% (p=0.000 n=10)
J1                                21.71n ±  1%    21.38n ±  1%   -1.54% (p=0.000 n=10)
Jn                                46.43n ±  1%    45.83n ±  1%   -1.30% (p=0.001 n=10)
Ldexp                             2.360n ±  1%    2.111n ±  1%  -10.51% (p=0.000 n=10)
Lgamma                            4.728n ±  1%    4.850n ±  2%   +2.59% (p=0.000 n=10)
Log                               4.304n ±  2%    4.228n ±  1%   -1.78% (p=0.000 n=10)
Logb                              1.833n ±  2%    1.635n ±  2%  -10.80% (p=0.000 n=10)
Log1p                             5.262n ±  2%    5.173n ±  2%   -1.69% (p=0.001 n=10)
Log10                             4.534n ±  1%    4.474n ±  1%   -1.33% (p=0.024 n=10)
Log2                              2.510n ±  2%    2.246n ±  2%  -10.48% (p=0.000 n=10)
Modf                              1.712n ±  3%    1.700n ±  1%        ~ (p=0.055 n=10)
Nextafter32                       2.190n ±  3%    2.187n ±  0%        ~ (p=0.266 n=10)
Nextafter64                       2.184n ±  0%    2.183n ±  0%   -0.05% (p=0.017 n=10)
PowInt                            11.45n ±  7%    11.32n ±  9%        ~ (p=0.137 n=10)
PowFrac                           27.46n ±  3%    27.04n ±  1%   -1.55% (p=0.001 n=10)
Pow10Pos                         0.5367n ±  3%   0.5466n ±  2%   +1.84% (p=0.009 n=10)
Pow10Neg                         0.8939n ±  1%   0.8720n ±  2%   -2.45% (p=0.000 n=10)
Round                             1.218n ±  1%    1.198n ±  1%   -1.56% (p=0.005 n=10)
RoundToEven                       1.711n ±  0%    1.710n ±  0%        ~ (p=0.464 n=10)
Remainder                         12.87n ± 10%    13.79n ± 14%   +7.11% (p=0.027 n=10)
Signbit                          0.4072n ±  2%   0.3839n ±  2%   -5.71% (p=0.000 n=10)
Sin                               4.102n ±  1%    4.058n ±  3%        ~ (p=0.138 n=10)
Sincos                            5.837n ±  1%    5.715n ±  2%   -2.10% (p=0.000 n=10)
Sinh                              5.622n ±  1%    5.567n ±  2%   -0.96% (p=0.006 n=10)
SqrtIndirect                     0.4284n ±  0%   0.4279n ±  0%        ~ (p=0.084 n=10)
SqrtLatency                       2.779n ±  0%    2.777n ±  0%        ~ (p=0.089 n=10)
SqrtIndirectLatency               2.777n ±  0%    2.778n ±  0%        ~ (p=0.305 n=10)
SqrtGoLatency                     24.00n ±  0%    24.51n ±  0%   +2.12% (p=0.000 n=10)
SqrtPrime                         673.0n ±  0%    673.0n ±  0%        ~ (p=0.574 n=10)
Tan                               4.111n ±  4%    4.123n ±  5%        ~ (p=0.424 n=10)
Tanh                              5.787n ±  1%    5.723n ±  1%   -1.11% (p=0.010 n=10)
Trunc                            0.3441n ±  3%   0.2596n ±  2%  -24.56% (p=0.000 n=10)
Y0                                21.63n ±  2%    21.07n ±  2%   -2.61% (p=0.001 n=10)
Y1                                21.42n ±  1%    20.93n ±  3%   -2.29% (p=0.041 n=10)
Yn                                45.78n ±  1%    45.83n ±  1%        ~ (p=0.671 n=10)
Float64bits                      0.2187n ±  2%   0.2199n ±  2%        ~ (p=0.138 n=10)
Float64frombits                  0.2198n ±  1%   0.2199n ±  1%        ~ (p=0.956 n=10)
Float32bits                      0.2237n ±  2%   0.2213n ±  1%        ~ (p=0.060 n=10)
Float32frombits                  0.2251n ±  1%   0.2219n ±  2%   -1.42% (p=0.000 n=10)
FMA                              0.8557n ±  1%   0.8555n ±  0%        ~ (p=0.286 n=10)
geomean                           3.186n          3.070n         -3.61%

Change-Id: I4814bb1e3d9d20e9d8cd7689e8d5383e36b00331
Reviewed-on: https://go-review.googlesource.com/c/go/+/694955
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
2025-08-25 12:43:51 -07:00
Michael Munday
1eed4f32a0 math: optimize Signbit implementation slightly
This small tweak to Signbit improves code generation on riscv64 and
possibly other architectures by removing the need to apply a 64 bit
mask.

Before:
  MOV $-9223372036854775808, X6
  AND X6, X5, X5
  SNEZ X5, X10

After:
  SLTI $0, X5, X10

This transformation could also be added to the optimization rules
but it is quite a special case.

goos: linux
goarch: riscv64
pkg: math
cpu: Spacemit(R) X60
        │    sec/op     │   sec/op     vs base                │
Signbit     13.05n ± 0%   11.42n ± 0%  -12.49% (p=0.000 n=10)

Change-Id: Ic218017c5bbb720ec24c6fe7cc230df539b2630c
Reviewed-on: https://go-review.googlesource.com/c/go/+/698419
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Sean Liao <sean@liao.dev>
Reviewed-by: Florian Lehner <lehner.florian86@gmail.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2025-08-25 12:35:20 -07:00
limeidan
bd71b94659 cmd/compile/internal: optimizing add+sll rule using ALSLV instruction on loong64
Reduce the number of go toolchain instructions on loong64 as follows:

	file	    before	after	    Δ 	     %
	go	    1573148	1571708	   -1,440  -0.0915%
	gofmt	    320578	320090	   -488    -0.1522%
	asm	    555066	554406	   -660    -0.1189%
	cgo	    481566	480926	   -640    -0.1329%
	compile	    2475962	2473880	   -2,082  -0.0841%
	cover	    516536	515920	   -616    -0.1193%
	link	    702172	701404	   -768    -0.1094%
	preprofile  238626	238274	   -352    -0.1475%
	vet	    792928	792100	   -828    -0.1044%

Change-Id: I61e462726835959c60e1b4e5256d4020202418ab
Reviewed-on: https://go-review.googlesource.com/c/go/+/693877
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
2025-08-25 12:30:16 -07:00
Wang Deyu
ea55ca3600 runtime: skip doInit of plugins in runtime.main
Plugins may be loaded in the user's init code.
If loading fails, md.bad is true, and doInit should not be executed.
If loading succeeds, the plugin must run modulesinit and typelinksinit
before doInit. Here is not protected by pluginsMu, and in concurrent
scenarios it is possible to obtain the moduledata of the plugin that
is still in the loading process.
Any added modules after loop starts will do their own doInit calls.
This fixes the issue introduced by CL 520375.

Fixes #75102

Change-Id: I48e91ae21615a0c54176875a6a2dea8e1dade906
Reviewed-on: https://go-review.googlesource.com/c/go/+/697675
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-08-25 10:54:23 -07:00
Joel Sing
9ae2f1fb57 internal/trace: skip async preempt off tests on low end systems
The OpenBSD armv7 port does not support SMP - on this platform the
trace tests take ~300 seconds to run when async preempt is disabled,
which then times out on the builder. Skip these tests when run in
short mode on a single CPU system.

Change-Id: I9a697d5ba2b20652f76dcc97bd178a4ee8f1a2a0
Reviewed-on: https://go-review.googlesource.com/c/go/+/698555
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Joel Sing <joel@sing.id.au>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-08-25 10:50:12 -07:00
database64128
bbd5342a62 net: fix cgoResSearch
CL 457439 mistakenly redeclared size inside the for loop, causing
cgoResSearch to always fail and fall back to goLookupCNAME.

Change-Id: I3e142d34287388284a8998ac13761b1e0c2911a5
Reviewed-on: https://go-review.googlesource.com/c/go/+/696895
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Mateusz Poliwczak <mpoliwczak34@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-25 10:50:07 -07:00
Damien Neil
ed7f804775 os: set full name for Roots created with Root.OpenRoot
Set the Name for a Root created within a Root to be the
concatenation of the parent's path and the name used to open the child.

This matches the behavior for files opened within a Root
with Root.Open.

Fixes #73868

Change-Id: Idf4021602ac25556721b7ef6924dec652c7bf4db
Reviewed-on: https://go-review.googlesource.com/c/go/+/698376
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-25 08:33:58 -07:00
qmuntal
a21249436b internal/poll: use fdMutex to provide read/write locking on Windows
On Windows it is not possible to do concurrent I/O on file handles due
to the way FD.Pread and FD.Pwrite are implemented. This serialization is
achieved by having a dedicated mutex locked in the affected FD methods.

This makes the code difficult to reason about, as there is another
layer of locking introduced by the fdMutex. For example, it is not
obvious that concurrent I/O operations are serialized.

This CL removed the dedicated mutex and uses the fdMutex to provide
read/write locking.

Change-Id: I00389662728ce29428a587c3189bab90a0399215
Reviewed-on: https://go-review.googlesource.com/c/go/+/698096
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2025-08-25 02:31:40 -07:00
Xiaolin Zhao
44c5956bf7 test/codegen: add Mul2 and DivPow2 test for loong64
Change-Id: I29ccd105c5418955146a3f4873162963da489a70
Reviewed-on: https://go-review.googlesource.com/c/go/+/697935
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2025-08-24 18:14:28 -07:00
Xiaolin Zhao
0aa8019e94 test/codegen: add Mul* test for loong64
Change-Id: Ica285212e4884a96fe9738b53cdc789b223bf2e3
Reviewed-on: https://go-review.googlesource.com/c/go/+/697895
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
2025-08-24 18:14:22 -07:00
Xiaolin Zhao
83420974b7 test/codegen: add sqrt* abs and copysign test for loong64
Change-Id: I645396fc4b00242f36a06f01550906805c0c1f73
Reviewed-on: https://go-review.googlesource.com/c/go/+/697955
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2025-08-24 18:14:13 -07:00
Junyang Shao
5ebe2d05d5 [dev.simd] simd: correct SumAbsDiff documentation
Change-Id: I6bb093615f12bbac5ea4c013a1c47cd5d338fe43
Reviewed-on: https://go-review.googlesource.com/c/go/+/698516
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-24 16:21:00 -07:00
Sean Liao
f2db0dca0b net/http/httptest: redirect example.com requests to server
The default server cert used by NewServer already includes example.com
in its DNSNames, and by default, the client's RootCA configuration
means it won't trust a response from the real example.com.

Fixes #31054

Change-Id: I0686977e5ffe2c2f22f3fc09a47ee8ecc44765db
Reviewed-on: https://go-review.googlesource.com/c/go/+/666855
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-23 12:28:10 -07:00
qmuntal
d86ec92499 internal/syscall/windows: increase internal Windows O_ flags values
The lowercase o_ flags are invented values. These conflict with
constants that will soon be allowed by os.OpenFile, which values will
be mandated by the Windows API. To avoid this overlap, the internal
values have been increased to the 33-63 bit range, as the Windows ones
are in the 0-32 bit range.

Updates #73676

Change-Id: I0f657f3ed3403de150f1730a5a65ae887a18a4e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/697363
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-22 23:39:20 -07:00
David Chase
a5137ec92a [dev.simd] cmd/compile: sample peephole optimization for SIMD broadcast
After tinkering and rewrite, this also optimizes some instances
of SetElem(0).

Change-Id: Ibba2d50a56b68ccf9de517ef24ca52b64c6c5b2c
Reviewed-on: https://go-review.googlesource.com/c/go/+/696376
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-22 21:19:38 -07:00
Cherry Mui
83714616aa [dev.simd] cmd/compile: remove VPADDD4
It is from my sample SIMD compilation, not used in the real thing.
The actual operation is VPADDD128.

Also clean up some of my XXX comments.

Change-Id: Ic20a9dd3c8531e25d88ba045ccef70cb856790d8
Reviewed-on: https://go-review.googlesource.com/c/go/+/698475
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-22 15:45:44 -07:00
Cherry Mui
4a3ea146ae [dev.simd] cmd/compile: correct register mask of some AVX512 ops
Change-Id: Ifce9d6667955c9b16b1cd78d6dd216a9c568c17a
Reviewed-on: https://go-review.googlesource.com/c/go/+/698239
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>
2025-08-22 15:45:38 -07:00
Cherry Mui
8d874834f1 [dev.simd] cmd/compile: use X15 for zero value in AVX context
With the previous CL, the X15 (aliasd with Y15, Z15) register
holds the zero value for the whole register width. Use that in
AVX context when a zero value is needed.

Change-Id: If49b7059bce50c5e86f90bace0eaa830a91fa0fc
Reviewed-on: https://go-review.googlesource.com/c/go/+/698238
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
TryBot-Bypass: Cherry Mui <cherryyz@google.com>
2025-08-22 15:45:30 -07:00
guoguangwu
9d3f7fda70 crypto/tls: fix quic comment typo
Change-Id: Ibd6b8d10ecac3cdea33de1218d516b7425443313
GitHub-Last-Rev: 3d5568ba08
GitHub-Pull-Request: golang/go#75092
Reviewed-on: https://go-review.googlesource.com/c/go/+/697575
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Auto-Submit: Sean Liao <sean@liao.dev>
2025-08-22 14:57:58 -07:00
Cherry Mui
4c311aa38f [dev.simd] cmd/compile: ensure the whole X15 register is zeroed
On AMD64, we reserve the X15 register as the zero register.
Currently we use an SSE instruction to zero it, and we only use
it in SSE contexts. When the machine supports AVX, the high bits
of the register is not necessarily zeroed.

Now that the compiler generates AVX code for SIMD, it would be
great to have a zero register in the AVX context. This CL zeroes
the whole X15 register if AVX is supported.

Change-Id: I4dc803362f2e007b1614b90de435fbb7814cebc7
Reviewed-on: https://go-review.googlesource.com/c/go/+/698237
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: David Chase <drchase@google.com>
2025-08-22 14:57:00 -07:00
database64128
78a05c541f internal/poll: don't pass non-nil WSAMsg.Name with 0 namelen on windows
CL 692436 changed WriteMsgInet{4,6} on windows to pass a zero namelen
when the sockaddr is nil. Turns out Windows also requires name to be
nil when namelen is 0.

With this commit, WriteMsgInet4 and WriteMsgInet6 now nicely align with
WriteMsg.

For #74841

Change-Id: Ifadee2d12d9bce2411f11a0e12b9fa2b3d71990e
Reviewed-on: https://go-review.googlesource.com/c/go/+/698395
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Auto-Submit: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Damien Neil <dneil@google.com>
2025-08-22 14:46:56 -07:00
Qingwei Li@WSL
52c3f73fda runtime/metrics: improve doc
Polish a sentence by removing redundant "in response".

Change-Id: I232198ad904333f8eaa0c25a12824f0dcbf3cfb6
GitHub-Last-Rev: 421bfc0387
GitHub-Pull-Request: golang/go#72793
Reviewed-on: https://go-review.googlesource.com/c/go/+/656735
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Sean Liao <sean@liao.dev>
2025-08-22 11:39:55 -07:00
database64128
a076f49757 os: fix Root.MkdirAll to handle race of directory creation
No tests were added, because in order to reproduce, the directory would
have to be created precisely between the rootOpenDir and mkdirat calls,
which is impossible to do in a test.

Fixes #75114

Change-Id: I6f86a5b33c87452c35728318eaf2169a7534ef37
Reviewed-on: https://go-review.googlesource.com/c/go/+/698215
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Sean Liao <sean@liao.dev>
2025-08-22 11:21:34 -07:00
Junyang Shao
baea0c700b [dev.simd] cmd/compile, simd: complete AVX2? u?int shuffles
The namings follow the following convention:
- If its indices are from constant, amend "Constant" to the name.
- If its indices are used by multiple groups, mend "Grouped" to the
  name.
- If its indexing only the low part, amend "Lo", similarly "Hi".

Change-Id: I6a58f5dae54c882ebd59f39b5288f6f3f14d957f
Reviewed-on: https://go-review.googlesource.com/c/go/+/698296
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-08-22 09:10:28 -07:00
Junyang Shao
fa1e78c9ad [dev.simd] cmd/compile, simd: make Permute 128-bit use AVX VPSHUFB
Change-Id: Ib89f602f797065e411eb0cbc95ccf2748b25fdec
Reviewed-on: https://go-review.googlesource.com/c/go/+/698295
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-08-22 09:10:23 -07:00
Junyang Shao
bc217d4170 [dev.simd] cmd/compile, simd: add packed saturated u?int conversions
This CL should complete the conversions between int and uint.

Change-Id: I46742a62214f346e014a68b9c72a9b116a127f67
Reviewed-on: https://go-review.googlesource.com/c/go/+/698236
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Commit-Queue: David Chase <drchase@google.com>
Reviewed-by: David Chase <drchase@google.com>
2025-08-22 09:10:18 -07:00
Junyang Shao
4fa23b0d29 [dev.simd] cmd/compile, simd: add saturated u?int conversions
Change-Id: I0c7f2d7ec31c59c95568ff8d4560989de849427e
Reviewed-on: https://go-review.googlesource.com/c/go/+/698235
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-22 09:10:14 -07:00
Alberto Donizetti
98238fd495 all: delete remaining windows/arm code
Fixes #43800
Updates #71671

Change-Id: Ib7aafe3a3f6ae48f23fa23f03103820e9fcf5161
Reviewed-on: https://go-review.googlesource.com/c/go/+/698415
Reviewed-by: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
2025-08-22 08:07:55 -07:00
ZhouGuangyuan
1ad30844d9 cmd/asm: process forward jump to PCALIGN
The forward jump target are not processed when the target is PCALIGN, so
process it before emit nops for PCALIGN.

Fixes #74648

Change-Id: I690fbfacf79e26d7a37628a2551729b2381616c5
Reviewed-on: https://go-review.googlesource.com/c/go/+/696915
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-08-21 18:51:39 -07:00
database64128
13c082601d internal/poll: permit nil destination address in WriteMsg{Inet4,Inet6}
For #74841

Change-Id: If2ea23b1eb23e32680bd576f54a0020d7e115797
Reviewed-on: https://go-review.googlesource.com/c/go/+/692436
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
2025-08-21 18:17:35 -07:00
David Chase
3f6bab5791 [dev.simd] simd: move tests to a subdirectory to declutter "simd"
Change-Id: I5bfa97e30eb9739f2cc2f2282e54666f6786d98a
Reviewed-on: https://go-review.googlesource.com/c/go/+/698175
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-08-21 12:47:20 -07:00
qmuntal
9b0a507735 runtime: remove remaining windows/arm files and comments
CL 648795 deleted most of windows/arm code, but some files escaped from
the purge.

This CL finishes the job.

For #71671

Change-Id: Id454c40a673a1a2a9f190d79248e6d56104cdd61
Reviewed-on: https://go-review.googlesource.com/c/go/+/698036
Reviewed-by: qiu laidongfeng <2645477756@qq.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2025-08-21 11:41:22 -07:00
limeidan
1843f1e9c0 cmd/compile: use zero register instead of specialized *zero instructions on loong64
Refer to CL 633075, loong64 has a zero(R0) register that can be used to do this.

Change-Id: I846c6bdfcfd6dbfa18338afc13e34e350580ead4
Reviewed-on: https://go-review.googlesource.com/c/go/+/693876
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
2025-08-21 11:23:05 -07:00
limeidan
e0870a0a12 cmd/compile: simplify zerorange on loong64
Refer to CL 678936, we also did the same thing on loong64.

Change-Id: I156a9110a034878192f64baf8018115424aa5f0a
Reviewed-on: https://go-review.googlesource.com/c/go/+/697957
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-21 11:21:59 -07:00
limeidan
fb8bbe46d5 cmd/compile/internal/ssa: eliminate unnecessary extension operations
Reduce the number of go toolchain instructions on loong64 as follows:

	file	     before	after	     Δ 	      %
	go	     1598706	1597230	   -1476    -0.0923%
	gofmt	     325180	324736	   -444     -0.1365%
	asm	     562538	562098	   -440     -0.0782%
	cgo	     488298	487634	   -664     -0.1360%
	compile	     2504502	2503590	   -912     -0.0364%
	cover	     525976	525312	   -664     -0.1262%
	link	     714182	713226	   -956     -0.1339%
	preprofile   241308	240988	   -320     -0.1326%
	vet	     794112	793316	   -796     -0.1002%

Change-Id: I048ef79518b41e83c53da1a3a6b7edaca7cb63f8
Reviewed-on: https://go-review.googlesource.com/c/go/+/693856
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn>
2025-08-21 11:20:48 -07:00
Xiaolin Zhao
9632ba8160 cmd/compile: optimize some patterns into revb2h/revb4h instruction on loong64
Pattern1: (the type of c is uint16)
    c>>8 | c<<8
To:
    revb2h c

Pattern2: (the type of c is uint32)
    (c & 0xff00ff00)>>8 | (c & 0x00ff00ff)<<8
To:
    revb2h c

Pattern3: (the type of c is uint64)
    (c & 0xff00ff00ff00ff00)>>8 | (c & 0x00ff00ff00ff00ff)<<8
To:
    revb4h c

Change-Id: Ic6231a3f476cbacbea4bd00e31193d107cb86cda
Reviewed-on: https://go-review.googlesource.com/c/go/+/696335
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-21 11:19:34 -07:00
Joel Sing
8dcab6f450 syscall: simplify execve handling on libc platforms
Rather than providing three different execve variables for different
platforms, use a single variable. Provide a small wrapper that handles
conversion to uintptr for the AIX/Solaris case.

Note that this removes special handling for openbsd/mips64, which is
now a dead port.

Updates #61546

Change-Id: I3d6387c31669f64bfb61639536803e595f478647
Reviewed-on: https://go-review.googlesource.com/c/go/+/693880
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>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2025-08-21 11:19:31 -07:00
Youlin Feng
ba840c1bf9 cmd/compile: deduplication in the source code generated by mknode
Most types in the ir package don't have hidden children, so having
their doChildrenWithHidden and editChildrenWithHidden methods call
their own doChildren and editChildren methods can save a lot of
duplicate code.

Change-Id: Ib22a29d6a9a32855f3c3191ca2d26dff94ac556b
Reviewed-on: https://go-review.googlesource.com/c/go/+/697476
Reviewed-by: Keith Randall <khr@golang.org>
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@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2025-08-21 11:18:07 -07:00
Xiaolin Zhao
fa706ea50f cmd/compile: optimize rule (x + x) << c to x << c+1 on loong64
Change-Id: I782f93510bba92ba60b298c1c1cde456c8bcec38
Reviewed-on: https://go-review.googlesource.com/c/go/+/697956
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2025-08-21 11:16:49 -07:00
Austin Clements
aea0a5e8d7 [dev.simd] simd/_gen/unify: improve envSet doc comment
Change-Id: I2cc0788fefb359b95663d2bd4ef8bf2f94e7f1a1
Reviewed-on: https://go-review.googlesource.com/c/go/+/698116
Auto-Submit: Austin Clements <austin@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-21 10:12:50 -07:00
Junyang Shao
7fdb1da6b0 [dev.simd] cmd/compile, simd: complete truncating u?int conversions.
Downsizing conversions' truncating version complete. Saturation ver not
done.

Change-Id: I710976c2b5329e2882763d60fcef2a827213df09
Reviewed-on: https://go-review.googlesource.com/c/go/+/697975
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-21 10:01:58 -07:00
Junyang Shao
f4c41d9922 [dev.simd] cmd/compile, simd: complete u?int widening conversions
Change-Id: I21da09261b6b278768d99229fe2db387aef1e812
Reviewed-on: https://go-review.googlesource.com/c/go/+/697915
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-21 10:01:55 -07:00
Junyang Shao
6af8881adb [dev.simd] simd: reorganize cvt rules
Comment and reorder rules for better bookkeeping.

This CL changes nothing in the generated code.

Change-Id: Iae04fda584a35fde5e3d54e4882d49614c9e4650
Reviewed-on: https://go-review.googlesource.com/c/go/+/697696
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-08-21 10:01:51 -07:00
Junyang Shao
58cfc2a5f6 [dev.simd] cmd/compile, simd: add VPSADBW
This new API is given the name SumAbsDiff, a slightly-longer name for
its canonical abbreviation SAD(Sum-Absolute-Differences).

This instruction has some similar semantic's one, but their semantic is much more
specific and complex: MPSADBW, VDBPSADBW. They should have a more
specific name given this fact.

Change-Id: Ied9144440f82919c3c2d45ae4ce5b961ae91a020
Reviewed-on: https://go-review.googlesource.com/c/go/+/697776
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-21 10:01:46 -07:00
Austin Clements
f7c6fa709e [dev.simd] simd/_gen/unify: fix some missing environments
There were a couples places where we failed to provide a reasonable
variable environment for YAML encoding. I think this only affects
encoding "!repeat" nodes, which aren't common in practice and a bit of
a disaster, which is how this went unnoticed.

Change-Id: I1a37c00d5eaa1ee8e86d119a2fd73f6a28d69008
Reviewed-on: https://go-review.googlesource.com/c/go/+/698115
Auto-Submit: Austin Clements <austin@google.com>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-21 07:49:35 -07:00
Joel Sing
ffc85ee1f1 cmd/internal/objabi,cmd/link: add support for additional riscv64 relocations
These additional relocation types are encountered when using the
Go race detector with riscv64.

Updates #64345

Change-Id: I6de6430165fb378463da1af9402198a3a31485ca
Reviewed-on: https://go-review.googlesource.com/c/go/+/690496
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
2025-08-21 06:15:34 -07:00
David Chase
7c84e984e6 [dev.simd] cmd/compile: rewrite to elide Slicemask from len==c>0 slicing
This might have been something that prove could be educated
into figuring out, but this also works, and it also helps
prove downstream.

Adjusted the prove test, because this change moved a message.

Change-Id: I5eabe639eff5db9cd9766a6a8666fdb4973829cb
Reviewed-on: https://go-review.googlesource.com/c/go/+/697715
Commit-Queue: David Chase <drchase@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Bypass: David Chase <drchase@google.com>
2025-08-20 15:13:04 -07:00
David Chase
cf31b15635 [dev.simd] simd, cmd/compile: added .Masked() peephole opt for many operations.
This should get many of the low-hanging and important fruit.
Others can follow later.
It needs more testing.

Change-Id: Ic186b075987e85c87197ef9e1ca0b4f33ff96697
Reviewed-on: https://go-review.googlesource.com/c/go/+/697515
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Commit-Queue: David Chase <drchase@google.com>
TryBot-Bypass: David Chase <drchase@google.com>
2025-08-20 15:12:30 -07:00
David Chase
1334285862 [dev.simd] simd: template field name cleanup in genfiles
things were getting a little too ad hoc

Change-Id: I4298002ae57f5b75159703ceed30a117804eb844
Reviewed-on: https://go-review.googlesource.com/c/go/+/697495
Commit-Queue: David Chase <drchase@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
TryBot-Bypass: David Chase <drchase@google.com>
2025-08-20 15:10:45 -07:00
David Chase
af6475df73 [dev.simd] simd: add testing hooks for size-changing conversions
and adds some tests of size-changing conversions.

IMO the template naming conventions in genfiles
are getting grubby, and I plan to change them in
an immediately following CL.

Change-Id: I4a72e8a8c9e9806fab60570dff4c87a754e427c5
Reviewed-on: https://go-review.googlesource.com/c/go/+/697456
Commit-Queue: David Chase <drchase@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
TryBot-Bypass: David Chase <drchase@google.com>
2025-08-20 15:10:27 -07:00
David Chase
ede64cf0d8 [dev.simd] simd, cmd/compile: sample peephole optimization for .Masked()
This is not the end of such peephole optimizations, there
would need to be many of these for many simd operations.

Change-Id: I4511f6fac502bc7259c1c4414c96f56eb400c202
Reviewed-on: https://go-review.googlesource.com/c/go/+/697157
TryBot-Bypass: David Chase <drchase@google.com>
Commit-Queue: David Chase <drchase@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-08-20 15:10:00 -07:00
Cherry Mui
103b6e39ca [dev.simd] all: merge master (9de69f6) into dev.simd
Merge List:

+ 2025-08-20 9de69f6913 errors: mention Is/As in Join docs
+ 2025-08-20 4afd482812 cmd/go/internal/doc: pass URL fragments separately with -http
+ 2025-08-20 509d5f647f internal/poll: don't call Seek for overlapped Windows handles
+ 2025-08-20 853fc12739 internal/poll: set the correct file offset in FD.Seek for Windows overlapped handles
+ 2025-08-19 bd885401d5 runtime: save and restore all fcc registers in async preempt on loong64
+ 2025-08-19 119546ea4f cmd/go: document install outputs to $GOOS_$GOARCH when cross compiling
+ 2025-08-19 ffa882059c unique: deflake TestCanonMap/LoadOrStore/ConcurrentUnsharedKeys
+ 2025-08-19 1f2e8e03e4 os: fix path in MkdirTemp error message
+ 2025-08-19 5024d0d884 cmd/compile: tweak example command in README
+ 2025-08-19 b80ffb64d8 internal/trace: remove redundant info from Event.String
+ 2025-08-19 c7d8bda459 cmd/compile/internal: make function comments match function names
+ 2025-08-19 de2d741667 internal/trace: use RFC3339Nano for wall clock snapshots in Event.String
+ 2025-08-19 c61db5ebd5 syscall: forkAndExecInChild1: don't reuse pid variable
+ 2025-08-19 07ee3bfc63 cmd/go: use modern pprof flags in documentation
+ 2025-08-18 5a56d8848b cmd/compile: ensure we use allowed registers for input-clobbering instructions
+ 2025-08-18 c3927a47f0 runtime: fix comments in tracetype.go
+ 2025-08-15 77f911e31c internal/trace: emit final sync event for generation in Go 1.26+
+ 2025-08-15 786be1d2bf runtime: don't overwrite global stop channel in tests
+ 2025-08-15 4a7fde922f internal/trace: add end-of-generation signal to trace
+ 2025-08-15 cb814bd5bc net: skip TestIPv4WriteMsgUDPAddrPort on plan9
+ 2025-08-15 78a3968c2c runtime/metrics: add metric for current Go-owned thread count
+ 2025-08-15 ab8121a407 runtime/metrics: add metric for total goroutines created
+ 2025-08-15 13df972f68 runtime/metrics: add metrics for goroutine sched states
+ 2025-08-15 bd07fafb0a runtime: disable stack shrinking for all waiting-for-suspendG cases
+ 2025-08-15 a651e2ea47 runtime: remove duff support for amd64
+ 2025-08-15 e4291e484c runtime: remove duff support for arm64
+ 2025-08-15 15d6dbc05c cmd/compile: use generated loops instead of DUFFCOPY on arm64
+ 2025-08-15 bca3e98b8a cmd/go: test barrier actions
+ 2025-08-15 052fcde9fd internal/runtime: cleaner overflow checker
+ 2025-08-15 3871c0d84d syscall: permit nil destination address in sendmsgN{Inet4,Inet6}
+ 2025-08-14 a8564bd412 runtime: make all synctest bubble violations fatal panics

Change-Id: Ibc94566bc69bcb59b1d79b6fa868610ca2d1d223
2025-08-20 16:07:37 -04:00
David Chase
728ac3e050 [dev.simd] simd: tweaks to improve test disassembly
Change-Id: Ic50dd82c05a398d947a38bf20bc8dd22c2f8b935
Reviewed-on: https://go-review.googlesource.com/c/go/+/697156
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-20 12:42:19 -07:00
Sean Liao
9de69f6913 errors: mention Is/As in Join docs
Fixes #74461

Change-Id: Ic1b1b2b43d59dd67f31c2388ca88650ee847ba93
Reviewed-on: https://go-review.googlesource.com/c/go/+/696737
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
2025-08-20 12:04:15 -07:00
David Finkel
4afd482812 cmd/go/internal/doc: pass URL fragments separately with -http
Plumb URL fragments separately when invoking pkgsite so the `#` doesn't
get %-encoded into the path.

Fixes: #75088
Change-Id: I33814fc6a192dff3e4f3d0b9d81205056dddd438
Reviewed-on: https://go-review.googlesource.com/c/go/+/697435
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Ian Alexander <jitsu@google.com>
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2025-08-20 11:19:58 -07:00
qmuntal
509d5f647f internal/poll: don't call Seek for overlapped Windows handles
Overlapped handles don't have the file pointer updated when performing
I/O operations, so there is no need to call FD.Seek to reset the file
pointer.

Also, some overlapped file handles don't support seeking. See #74951.

Fixes #74951.

Change-Id: I0edd53beed7d3862730f3b2ed5fe9ba490e66c06
Reviewed-on: https://go-review.googlesource.com/c/go/+/697295
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2025-08-20 10:33:51 -07:00
qmuntal
853fc12739 internal/poll: set the correct file offset in FD.Seek for Windows overlapped handles
Windows doesn't keep the file pointer for overlapped file handles.
To work around this, we keep track of the current offset ourselves
and use it on every Read/Write operation.

When the user calls File.Seek with whence == io.SeekCurrent, it expects
that the offset we keep track of is also accounted for, else the
the seek'ed value won't match the file pointer seen by the user.

Updates #74951.
Fixes #75081.

Change-Id: Ieca7c3779e5349292883ffc293a8474088a4dec7
Reviewed-on: https://go-review.googlesource.com/c/go/+/697275
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2025-08-20 10:33:45 -07:00
David Chase
4fce49b86c [dev.simd] simd, cmd/compile: add widening unsigned converts 8->16->32
Change-Id: If0bde7154bd622573375eba5539fd642b8ef9d2f
Reviewed-on: https://go-review.googlesource.com/c/go/+/696555
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-08-20 10:26:43 -07:00
Guoqi Chen
bd885401d5 runtime: save and restore all fcc registers in async preempt on loong64
Currently, all Op implementations on loong64 use fcc0 by default, so only
fcc0 is saved in CL 475577. However, fcc1-fcc7 may also be used by users
when writing assembly code, such as in CL 693878.

Change-Id: Idb60d8101a0f7d602dfcbbb39bd5da9f2c475bfd
Reviewed-on: https://go-review.googlesource.com/c/go/+/696875
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2025-08-19 18:58:21 -07:00
Sean Liao
119546ea4f cmd/go: document install outputs to $GOOS_$GOARCH when cross compiling
Fixes #74979

Change-Id: I2a93e3a78c953418cf62d93db107b9c8d25e8ed2
Reviewed-on: https://go-review.googlesource.com/c/go/+/696755
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
2025-08-19 15:58:03 -07:00
Junyang Shao
0f660d675f [dev.simd] simd: make OpMasked machine ops only
Right now we can expect the `Op(...).Masked` idiom to lack many parts that will
make the API incomplete. But to make the API sizes smaller, we are removing these ops' frontend types and interfaces for now. We will have the peepholes and a new pass
checking the CPU features check domination relations to make these ops
picked for the right `Op(...).Masked` idiom.

Change-Id: I77f72a198b3d8b1880dcb911470db5e0089ac1ca
Reviewed-on: https://go-review.googlesource.com/c/go/+/697155
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Bypass: Junyang Shao <shaojunyang@google.com>
2025-08-19 13:46:58 -07:00
Michael Anthony Knyszek
ffa882059c unique: deflake TestCanonMap/LoadOrStore/ConcurrentUnsharedKeys
I do not know yet what's causing this flake, but I've debugged it enough
to be confident that it's not a serious issue; it seems to be a test
flake. There is some path through which the tree nodes or keys might
still be transiently reachable, but I don't yet know what that is.

Details about what I tried and ruled out are in the code.

For #74083.

Change-Id: I97cdaf3f97e8c543fcc2ccde8b7e682893ae2f97
Reviewed-on: https://go-review.googlesource.com/c/go/+/697341
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-19 13:39:08 -07:00
Jonathan Conder
1f2e8e03e4 os: fix path in MkdirTemp error message
Fixes #75012

Change-Id: I9dd3ba8987bde9db93769a1b05d13b162ba5332d
Reviewed-on: https://go-review.googlesource.com/c/go/+/696715
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Sean Liao <sean@liao.dev>
Reviewed-by: David Chase <drchase@google.com>
2025-08-19 12:54:53 -07:00
Jes Cok
5024d0d884 cmd/compile: tweak example command in README
While running ./src/all.bash, I got the following error:

all.bash must be run from $GOROOT/src

Change-Id: Iad271654ff8647501a324c282f01baf39605e3df
GitHub-Last-Rev: 2e289babf1
GitHub-Pull-Request: golang/go#75050
Reviewed-on: https://go-review.googlesource.com/c/go/+/696296
Reviewed-by: t hepudds <thepudds1460@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2025-08-19 12:53:35 -07:00
Felix Geisendörfer
b80ffb64d8 internal/trace: remove redundant info from Event.String
Remove redundant information from state transition events. They
currently mention the proc and goroutine id that is transitioning twice.

Also reorder the reason to appear after the from->to state transition
information since it is a detail that is not available for all
transition.

Before example:

M=6164541440 P=3 G=17 StateTransition Time=7169014471424 Resource=Goroutine(17) Reason="chan receive" GoID=17 Running->Waiting
M=6166261760 P=3 G=10 StateTransition Time=7169908799040 Resource=Proc(4) Reason="" ProcID=4 Idle->Idle

After example:

M=6164541440 P=3 G=17 StateTransition Time=7169014471424 GoID=17 Running->Waiting Reason="chan receive" 
M=6166261760 P=3 G=10 StateTransition Time=7169908799040 ProcID=4 Idle->Idle Reason=""

Change-Id: I6a6a696487ff2905f7c98dae7e887b998a2cb298
Reviewed-on: https://go-review.googlesource.com/c/go/+/697356
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2025-08-19 12:48:42 -07:00
cuishuang
c7d8bda459 cmd/compile/internal: make function comments match function names
Change-Id: I2ebadb87a4f60487c8f720930a72bc5ef953d7cf
Reviewed-on: https://go-review.googlesource.com/c/go/+/696695
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-19 12:45:29 -07:00
Felix Geisendörfer
de2d741667 internal/trace: use RFC3339Nano for wall clock snapshots in Event.String
Improve the quality of life for people who use go tool trace -d=parsed
to look at clock snapshot wall timestamps. Many use cases will benefit
from seing the timestamp in sub-second resolution.

Change-Id: I6a6a696403a2164db0c12789c764e22a5c519b1c
Reviewed-on: https://go-review.googlesource.com/c/go/+/697355
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-08-19 12:37:54 -07:00
Junyang Shao
a034826e26 [dev.simd] simd, cmd/compile: implement ToMask, unexport asMask.
This CL defines the mask semantic better:
When converting from vector to mask, its element is set to true iff
the corresponding vector element is non zero.

Change-Id: I331c1c7992dc9e81c211bdc6d73e5eb3b8414506
Reviewed-on: https://go-review.googlesource.com/c/go/+/697056
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-19 10:20:22 -07:00
Kir Kolyshkin
c61db5ebd5 syscall: forkAndExecInChild1: don't reuse pid variable
A named return variable pid is reused in a few places, and while
the code is not wrong, it is somewhat confusing.

This variable used to be called r1 before CL 456516 (which did the right
thing, but slightly added to the confusion).

Now, the code calling SYS_WRITE (initially added by CL 158298) never
checks the number of bytes written, so let's remove the assignment.

In the code that calls SYS_READ it is used, so let's use a different
variable, c, which seems less confusing.

All this hopefully makes the code more readable.

Change-Id: I0d7ec311615100deb7e0aa3f02384eadcc1b47e8
Reviewed-on: https://go-review.googlesource.com/c/go/+/696835
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Stapelberg <stapelberg@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-19 08:26:46 -07:00
Ian Alexander
07ee3bfc63 cmd/go: use modern pprof flags in documentation
This change updates our mentions of pprof flags so that we now refer to
the modern flag names instead of the legacy ones.

Fixes #74336.

Change-Id: Ie8fbc7407178219b84ce5171fa5e94621129267e
Reviewed-on: https://go-review.googlesource.com/c/go/+/689095
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2025-08-19 07:14:53 -07:00
David Chase
8ccd6c2034 [dev.simd] simd, cmd/compile: mark BLEND instructions as not-zero-mask
Change-Id: Ida9f29423d62a25be41dcf637ffb9275b7cae642
Reviewed-on: https://go-review.googlesource.com/c/go/+/697055
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-18 13:12:38 -07:00
David Chase
9a934d5080 [dev.simd] cmd/compile, simd: added methods for "float" GetElem
This also required a "always use operation with least
OverrideBase" filter in choosing the machine instructions.

The order of generated HW operations is slightly
modified because the Float version of GetElem
appears earlier in the sorted operations list,
though it is not chosen to generate the HW Op.

Change-Id: I95fa67afca9c8b6f4f18941fdcaf69afdad8055b
Reviewed-on: https://go-review.googlesource.com/c/go/+/696375
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>
2025-08-18 13:12:27 -07:00
Keith Randall
5a56d8848b cmd/compile: ensure we use allowed registers for input-clobbering instructions
For instructions which clobber their input register, we make a second
copy of the input value so it is still available in a register for
future instructions.

That second copy might not respect the register input restrictions
for the instruction. So the second copy we make here can't actually
be used by the instruction - it should use the first copy, the second
copy is the one that will persist beyond the clobber.

Fixes #75063

Change-Id: I99acdc63f0c4e54567a174ff7ada601ae4e796b7
Reviewed-on: https://go-review.googlesource.com/c/go/+/697015
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-18 12:15:08 -07:00
Felix Geisendörfer
c3927a47f0 runtime: fix comments in tracetype.go
They seem to have been copy and pasted from tracestack.go without being
updated.

Change-Id: I6a6a69645a778fe8e6e8a2f4a80429f20e90162e
Reviewed-on: https://go-review.googlesource.com/c/go/+/674215
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-08-18 08:57:45 -07:00
Michael Anthony Knyszek
77f911e31c internal/trace: emit final sync event for generation in Go 1.26+
CL 693398 returned the error from reading a generation immediately, but
this is wrong -- a Sync event must be emitted to indicate the end of the
trace before reporting the error. This caused TestCrashWhileTracing
to fail because that test has a high likelihood of producing a truncated
trace, and it expects at least 2 Sync events. The truncated trace error
would be reported before the second Sync event, which is incorrect.

Fixes #75045.

Change-Id: Ia71592c4ec56a544afc85cdb7b575e143f80e048
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/696436
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-15 18:10:28 -07:00
Michael Anthony Knyszek
786be1d2bf runtime: don't overwrite global stop channel in tests
This is used by TestStopTheWorldDeadlock, and the new
TestReadMetricsSched test accidentally modifies this global variable
instead of (as intended) defining a local one.

Change-Id: I7aaece83f285d051ad8b56b7591c76613c39613a
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/696556
Reviewed-by: Michael Pratt <mpratt@google.com>
TryBot-Bypass: Michael Knyszek <mknyszek@google.com>
2025-08-15 14:45:43 -07:00
Michael Anthony Knyszek
4a7fde922f internal/trace: add end-of-generation signal to trace
This change takes the EvEndOfGeneration event and promotes it to a real
event that appears in the trace.

This allows the trace parser to unambiguously identify truncated traces
vs. broken traces. It also makes a lot of the logic around parsing
simpler, because there's no more batch spilling necessary.

Fixes #73904.

Change-Id: I37c359b32b6b5f894825aafc02921adeaacf2595
Reviewed-on: https://go-review.googlesource.com/c/go/+/693398
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-15 14:01:30 -07:00
Richard Miller
cb814bd5bc net: skip TestIPv4WriteMsgUDPAddrPort on plan9
This test uses method (*UDPConn).WriteMsgUDPAddrPort, which is
not supported on Plan 9. The test needs to be skipped, like
for example TestAllocs which is already skipped for the
same reason.

Fixes #75017

Change-Id: Iaa0e6ecdba0938736d8f675fcac43c46db34cb5d
Reviewed-on: https://go-review.googlesource.com/c/go/+/696095
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>
2025-08-15 13:18:32 -07:00
Michael Anthony Knyszek
78a3968c2c runtime/metrics: add metric for current Go-owned thread count
Fixes #15490.

Change-Id: I6ce9edc46398030ff639e22d4ca4adebccdfe1b7
Reviewed-on: https://go-review.googlesource.com/c/go/+/690399
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>
2025-08-15 12:59:55 -07:00
Michael Anthony Knyszek
ab8121a407 runtime/metrics: add metric for total goroutines created
For #15490.

Change-Id: Ic587dda1f42d613ea131a6b53ce6ba6e6cadf4c7
Reviewed-on: https://go-review.googlesource.com/c/go/+/690398
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>
2025-08-15 11:31:04 -07:00
Michael Anthony Knyszek
13df972f68 runtime/metrics: add metrics for goroutine sched states
This is largely a port of CL 38180.

For #15490.

Change-Id: I2726111e472e81e9f9f0f294df97872c2689f061
Reviewed-on: https://go-review.googlesource.com/c/go/+/690397
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>
2025-08-15 11:31:00 -07:00
Michael Anthony Knyszek
bd07fafb0a runtime: disable stack shrinking for all waiting-for-suspendG cases
Currently isShrinkStackSafe returns false if a goroutine is put into
_Gwaiting while it actually goes and executes on the system stack.
For a long time, we needed to be robust to the goroutine's stack
shrinking while we're executing on the system stack.

Unfortunately, this has become harder and harder to do over time. First,
the execution tracer might be invoked in these contexts and it may wish
to take a stack trace. We cannot take the stack trace if the garbage
collector might concurrently shrink the stack of the user goroutine we
want to trace. So, isShrinkStackSafe grew the condition that we wouldn't
try to shrink the stack in these cases if execution tracing was enabled.

Today, runtime.mutex may wish to take a stack trace for the mutex
profile, and it can happen in a very similar context. Taking the stack
trace is no longer safe.

This change takes the stance that we stop trying to make this work at
all, and instead guarantee that the stack won't move while we're in
these sensitive contexts.

Change-Id: Ibfad2d7a335ee97cecaa48001df0db9812deeab1
Reviewed-on: https://go-review.googlesource.com/c/go/+/692716
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>
2025-08-15 11:23:37 -07:00
Keith Randall
a651e2ea47 runtime: remove duff support for amd64
Change-Id: I742b49a3889892b7b1bb354f47f1c0d933c041e4
Reviewed-on: https://go-review.googlesource.com/c/go/+/682395
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-15 11:13:59 -07:00
Keith Randall
e4291e484c runtime: remove duff support for arm64
Change-Id: Ib290079a77a746a8512cd4638310b24164f6a930
Reviewed-on: https://go-review.googlesource.com/c/go/+/679456
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-15 11:01:34 -07:00
Keith Randall
15d6dbc05c cmd/compile: use generated loops instead of DUFFCOPY on arm64
Change-Id: Ic2aa8959b7fc594b86def70b6c2be38badf7970c
Reviewed-on: https://go-review.googlesource.com/c/go/+/679015
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
2025-08-15 09:57:17 -07:00
Junyang Shao
7380213a4e [dev.simd] cmd/compile: make move/load/store dependent only on reg and width
This CL improve its previous CL by implementing
move/load/storeByRegWidth. It should have not touched the compilation
path of complex128, but as a side effect, the move/load/store of
16-byte SIMD vectors in X0 to X15 are now compiled to MOVUPS instead of
VMOVDQU.

These functions could be used in MOV*const, but this CL does not do that
because we haven't seen problems of them yet. But in the future if we
see problems calling these functions to find the right asm might be handy.

Change-Id: I9b76e65eef8155479d3e288402aa96bc29a4f7cb
Reviewed-on: https://go-review.googlesource.com/c/go/+/696255
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-08-15 09:51:45 -07:00
Junyang Shao
908e3e8166 [dev.simd] cmd/compile: make (most) move/load/store lowering use reg and width only
This CL tries to clean up the move/load/store lowering a bit. After CL
695315 the register information for instructions are expected to be
correct for SIMD, but we still need to pick the right instruction during
ssa to asm lowering.

The code before this CL should be working correctly, but MOVSSconst and
MOVSDconst contains duplicated codes, this CL removes that.

This CL also rewrite move/load/storeByTypeAndReg to use only the width
and reg for all non-SIMD types, which is more consistent.

Change-Id: I76c14f3d0140bcbd4fbea0df275fee0202a3b7d9
Reviewed-on: https://go-review.googlesource.com/c/go/+/696175
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-15 09:51:39 -07:00
Jon San Miguel
bca3e98b8a cmd/go: test barrier actions
Add a barrier action between test run action and it's dependencies.
Run will depend on this barrier action, and the barrier action will depend on:
1. The run action's dependencies
2. The previous barrier action

This will force internal/work to schedule test run actions in-order, preventing potential goroutine starvation from
the channel locking mechanism created to force test run actions to start in-order.

Fixes #73106 #61233

Change-Id: I72e9f752f7521093f3c875eef7f2f29b2393fce9
Reviewed-on: https://go-review.googlesource.com/c/go/+/668035
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Michael Matloob <matloob@google.com>
2025-08-15 08:14:16 -07:00
cuiweixie
052fcde9fd internal/runtime: cleaner overflow checker
remove todo

Change-Id: I4b10d7a8c26bea9296b321f53abd0330f2afc35a
GitHub-Last-Rev: b939acc287
GitHub-Pull-Request: golang/go#74943
Reviewed-on: https://go-review.googlesource.com/c/go/+/694236
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-08-15 08:13:02 -07:00
database64128
3871c0d84d syscall: permit nil destination address in sendmsgN{Inet4,Inet6}
For #74841

Change-Id: Ic3ef9c61a89bc8bc0594724a6d94eed91fb63eae
Reviewed-on: https://go-review.googlesource.com/c/go/+/692435
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
2025-08-15 04:01:41 -07:00
Damien Neil
a8564bd412 runtime: make all synctest bubble violations fatal panics
Unblocking a bubbled goroutine from outside the bubble is an error
and panics. Currently, some of those panics are regular panics
and some are fatal. We use fatal panics in cases where its difficult
to panic without leaving something in an inconsistent state.

Change the regular panics (channel and timer operations) to be fatal.

This makes our behavior more consistent: All bubble violations are
always fatal.

More importantly, it avoids introducing new, recoverable panics.
A motivating example for this change is the context package,
which performs channel operations with a mutex held in the
expectation that those operations can never panic. These operations
can now panic as a result of a bubble violation, potentially
leaving a context.Context in an inconsistent state.

Fixes #74837

Change-Id: Ie6efd916b7f505c0f13dde42de1572992401f15c
Reviewed-on: https://go-review.googlesource.com/c/go/+/696195
Auto-Submit: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-08-14 12:20:59 -07:00
Junyang Shao
9783f86bc8 [dev.simd] cmd/compile: accounts rematerialize ops's output reginfo
This CL implements the check for rematerializeable value's output
regspec at its remateralization site. It has some potential problems,
please see the TODO in regalloc.go.

Fixes #70451.

Change-Id: Ib624b967031776851136554719e939e9bf116b7c
Reviewed-on: https://go-review.googlesource.com/c/go/+/695315
Reviewed-by: David Chase <drchase@google.com>
TryBot-Bypass: David Chase <drchase@google.com>
2025-08-14 11:46:41 -07:00
Cherry Mui
a4ad41708d [dev.simd] all: merge master (924fe98) into dev.simd
Conflicts:

- src/cmd/compile/internal/amd64/ssa.go
- src/cmd/compile/internal/ssa/expand_calls.go
- src/cmd/compile/internal/ssagen/ssa.go
- src/internal/buildcfg/exp.go
- src/internal/cpu/cpu.go
- src/internal/cpu/cpu_x86.go
- src/runtime/mkpreempt.go
- src/runtime/preempt_amd64.go
- src/runtime/preempt_amd64.s

Merge List:

+ 2025-08-14 924fe98902 cmd/internal/obj/riscv: add encoding for compressed riscv64 instructions
+ 2025-08-13 320df537cc cmd/compile: emit classify instructions for infinity tests on riscv64
+ 2025-08-13 ca66f907dd cmd/compile: use generated loops instead of DUFFCOPY on amd64
+ 2025-08-13 4b1800e476 encoding/json/v2: cleanup error constructors
+ 2025-08-13 af8870708b encoding/json/v2: fix incorrect marshaling of NaN in float64 any
+ 2025-08-13 0a75e5a07b encoding/json/v2: fix wrong type with cyclic marshal error in map[string]any
+ 2025-08-13 de9b6f9875 cmd/pprof: update vendored github.com/google/pprof
+ 2025-08-13 674c5f0edd os/exec: fix incorrect expansion of ".." in LookPath on plan9
+ 2025-08-13 9bbea0f21a cmd/compile: during regalloc, fixedreg values are always available
+ 2025-08-13 08eef97500 runtime/trace: fix documentation typo
+ 2025-08-13 2fe5d51d04 internal/trace: fix wrong scope for Event.Range or EvGCSweepActive
+ 2025-08-13 9fcb87c352 cmd/compile: teach prove about len's & cap's max based on the element size
+ 2025-08-13 9763ece873 cmd/compile: absorb NEGV into branch on loong64
+ 2025-08-13 f10a82b76f all: update vendored dependencies [generated]
+ 2025-08-13 3bea95b277 cmd/link/internal/ld: remove OpenBSD buildid workaround
+ 2025-08-12 90b7d7aaa2 cmd/compile/internal: optimize multiplication use new operation 'ADDshiftLLV' on loong64
+ 2025-08-12 1b263fc604 runtime/race: restore previous version of LLVM TSAN on macOS
+ 2025-08-12 b266318cf7 cmd/compile/internal/ssa: use BEQ/BNE to optimize the combination of XOR and EQ/NE on loong64
+ 2025-08-12 adbf59525c internal/runtime/gc/scan: avoid -1 index when cache sizes unavailable
+ 2025-08-12 4e182db5fc Revert "cmd/compile: use generated loops instead of DUFFCOPY on amd64"
+ 2025-08-12 d2b3c1a504 internal/trace: clarify which StateTransition events have stacks
+ 2025-08-12 f63e12d0e0 internal/trace: fix Sync.ClockSnapshot comment
+ 2025-08-12 8e317da77d internal/trace: remove unused StateTransition.id field
+ 2025-08-12 f67d8ff34a internal/trace/tracev2: adjust comment for consistency
+ 2025-08-12 fe4d445c36 internal/trace/tracev2: fix EvSTWBegin comment to include stack ID
+ 2025-08-12 750789fab7 internal/trace/internal/testgen: fix missing stacks nframes arg
+ 2025-08-12 889ab74169 internal/runtime/gc/scan: import scan kernel from gclab [green tea]
+ 2025-08-12 182336bf05 net/http: fix data race in client
+ 2025-08-12 f04421ea9a cmd/compile: soften test for 74788
+ 2025-08-12 28aa529c99 cmd/compile: use generated loops instead of DUFFZERO on arm64
+ 2025-08-12 ec9e1176c3 cmd/compile: use generated loops instead of DUFFCOPY on amd64
+ 2025-08-12 d0a64f7969 Revert "cmd/compile/internal/ssa: Use transitive properties for len/cap"
+ 2025-08-12 00a7bdcb55 all: delete aliastypeparams GOEXPERIMENT
+ 2025-08-11 74421a305b Revert "cmd/compile: allow multi-field structs to be stored directly in interfaces"
+ 2025-08-11 c31359138c Revert "cmd/compile: allow StructSelect [x] of interface data fields for x>0"
+ 2025-08-11 7248995b60 Revert "cmd/compile: allow more args in StructMake folding rule"
+ 2025-08-11 caf9fc3ccd Revert "reflect: handle zero-sized fields of directly-stored structures correctly"
+ 2025-08-11 ce3f3e2ae7 cmd/link/internal/ld, internal/syscall/unix: use posix_fallocate on netbsd
+ 2025-08-11 3dbef65bf3 database/sql: allow drivers to override Scan behavior
+ 2025-08-11 2b804abf07 net: context aware Dialer.Dial functions
+ 2025-08-11 6abfe7b0de cmd/dist: require Go 1.24.6 as minimum bootstrap toolchain
+ 2025-08-11 691af6ca28 encoding/json: fix Indent trailing whitespace regression in goexperiment.jsonv2
+ 2025-08-11 925149da20 net/http: add example for CrossOriginProtection
+ 2025-08-11 cf4af0b2f3 encoding/json/v2: fix UnmarshalDecode regression with EOF
+ 2025-08-11 b096ddb9ea internal/runtime/maps: loop invariant code motion with h2(hash) by hand
+ 2025-08-11 a2431776eb net, os, file/filepath, syscall: use slices.Equal in tests
+ 2025-08-11 a7f05b38f7 cmd/compile: convert branch with zero to more optimal branch zero on loong64
+ 2025-08-11 1718828c81 internal/sync: warn about incorrect unsafe usage in HashTrieMap
+ 2025-08-11 084c0f8494 cmd/compile: allow InlMark operations to be speculatively executed
+ 2025-08-10 a62f72f7a7 cmd/compile/internal/ssa: optimise more branches with SGTconst/SGTUconst on loong64
+ 2025-08-08 fbac94a799 internal/sync: rename Store parameter from old to new
+ 2025-08-08 317be4cfeb cmd/compile/internal/staticinit: remove deadcode
+ 2025-08-08 bce5601cbb cmd/go: fix fips doc link
+ 2025-08-08 777d76c4f2 text/template: use sync.OnceValue for builtinFuncs
+ 2025-08-08 0201524c52 math: remove redundant infinity tests
+ 2025-08-08 dcc77f9e3c cmd/go: fix get -tool when multiple packages are provided
+ 2025-08-08 c7b85e9ddc all: update blog link
+ 2025-08-08 a8dd771e13 crypto/tls: check if quic conn can send session ticket
+ 2025-08-08 bdb2d50fdf net: fix WriteMsgUDPAddrPort addr handling on IPv4 sockets
+ 2025-08-08 768c51e368 internal/runtime/maps: remove unused var bitsetDeleted
+ 2025-08-08 b3388569a1 reflect: handle zero-sized fields of directly-stored structures correctly
+ 2025-08-08 d83b16fcb8 internal/bytealg: vector implementation of compare for riscv64
+ 2025-08-07 dd3abf6bc5 internal/bytealg: optimize Index/IndexString on loong64
+ 2025-08-07 73ff6d1480 cmd/internal/obj/loong64: change the immediate range of ALSL{W/WU/V}
+ 2025-08-07 f3606b0825 cmd/compile/internal/ssa: fix typo in LOONG64Ops.go comment
+ 2025-08-07 ee7bb8969a cmd/internal/obj/loong64: add support for FSEL instruction
+ 2025-08-07 1f7ffca171 time: skip TestLongAdjustTimers on plan9 (too slow)
+ 2025-08-06 8282b72d62 runtime/race: update darwin race syso
+ 2025-08-06 dc54d7b607 all: remove support for windows/arm
+ 2025-08-06 e0a1ea431c cmd/compile: make panicBounds stack frame smaller on ppc64
+ 2025-08-06 2747f925dd debug/macho: support reading imported symbols without LC_DYSYMTAB
+ 2025-08-06 025d36917c cmd/internal/testdir: pass -buildid to link command
+ 2025-08-06 f53dcb6280 cmd/internal/testdir: unify link command
+ 2025-08-06 a3895fe9f1 database/sql: avoid closing Rows while scan is in progress
+ 2025-08-06 608e9fac90 go/types, types2: flip on position tracing
+ 2025-08-06 72e8237cc1 cmd/compile: allow more args in StructMake folding rule
+ 2025-08-06 3406a617d9 internal/bytealg: vector implementation of indexbyte for riscv64
+ 2025-08-06 75ea2d05c0 internal/bytealg: vector implementation of equal for riscv64
+ 2025-08-05 17a8be7117 crypto/sha512: use const table for key loading on loong64
+ 2025-08-05 dda9d780e2 crypto/sha256: use const table for key loading on loong64
+ 2025-08-05 5defe8ebb3 internal/chacha8rand: replace WORD with instruction VMOVQ
+ 2025-08-05 4c7362e41c cmd/internal/obj/loong64: add new instructions ALSL{W/WU/V} for loong64
+ 2025-08-05 a552737418 cmd/compile: fold negation into multiplication on loong64
+ 2025-08-05 e1fd4faf91 runtime: fix godoc comment for inVDSOPage
+ 2025-08-05 bcd25c79aa cmd/compile: allow StructSelect [x] of interface data fields for x>0
+ 2025-08-05 b0945a54b5 cmd/dist, internal/platform: mark freebsd/riscv64 broken
+ 2025-08-05 55d961b202 runtime: save AVX2 and AVX-512 state on asynchronous preemption
+ 2025-08-05 af0c4fe2ca runtime: save scalar registers off stack in amd64 async preemption
+ 2025-08-05 e73afaae69 internal/cpu: add AVX-512-CD and DQ, and derived "basic AVX-512"
+ 2025-08-05 cef381ba60 runtime: eliminate global state in mkpreempt.go
+ 2025-08-05 c0025d5e0b go/parser: correct comment in expectedErrors
+ 2025-08-05 4ee0df8c46 cmd: remove dead code
+ 2025-08-05 a2c45f0eb1 runtime: test VDSO symbol hash values
+ 2025-08-05 cd55f86b8d cmd/compile: allow multi-field structs to be stored directly in interfaces
+ 2025-08-05 21ab0128b6 cmd/compile: remove support for old-style bounds check calls
+ 2025-08-05 802d056c78 cmd/compile: move ppc64 over to new bounds check strategy
+ 2025-08-05 a3295df873 cmd/compile/internal/ssa: Use transitive properties for len/cap
+ 2025-08-05 bd082857a5 doc: fix typo in go memory model doc
+ 2025-08-05 2b622b05a9 cmd/compile: remove isUintXPowerOfTwo functions
+ 2025-08-05 72147ffa75 cmd/compile: simplify isUintXPowerOfTwo implementation
+ 2025-08-05 26da1199eb cmd/compile: make isUint{32,64}PowerOfTwo implementations clearer
+ 2025-08-05 5ab9f23977 cmd/compile, runtime: add checkptr instrumentation for unsafe.Add
+ 2025-08-05 fcc036f03b cmd/compile: optimise float <-> int register moves on riscv64

Change-Id: Ie94f29d9b0cc14a52a536866f5abaef27b5c52d7
2025-08-14 11:43:16 -04:00
Joel Sing
924fe98902 cmd/internal/obj/riscv: add encoding for compressed riscv64 instructions
Regenerate instruction encodings for riscv64, including rv64_c, rv_c
and rv_c_d.

Updates #71105

Change-Id: I004cc00290bf018ebb848592d84d924481f03851
Reviewed-on: https://go-review.googlesource.com/c/go/+/523476
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2025-08-14 07:49:28 -07:00
Michael Munday
320df537cc cmd/compile: emit classify instructions for infinity tests on riscv64
The 'classify' instruction on RISC-V sets a bit in a mask to indicate
the class a floating point value belongs to (e.g. whether the value is
an infinity, a normal number, a subnormal number and so on). There are
other places this instruction is useful but for now I've just used it
for infinity tests.

The gains are relatively small (~1-2 instructions per IsInf call) but
using FCLASSD does potentially unlock further optimizations. It also
reduces the number of loads from memory and the number of moves
between general purpose and floating point register files.

goos: linux
goarch: riscv64
pkg: math
cpu: Spacemit(R) X60
                    │        sec/op        │   sec/op     vs base                │
Acos                           159.9n ± 0%   173.7n ± 0%   +8.66% (p=0.000 n=10)
Acosh                          249.8n ± 0%   254.4n ± 0%   +1.86% (p=0.000 n=10)
Asin                           159.9n ± 0%   173.7n ± 0%   +8.66% (p=0.000 n=10)
Asinh                          292.2n ± 0%   283.0n ± 0%   -3.15% (p=0.000 n=10)
Atan                           119.1n ± 0%   119.0n ± 0%   -0.08% (p=0.036 n=10)
Atanh                          265.1n ± 0%   271.6n ± 0%   +2.43% (p=0.000 n=10)
Atan2                          194.9n ± 0%   186.7n ± 0%   -4.23% (p=0.000 n=10)
Cbrt                           216.3n ± 0%   203.1n ± 0%   -6.10% (p=0.000 n=10)
Ceil                           31.82n ± 0%   31.81n ± 0%        ~ (p=0.063 n=10)
Copysign                       4.897n ± 0%   4.893n ± 3%   -0.08% (p=0.038 n=10)
Cos                            123.9n ± 0%   107.7n ± 1%  -13.03% (p=0.000 n=10)
Cosh                           293.0n ± 0%   264.6n ± 0%   -9.68% (p=0.000 n=10)
Erf                            150.0n ± 0%   133.8n ± 0%  -10.80% (p=0.000 n=10)
Erfc                           151.8n ± 0%   137.9n ± 0%   -9.16% (p=0.000 n=10)
Erfinv                         173.8n ± 0%   173.8n ± 0%        ~ (p=0.820 n=10)
Erfcinv                        173.8n ± 0%   173.8n ± 0%        ~ (p=1.000 n=10)
Exp                            247.7n ± 0%   220.4n ± 0%  -11.04% (p=0.000 n=10)
ExpGo                          261.4n ± 0%   232.5n ± 0%  -11.04% (p=0.000 n=10)
Expm1                          176.2n ± 0%   164.9n ± 0%   -6.41% (p=0.000 n=10)
Exp2                           220.4n ± 0%   190.2n ± 0%  -13.70% (p=0.000 n=10)
Exp2Go                         232.5n ± 0%   204.0n ± 0%  -12.22% (p=0.000 n=10)
Abs                            4.897n ± 0%   4.897n ± 0%        ~ (p=0.726 n=10)
Dim                            16.32n ± 0%   16.31n ± 0%        ~ (p=0.770 n=10)
Floor                          31.84n ± 0%   31.83n ± 0%        ~ (p=0.677 n=10)
Max                            26.11n ± 0%   26.13n ± 0%        ~ (p=0.290 n=10)
Min                            26.10n ± 0%   26.11n ± 0%        ~ (p=0.424 n=10)
Mod                            416.2n ± 0%   337.8n ± 0%  -18.83% (p=0.000 n=10)
Frexp                          63.65n ± 0%   50.60n ± 0%  -20.50% (p=0.000 n=10)
Gamma                          218.8n ± 0%   206.4n ± 0%   -5.62% (p=0.000 n=10)
Hypot                          92.20n ± 0%   94.69n ± 0%   +2.70% (p=0.000 n=10)
HypotGo                        107.7n ± 0%   109.3n ± 0%   +1.49% (p=0.000 n=10)
Ilogb                          59.54n ± 0%   44.04n ± 0%  -26.04% (p=0.000 n=10)
J0                             708.9n ± 0%   674.5n ± 0%   -4.86% (p=0.000 n=10)
J1                             707.6n ± 0%   676.1n ± 0%   -4.44% (p=0.000 n=10)
Jn                             1.513µ ± 0%   1.427µ ± 0%   -5.68% (p=0.000 n=10)
Ldexp                          70.20n ± 0%   57.09n ± 0%  -18.68% (p=0.000 n=10)
Lgamma                         201.5n ± 0%   185.3n ± 1%   -8.01% (p=0.000 n=10)
Log                            201.5n ± 0%   182.7n ± 0%   -9.35% (p=0.000 n=10)
Logb                           59.54n ± 0%   46.53n ± 0%  -21.86% (p=0.000 n=10)
Log1p                          178.8n ± 0%   173.9n ± 6%   -2.74% (p=0.021 n=10)
Log10                          201.4n ± 0%   184.3n ± 0%   -8.49% (p=0.000 n=10)
Log2                           79.17n ± 0%   66.07n ± 0%  -16.54% (p=0.000 n=10)
Modf                           34.27n ± 0%   34.25n ± 0%        ~ (p=0.559 n=10)
Nextafter32                    49.34n ± 0%   49.37n ± 0%   +0.05% (p=0.040 n=10)
Nextafter64                    43.66n ± 0%   43.66n ± 0%        ~ (p=0.869 n=10)
PowInt                         309.1n ± 0%   267.4n ± 0%  -13.49% (p=0.000 n=10)
PowFrac                        769.6n ± 0%   677.3n ± 0%  -11.98% (p=0.000 n=10)
Pow10Pos                       13.88n ± 0%   13.88n ± 0%        ~ (p=0.811 n=10)
Pow10Neg                       19.58n ± 0%   19.57n ± 0%        ~ (p=0.993 n=10)
Round                          23.65n ± 0%   23.66n ± 0%        ~ (p=0.354 n=10)
RoundToEven                    27.75n ± 0%   27.75n ± 0%        ~ (p=0.971 n=10)
Remainder                      380.0n ± 0%   309.9n ± 0%  -18.45% (p=0.000 n=10)
Signbit                        13.06n ± 0%   13.06n ± 0%        ~ (p=1.000 n=10)
Sin                            133.8n ± 0%   120.8n ± 0%   -9.75% (p=0.000 n=10)
Sincos                         160.7n ± 0%   147.7n ± 0%   -8.12% (p=0.000 n=10)
Sinh                           305.9n ± 0%   277.9n ± 0%   -9.17% (p=0.000 n=10)
SqrtIndirect                   3.265n ± 0%   3.264n ± 0%        ~ (p=0.546 n=10)
SqrtLatency                    19.58n ± 0%   19.58n ± 0%        ~ (p=0.973 n=10)
SqrtIndirectLatency            19.59n ± 0%   19.58n ± 0%        ~ (p=0.370 n=10)
SqrtGoLatency                  205.7n ± 0%   202.7n ± 0%   -1.46% (p=0.000 n=10)
SqrtPrime                      4.953µ ± 0%   4.954µ ± 0%        ~ (p=0.477 n=10)
Tan                            163.2n ± 0%   150.2n ± 0%   -7.99% (p=0.000 n=10)
Tanh                           312.4n ± 0%   284.2n ± 0%   -9.01% (p=0.000 n=10)
Trunc                          31.83n ± 0%   31.83n ± 0%        ~ (p=0.663 n=10)
Y0                             701.0n ± 0%   669.2n ± 0%   -4.54% (p=0.000 n=10)
Y1                             704.5n ± 0%   672.4n ± 0%   -4.55% (p=0.000 n=10)
Yn                             1.490µ ± 0%   1.422µ ± 0%   -4.60% (p=0.000 n=10)
Float64bits                    5.713n ± 0%   5.710n ± 0%        ~ (p=0.926 n=10)
Float64frombits                4.896n ± 0%   4.896n ± 0%        ~ (p=0.663 n=10)
Float32bits                    12.25n ± 0%   12.25n ± 0%        ~ (p=0.571 n=10)
Float32frombits                4.898n ± 0%   4.896n ± 0%        ~ (p=0.754 n=10)
FMA                            4.895n ± 0%   4.895n ± 0%        ~ (p=0.745 n=10)
geomean                        94.40n        89.43n        -5.27%

Change-Id: I4fe0f2e9f609e38d79463f9ba2519a3f9427432e
Reviewed-on: https://go-review.googlesource.com/c/go/+/348389
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@google.com>
2025-08-13 20:33:56 -07:00
Keith Randall
ca66f907dd cmd/compile: use generated loops instead of DUFFCOPY on amd64
This reverts commit 4e182db5fc (CL 695196),
which is itself a revert of
ec9e1176c3 (CL 678620).

So this CL is exactly the same as CL 678620, but with a regalloc fix
(CL 696035) submitted first.

Change-Id: I743ab32fa3aa6ef3e1b2b6751a2ef4519139057c
Reviewed-on: https://go-review.googlesource.com/c/go/+/696016
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-13 15:57:33 -07:00
Joe Tsai
4b1800e476 encoding/json/v2: cleanup error constructors
There is no need to explicitly pass in the options
since this contained within the Encoder or Decoder struct
ever since https://github.com/go-json-experiment/json/pull/163.

Thus, remove it as an argument and fetch it from the coder.

This only modifies code that is compiled in under goexperiment.jsonv2.

Change-Id: I6c928b864bf7869889d7ee7d5c1d396fbe71296b
Reviewed-on: https://go-review.googlesource.com/c/go/+/695278
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2025-08-13 15:47:52 -07:00
Joe Tsai
af8870708b encoding/json/v2: fix incorrect marshaling of NaN in float64 any
There is a fast-path optimization for marshaling an any type
that should be semantically identical to when the optimization
is not active (i.e., optimizeCommon is false).
Unfortunately, the optimization accidentally allows NaN,
which this change fixes.

The source of this discrepency is that Encoder.WriteToken(Float(math.NaN()))
emits a JSON string with "NaN", rather than report an error.
The rationale for this behavior is because we needed to decide what to do
with Float(math.NaN()), whether it would return an error, panic, or allow it.
To keep the API simpler (no errors) and less sharp (no panics), we permitted NaN.
The fact that WriteToken allowed it is a logical extension of that decision,
but we could decide to disallow it at least within WriteToken.
As things stand, it is already inconsistent between json/v2 and jsontext, where
json/v2 rejects NaN by default in Marshal, but jsontext allows it in WriteToken.

This only modifies code that is compiled under goexperiment.jsonv2.

Fixes #74797

Change-Id: Ib0708cfbf93c2b059c0a85e4c4544c0604573448
Reviewed-on: https://go-review.googlesource.com/c/go/+/695276
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>
2025-08-13 15:47:31 -07:00
Joe Tsai
0a75e5a07b encoding/json/v2: fix wrong type with cyclic marshal error in map[string]any
The type reported in a ErrCycle is the wrong type due to a typo.
This discrepency was detected by setting optimizeCommon to false
and running the tests.

This only modifies code that is compiled in under goexperiment.jsonv2.

Change-Id: I68268f5c719d8b79a67424a35ed0647adf12288c
Reviewed-on: https://go-review.googlesource.com/c/go/+/695277
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2025-08-13 15:47:11 -07:00
Dmitri Shuralyov
de9b6f9875 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-20250630185457-6e76a2b096b5
go mod tidy
go mod vendor

Change-Id: Icfa35291f629fcffae67238704e59e17ee05e0b5
Reviewed-on: https://go-review.googlesource.com/c/go/+/696015
Reviewed-by: David Chase <drchase@google.com>
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>
2025-08-13 15:06:59 -07:00
Richard Miller
674c5f0edd os/exec: fix incorrect expansion of ".." in LookPath on plan9
The correction in CL 685755 is incomplete for plan9, where path
search is performed even on file strings containing "/". By
applying filepath.Clean to the argument of validateLookPath,
we can check for bogus file strings containing ".." where the
later call to filepath.Join would transform a path like
"badfile/dir/.." to "badfile" even where "dir" isn't a directory
or doesn't exist.

For #74466
Fixes #74892

Change-Id: I3f8b73a1de6bc7d8001b1ca8e74b78722408548e
Reviewed-on: https://go-review.googlesource.com/c/go/+/693935
Reviewed-by: David du Colombier <0intro@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2025-08-13 14:55:23 -07:00
Keith Randall
9bbea0f21a cmd/compile: during regalloc, fixedreg values are always available
It is ok to clobber registers that have a copy of a fixedreg value,
as that value is always available in its original location later
if we need it. (See 14 lines below the change.)

This CL will fix the regalloc infinite loop that CL 678620 introduced.

That CL requests that the stack pointer value be materialized in a
non-stack-pointer register, which is atypical. That condition
triggered the infinite loop that this CL fixes.  The infinite loop is
the compiler trying to reuse that non-stack-pointer register for
something else, but then refusing to give it up because it thought
that non-stack-pointer register held the last copy of the original SP
value.

Change-Id: Id604d0937fb9d3753ee273bf1917753d3ef2d5d7
Reviewed-on: https://go-review.googlesource.com/c/go/+/696035
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-13 14:55:05 -07:00
Austin Clements
8b90d48d8c [dev.simd] simd/_gen/simdgen: rewrite etetest.sh
Now that simdgen is in the main repo, the end-to-end test script can
be much simpler, more robust, and faster.

Change-Id: Ie3b12feaf98c327920071c67cfe74f673bb08d3e
Reviewed-on: https://go-review.googlesource.com/c/go/+/695978
Auto-Submit: Austin Clements <austin@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-08-13 14:26:29 -07:00
Austin Clements
b7c8698549 [dev.simd] simd/_gen: migrate simdgen from x/arch
This moves the simdgen tool and its supporting unify package from
golang.org/x/arch/internal as of CL 695619 to simd/_gen in the main repo.

The simdgen tool was started in x/arch to live next to xeddata and a
few other assembler generators that already lived there. However, as
we've been developing simdgen, we've discovered that there's a
tremendous amount of process friction coordinating commits to x/arch
with the corresponding generated files in the main repo.

Many of the existing generators in x/arch were started before modules
existed. In GOPATH world, it was impractical for them to live in the
main repo because they have dependencies that are not allowed in the
main repo. However, now that we have modules and can use small
submodules in the main repo, we can isolate these dependencies to just
the generators, making it practical for them to live in the main repo.

This commit was generated by the following script:

	# Checks
	set -e
	if [[ ! -d src/simd ]]; then
	    echo >&2 "$PWD is not the root of the main repo on dev.simd"
	    exit 1
	fi
	if [[ -z "$XEDDATA" ]]; then
	    echo >&2 "Must set \$XEDDATA"
	    exit 1
	fi
	which go >/dev/null

	# Move simdgen from x/arch
	xarch=$(mktemp -d)
	git clone https://go.googlesource.com/arch $xarch
	xarchCL=$(git -C $xarch log -1 --format=%b | awk -F/ '/^Reviewed-on:/ {print $NF}')
	echo >&2 "x/arch CL: $xarchCL"
	mv $xarch/internal src/simd/_gen
	sed --in-place s,golang.org/x/arch/internal/,simd/_gen/, src/simd/_gen/*/*.go
	# Create self-contained module
	cat > src/simd/_gen/go.mod <<EOF
	module simd/_gen

	go 1.24
	EOF
	cd src/simd/_gen
	go mod tidy
	git add .
	git gofmt
	# Regenerate file
	go run -C simdgen . -xedPath $XEDDATA -o godefs -goroot $(go env GOROOT) go.yaml types.yaml categories.yaml
	go run -C ../../cmd/compile/internal/ssa/_gen .

Change-Id: I56dd8473e913a9eb1978d9b3b3518ed632972f6f
Reviewed-on: https://go-review.googlesource.com/c/go/+/695975
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-08-13 13:56:26 -07:00
Austin Clements
257c1356ec [dev.simd] go/types: exclude simd/_gen module from TestStdlib
We're about to add a small simd/_gen submodule that imports external
dependencies. Exclude it from TestStdlib since it won't be able to
follow those dependencies.

Change-Id: I29a1adc98d141b9c511aa29e1992fab2248747d5
Reviewed-on: https://go-review.googlesource.com/c/go/+/695976
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-08-13 13:56:13 -07:00
David Chase
858a8d2276 [dev.simd] simd: reorganize/rename generated emulation files
Change-Id: I8c755d3b6a1a16ac271a22ab2bd2abb308441563
Reviewed-on: https://go-review.googlesource.com/c/go/+/694097
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-08-13 11:50:00 -07:00
David Chase
2080415aa2 [dev.simd] simd: add emulations for missing AVX2 comparisons
this also removes AVX512 versions of the operations
that would use the same names, but not run on AVX2-only

includes files generated by simdgen CL 692355

Change-Id: Iff29042245b7688133fed49a03e681e85235b8a8
Reviewed-on: https://go-review.googlesource.com/c/go/+/692335
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-08-13 11:49:05 -07:00
David Chase
ddb689c7bb [dev.simd] simd, cmd/compile: generated code for Broadcast
Generated by simdgen CL 693599

This turned out to require some additional work in
other places, including filling in missing
methods (use OverwriteBase to get FP versions).

Also includes a test.

Change-Id: I2efe8967837834745f9cae661d4d4dcbb5390b6f
Reviewed-on: https://go-review.googlesource.com/c/go/+/693758
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-08-13 11:48:29 -07:00
David Chase
e001300cf2 [dev.simd] cmd/compile: fix LoadReg so it is aware of register target
SIMD code generation created interesting new type/register
combintations.

Change-Id: I9c9a73bf51f6cb54551db1fdc88f9dd1eef7ab26
Reviewed-on: https://go-review.googlesource.com/c/go/+/695895
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-08-13 11:48:17 -07:00
David Chase
d5dea86993 [dev.simd] cmd/compile: fix isIntrinsic for methods; fix fp <-> gp moves
also includes a handy debugging hook for the inliner.

Change-Id: I23d0619506219d21db78c6c801612ff058562142
Reviewed-on: https://go-review.googlesource.com/c/go/+/694118
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-08-13 11:48:08 -07:00
Alexey Palazhchenko
08eef97500 runtime/trace: fix documentation typo
Change-Id: I3d8dc20536c7a1fb4b1d895fcf989f86bf45f499
GitHub-Last-Rev: 234aea60e2
GitHub-Pull-Request: golang/go#74991
Reviewed-on: https://go-review.googlesource.com/c/go/+/695535
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: qiu laidongfeng <2645477756@qq.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: David Chase <drchase@google.com>
2025-08-13 11:15:16 -07:00
Felix Geisendörfer
2fe5d51d04 internal/trace: fix wrong scope for Event.Range or EvGCSweepActive
Change-Id: I6a6a69643e804c75914e6eedd32463cb825ab69f
Reviewed-on: https://go-review.googlesource.com/c/go/+/694695
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
2025-08-13 11:15:12 -07:00
David Chase
08ab8e24a3 [dev.simd] cmd/compile: generated code from 'fix generated rules for shifts'
this code is generated by simdgen CL 695455

Change-Id: I5afdc209a50b49d68e120130e0578e4666bf8749
Reviewed-on: https://go-review.googlesource.com/c/go/+/695475
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-08-13 10:28:09 -07:00
Jorropo
9fcb87c352 cmd/compile: teach prove about len's & cap's max based on the element size
Change-Id: I88056fada1ff488c199fce54cf737dbdd091214d
Reviewed-on: https://go-review.googlesource.com/c/go/+/695095
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2025-08-13 07:21:20 -07:00
Xiaolin Zhao
9763ece873 cmd/compile: absorb NEGV into branch on loong64
Removes 132 instructions from the go binary on loong64.

Change-Id: Ia02dc305b12f63a64f3f48d120ef852d45cc2a7b
Reviewed-on: https://go-review.googlesource.com/c/go/+/695115
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2025-08-13 07:20:08 -07:00
Dmitri Shuralyov
f10a82b76f all: update vendored dependencies [generated]
The tree has opened for Go 1.26 development. 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

# Update a cmd/vet test case.
patch <<EOF
--- src/cmd/vet/testdata/assign/assign.go
+++ src/cmd/vet/testdata/assign/assign.go
@@ -18 +18 @@ func (s *ST) SetX(x int, ch chan int) {
-	x = x // ERROR "self-assignment of x to x"
+	x = x // ERROR "self-assignment of x"
@@ -20 +20 @@ func (s *ST) SetX(x int, ch chan int) {
-	s.x = s.x // ERROR "self-assignment of s.x to s.x"
+	s.x = s.x // ERROR "self-assignment of s.x"
@@ -22 +22 @@ func (s *ST) SetX(x int, ch chan int) {
-	s.l[0] = s.l[0] // ERROR "self-assignment of s.l.0. to s.l.0."
+	s.l[0] = s.l[0] // ERROR "self-assignment of s.l.0."
EOF

Change-Id: I3fc77d49fa7b47803d363287910b0e37bedefb60
Reviewed-on: https://go-review.googlesource.com/c/go/+/694536
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
2025-08-13 07:15:41 -07:00
Joel Sing
3bea95b277 cmd/link/internal/ld: remove OpenBSD buildid workaround
Now that there are no Go OpenBSD ports that are using non-libc based
system calls, remove the buildid that was generated to permit
binaries using direct syscalls to execute.

Updates #36435

Change-Id: I7bc70b47b2a3781eafef85b974baee9a1d334e21
Reviewed-on: https://go-review.googlesource.com/c/go/+/694355
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>
2025-08-13 07:01:03 -07:00
limeidan
90b7d7aaa2 cmd/compile/internal: optimize multiplication use new operation 'ADDshiftLLV' on loong64
goos: linux
goarch: loong64
pkg: cmd/compile/internal/test
cpu: Loongson-3A6000-HV @ 2500.00MHz
                  │     old      │                 new                  │
                  │    sec/op    │    sec/op     vs base                │
MulconstI32/3       0.8004n ± 0%   0.4247n ± 2%  -46.94% (p=0.000 n=10)
MulconstI32/5       0.8005n ± 0%   0.4256n ± 1%  -46.83% (p=0.000 n=10)
MulconstI32/12      1.2010n ± 0%   0.8005n ± 0%  -33.35% (p=0.000 n=10)
MulconstI32/120     0.8090n ± 0%   0.8067n ± 0%   -0.28% (p=0.007 n=10)
MulconstI32/-120    0.8109n ± 0%   0.8072n ± 0%   -0.47% (p=0.000 n=10)
MulconstI32/65537   0.8004n ± 0%   0.8004n ± 0%        ~ (p=1.000 n=10)
MulconstI32/65538   0.8005n ± 0%   0.8005n ± 0%        ~ (p=0.265 n=10)
MulconstI64/3       0.8005n ± 0%   0.4241n ± 1%  -47.02% (p=0.000 n=10)
MulconstI64/5       0.8004n ± 0%   0.4249n ± 1%  -46.91% (p=0.000 n=10)
MulconstI64/12      1.2010n ± 0%   0.8004n ± 0%  -33.36% (p=0.000 n=10)
MulconstI64/120     0.8005n ± 0%   0.8005n ± 0%        ~ (p=0.635 n=10)
MulconstI64/-120    0.8005n ± 0%   0.8005n ± 0%        ~ (p=0.837 n=10)
MulconstI64/65537   0.8005n ± 0%   0.8005n ± 0%        ~ (p=0.837 n=10)
MulconstI64/65538   0.8096n ± 0%   0.8004n ± 0%   -1.14% (p=0.000 n=10)
MulconstU32/3       0.8004n ± 0%   0.4263n ± 1%  -46.75% (p=0.000 n=10)
MulconstU32/5       0.8005n ± 0%   0.4262n ± 1%  -46.76% (p=0.000 n=10)
MulconstU32/12      1.2010n ± 0%   0.8005n ± 0%  -33.35% (p=0.000 n=10)
MulconstU32/120     0.8105n ± 0%   0.8096n ± 0%        ~ (p=0.183 n=10)
MulconstU32/65537   0.8004n ± 0%   0.8004n ± 0%        ~ (p=1.000 n=10)
MulconstU32/65538   0.8005n ± 0%   0.8005n ± 0%        ~ (p=1.000 n=10)
MulconstU64/3       0.8004n ± 0%   0.4265n ± 4%  -46.71% (p=0.000 n=10)
MulconstU64/5       0.8004n ± 0%   0.4256n ± 0%  -46.82% (p=0.000 n=10)
MulconstU64/12      1.2010n ± 0%   0.8004n ± 0%  -33.36% (p=0.000 n=10)
MulconstU64/120     0.8005n ± 0%   0.8005n ± 0%        ~ (p=0.387 n=10)
MulconstU64/65537   0.8005n ± 0%   0.8005n ± 0%        ~ (p=0.265 n=10)
MulconstU64/65538   0.8080n ± 0%   0.8004n ± 0%   -0.93% (p=0.000 n=10)
geomean             0.8539n        0.6597n       -22.74%

Change-Id: Ie33e88985d7639f481bbba540bc917b9f185c357
Reviewed-on: https://go-review.googlesource.com/c/go/+/693855
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-12 23:01:49 -07:00
Cherry Mui
1b263fc604 runtime/race: restore previous version of LLVM TSAN on macOS
Apparently CL 692996 made the Darwin race builders to be very
flaky. That CL does two things: 1. uses "ld -r" to strip out the
dynamic symbol table; 2. updates to a newer version of LLVM TSAN.
To narrow it down, this CL undoes the second part, restpring the
previous version of LLVM TSAN, but keeps the "ld -r" part.

For #74978.

Change-Id: I0611d733232b18440f249cd5a0b76f7e1ff99a55
Reviewed-on: https://go-review.googlesource.com/c/go/+/695137
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Bypass: Cherry Mui <cherryyz@google.com>
Commit-Queue: Cherry Mui <cherryyz@google.com>
2025-08-12 22:06:00 -07:00
limeidan
b266318cf7 cmd/compile/internal/ssa: use BEQ/BNE to optimize the combination of XOR and EQ/NE on loong64
Reduce the number of go toolchain instructions on loong64 as follows:

	file	    before	after	     Δ		 %
	go	    1599056	1590560	    -8496    -0.5313%
	gofmt	    326188	326104	    -84	     -0.0258%
	asm	    563482	561250	    -2232    -0.3961%
	cgo	    488644	485252	    -3392    -0.6942%
	compile	    2504614	2486388	    -18226   -0.7277%
	cover	    526322	523270	    -3052    -0.5799%
	link	    714532	711124	    -3408    -0.4770%
	preprofile  242316	241112	    -1204    -0.4969%
	vet	    794446	786118	    -8328    -1.0483%

Change-Id: I0914889119a28ea672b694529ef54513fbb3f3b5
Reviewed-on: https://go-review.googlesource.com/c/go/+/693875
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Keith Randall <khr@google.com>
2025-08-12 18:02:02 -07:00
Michael Anthony Knyszek
adbf59525c internal/runtime/gc/scan: avoid -1 index when cache sizes unavailable
Fixes #74984.
Fixes #74983.

Change-Id: I011c66c2005bc4d92f1d17f1f8ce88158634f71f
Reviewed-on: https://go-review.googlesource.com/c/go/+/695476
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-12 17:45:43 -07:00
Keith Randall
4e182db5fc Revert "cmd/compile: use generated loops instead of DUFFCOPY on amd64"
This reverts commit ec9e1176c3 (CL 678620).

Reason for revert: causing regalloc to get into an infinite loop

Change-Id: Ie53c58c6126804af6d6883ea4acdcfb632a172bd
Reviewed-on: https://go-review.googlesource.com/c/go/+/695196
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2025-08-12 16:04:18 -07:00
Felix Geisendörfer
d2b3c1a504 internal/trace: clarify which StateTransition events have stacks
Clarify that EvGoDestroy, EvGoSyscallEnd and EvGoSyscallEndBlocked do
not have a stack trace by removing the code that tries to assign an
empty stack.

Change-Id: I6a6a696479ac7f753b3c6f6f48d8b9b67f6e3b95
Reviewed-on: https://go-review.googlesource.com/c/go/+/694621
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-12 11:42:13 -07:00
Felix Geisendörfer
f63e12d0e0 internal/trace: fix Sync.ClockSnapshot comment
The old comment said "clocks take in close in time" which was probably
due to rewording this a few times.

Replace the comment with the one of the ClockSnapshot type as there
doesn't seem to be a good reason for using a different wording here.

Change-Id: I6a6a69648c8470c2f45f6f8e728f5dc8b121a82b
Reviewed-on: https://go-review.googlesource.com/c/go/+/694620
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
2025-08-12 11:42:10 -07:00
Felix Geisendörfer
8e317da77d internal/trace: remove unused StateTransition.id field
Change-Id: I6a6a69647e6d91f9fd937032d95cbaf5d737fd5d
Reviewed-on: https://go-review.googlesource.com/c/go/+/694619
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
2025-08-12 11:42:06 -07:00
Felix Geisendörfer
f67d8ff34a internal/trace/tracev2: adjust comment for consistency
Adjust the EvGoStatus comment to use the term M ID in favor of thread ID
in order to be consistent with the documentation for the other events.

Change-Id: Ie9f6d52df6eea809682a33aa2bc9922a57fe03db
Reviewed-on: https://go-review.googlesource.com/c/go/+/694618
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-08-12 11:42:03 -07:00
Felix Geisendörfer
fe4d445c36 internal/trace/tracev2: fix EvSTWBegin comment to include stack ID
Change-Id: I6a6a69644fb9a6e765933384cdb17c63458be69a
Reviewed-on: https://go-review.googlesource.com/c/go/+/694617
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-08-12 11:42:00 -07:00
Felix Geisendörfer
750789fab7 internal/trace/internal/testgen: fix missing stacks nframes arg
Change-Id: I6a6a6964c9c1322bfe289394d5d3937d1f7097bb
Reviewed-on: https://go-review.googlesource.com/c/go/+/694616
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
2025-08-12 11:41:56 -07:00
Michael Anthony Knyszek
889ab74169 internal/runtime/gc/scan: import scan kernel from gclab [green tea]
This change imports the AVX512 GC scanning kernel from CL 593938 into a
new package, internal/runtime/gc/scan. Credit to Austin Clements for
most of this work. I did some cleanup, added support for more size
classes to the expanders, and added more testing. I also restructured
the code to make it easier and clearer to add new scan kernels for new
architectures.

For #73581.

Change-Id: I76bcbc889fa6cad73ba0084620fae084a5912e6b
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64_avx512,gotip-linux-amd64_avx512-greenteagc
Reviewed-on: https://go-review.googlesource.com/c/go/+/655280
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>
2025-08-12 11:23:02 -07:00
Brad Fitzpatrick
182336bf05 net/http: fix data race in client
Fixes #73522

Co-authored-by: Damien Neil <dneil@google.com>
Change-Id: I6fb408a0b03bc387f443e17e6f9d0bac32eff31e
Reviewed-on: https://go-review.googlesource.com/c/go/+/694815
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: David Chase <drchase@google.com>
2025-08-12 11:19:35 -07:00
Keith Randall
f04421ea9a cmd/compile: soften test for 74788
We now (as of CL 678620) use float registers other than X0 for copying.

Change-Id: Ifdecd5df7519663742eed0f292c98453754d4b25
Reviewed-on: https://go-review.googlesource.com/c/go/+/695275
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
2025-08-12 10:05:55 -07:00
Keith Randall
28aa529c99 cmd/compile: use generated loops instead of DUFFZERO on arm64
Change-Id: Ie0c8263f36d1bcfd0edfc4ea6710ae6c113c4d48
Reviewed-on: https://go-review.googlesource.com/c/go/+/678995
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-08-12 09:15:19 -07:00
Keith Randall
ec9e1176c3 cmd/compile: use generated loops instead of DUFFCOPY on amd64
goarch: amd64
cpu: 12th Gen Intel(R) Core(TM) i7-12700
                        │     base      │                 exp                 │
                        │    sec/op     │   sec/op     vs base                │
MemmoveKnownSize112-20     1.764n ±  0%   1.247n ± 0%  -29.31% (p=0.000 n=10)
MemmoveKnownSize128-20     1.891n ±  0%   1.405n ± 1%  -25.72% (p=0.000 n=10)
MemmoveKnownSize192-20     2.521n ±  0%   2.114n ± 3%  -16.16% (p=0.000 n=10)
MemmoveKnownSize248-20     4.028n ±  0%   3.877n ± 1%   -3.75% (p=0.000 n=10)
MemmoveKnownSize256-20     3.272n ±  0%   2.961n ± 2%   -9.53% (p=0.000 n=10)
MemmoveKnownSize512-20     6.733n ±  3%   5.936n ± 4%  -11.83% (p=0.000 n=10)
MemmoveKnownSize1024-20   13.905n ±  5%   9.798n ± 9%  -29.54% (p=0.000 n=10)

Change-Id: Icc01cec0d8b072300d749a5ce76f53b3725b5c65
Reviewed-on: https://go-review.googlesource.com/c/go/+/678620
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Jakub Ciolek <jakub@ciolek.dev>
2025-08-12 09:15:08 -07:00
Keith Randall
d0a64f7969 Revert "cmd/compile/internal/ssa: Use transitive properties for len/cap"
This reverts commit a3295df873 (CL 679155)

Reason for revert: leads to a very expensive prove pass, see #74974

(Maybe not this CL's fault, just tickling some superlinear behavior.)

Change-Id: I75302c04cfc5e1e075aeb80edb73080bfb1efcac
Reviewed-on: https://go-review.googlesource.com/c/go/+/695175
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Daniel Morsing <daniel.morsing@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
2025-08-12 09:00:35 -07:00
Cherry Mui
00a7bdcb55 all: delete aliastypeparams GOEXPERIMENT
Always enable aliastypeparams and remove the GOEXPERIMENT.

Change-Id: Ic38fe25b0bba312a7f83f7bb94b57ab75ce0f0c3
Reviewed-on: https://go-review.googlesource.com/c/go/+/691956
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-08-12 06:28:26 -07:00
Keith Randall
74421a305b Revert "cmd/compile: allow multi-field structs to be stored directly in interfaces"
This reverts commit cd55f86b8d (CL 681937)

Reason for revert: still causing compiler failures on Google test code

Change-Id: I5cd482fd607fd060a523257082d48821b5f965d6
Reviewed-on: https://go-review.googlesource.com/c/go/+/695016
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2025-08-11 22:59:52 -07:00
Keith Randall
c31359138c Revert "cmd/compile: allow StructSelect [x] of interface data fields for x>0"
This reverts commit bcd25c79aa (CL 693415)

Reason for revert: still causing compiler failures on Google test code

Change-Id: I887edcff56bde3ffa316f2b629021ad323a357fa
Reviewed-on: https://go-review.googlesource.com/c/go/+/694996
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2025-08-11 22:36:26 -07:00
Keith Randall
7248995b60 Revert "cmd/compile: allow more args in StructMake folding rule"
This reverts commit 72e8237cc1 (CL 693615)

Reason for revert: still causing compiler failures on Google test code

Change-Id: I4a7850c321d95ed7803d56866bb0c524c7a377d3
Reviewed-on: https://go-review.googlesource.com/c/go/+/695015
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Keith Randall <khr@google.com>
2025-08-11 22:36:20 -07:00
Keith Randall
caf9fc3ccd Revert "reflect: handle zero-sized fields of directly-stored structures correctly"
This reverts commit b3388569a1 (CL 694195)

Reason for revert: still causing compiler failures on Google test code

Change-Id: I2a9b0f9a57fe2b6977238bbfbefb572545210b9f
Reviewed-on: https://go-review.googlesource.com/c/go/+/694995
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2025-08-11 22:36:13 -07:00
Tobias Klauser
ce3f3e2ae7 cmd/link/internal/ld, internal/syscall/unix: use posix_fallocate on netbsd
The posix_fallocate system call is available since NetBSD 7.0, see
https://man.netbsd.org/posix_fallocate.2

Re-use the syscall wrappers already in place for freebsd. Note that
posix_fallocate on netbsd also returns the result in r1 rather than in
errno:

> If successful, posix_fallocate() returns zero. It returns an error on failure, without
> setting errno.

Source: https://man.netbsd.org/posix_fallocate.2#RETURN%20VALUES

Cq-Include-Trybots: luci.golang.try:gotip-netbsd-arm64
Change-Id: Iaa1f6a805d511645da7f1d2737235bfd42da3407
Reviewed-on: https://go-review.googlesource.com/c/go/+/480475
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-11 15:25:38 -07:00
Jack Christensen
3dbef65bf3 database/sql: allow drivers to override Scan behavior
Implementing RowsColumnScanner allows the driver
to completely control how values are scanned.

Fixes #67546

Change-Id: Id8e7c3a973479c9665e4476fe2d29e1255aee687
GitHub-Last-Rev: ed0cacaec4
GitHub-Pull-Request: golang/go#67648
Reviewed-on: https://go-review.googlesource.com/c/go/+/588435
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-11 14:27:36 -07:00
Michael Fraenkel
2b804abf07 net: context aware Dialer.Dial functions
Add context aware dial functions for TCP, UDP, IP and Unix networks.

Fixes #49097
Updates #59897

Change-Id: I7523452e8e463a587a852e0555cec822d8dcb3dd
Reviewed-on: https://go-review.googlesource.com/c/go/+/490975
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Sean Liao <sean@liao.dev>
2025-08-11 14:26:10 -07:00
Dmitri Shuralyov
6abfe7b0de cmd/dist: require Go 1.24.6 as minimum bootstrap toolchain
This is a minimal change to start to require the new minimum bootstrap.
Taking advantage of the newer bootstrap to simplify and improve code is
left to be done in separate CLs.

For #69315.

Change-Id: I4bef752b2adb67e969d585d97e680d26afefc6f4
Reviewed-on: https://go-review.googlesource.com/c/go/+/694535
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2025-08-11 14:25:55 -07:00
Austin Clements
702ee2d51e [dev.simd] cmd/compile, simd: update generated files
This CL is generated by x/arch CL 694861

Change-Id: I2af1aaacbe9374d98b13be972713fc2cb1177927
Reviewed-on: https://go-review.googlesource.com/c/go/+/694918
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Auto-Submit: Austin Clements <austin@google.com>
2025-08-11 13:45:36 -07:00
Austin Clements
e33eb1a7a5 [dev.simd] cmd/compile, simd: update generated files
This CL is generated by x/arch CL 694860

Change-Id: Ifa7c0e9749b1d9a20f31b70aafe563d7844ce6b0
Reviewed-on: https://go-review.googlesource.com/c/go/+/694917
Auto-Submit: Austin Clements <austin@google.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-11 13:45:31 -07:00
Austin Clements
667add4f1c [dev.simd] cmd/compile, simd: update generated files
This CL is generated by x/arch CL 694859.

Change-Id: I18bd076e26e93bc2fb0e761de26511138e95055f
Reviewed-on: https://go-review.googlesource.com/c/go/+/694916
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Austin Clements <austin@google.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-08-11 13:45:27 -07:00
Austin Clements
1755c2909d [dev.simd] cmd/compile, simd: update generated files
This CL is generated by x/arch CL 694857.

Change-Id: I9745fa8c9b2e3f49bd2cff5ff6b5578c0c67bfa1
Reviewed-on: https://go-review.googlesource.com/c/go/+/694915
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Austin Clements <austin@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-11 13:45:22 -07:00
Joe Tsai
691af6ca28 encoding/json: fix Indent trailing whitespace regression in goexperiment.jsonv2
The Indent function preserves trailing whitespace,
while the v1 emulation under v2 implementation accidentally dropped it.

There was prior logic that attempted to preserve it,
but it did not work correctly since it ran in a defer and
accidentally mutated the dst input argument rather than the output argument.
Move the logic to the end and avoid a defer.
Also, add a test to both v1 and v1in2 to codify this behavior.

This only modifies code that is compiled in under goexperiment.jsonv2.

Updates #13520
Fixes #74806

Change-Id: I22b1a8da5185eb969e2a8a111b625d3752cfcbe8
Reviewed-on: https://go-review.googlesource.com/c/go/+/692195
Reviewed-by: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Sean Liao <sean@liao.dev>
2025-08-11 12:17:50 -07:00
Bracken Dawson
925149da20 net/http: add example for CrossOriginProtection
It's not immediately appaerent that a method must
be used to wrap the handler, so add a basic
example to guide users to the right API.

Fixes #74121

Change-Id: I23fc3dff6fff9bf4eb29c099bc77da8c99620671
Reviewed-on: https://go-review.googlesource.com/c/go/+/681256
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Auto-Submit: Sean Liao <sean@liao.dev>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2025-08-11 12:16:10 -07:00
Joe Tsai
cf4af0b2f3 encoding/json/v2: fix UnmarshalDecode regression with EOF
When EOF is encountered within jsontext.Decoder stream without
starting to parse any token, UnmarshalDecode should report EOF,
rather than converting it into ErrUnexpectedEOF.

This fixes a regression introduced by https://go.dev/cl/689919.

This change only affects code compiled under goexperiment.jsonv2.

Fixes #74835

Change-Id: I7e8e57ab11b462c422c538503ed8c6b91ead53bd
Reviewed-on: https://go-review.googlesource.com/c/go/+/692175
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Jake Bailey <jacob.b.bailey@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Joseph Tsai <joetsai@digital-static.net>
2025-08-11 12:12:28 -07:00
Junyang Shao
2fd49d8f30 [dev.simd] simd: imm doc improve
This CL is generated by CL 694775.

Change-Id: I3d551b1a7981c6c35c1ecf139a38b6e07323a861
Reviewed-on: https://go-review.googlesource.com/c/go/+/694795
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-08-11 11:18:13 -07:00
David Chase
ce0e803ab9 [dev.simd] cmd/compile: keep track of multiple rule file names in ssa/_gen
This was a long-standing "we need to fix this"
for simd work, this fixes it.  I expect that
simd peephole rule files will be coming soon
and there will be more errors and we will be
happier to have this.

Change-Id: Iefffc43e3e2110939f8d406f6e5da7e9e2d55bd9
Reviewed-on: https://go-review.googlesource.com/c/go/+/694455
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-11 11:12:55 -07:00
Junyang Shao
38b76bf2a3 [dev.simd] cmd/compile, simd: jump table for imm ops
This CL fixes some errors in prog generation for imm operations, please
see the changes in ssa.go for details.

This CL also implements the jump table for non-const immediate arg. The
current implementation exhaust 0-255, the bound-checked version will be
in the next CL.

This CL is partially generated by CL 694375.

Change-Id: I75fe9900430b4fca5b39b0c0958a13b20b1104b7
Reviewed-on: https://go-review.googlesource.com/c/go/+/694395
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-11 10:49:50 -07:00
cuiweixie
b096ddb9ea internal/runtime/maps: loop invariant code motion with h2(hash) by hand
Change-Id: I0cd9763aeedfe326bc566da39b8be0d0ebd113ec
GitHub-Last-Rev: 1ec8864414
GitHub-Pull-Request: golang/go#74952
Reviewed-on: https://go-review.googlesource.com/c/go/+/694016
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Keith Randall <khr@google.com>
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>
Reviewed-by: Keith Randall <khr@golang.org>
2025-08-11 09:51:15 -07:00
Tobias Klauser
a2431776eb net, os, file/filepath, syscall: use slices.Equal in tests
Use slices.Equal to compare slices instead of strings.Join and then
comparing strings.

Change-Id: Ib916002b7357bd7f4e66b853dd7af8d98eba5549
Reviewed-on: https://go-review.googlesource.com/c/go/+/690475
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-08-11 08:13:16 -07:00
Xiaolin Zhao
a7f05b38f7 cmd/compile: convert branch with zero to more optimal branch zero on loong64
This reduces 7500+ instructions from the go toolchain binary on loong64.

	file         before      after      Δ       %
	asm          555066      554406   -660    -0.1189%
	cgo          481480      480764   -716    -0.1487%
	compile      2475836     2474776  -1060   -0.0428%
	cover        516536      515788   -748    -0.1448%
	link         702220      701216   -1004   -0.1430%
	preprofile   238626      238122   -504    -0.2112%
	vet          792798      791894   -904    -0.1140%
	go           1573108     1571676  -1432   -0.0910%
	gofmt        320578      320042   -536    -0.1672%
	total        7656248     7648684  -7564   -0.0988%

Change-Id: I51b70a1543bc258b7664caa8647e75eecbaf5eed
Reviewed-on: https://go-review.googlesource.com/c/go/+/693495
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-11 07:37:59 -07:00
thepudds
1718828c81 internal/sync: warn about incorrect unsafe usage in HashTrieMap
When the HashTrieMap expand method runs out of bits, it can be because
the user mutated a key after insertion using unsafe or similar
in violation of the HashTrieMap invariants.

Adjust the panic message to help triage and debugging by
more directly suggesting unsafe code might be at fault.

CL 694635 is a follow-up change that attempts to detect and
report illegally mutated keys sooner and more precisely.

Updates #74948
Updates #73427

Change-Id: Ib2bca067f0e212b8765c61183f59ac229513a823
Reviewed-on: https://go-review.googlesource.com/c/go/+/694376
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>
2025-08-11 06:46:40 -07:00
Michael Munday
084c0f8494 cmd/compile: allow InlMark operations to be speculatively executed
Although InlMark takes a memory argument it ultimately becomes a
NOP and therefore is safe to speculatively execute.

Fixes #74915

Change-Id: I64317dd433e300ac28de2bcf201845083ec2ac82
Reviewed-on: https://go-review.googlesource.com/c/go/+/693795
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>
2025-08-11 00:52:23 -07:00
Xiaolin Zhao
a62f72f7a7 cmd/compile/internal/ssa: optimise more branches with SGTconst/SGTUconst on loong64
Add branches to convert EQZ/NEZ into more optimal branch conditions.
This reduces 720 instructions from the go toolchain binary on loong64.

	file         before      after      Δ       %
	asm          555306      555082   -224   -0.0403%
	cgo          481814      481742   -72    -0.0149%
	compile      2475686     2475710  +24    +0.0010%
	cover        516854      516770   -84    -0.0163%
	link         702566      702530   -36    -0.0051%
	preprofile   238612      238548   -64    -0.0268%
	vet          793140      793060   -80    -0.0101%
	go           1573466     1573346  -120   -0.0076%
	gofmt        320560      320496   -64    -0.0200%
	total        7658004     7657284  -720   -0.0094%

Additionally, rename EQ/NE to EQZ/NEZ to enhance readability.

Change-Id: Ibc876bc8b8d4e81d5c3aaf0b74b60419f3c771b1
Reviewed-on: https://go-review.googlesource.com/c/go/+/693455
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: Keith Randall <khr@google.com>
2025-08-10 18:53:21 -07:00
Ian Lance Taylor
fbac94a799 internal/sync: rename Store parameter from old to new
It's not an old value, it's a new value.

Change-Id: I135ecd8815fac9c3d34ca35afa2b62e74fa76cb6
Reviewed-on: https://go-review.googlesource.com/c/go/+/694436
Auto-Submit: Ian Lance Taylor <iant@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 Knyszek <mknyszek@google.com>
2025-08-08 15:10:55 -07:00
Cuong Manh Le
317be4cfeb cmd/compile/internal/staticinit: remove deadcode
The staticAssignInlinedCall function contains code for handling
non-Unified IR. As Unified IR is now the sole format for the frontend,
this code is obsolete and can be removed.

Change-Id: Iac93a9b59ec6d639851e1b17ba1f75563d8bcda5
Reviewed-on: https://go-review.googlesource.com/c/go/+/694075
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Keith Randall <khr@google.com>
2025-08-08 14:22:23 -07:00
Roland Shoemaker
bce5601cbb cmd/go: fix fips doc link
Change-Id: I8f06ebd65ba9961e19274c1e5fec251b18395d1c
Reviewed-on: https://go-review.googlesource.com/c/go/+/691435
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Auto-Submit: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-08 12:57:33 -07:00
1911860538
777d76c4f2 text/template: use sync.OnceValue for builtinFuncs
Replaced sync.Once with sync.OnceValue to simplify code and reduce globals.

Change-Id: I0586df379b855950eacc5b98baad68f6ba0ba129
GitHub-Last-Rev: 7540b1efba
GitHub-Pull-Request: golang/go#73689
Reviewed-on: https://go-review.googlesource.com/c/go/+/672235
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2025-08-08 12:53:12 -07:00
Michael Munday
0201524c52 math: remove redundant infinity tests
These cases are covered by existing comparisons against constants.

Change-Id: I19ad530e95d2437a8617f5229495da591ceb779a
Reviewed-on: https://go-review.googlesource.com/c/go/+/692255
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Russ Cox <rsc@golang.org>
Auto-Submit: Sean Liao <sean@liao.dev>
2025-08-08 12:47:59 -07:00
wagner riffel
dcc77f9e3c cmd/go: fix get -tool when multiple packages are provided
Fixes #74035

Change-Id: I51865f4f753aade9a8be62ed6f9bc2d298742bf1
Reviewed-on: https://go-review.googlesource.com/c/go/+/679975
Reviewed-by: Ian Alexander <jitsu@google.com>
Reviewed-by: Michael Matloob <matloob@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Auto-Submit: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sean Liao <sean@liao.dev>
2025-08-08 10:48:08 -07:00
jiahua wang
c7b85e9ddc all: update blog link
Change-Id: I8631fbc552b85f35b494a8d5a2c0baf68ee66982
Reviewed-on: https://go-review.googlesource.com/c/go/+/690215
Reviewed-by: qiu laidongfeng <2645477756@qq.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
2025-08-08 10:00:21 -07:00
Audi P. R. Putra
a8dd771e13 crypto/tls: check if quic conn can send session ticket
On SendSessionTicket, returns nil if SessionTicketsDisabled is disabled in config.

Fixes #62032

Change-Id: Id0c89e2e6fb0805bbf108bb0cafdabdfbaf3897f
Reviewed-on: https://go-review.googlesource.com/c/go/+/528755
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
2025-08-08 09:59:24 -07:00
database64128
bdb2d50fdf net: fix WriteMsgUDPAddrPort addr handling on IPv4 sockets
Accept IPv4-mapped IPv6 destination addresses on IPv4 UDP sockets.

Fixes #74737.

Change-Id: I4624b9b8f861aedcae29e51d5298d23ce1c0f2c7
Reviewed-on: https://go-review.googlesource.com/c/go/+/689976
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
2025-08-08 09:58:19 -07:00
David Chase
94d72355f6 [dev.simd] simd: add emulations for bitwise ops and for mask/merge methods
This CL adds the emulations under a "wrong name"; subsequent CLs
will move the AVX512 versions of these operations out of the way,
and then will rename these to their better names.

Change-Id: I49e7a73e4fea74fb7bd26cb8062014568d7999ca
Reviewed-on: https://go-review.googlesource.com/c/go/+/692217
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-08 08:41:01 -07:00
cuiweixie
768c51e368 internal/runtime/maps: remove unused var bitsetDeleted
Change-Id: Ie9e5c2627dc9a7ae1e8186f2c4d0a7a1955ec707
GitHub-Last-Rev: 416419248e
GitHub-Pull-Request: golang/go#74942
Reviewed-on: https://go-review.googlesource.com/c/go/+/694255
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>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
2025-08-08 07:02:00 -07:00
Keith Randall
b3388569a1 reflect: handle zero-sized fields of directly-stored structures correctly
type W struct {
	E struct{}
	X *byte
}

type W is a "direct" type. That is, it is a pointer-ish type that can
be stored directly as the second word of an interface.

But if we ask reflect for W's first field, that value must *not* be
direct, as zero-sized things cannot be stored directly.

This was a problem introduced in CL 681937. Before that, types like W
were not eligible for directness.

Fixes #74935

Change-Id: Idefb55c23eaa59153009f863bad611593981e5cb
Reviewed-on: https://go-review.googlesource.com/c/go/+/694195
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: 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>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2025-08-08 06:51:37 -07:00
Joel Sing
d83b16fcb8 internal/bytealg: vector implementation of compare for riscv64
Provide a vector implementation of compare for riscv64, which is used
when compiled with the rva23u64 profile, or when vector is detected
to be available. Inputs that are 8 byte aligned will still be handled
via a the non-vector code if the length is less than or equal to 128
bytes.

On a Banana Pi F3, with GORISCV64=rva23u64:

                                        │  compare.1   │              compare.2              │
                                        │    sec/op    │   sec/op     vs base                │
BytesCompare/1-8                           24.36n ± 0%   24.15n ± 0%   -0.84% (p=0.007 n=10)
BytesCompare/2-8                           26.75n ± 0%   26.97n ± 0%   +0.82% (p=0.000 n=10)
BytesCompare/4-8                           27.63n ± 0%   27.80n ± 0%   +0.60% (p=0.001 n=10)
BytesCompare/8-8                           35.91n ± 0%   35.19n ± 0%   -2.01% (p=0.000 n=10)
BytesCompare/16-8                          53.22n ± 0%   24.04n ± 1%  -54.82% (p=0.000 n=10)
BytesCompare/32-8                          25.12n ± 0%   26.09n ± 1%   +3.86% (p=0.000 n=10)
BytesCompare/64-8                          32.52n ± 0%   33.43n ± 1%   +2.78% (p=0.000 n=10)
BytesCompare/128-8                         46.59n ± 0%   48.22n ± 1%   +3.50% (p=0.000 n=10)
BytesCompare/256-8                         74.25n ± 0%   50.18n ± 0%  -32.42% (p=0.000 n=10)
BytesCompare/512-8                        129.85n ± 0%   83.12n ± 0%  -35.98% (p=0.000 n=10)
BytesCompare/1024-8                        244.6n ± 0%   148.0n ± 1%  -39.49% (p=0.000 n=10)
BytesCompare/2048-8                        465.9n ± 0%   282.8n ± 2%  -39.30% (p=0.000 n=10)
CompareBytesEqual-8                        51.96n ± 0%   52.90n ± 1%   +1.80% (p=0.000 n=10)
CompareBytesToNil-8                        15.77n ± 1%   15.68n ± 0%   -0.57% (p=0.000 n=10)
CompareBytesEmpty-8                        14.21n ± 1%   14.20n ± 1%        ~ (p=1.000 n=10)
CompareBytesIdentical-8                    14.20n ± 1%   15.07n ± 1%   +6.20% (p=0.000 n=10)
CompareBytesSameLength-8                   31.38n ± 0%   30.52n ± 0%   -2.74% (p=0.000 n=10)
CompareBytesDifferentLength-8              31.38n ± 0%   30.53n ± 0%   -2.71% (p=0.000 n=10)
CompareBytesBigUnaligned/offset=1-8       2401.0µ ± 0%   437.6µ ± 0%  -81.77% (p=0.000 n=10)
CompareBytesBigUnaligned/offset=2-8       2376.8µ ± 0%   437.4µ ± 0%  -81.60% (p=0.000 n=10)
CompareBytesBigUnaligned/offset=3-8       2384.1µ ± 0%   437.5µ ± 0%  -81.65% (p=0.000 n=10)
CompareBytesBigUnaligned/offset=4-8       2377.7µ ± 0%   437.4µ ± 0%  -81.60% (p=0.000 n=10)
CompareBytesBigUnaligned/offset=5-8       2366.3µ ± 0%   437.5µ ± 0%  -81.51% (p=0.000 n=10)
CompareBytesBigUnaligned/offset=6-8       2357.3µ ± 0%   437.3µ ± 0%  -81.45% (p=0.000 n=10)
CompareBytesBigUnaligned/offset=7-8       2385.3µ ± 0%   437.6µ ± 0%  -81.65% (p=0.000 n=10)
CompareBytesBigBothUnaligned/offset=0-8    447.2µ ± 0%   464.8µ ± 0%   +3.94% (p=0.000 n=10)
CompareBytesBigBothUnaligned/offset=1-8    447.7µ ± 0%   453.1µ ± 0%   +1.20% (p=0.000 n=10)
CompareBytesBigBothUnaligned/offset=2-8    447.9µ ± 0%   453.0µ ± 0%   +1.15% (p=0.000 n=10)
CompareBytesBigBothUnaligned/offset=3-8    448.0µ ± 0%   452.5µ ± 0%   +1.02% (p=0.000 n=10)
CompareBytesBigBothUnaligned/offset=4-8    448.0µ ± 0%   452.1µ ± 0%   +0.92% (p=0.000 n=10)
CompareBytesBigBothUnaligned/offset=5-8    447.8µ ± 0%   452.8µ ± 0%   +1.12% (p=0.000 n=10)
CompareBytesBigBothUnaligned/offset=6-8    447.9µ ± 0%   452.4µ ± 0%   +1.01% (p=0.000 n=10)
CompareBytesBigBothUnaligned/offset=7-8    447.9µ ± 0%   452.8µ ± 0%   +1.09% (p=0.000 n=10)
CompareBytesBig-8                          441.2µ ± 0%   461.8µ ± 0%   +4.66% (p=0.000 n=10)
CompareBytesBigIdentical-8                 13.81n ± 0%   13.80n ± 0%        ~ (p=0.519 n=10)
geomean                                    3.980µ        2.651µ       -33.40%

                                        │  compare.1   │               compare.2                │
                                        │     B/s      │      B/s       vs base                 │
CompareBytesBigUnaligned/offset=1-8       416.5Mi ± 0%   2285.1Mi ± 0%  +448.64% (p=0.000 n=10)
CompareBytesBigUnaligned/offset=2-8       420.7Mi ± 0%   2286.4Mi ± 0%  +443.43% (p=0.000 n=10)
CompareBytesBigUnaligned/offset=3-8       419.5Mi ± 0%   2285.9Mi ± 0%  +444.97% (p=0.000 n=10)
CompareBytesBigUnaligned/offset=4-8       420.6Mi ± 0%   2286.1Mi ± 0%  +443.57% (p=0.000 n=10)
CompareBytesBigUnaligned/offset=5-8       422.6Mi ± 0%   2285.7Mi ± 0%  +440.86% (p=0.000 n=10)
CompareBytesBigUnaligned/offset=6-8       424.2Mi ± 0%   2286.8Mi ± 0%  +439.07% (p=0.000 n=10)
CompareBytesBigUnaligned/offset=7-8       419.2Mi ± 0%   2285.2Mi ± 0%  +445.07% (p=0.000 n=10)
CompareBytesBigBothUnaligned/offset=0-8   2.184Gi ± 0%    2.101Gi ± 0%    -3.79% (p=0.000 n=10)
CompareBytesBigBothUnaligned/offset=1-8   2.181Gi ± 0%    2.155Gi ± 0%    -1.18% (p=0.000 n=10)
CompareBytesBigBothUnaligned/offset=2-8   2.180Gi ± 0%    2.156Gi ± 0%    -1.13% (p=0.000 n=10)
CompareBytesBigBothUnaligned/offset=3-8   2.180Gi ± 0%    2.158Gi ± 0%    -1.01% (p=0.000 n=10)
CompareBytesBigBothUnaligned/offset=4-8   2.180Gi ± 0%    2.160Gi ± 0%    -0.91% (p=0.000 n=10)
CompareBytesBigBothUnaligned/offset=5-8   2.181Gi ± 0%    2.157Gi ± 0%    -1.11% (p=0.000 n=10)
CompareBytesBigBothUnaligned/offset=6-8   2.181Gi ± 0%    2.159Gi ± 0%    -1.00% (p=0.000 n=10)
CompareBytesBigBothUnaligned/offset=7-8   2.180Gi ± 0%    2.157Gi ± 0%    -1.08% (p=0.000 n=10)
CompareBytesBig-8                         2.213Gi ± 0%    2.115Gi ± 0%    -4.45% (p=0.000 n=10)
CompareBytesBigIdentical-8                69.06Ti ± 0%    69.09Ti ± 0%         ~ (p=0.315 n=10)
geomean                                   2.022Gi         4.022Gi        +98.95%

Change-Id: Id3012faf8d353eb1be0e1fb01b78ac43fa4c7e8b
Reviewed-on: https://go-review.googlesource.com/c/go/+/646737
Reviewed-by: Mark Ryan <markdryan@rivosinc.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
2025-08-08 01:35:29 -07:00
limeidan
dd3abf6bc5 internal/bytealg: optimize Index/IndexString on loong64
goos: linux
goarch: loong64
pkg: bytes
cpu: Loongson-3A6000 @ 2500.00MHz
                              | 3a6000.old.txt |           3a6000.new.txt            |
                              |     sec/op     |   sec/op     vs base                |
IndexRune/10                      23.56n ±  1%   20.42n ± 0%  -13.33% (p=0.000 n=10)
IndexRune/32                      29.91n ±  1%   22.46n ± 0%  -24.90% (p=0.000 n=10)
IndexRune/4K                     102.45n ±  2%   72.66n ± 0%  -29.08% (p=0.000 n=10)
IndexRune/4M                     111.96µ ±  1%   52.50µ ± 1%  -53.11% (p=0.000 n=10)
IndexRune/64M                     3.653m ± 30%   3.633m ± 0%        ~ (p=0.143 n=10)
IndexRuneASCII/10                 8.736n ±  2%   7.206n ± 0%  -17.51% (p=0.000 n=10)
IndexRuneASCII/32                10.195n ±  2%   8.008n ± 0%  -21.45% (p=0.000 n=10)
IndexRuneASCII/4K                 70.27n ±  2%   52.84n ± 0%  -24.80% (p=0.000 n=10)
IndexRuneASCII/4M                 98.15µ ±  1%   87.87µ ± 1%  -10.47% (p=0.000 n=10)
IndexRuneASCII/64M                2.028m ±  0%   1.918m ± 2%   -5.41% (p=0.000 n=10)
IndexRuneUnicode/Latin/10         18.80n ±  1%   13.61n ± 0%  -27.59% (p=0.000 n=10)
IndexRuneUnicode/Latin/32         28.09n ±  2%   20.82n ± 0%  -25.88% (p=0.000 n=10)
IndexRuneUnicode/Latin/4K         373.8n ±  1%   357.1n ± 0%   -4.47% (p=0.000 n=10)
IndexRuneUnicode/Latin/4M         395.8µ ±  0%   381.0µ ± 0%   -3.74% (p=0.000 n=10)
IndexRuneUnicode/Latin/64M        8.056m ±  0%   7.614m ± 0%   -5.49% (p=0.000 n=10)
IndexRuneUnicode/Cyrillic/10      23.72n ±  1%   20.42n ± 0%  -13.91% (p=0.000 n=10)
IndexRuneUnicode/Cyrillic/32      30.20n ±  1%   22.42n ± 0%  -25.77% (p=0.000 n=10)
IndexRuneUnicode/Cyrillic/4K      1.134µ ±  1%   1.122µ ± 0%   -1.06% (p=0.000 n=10)
IndexRuneUnicode/Cyrillic/4M      1.160m ±  1%   1.152m ± 0%   -0.72% (p=0.005 n=10)
IndexRuneUnicode/Cyrillic/64M     20.26m ±  1%   19.61m ± 0%   -3.24% (p=0.000 n=10)
IndexRuneUnicode/Han/10           30.11n ±  2%   24.82n ± 0%  -17.57% (p=0.000 n=10)
IndexRuneUnicode/Han/32           36.16n ±  2%   27.20n ± 0%  -24.78% (p=0.000 n=10)
IndexRuneUnicode/Han/4K           548.1n ±  0%   524.8n ± 0%   -4.25% (p=0.000 n=10)
IndexRuneUnicode/Han/4M           706.7µ ±  1%   624.0µ ± 0%  -11.70% (p=0.000 n=10)
IndexRuneUnicode/Han/64M          12.50m ±  1%   10.84m ± 1%  -13.24% (p=0.000 n=10)
Index/10                          42.03n ±  2%   10.01n ± 0%  -76.18% (p=0.000 n=10)
Index/32                         133.15n ±  1%   40.03n ± 0%  -69.94% (p=0.000 n=10)
Index/4K                         11.647µ ±  1%   2.493µ ± 0%  -78.60% (p=0.000 n=10)
Index/4M                         11.536m ±  0%   2.519m ± 0%  -78.16% (p=0.000 n=10)
Index/64M                        184.60m ±  1%   40.42m ± 0%  -78.10% (p=0.000 n=10)
IndexEasy/10                     17.290n ±  2%   9.608n ± 0%  -44.43% (p=0.000 n=10)
IndexEasy/32                      23.71n ±  2%   16.61n ± 0%  -29.95% (p=0.000 n=10)
IndexEasy/4K                      95.64n ±  2%   68.25n ± 0%  -28.64% (p=0.000 n=10)
IndexEasy/4M                     105.04µ ±  1%   91.94µ ± 0%  -12.47% (p=0.000 n=10)
IndexEasy/64M                     4.280m ±  0%   4.264m ± 0%   -0.38% (p=0.002 n=10)
Count/10                          53.09n ±  1%   16.81n ± 0%  -68.33% (p=0.000 n=10)
Count/32                         142.20n ±  2%   46.44n ± 0%  -67.34% (p=0.000 n=10)
Count/4K                         11.428µ ±  1%   2.500µ ± 1%  -78.12% (p=0.000 n=10)
Count/4M                         11.536m ±  1%   2.520m ± 0%  -78.16% (p=0.000 n=10)
Count/64M                        183.80m ±  1%   40.42m ± 0%  -78.01% (p=0.000 n=10)
IndexHard1                       2906.4µ ±  1%   420.4µ ± 0%  -85.54% (p=0.000 n=10)
IndexHard2                       2918.0µ ±  1%   421.1µ ± 1%  -85.57% (p=0.000 n=10)
IndexHard3                       2912.8µ ±  1%   440.2µ ± 0%  -84.89% (p=0.000 n=10)
IndexHard4                       2909.6µ ±  1%   840.4µ ± 0%  -71.12% (p=0.000 n=10)
LastIndexHard1                    2.939m ±  1%   2.621m ± 0%  -10.83% (p=0.000 n=10)
LastIndexHard2                    2.924m ±  1%   2.624m ± 0%  -10.26% (p=0.000 n=10)
LastIndexHard3                    2.936m ±  1%   2.580m ± 1%  -12.12% (p=0.000 n=10)
CountHard1                       2900.4µ ±  1%   420.0µ ± 0%  -85.52% (p=0.000 n=10)
CountHard2                       2915.6µ ±  1%   420.0µ ± 0%  -85.59% (p=0.000 n=10)
CountHard3                       2905.0µ ±  0%   440.0µ ± 0%  -84.85% (p=0.000 n=10)
IndexPeriodic/IndexPeriodic2     181.95µ ±  1%   26.28µ ± 0%  -85.56% (p=0.000 n=10)
IndexPeriodic/IndexPeriodic4     182.59µ ±  1%   26.29µ ± 0%  -85.60% (p=0.000 n=10)
IndexPeriodic/IndexPeriodic8      183.9µ ±  1%   108.2µ ± 0%  -41.14% (p=0.000 n=10)
IndexPeriodic/IndexPeriodic16     58.24µ ±  0%   56.58µ ± 0%   -2.86% (p=0.000 n=10)
IndexPeriodic/IndexPeriodic32     30.82µ ±  0%   29.62µ ± 0%   -3.92% (p=0.000 n=10)
IndexPeriodic/IndexPeriodic64     16.59µ ±  0%   15.00µ ± 0%   -9.62% (p=0.000 n=10)
geomean                           22.69µ         11.59µ       -48.92%

Change-Id: Iacc9e686027f99bb0413b566cfc8ee6cd873d2d9
Reviewed-on: https://go-review.googlesource.com/c/go/+/693878
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-07 20:32:55 -07:00
limeidan
73ff6d1480 cmd/internal/obj/loong64: change the immediate range of ALSL{W/WU/V}
When executing the alsl.w/wu/d family of instructions, the actual shift amount is the immediate value
in the instruction encoding plus one. Therefore, this change is made to align the immediate value
in the assembly code with the programmer's intended shift amount, and to include the result of
the immediate value minus one in the final encoding.

Change-Id: Ic82249251878eabde8372e183d841a03f963f9f9
Reviewed-on: https://go-review.googlesource.com/c/go/+/693475
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn>
2025-08-07 19:04:41 -07:00
Xiaolin Zhao
f3606b0825 cmd/compile/internal/ssa: fix typo in LOONG64Ops.go comment
Change-Id: I680bae7fc1a26c1f249ab833fa8d41e9387b2d50
Reviewed-on: https://go-review.googlesource.com/c/go/+/693456
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
2025-08-07 19:04:29 -07:00
Xiaolin Zhao
ee7bb8969a cmd/internal/obj/loong64: add support for FSEL instruction
Go asm syntax:
	FSEL	FCC, FK, FJ, FD

Equivalent platform assembler syntax:
	fsel	fd, fj, fk, ca

Change-Id: If75f16fca0adfc03f4952f8a5143d22da33ed425
Reviewed-on: https://go-review.googlesource.com/c/go/+/693457
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
2025-08-07 19:04:20 -07:00
Richard Miller
1f7ffca171 time: skip TestLongAdjustTimers on plan9 (too slow)
The TestLongAdjustTimers test has been consistently timing out
after 60 seconds on plan9-arm. Skip the test for plan9, as it
is already skipped for being too slow on android and ios.

Fixes #74921

Change-Id: Icc32e902cecd2e98971a898373fe8346b179437d
Reviewed-on: https://go-review.googlesource.com/c/go/+/693955
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>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Mark Freeman <markfreeman@google.com>
2025-08-07 11:07:04 -07:00
Junyang Shao
8eb5f6020e [dev.simd] cmd/compile, simd: API interface fixes
- Absolute -> Abs
    - ApproximateReciprocal -> Reciprocal
      - Other derived apis also changed.
    - Round -> RoundToEven
      - Other derived apis also changed.
    - Drop DotProdBroadcast
    - Fused(Mul|Add)(Mul|Add)? -> remove the "Fused"
    - MulEvenWiden -> remove 64bit
    - MulLow -> Mul, add unit
    - PairDotProd -> DotProdPairs
      - make AddDotProdPairs machine ops only - peepholes will be in another
        CL at dev.simd.
    - PopCount -> OnesCount
    - Saturated* -> *Saturated
    - Fix (Add|Sub)Saturated uint mappings.
    - UnsignedSignedQuadDotProdAccumulate -> AddDotProdQuadruple
      - The "DotProdQuadruple" instruction does not exist, so no peepholes for
        this.
This CL is generated by CL 694095.

Change-Id: If4110cc04ab96240cf56f2348d35ed2a719687de
Reviewed-on: https://go-review.googlesource.com/c/go/+/694115
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-07 10:37:58 -07:00
Junyang Shao
b226bcc4a9 [dev.simd] cmd/compile, simd: add value conversion ToBits for mask
This CL is generated by CL 693598.

Change-Id: I949d3b3b4e5670cb30f0fb9dc779f7359409b54c
Reviewed-on: https://go-review.googlesource.com/c/go/+/693755
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-07 08:29:47 -07:00
Cherry Mui
8282b72d62 runtime/race: update darwin race syso
On macOS, the script in LLVM TSAN building the race syso files
produces the Mach-O object with a malformed dynamic symbol table,
which new Apple linker doesn't like and emits an annoying warning
(https://github.com/golang/go/issues/61229#issuecomment-1988965927).
The dynamic symbol table isn't really needed, as it is a static
object. Perhaps it should be fixed in TSAN or the C toolchain, but
we can do a simple workaround: pass it through "ld -r", which
produces an equivalent object file with LC_DYSYMTAB removed.
CL 692975 changes racebuild to do this, which produces new syso's
in this CL.

While here, build the syso with a newer version of LLVM TSAN.

Updates #61229.

Change-Id: Ide4b7831eb2cb6877c8ace7b3ec8ff565a9eaf54
Reviewed-on: https://go-review.googlesource.com/c/go/+/692996
Reviewed-by: David Chase <drchase@google.com>
TryBot-Bypass: Cherry Mui <cherryyz@google.com>
2025-08-06 14:34:39 -07:00
qiulaidongfeng
dc54d7b607 all: remove support for windows/arm
Also CL 690655 for golang.org/x/sys.

For #71671

Change-Id: Iceb369dec5affb944a39d07cdabfd7add6f1f319
Reviewed-on: https://go-review.googlesource.com/c/go/+/648795
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-06 14:28:12 -07:00
Junyang Shao
5b0ef7fcdc [dev.simd] cmd/compile, simd: add Expand
This CL is generated by CL 693336.

Change-Id: Ic1712d49fcad0544fa3c19b0249d8bc65b347104
Reviewed-on: https://go-review.googlesource.com/c/go/+/693375
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-06 13:50:57 -07:00
Junyang Shao
d3cf582f8a [dev.simd] cmd/compile, simd: (Set|Get)(Lo|Hi)
This CL is generated by CL 693335.

Change-Id: Ie9adda526573f979ec7e4f535033ba29236cc5cb
Reviewed-on: https://go-review.googlesource.com/c/go/+/693355
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-08-06 13:50:50 -07:00
Keith Randall
e0a1ea431c cmd/compile: make panicBounds stack frame smaller on ppc64
We're running into nosplit limits when compiled with all=-N -l.

Fixes #74910

Change-Id: I156263ae9b54ded240000001719512af86af70ee
Reviewed-on: https://go-review.googlesource.com/c/go/+/693557
Reviewed-by: Paul Murphy <paumurph@redhat.com>
Auto-Submit: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Keith Randall <khr@google.com>
2025-08-06 13:32:58 -07:00
Cherry Mui
2747f925dd debug/macho: support reading imported symbols without LC_DYSYMTAB
Currently, the ImportedSymbols method requires an LC_DYSYMTAB load
command to exist. However, a Mach-O object file may not have an
LC_DYSYMTAB load command, e.g. the one produced by "ld -r".
Support this case by just reading the symbol table and gathers
undefined symbols.

Updates #61229.

Change-Id: I8b4761ac7d99e1f1f378e883e9be75ee4049ffbb
Reviewed-on: https://go-review.googlesource.com/c/go/+/692995
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-08-06 12:28:05 -07:00
Cherry Mui
025d36917c cmd/internal/testdir: pass -buildid to link command
The new dynamic loader in macOS 26 beta doesn't like binaries
without LC_UUID. Binaries built by "go build" have LC_UUID by
default. When invoking the linker manually, it has an LC_UUID by
default if a Go buildid is specified. This CL makes it pass
-buildid to link command for the test directory, so the binaries
will have LC_UUID.

Change-Id: I9369aeb7323d211eda80e4f22f459c220085f61d
Reviewed-on: https://go-review.googlesource.com/c/go/+/692876
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-06 12:27:26 -07:00
Cherry Mui
f53dcb6280 cmd/internal/testdir: unify link command
There are three places where we manually construct a "go tool link"
command. Unify them.

Test binaries don't need the symbol table or debug info, so pass
-s -w always.

Change-Id: I40143894172877738e250f291d7e7ef8dce62488
Reviewed-on: https://go-review.googlesource.com/c/go/+/692875
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-06 12:27:04 -07:00
Damien Neil
a3895fe9f1 database/sql: avoid closing Rows while scan is in progress
A database/sql/driver.Rows can return database-owned data
from Rows.Next. The driver.Rows documentation doesn't explicitly
document the lifetime guarantees for this data, but a reasonable
expectation is that the caller of Next should only access it
until the next call to Rows.Close or Rows.Next.

Avoid violating that constraint when a query is cancelled while
a call to database/sql.Rows.Scan (note the difference between
the two different Rows types!) is in progress. We previously
took care to avoid closing a driver.Rows while the user has
access to driver-owned memory via a RawData, but we could still
close a driver.Rows while a Scan call was in the process of
reading previously-returned driver-owned data.

Update the fake DB used in database/sql tests to invalidate
returned data to help catch other places we might be
incorrectly retaining it.

Fixes #74831.

Change-Id: Ice45b5fad51b679c38e3e1d21ef39156b56d6037
Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/2540
Reviewed-by: Roland Shoemaker <bracewell@google.com>
Reviewed-by: Neal Patel <nealpatel@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/693735
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2025-08-06 11:36:35 -07:00
Mark Freeman
608e9fac90 go/types, types2: flip on position tracing
Running compilebench with flags off / on, we get the below:

                         │   old.txt    │              new.txt               │
                         │    sec/op    │   sec/op     vs base               │
Template                    149.2m ± 6%   155.5m ± 5%       ~ (p=0.280 n=10)
Unicode                     110.1m ± 3%   105.8m ± 7%       ~ (p=0.280 n=10)
GoTypes                     774.0m ± 6%   757.7m ± 2%       ~ (p=0.247 n=10)
Compiler                    109.6m ± 6%   109.8m ± 6%       ~ (p=0.579 n=10)
SSA                          4.562 ± 2%    4.550 ± 2%       ~ (p=0.436 n=10)
Flate                      101.65m ± 9%   96.32m ± 7%  -5.24% (p=0.043 n=10)
GoParser                    168.7m ± 6%   173.7m ± 6%       ~ (p=0.436 n=10)
Reflect                     390.2m ± 5%   387.8m ± 6%       ~ (p=0.684 n=10)
Tar                         185.9m ± 3%   182.2m ± 4%       ~ (p=0.529 n=10)
XML                         212.7m ± 4%   211.4m ± 4%       ~ (p=0.971 n=10)
LinkCompiler                490.9m ± 4%   480.4m ± 4%       ~ (p=0.353 n=10)
ExternalLinkCompiler         1.501 ± 1%    1.501 ± 1%       ~ (p=0.853 n=10)
LinkWithoutDebugCompiler    311.8m ± 4%   308.6m ± 4%       ~ (p=0.579 n=10)
StdCmd                       17.60 ± 1%    17.62 ± 1%       ~ (p=0.912 n=10)
geomean                     427.5m        424.2m       -0.77%

Overall, we do not see a statistically significant perforance impact. Flate
actually reports a speedup, but with a p-value of 0.043, it's quite close
to the significance threshold (which is fairly lenient). In my opinion,
this is likely due to chance.

Fixes #51603

Change-Id: I7f439730be45e02c7f799df768590ef78e321952
Reviewed-on: https://go-review.googlesource.com/c/go/+/676816
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-06 11:05:55 -07:00
Keith Randall
72e8237cc1 cmd/compile: allow more args in StructMake folding rule
imakeOfStructMake does the right thing, but we never call it
when the StructMake has more than one argument.

Fixes #74908

Change-Id: Ib4b1a025bfb1fa69a325207e47b74bd6217092bf
Reviewed-on: https://go-review.googlesource.com/c/go/+/693615
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-06 11:04:07 -07:00
Joel Sing
3406a617d9 internal/bytealg: vector implementation of indexbyte for riscv64
Provide a vector implementation of indexbyte for riscv64, which is used
when compiled with the rva23u64 profile, or when vector is detected
to be available. Inputs that are smaller than 24 bytes will continue
to use the non-vector path.

On a Banana Pi F3, with GORISCV64=rva23u64:

                │  indexbyte.1  │             indexbyte.2              │
                │    sec/op     │    sec/op     vs base                │
IndexByte/10-8     52.68n ±  0%   47.26n ±  0%  -10.30% (p=0.000 n=10)
IndexByte/32-8     68.62n ±  0%   47.02n ±  0%  -31.49% (p=0.000 n=10)
IndexByte/4K-8    2217.0n ±  0%   420.4n ±  0%  -81.04% (p=0.000 n=10)
IndexByte/4M-8    2624.4µ ±  0%   767.5µ ±  0%  -70.75% (p=0.000 n=10)
IndexByte/64M-8    68.08m ± 10%   47.84m ± 45%  -29.73% (p=0.004 n=10)
geomean            17.03µ         8.073µ        -52.59%

                │ indexbyte.1  │               indexbyte.2               │
                │     B/s      │      B/s        vs base                 │
IndexByte/10-8    181.0Mi ± 0%    201.8Mi ±  0%   +11.48% (p=0.000 n=10)
IndexByte/32-8    444.7Mi ± 0%    649.1Mi ±  0%   +45.97% (p=0.000 n=10)
IndexByte/4K-8    1.721Gi ± 0%    9.076Gi ±  0%  +427.51% (p=0.000 n=10)
IndexByte/4M-8    1.488Gi ± 0%    5.089Gi ±  0%  +241.93% (p=0.000 n=10)
IndexByte/64M-8   940.3Mi ± 9%   1337.8Mi ± 31%   +42.27% (p=0.004 n=10)
geomean           727.1Mi         1.498Gi        +110.94%

Change-Id: If7b0dbef38d76fa7a2021e4ecaed668a1d4b9783
Reviewed-on: https://go-review.googlesource.com/c/go/+/648856
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Mark Ryan <markdryan@rivosinc.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2025-08-06 06:23:02 -07:00
Joel Sing
75ea2d05c0 internal/bytealg: vector implementation of equal for riscv64
Provide a vector implementation of equal for riscv64, which is used
when compiled with the rva23u64 profile, or when vector is detected
to be available. Inputs that are 8 byte aligned will still be handled
via a the non-vector code if the length is less than or equal to 64
bytes.

On a Banana Pi F3, with GORISCV64=rva23u64:

                                │   equal.1    │               equal.2                │
                                │    sec/op    │    sec/op     vs base                │
Equal/0-8                         1.254n ±  0%   1.254n ±  0%        ~ (p=1.000 n=10)
Equal/same/1-8                    21.32n ±  0%   21.32n ±  0%        ~ (p=0.466 n=10)
Equal/same/6-8                    21.32n ±  0%   21.32n ±  0%        ~ (p=0.689 n=10)
Equal/same/9-8                    21.32n ±  0%   21.32n ±  0%        ~ (p=0.861 n=10)
Equal/same/15-8                   21.32n ±  0%   21.32n ±  0%        ~ (p=0.657 n=10)
Equal/same/16-8                   21.32n ±  0%   21.33n ±  0%        ~ (p=0.075 n=10)
Equal/same/20-8                   21.32n ±  0%   21.32n ±  0%        ~ (p=0.249 n=10)
Equal/same/32-8                   21.32n ±  0%   21.32n ±  0%        ~ (p=0.303 n=10)
Equal/same/4K-8                   21.32n ±  0%   21.32n ±  0%        ~ (p=1.000 n=10)
Equal/same/4M-8                   21.32n ±  0%   21.32n ±  0%        ~ (p=0.582 n=10)
Equal/same/64M-8                  21.32n ±  0%   21.32n ±  0%        ~ (p=0.930 n=10)
Equal/1-8                         39.16n ±  1%   38.71n ±  0%   -1.15% (p=0.000 n=10)
Equal/6-8                         51.49n ±  1%   50.40n ±  1%   -2.12% (p=0.000 n=10)
Equal/9-8                         54.46n ±  1%   53.89n ±  0%   -1.04% (p=0.000 n=10)
Equal/15-8                        71.81n ±  1%   70.59n ±  0%   -1.71% (p=0.000 n=10)
Equal/16-8                        69.14n ±  0%   68.21n ±  0%   -1.34% (p=0.000 n=10)
Equal/20-8                        78.59n ±  0%   77.59n ±  0%   -1.26% (p=0.000 n=10)
Equal/32-8                        41.55n ±  0%   41.16n ±  0%   -0.96% (p=0.000 n=10)
Equal/4K-8                        925.5n ±  0%   561.4n ±  1%  -39.34% (p=0.000 n=10)
Equal/4M-8                        3.110m ± 32%   2.463m ± 16%  -20.80% (p=0.000 n=10)
Equal/64M-8                       47.34m ± 30%   39.89m ± 16%  -15.75% (p=0.004 n=10)
EqualBothUnaligned/64_0-8         32.17n ±  1%   32.11n ±  1%        ~ (p=0.184 n=10)
EqualBothUnaligned/64_1-8         79.48n ±  0%   48.24n ±  1%  -39.31% (p=0.000 n=10)
EqualBothUnaligned/64_4-8         72.71n ±  0%   48.37n ±  1%  -33.48% (p=0.000 n=10)
EqualBothUnaligned/64_7-8         77.12n ±  0%   48.16n ±  1%  -37.56% (p=0.000 n=10)
EqualBothUnaligned/4096_0-8       908.4n ±  0%   562.4n ±  2%  -38.09% (p=0.000 n=10)
EqualBothUnaligned/4096_1-8       956.6n ±  0%   571.4n ±  3%  -40.26% (p=0.000 n=10)
EqualBothUnaligned/4096_4-8       949.6n ±  0%   571.6n ±  3%  -39.81% (p=0.000 n=10)
EqualBothUnaligned/4096_7-8       954.2n ±  0%   571.7n ±  3%  -40.09% (p=0.000 n=10)
EqualBothUnaligned/4194304_0-8    2.935m ± 29%   2.664m ± 19%        ~ (p=0.089 n=10)
EqualBothUnaligned/4194304_1-8    3.341m ± 13%   2.896m ± 34%        ~ (p=0.075 n=10)
EqualBothUnaligned/4194304_4-8    3.204m ± 39%   3.352m ± 33%        ~ (p=0.796 n=10)
EqualBothUnaligned/4194304_7-8    3.226m ± 30%   2.737m ± 34%  -15.16% (p=0.043 n=10)
EqualBothUnaligned/67108864_0-8   49.04m ± 17%   39.94m ± 12%  -18.57% (p=0.005 n=10)
EqualBothUnaligned/67108864_1-8   51.96m ± 15%   42.48m ± 15%  -18.23% (p=0.015 n=10)
EqualBothUnaligned/67108864_4-8   47.67m ± 17%   37.85m ± 41%  -20.61% (p=0.035 n=10)
EqualBothUnaligned/67108864_7-8   53.00m ± 22%   38.76m ± 21%  -26.87% (p=0.000 n=10)
CompareBytesEqual-8               51.71n ±  1%   52.00n ±  0%   +0.57% (p=0.002 n=10)
geomean                           1.469µ         1.265µ        -13.93%

                                │    equal.1     │                equal.2                 │
                                │      B/s       │      B/s        vs base                │
Equal/same/1-8                     44.73Mi ±  0%    44.72Mi ±  0%        ~ (p=0.426 n=10)
Equal/same/6-8                     268.3Mi ±  0%    268.4Mi ±  0%        ~ (p=0.753 n=10)
Equal/same/9-8                     402.6Mi ±  0%    402.5Mi ±  0%        ~ (p=0.209 n=10)
Equal/same/15-8                    670.9Mi ±  0%    670.9Mi ±  0%        ~ (p=0.724 n=10)
Equal/same/16-8                    715.6Mi ±  0%    715.4Mi ±  0%   -0.04% (p=0.022 n=10)
Equal/same/20-8                    894.6Mi ±  0%    894.5Mi ±  0%        ~ (p=0.060 n=10)
Equal/same/32-8                    1.398Gi ±  0%    1.398Gi ±  0%        ~ (p=0.986 n=10)
Equal/same/4K-8                    178.9Gi ±  0%    178.9Gi ±  0%        ~ (p=0.853 n=10)
Equal/same/4M-8                    178.9Ti ±  0%    178.9Ti ±  0%        ~ (p=0.971 n=10)
Equal/same/64M-8                  2862.8Ti ±  0%   2862.6Ti ±  0%        ~ (p=0.971 n=10)
Equal/1-8                          24.35Mi ±  1%    24.63Mi ±  0%   +1.16% (p=0.000 n=10)
Equal/6-8                          111.1Mi ±  1%    113.5Mi ±  1%   +2.17% (p=0.000 n=10)
Equal/9-8                          157.6Mi ±  1%    159.3Mi ±  0%   +1.05% (p=0.000 n=10)
Equal/15-8                         199.2Mi ±  1%    202.7Mi ±  0%   +1.74% (p=0.000 n=10)
Equal/16-8                         220.7Mi ±  0%    223.7Mi ±  0%   +1.36% (p=0.000 n=10)
Equal/20-8                         242.7Mi ±  0%    245.8Mi ±  0%   +1.27% (p=0.000 n=10)
Equal/32-8                         734.3Mi ±  0%    741.6Mi ±  0%   +0.98% (p=0.000 n=10)
Equal/4K-8                         4.122Gi ±  0%    6.795Gi ±  1%  +64.84% (p=0.000 n=10)
Equal/4M-8                         1.258Gi ± 24%    1.586Gi ± 14%  +26.12% (p=0.000 n=10)
Equal/64M-8                        1.320Gi ± 23%    1.567Gi ± 14%  +18.69% (p=0.004 n=10)
EqualBothUnaligned/64_0-8          1.853Gi ±  1%    1.856Gi ±  1%        ~ (p=0.190 n=10)
EqualBothUnaligned/64_1-8          767.9Mi ±  0%   1265.2Mi ±  1%  +64.76% (p=0.000 n=10)
EqualBothUnaligned/64_4-8          839.4Mi ±  0%   1261.9Mi ±  1%  +50.33% (p=0.000 n=10)
EqualBothUnaligned/64_7-8          791.4Mi ±  0%   1267.5Mi ±  1%  +60.16% (p=0.000 n=10)
EqualBothUnaligned/4096_0-8        4.199Gi ±  0%    6.784Gi ±  2%  +61.54% (p=0.000 n=10)
EqualBothUnaligned/4096_1-8        3.988Gi ±  0%    6.676Gi ±  3%  +67.40% (p=0.000 n=10)
EqualBothUnaligned/4096_4-8        4.017Gi ±  0%    6.674Gi ±  3%  +66.14% (p=0.000 n=10)
EqualBothUnaligned/4096_7-8        3.998Gi ±  0%    6.673Gi ±  3%  +66.92% (p=0.000 n=10)
EqualBothUnaligned/4194304_0-8     1.332Gi ± 22%    1.468Gi ± 16%        ~ (p=0.089 n=10)
EqualBothUnaligned/4194304_1-8     1.169Gi ± 12%    1.350Gi ± 25%        ~ (p=0.075 n=10)
EqualBothUnaligned/4194304_4-8     1.222Gi ± 28%    1.165Gi ± 48%        ~ (p=0.796 n=10)
EqualBothUnaligned/4194304_7-8     1.211Gi ± 23%    1.427Gi ± 26%  +17.88% (p=0.043 n=10)
EqualBothUnaligned/67108864_0-8    1.274Gi ± 14%    1.567Gi ± 14%  +22.97% (p=0.005 n=10)
EqualBothUnaligned/67108864_1-8    1.204Gi ± 14%    1.471Gi ± 13%  +22.18% (p=0.015 n=10)
EqualBothUnaligned/67108864_4-8    1.311Gi ± 14%    1.651Gi ± 29%  +25.92% (p=0.035 n=10)
EqualBothUnaligned/67108864_7-8    1.179Gi ± 18%    1.612Gi ± 17%  +36.73% (p=0.000 n=10)
geomean                            1.870Gi          2.190Gi        +17.16%

Change-Id: I9c5270bcc6997d020a96d1e97c7e7cfc7ca7fd34
Reviewed-on: https://go-review.googlesource.com/c/go/+/646736
Reviewed-by: Mark Ryan <markdryan@rivosinc.com>
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
2025-08-06 06:18:46 -07:00
Julian Zhu
17a8be7117 crypto/sha512: use const table for key loading on loong64
Load constant keys from a static memory table rather than loading immediates into registers on loong64.

Benchmark for Loongson-3A5000:
goos: linux
goarch: loong64
pkg: crypto/sha512
cpu: Loongson-3A5000-HV @ 2500.00MHz
                    │   sha512o   │              sha512n            │
                    │   sec/op    │   sec/op     vs base            │
Hash8Bytes/New-4      489.1n ± 0%   464.7n ± 0%  -5.00% (p=0.000 n=8)
Hash8Bytes/Sum384-4   499.1n ± 0%   474.6n ± 0%  -4.92% (p=0.000 n=8)
Hash8Bytes/Sum512-4   506.6n ± 0%   481.9n ± 0%  -4.86% (p=0.000 n=8)
Hash1K/New-4          3.371µ ± 0%   3.152µ ± 0%  -6.51% (p=0.000 n=8)
Hash1K/Sum384-4       3.385µ ± 0%   3.164µ ± 0%  -6.53% (p=0.000 n=8)
Hash1K/Sum512-4       3.392µ ± 0%   3.170µ ± 0%  -6.54% (p=0.000 n=8)
Hash8K/New-4          23.62µ ± 0%   22.01µ ± 0%  -6.82% (p=0.000 n=8)
Hash8K/Sum384-4       23.63µ ± 0%   22.02µ ± 0%  -6.82% (p=0.000 n=8)
Hash8K/Sum512-4       23.64µ ± 0%   22.02µ ± 0%  -6.86% (p=0.000 n=8)
geomean               3.415µ        3.207µ       -6.10%

                    │   sha512o    │              sha512n            │
                    │     B/s      │     B/s       vs base           │
Hash8Bytes/New-4     15.60Mi ± 0%   16.42Mi ± 0%  +5.29% (p=0.000 n=8)
Hash8Bytes/Sum384-4  15.29Mi ± 0%   16.08Mi ± 0%  +5.18% (p=0.000 n=8)
Hash8Bytes/Sum512-4  15.06Mi ± 0%   15.83Mi ± 0%  +5.13% (p=0.000 n=8)
Hash1K/New-4         289.7Mi ± 0%   309.9Mi ± 0%  +6.97% (p=0.000 n=8)
Hash1K/Sum384-4      288.5Mi ± 0%   308.6Mi ± 0%  +6.97% (p=0.000 n=8)
Hash1K/Sum512-4      287.9Mi ± 0%   308.0Mi ± 0%  +7.00% (p=0.000 n=8)
Hash8K/New-4         330.8Mi ± 0%   355.0Mi ± 0%  +7.32% (p=0.000 n=8)
Hash8K/Sum384-4      330.6Mi ± 0%   354.9Mi ± 0%  +7.32% (p=0.000 n=8)
Hash8K/Sum512-4      330.5Mi ± 0%   354.8Mi ± 0%  +7.36% (p=0.000 n=8)
geomean              113.5Mi        120.9Mi       +6.50%

Benchmark for Loongson-3A6000:
goos: linux
goarch: loong64
pkg: crypto/sha512
cpu: Loongson-3A6000 @ 2500.00MHz
                    │ sha512.old  │             sha512.new           │
                    │   sec/op    │   sec/op     vs base             │
Hash8Bytes/New-8      397.2n ± 0%   380.6n ± 0%  -4.17% (p=0.000 n=10)
Hash8Bytes/Sum384-8   406.1n ± 0%   397.9n ± 0%  -2.02% (p=0.000 n=10)
Hash8Bytes/Sum512-8   410.1n ± 0%   395.8n ± 1%  -3.50% (p=0.000 n=10)
Hash1K/New-8          2.932µ ± 0%   2.800µ ± 0%  -4.50% (p=0.000 n=10)
Hash1K/Sum384-8       2.941µ ± 0%   2.812µ ± 0%  -4.39% (p=0.000 n=10)
Hash1K/Sum512-8       2.947µ ± 0%   2.814µ ± 0%  -4.50% (p=0.000 n=10)
Hash8K/New-8          20.68µ ± 0%   19.73µ ± 1%  -4.58% (p=0.000 n=10)
Hash8K/Sum384-8       20.69µ ± 0%   19.73µ ± 0%  -4.62% (p=0.000 n=10)
Hash8K/Sum512-8       20.70µ ± 0%   19.75µ ± 0%  -4.60% (p=0.000 n=10)
geomean               2.908µ        2.789µ       -4.10%

                    │  sha512.old  │             sha512.new          │
                    │     B/s      │     B/s       vs base           │
Hash8Bytes/New-8    19.21Mi ± 0%   20.05Mi ± 0%  +4.37% (p=0.000 n=10)
Hash8Bytes/Sum384-8 18.79Mi ± 0%   19.18Mi ± 0%  +2.08% (p=0.000 n=10)
Hash8Bytes/Sum512-8 18.60Mi ± 0%   19.28Mi ± 1%  +3.64% (p=0.000 n=10)
Hash1K/New-8        333.1Mi ± 0%   348.8Mi ± 0%  +4.71% (p=0.000 n=10)
Hash1K/Sum384-8     332.0Mi ± 0%   347.3Mi ± 0%  +4.60% (p=0.000 n=10)
Hash1K/Sum512-8     331.5Mi ± 0%   347.0Mi ± 0%  +4.69% (p=0.000 n=10)
Hash8K/New-8        377.8Mi ± 0%   396.0Mi ± 1%  +4.80% (p=0.000 n=10)
Hash8K/Sum384-8     377.7Mi ± 0%   396.0Mi ± 0%  +4.85% (p=0.000 n=10)
Hash8K/Sum512-8     377.5Mi ± 0%   395.7Mi ± 0%  +4.82% (p=0.000 n=10)
geomean             133.3Mi        139.0Mi       +4.28%

Change-Id: I55ae4a8e4b0c51a98583f654158235fe738cf348
Reviewed-on: https://go-review.googlesource.com/c/go/+/678436
Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn>
Reviewed-by: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
2025-08-05 18:02:52 -07:00
Julian Zhu
dda9d780e2 crypto/sha256: use const table for key loading on loong64
Load constant keys from a static memory table rather than loading immediates into registers on loong64.

Benchmark for Loongson-3A5000:
goos: linux
goarch: loong64
pkg: crypto/sha256
cpu: Loongson-3A5000-HV @ 2500.00MHz
                    │   sha256o   │              sha256n              │
                    │   sec/op    │   sec/op     vs base              │
Hash8Bytes/New-4      356.1n ± 0%   347.0n ± 0%  -2.54% (p=0.000 n=8)
Hash8Bytes/Sum224-4   368.7n ± 0%   359.5n ± 0%  -2.50% (p=0.000 n=8)
Hash8Bytes/Sum256-4   367.7n ± 0%   358.9n ± 0%  -2.41% (p=0.000 n=8)
Hash1K/New-4          4.741µ ± 0%   4.578µ ± 0%  -3.44% (p=0.000 n=8)
Hash1K/Sum224-4       4.755µ ± 0%   4.591µ ± 0%  -3.44% (p=0.000 n=8)
Hash1K/Sum256-4       4.753µ ± 0%   4.589µ ± 0%  -3.46% (p=0.000 n=8)
Hash8K/New-4          35.42µ ± 0%   34.19µ ± 0%  -3.45% (p=0.000 n=8)
Hash8K/Sum224-4       35.43µ ± 0%   34.21µ ± 0%  -3.44% (p=0.000 n=8)
Hash8K/Sum256-4       35.46µ ± 0%   34.22µ ± 0%  -3.48% (p=0.000 n=8)
Hash256K/New-4        1.138m ± 0%   1.098m ± 0%  -3.54% (p=0.000 n=8)
Hash256K/Sum224-4     1.138m ± 0%   1.098m ± 0%  -3.53% (p=0.000 n=8)
Hash256K/Sum256-4     1.139m ± 0%   1.099m ± 0%  -3.48% (p=0.000 n=8)
Hash1M/New-4          4.488m ± 0%   4.388m ± 0%  -2.22% (p=0.000 n=8)
Hash1M/Sum224-4       4.488m ± 0%   4.387m ± 0%  -2.24% (p=0.000 n=8)
Hash1M/Sum256-4       4.489m ± 0%   4.388m ± 0%  -2.25% (p=0.000 n=8)
geomean               50.02µ        48.50µ       -3.03%

                    │   sha256o    │              sha256n               │
                    │     B/s      │     B/s       vs base              │
Hash8Bytes/New-4      21.42Mi ± 0%   21.99Mi ± 0%  +2.63% (p=0.000 n=8)
Hash8Bytes/Sum224-4   20.69Mi ± 0%   21.22Mi ± 0%  +2.56% (p=0.000 n=8)
Hash8Bytes/Sum256-4   20.74Mi ± 0%   21.26Mi ± 0%  +2.48% (p=0.000 n=8)
Hash1K/New-4          206.0Mi ± 0%   213.3Mi ± 0%  +3.57% (p=0.000 n=8)
Hash1K/Sum224-4       205.4Mi ± 0%   212.7Mi ± 0%  +3.57% (p=0.000 n=8)
Hash1K/Sum256-4       205.5Mi ± 0%   212.8Mi ± 0%  +3.58% (p=0.000 n=8)
Hash8K/New-4          220.6Mi ± 0%   228.5Mi ± 0%  +3.58% (p=0.000 n=8)
Hash8K/Sum224-4       220.5Mi ± 0%   228.4Mi ± 0%  +3.56% (p=0.000 n=8)
Hash8K/Sum256-4       220.3Mi ± 0%   228.3Mi ± 0%  +3.61% (p=0.000 n=8)
Hash256K/New-4        219.7Mi ± 0%   227.7Mi ± 0%  +3.67% (p=0.000 n=8)
Hash256K/Sum224-4     219.6Mi ± 0%   227.6Mi ± 0%  +3.66% (p=0.000 n=8)
Hash256K/Sum256-4     219.6Mi ± 0%   227.5Mi ± 0%  +3.60% (p=0.000 n=8)
Hash1M/New-4          222.8Mi ± 0%   227.9Mi ± 0%  +2.27% (p=0.000 n=8)
Hash1M/Sum224-4       222.8Mi ± 0%   227.9Mi ± 0%  +2.29% (p=0.000 n=8)
Hash1M/Sum256-4       222.8Mi ± 0%   227.9Mi ± 0%  +2.30% (p=0.000 n=8)
geomean               136.0Mi        140.2Mi       +3.13%

Benchmark for Loongson-3A6000:
goos: linux
goarch: loong64
pkg: crypto/sha256
cpu: Loongson-3A6000 @ 2500.00MHz
                    │ sha256.old  │             sha256.new             │
                    │   sec/op    │   sec/op     vs base               │
Hash8Bytes/New-8      294.5n ± 0%   288.6n ± 0%  -2.00% (p=0.000 n=10)
Hash8Bytes/Sum224-8   305.0n ± 0%   299.7n ± 0%  -1.74% (p=0.000 n=10)
Hash8Bytes/Sum256-8   302.0n ± 0%   296.8n ± 0%  -1.74% (p=0.000 n=10)
Hash1K/New-8          4.186µ ± 0%   4.096µ ± 0%  -2.15% (p=0.000 n=10)
Hash1K/Sum224-8       4.193µ ± 0%   4.104µ ± 0%  -2.12% (p=0.000 n=10)
Hash1K/Sum256-8       4.194µ ± 0%   4.108µ ± 0%  -2.04% (p=0.000 n=10)
Hash8K/New-8          31.44µ ± 0%   30.76µ ± 0%  -2.17% (p=0.000 n=10)
Hash8K/Sum224-8       31.45µ ± 0%   30.79µ ± 0%  -2.10% (p=0.000 n=10)
Hash8K/Sum256-8       31.45µ ± 0%   30.78µ ± 0%  -2.12% (p=0.000 n=10)
Hash256K/New-8        996.7µ ± 0%   975.6µ ± 0%  -2.12% (p=0.000 n=10)
Hash256K/Sum224-8     996.8µ ± 0%   975.8µ ± 0%  -2.11% (p=0.000 n=10)
Hash256K/Sum256-8     996.8µ ± 0%   975.6µ ± 0%  -2.12% (p=0.000 n=10)
Hash1M/New-8          3.987m ± 0%   3.904m ± 0%  -2.08% (p=0.000 n=10)
Hash1M/Sum224-8       3.990m ± 0%   3.902m ± 0%  -2.20% (p=0.000 n=10)
Hash1M/Sum256-8       3.987m ± 0%   3.903m ± 0%  -2.10% (p=0.000 n=10)
geomean               43.59µ        42.69µ       -2.06%

                    │  sha256.old  │             sha256.new              │
                    │     B/s      │     B/s       vs base               │
Hash8Bytes/New-8      25.90Mi ± 0%   26.44Mi ± 0%  +2.06% (p=0.000 n=10)
Hash8Bytes/Sum224-8   25.01Mi ± 0%   25.46Mi ± 0%  +1.77% (p=0.000 n=10)
Hash8Bytes/Sum256-8   25.26Mi ± 0%   25.72Mi ± 0%  +1.79% (p=0.000 n=10)
Hash1K/New-8          233.3Mi ± 0%   238.5Mi ± 0%  +2.19% (p=0.000 n=10)
Hash1K/Sum224-8       232.9Mi ± 0%   238.0Mi ± 0%  +2.17% (p=0.000 n=10)
Hash1K/Sum256-8       232.9Mi ± 0%   237.7Mi ± 0%  +2.07% (p=0.000 n=10)
Hash8K/New-8          248.5Mi ± 0%   254.0Mi ± 0%  +2.22% (p=0.000 n=10)
Hash8K/Sum224-8       248.4Mi ± 0%   253.7Mi ± 0%  +2.14% (p=0.000 n=10)
Hash8K/Sum256-8       248.4Mi ± 0%   253.8Mi ± 0%  +2.17% (p=0.000 n=10)
Hash256K/New-8        250.8Mi ± 0%   256.3Mi ± 0%  +2.17% (p=0.000 n=10)
Hash256K/Sum224-8     250.8Mi ± 0%   256.2Mi ± 0%  +2.16% (p=0.000 n=10)
Hash256K/Sum256-8     250.8Mi ± 0%   256.2Mi ± 0%  +2.17% (p=0.000 n=10)
Hash1M/New-8          250.8Mi ± 0%   256.2Mi ± 0%  +2.12% (p=0.000 n=10)
Hash1M/Sum224-8       250.6Mi ± 0%   256.3Mi ± 0%  +2.25% (p=0.000 n=10)
Hash1M/Sum256-8       250.8Mi ± 0%   256.2Mi ± 0%  +2.14% (p=0.000 n=10)
geomean               156.0Mi        159.3Mi       +2.11%

Change-Id: Ib72cf3c746d4ad73e52e5d31f6b4a834fd36d934
Reviewed-on: https://go-review.googlesource.com/c/go/+/678435
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
2025-08-05 18:02:46 -07:00
Xiaolin Zhao
5defe8ebb3 internal/chacha8rand: replace WORD with instruction VMOVQ
Change-Id: I5d05af4d071b4b0ee60fafbd2a39494128bdf3f1
Reviewed-on: https://go-review.googlesource.com/c/go/+/682896
Reviewed-by: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2025-08-05 18:02:27 -07:00
limeidan
4c7362e41c cmd/internal/obj/loong64: add new instructions ALSL{W/WU/V} for loong64
Go asm syntax:
	ALSL{W/WU/V}	$3, R4, R5, R6

Equivalent platform assembler syntax:
	alsl.{w/wu/d}	$r6, $r4, $r5, 3

Change-Id: Ic8364dfe2753bcea7de6cffe656ca0dde6875766
Reviewed-on: https://go-review.googlesource.com/c/go/+/692136
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn>
2025-08-05 18:02:17 -07:00
Xiaolin Zhao
a552737418 cmd/compile: fold negation into multiplication on loong64
This change also add corresponding benchmark tests and codegen tests.
The performance improvement on CPU Loongson-3A6000-HV is as follows:

goos: linux
goarch: loong64
pkg: cmd/compile/internal/test
cpu: Loongson-3A6000-HV @ 2500.00MHz
        |  bench.old   |              bench.new              |
        |    sec/op    |   sec/op     vs base                |
MulNeg     828.4n ± 0%   655.9n ± 0%  -20.82% (p=0.000 n=10)
Mul2Neg   1062.0n ± 0%   826.8n ± 0%  -22.15% (p=0.000 n=10)
geomean    938.0n        736.4n       -21.49%

Change-Id: Ia999732880ec65be0c66cddc757a4868847e5b15
Reviewed-on: https://go-review.googlesource.com/c/go/+/682535
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
2025-08-05 18:02:06 -07:00
David Chase
7ca34599ec [dev.simd] simd, cmd/compile: generated files to add 'blend' and 'blendMasked'
Generated by arch/internal/simdgen CL 693175

These methods are not public because of simdgen-induced name/signature
issues, and because their addition was motivated by the need for
emulation tools.

The specific name signature problems are:

1) one set of instructions has the "Masked" suffix (because of how
that is incorporated into names) and the other set does not (though I
suppose the operation could be renamed).

2) because the AVX2 instruction is bytes-only, to get the signature
right, requires "OverwriteBase" but OverwriteBase also requires
OverwriteClass and "simdgen does not support [OverwriteClass] in
inputs".

3) the default operation order is false, true, but we want this in a
"x.Merged(y, mask)" that pairs with "x.Masked(mask)" where the true
 case is x and the false case is y/zero, but the default ordering for
 VPBLENDVB and VPBLENDMB is false->x and true->y.

4) VPBLENDVB only comes in byte width, which causes problems
for floats.

All this may get fixed in the future, for now it is just an
implementation detail.

Change-Id: I61b655c7011e2c33f8644f704f886133c89d2f15
Reviewed-on: https://go-review.googlesource.com/c/go/+/693155
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-08-05 17:43:49 -07:00
Tobias Klauser
e1fd4faf91 runtime: fix godoc comment for inVDSOPage
Change-Id: I7dcab0c915a748e52c5c689c1cb774f486d2b9e6
Reviewed-on: https://go-review.googlesource.com/c/go/+/693195
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-08-05 14:31:35 -07:00
Keith Randall
bcd25c79aa cmd/compile: allow StructSelect [x] of interface data fields for x>0
As of CL 681937 we can now have structs which are pointer shaped, but
their pointer field is not the first field, like struct{ struct{}; *int }.

Fixes #74888

Change-Id: Idc80f6b1abde3ae01437e2a9cadb5aa23d04b806
Reviewed-on: https://go-review.googlesource.com/c/go/+/693415
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-05 14:30:13 -07:00
Mark Freeman
b0945a54b5 cmd/dist, internal/platform: mark freebsd/riscv64 broken
It seems we have a builder, but it is not running correctly. Until
then, we should mark this port broken.

For #74734
For #74735

Change-Id: I536d037a43499cbd033fb6ebdf004a3df76332ab
Reviewed-on: https://go-review.googlesource.com/c/go/+/691835
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2025-08-05 14:10:52 -07:00
Austin Clements
55d961b202 runtime: save AVX2 and AVX-512 state on asynchronous preemption
Based on CL 669415 by shaojunyang@google.com.

This is a cherry-pick of CL 680900 from the dev.simd branch.

Change-Id: I574f15c3b18a7179a1573aaf567caf18d8602ef1
Reviewed-on: https://go-review.googlesource.com/c/go/+/693397
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Austin Clements <austin@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-05 14:00:15 -07:00
Austin Clements
af0c4fe2ca runtime: save scalar registers off stack in amd64 async preemption
Asynchronous preemption must save all registers that could be in use
by Go code. Currently, it saves all of these to the goroutine stack.
As a result, the stack frame requirements of asynchronous preemption
can be rather high. On amd64, this requires 368 bytes of stack space,
most of which is the XMM registers. Several RISC architectures are
around 0.5 KiB.

As we add support for SIMD instructions, this is going to become a
problem. The AVX-512 register state is 2.5 KiB. This well exceeds the
nosplit limit, and even if it didn't, could constrain when we can
asynchronously preempt goroutines on small stacks.

This CL fixes this by moving pure scalar state stored in non-GP
registers off the stack and into an allocated "extended register
state" object. To reduce space overhead, we only allocate these
objects as needed. While in the theoretical limit, every G could need
this register state, in practice very few do at a time.

However, we can't allocate when we're in the middle of saving the
register state during an asynchronous preemption, so we reserve
scratch space on every P to temporarily store the register state,
which can then be copied out to an allocated state object later by Go
code.

This commit only implements this for amd64, since that's where we're
about to add much more vector state, but it lays the groundwork for
doing this on any architecture that could benefit.

This is a cherry-pick of CL 680898 plus bug fix CL 684836 from the
dev.simd branch.

Change-Id: I123a95e21c11d5c10942d70e27f84d2d99bbf735
Reviewed-on: https://go-review.googlesource.com/c/go/+/669195
Auto-Submit: Austin Clements <austin@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-08-05 13:58:52 -07:00
Austin Clements
e73afaae69 internal/cpu: add AVX-512-CD and DQ, and derived "basic AVX-512"
This adds detection for the CD and DQ sub-features of x86 AVX-512.

Building on these, we also add a "derived" AVX-512 feature that
bundles together the basic usable subset of subfeatures. Despite the F
in AVX-512-F standing for "foundation", AVX-512-F+BW+DQ+VL together
really form the basic usable subset of AVX-512 functionality. These
have also all been supported together by almost every CPU, and are
guaranteed by GOAMD64=v4, so there's little point in separating them
out.

This is a cherry-pick of CL 680899 from the dev.simd branch.

Change-Id: I34356502bd1853ba2372e48db0b10d55cffe07a1
Reviewed-on: https://go-review.googlesource.com/c/go/+/693396
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Austin Clements <austin@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-05 13:57:45 -07:00
Austin Clements
cef381ba60 runtime: eliminate global state in mkpreempt.go
We're going to start writing two files, so having a single global file
we're writing will be a problem.

This has no effect on the generated code.

This is a cherry-pick of CL 680897 from the dev.simd branch.

Change-Id: I49897ea0c6500a29eac89b597d75c0eb3e9b6706
Reviewed-on: https://go-review.googlesource.com/c/go/+/693395
Auto-Submit: Austin Clements <austin@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-05 13:55:01 -07:00
Mateusz Poliwczak
c0025d5e0b go/parser: correct comment in expectedErrors
If `here` were already the start of the comment, then
the `pos = here` assignment would be redundant. Since pos
is already the start of the comment.

Change-Id: I793334988951ae5441327cb62d7524b423155b74
Reviewed-on: https://go-review.googlesource.com/c/go/+/693295
Reviewed-by: Alan Donovan <adonovan@google.com>
Commit-Queue: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
2025-08-05 10:41:10 -07:00
qiulaidongfeng
4ee0df8c46 cmd: remove dead code
Fixes #74076

Change-Id: Icc67b3d4e342f329584433bd1250c56ae8f5a73d
Reviewed-on: https://go-review.googlesource.com/c/go/+/690635
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Commit-Queue: Alan Donovan <adonovan@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2025-08-05 10:31:25 -07:00
Michael Pratt
a2c45f0eb1 runtime: test VDSO symbol hash values
In addition to verifying existing values, this makes it easier to add a
new one by adding an invalid entry and running the test.

Change-Id: I6a6a636c9c413add29884e4f6759196f4db34de7
Reviewed-on: https://go-review.googlesource.com/c/go/+/693276
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-08-05 09:52:44 -07:00
Keith Randall
cd55f86b8d cmd/compile: allow multi-field structs to be stored directly in interfaces
If the struct is a bunch of 0-sized fields and one pointer field.

Fixes #74092

Change-Id: I87c5d162c8c9fdba812420d7f9d21de97295b62c
Reviewed-on: https://go-review.googlesource.com/c/go/+/681937
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@google.com>
2025-08-05 09:18:31 -07:00
Keith Randall
21ab0128b6 cmd/compile: remove support for old-style bounds check calls
This CL rips out the support for old-style assembly stubs.

We need to keep the Go stubs for wasm support.

Change-Id: I23d6d9f2f06be1ded8d22b3e0ef04ff6e252a587
Reviewed-on: https://go-review.googlesource.com/c/go/+/682402
Reviewed-by: Austin Clements <austin@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>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-08-05 08:59:28 -07:00
Keith Randall
802d056c78 cmd/compile: move ppc64 over to new bounds check strategy
Change-Id: I25a9bbc247b2490e7e37ed843386f53a71822146
Reviewed-on: https://go-review.googlesource.com/c/go/+/682498
Reviewed-by: Paul Murphy <paumurph@redhat.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Keith Randall <khr@google.com>
2025-08-05 08:59:16 -07:00
Daniel Morsing
a3295df873 cmd/compile/internal/ssa: Use transitive properties for len/cap
Remove the special casing for len/cap and rely on the posets.

After removing the special logic, I ran `go build -gcflags='-d
ssa/prove/debug=2' all` to verify my results. During this, I found 2
common cases where the old implicit unsigned->signed domain conversion
made proving a branch possible that shouldn't be strictly possible and
added these.

The 2 cases are shifting a non-negative signed integer and unsigned
comparisons that happen with arguments that fits entirely inside the
unsigned argument

Change-Id: Ic88049ff69efc5602fc15f5dad02028e704f5483
Reviewed-on: https://go-review.googlesource.com/c/go/+/679155
Reviewed-by: Mark Freeman <mark@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
2025-08-05 08:58:11 -07:00
Derek Parker
bd082857a5 doc: fix typo in go memory model doc
Fixes a typo where originally "may by" was written where the intent was
"may be".

Change-Id: Ia5ba51a966506395c41b17ca28d59f63bd487f3e
Reviewed-on: https://go-review.googlesource.com/c/go/+/693075
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Bypass: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-05 08:41:37 -07:00
Cuong Manh Le
2b622b05a9 cmd/compile: remove isUintXPowerOfTwo functions
And use the generic version instead.

While at it, also correct the corresponding rules to use logXu variants
instead of logXu, following discussion in CL 689815.

Change-Id: Iba85d14ff0e26d45a126764e7bd5702586358d23
Reviewed-on: https://go-review.googlesource.com/c/go/+/692917
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2025-08-05 08:37:45 -07:00
Junyang Shao
82d056ddd7 [dev.simd] cmd/compile: add ShiftAll immediate variant
This CL is generated by CL 693136.

Change-Id: Ifd2278d3f927efa008a14cc5e592e7c14b7120ff
Reviewed-on: https://go-review.googlesource.com/c/go/+/693157
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
2025-08-05 08:37:44 -07:00
Cuong Manh Le
72147ffa75 cmd/compile: simplify isUintXPowerOfTwo implementation
By calling isUnsignedPowerOfTwo instead of duplicating the same ones.

Change-Id: I1e29d3b7eda1bc8773fcd25728d8f508ae633ac9
Reviewed-on: https://go-review.googlesource.com/c/go/+/692916
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Keith Randall <khr@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>
2025-08-05 08:34:05 -07:00
Cuong Manh Le
26da1199eb cmd/compile: make isUint{32,64}PowerOfTwo implementations clearer
Since these functions cast the input to uint64, so the result always
non-negative. The condition should be changed to comparing with zero,
thus maaking it clearer to reader, and open room for simplifying in the
future by using the generic isUnsignedPowerOfTwo function.

Separated this change, so it's easier to do bisecting if there's any
problems happened.

Change-Id: Ibec28c2590f4c52caa36384b710d526459725e49
Reviewed-on: https://go-review.googlesource.com/c/go/+/692915
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
2025-08-05 08:32:51 -07:00
Cuong Manh Le
5ab9f23977 cmd/compile, runtime: add checkptr instrumentation for unsafe.Add
Fixes #74431

Change-Id: Id651ea0b82599ccaff8816af0a56ddbb149b6f89
Reviewed-on: https://go-review.googlesource.com/c/go/+/692015
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: t hepudds <thepudds1460@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2025-08-05 08:28:50 -07:00
Michael Munday
fcc036f03b cmd/compile: optimise float <-> int register moves on riscv64
Use the FMV* instructions to move values between the floating point and
integer register files.

Note: I'm unsure why there is a slowdown in the Float32bits benchmark,
I've checked and an FMVXS instruction is being used as expected. There
are multiple loads and other instructions in the main loop.

goos: linux
goarch: riscv64
pkg: math
cpu: Spacemit(R) X60
                    │ fmv-before.txt │            fmv-after.txt            │
                    │     sec/op     │   sec/op     vs base                │
Acos                     122.7n ± 0%   122.7n ± 0%        ~ (p=1.000 n=10)
Acosh                    197.2n ± 0%   191.5n ± 0%   -2.89% (p=0.000 n=10)
Asin                     122.7n ± 0%   122.7n ± 0%        ~ (p=0.474 n=10)
Asinh                    231.0n ± 0%   224.1n ± 0%   -2.99% (p=0.000 n=10)
Atan                     91.39n ± 0%   91.41n ± 0%        ~ (p=0.465 n=10)
Atanh                    210.3n ± 0%   203.4n ± 0%   -3.26% (p=0.000 n=10)
Atan2                    149.6n ± 0%   149.6n ± 0%        ~ (p=0.721 n=10)
Cbrt                     176.5n ± 0%   165.9n ± 0%   -6.01% (p=0.000 n=10)
Ceil                     25.67n ± 0%   24.42n ± 0%   -4.87% (p=0.000 n=10)
Copysign                 3.756n ± 0%   3.756n ± 0%        ~ (p=0.149 n=10)
Cos                      95.15n ± 0%   95.15n ± 0%        ~ (p=0.374 n=10)
Cosh                     228.6n ± 0%   224.7n ± 0%   -1.71% (p=0.000 n=10)
Erf                      115.2n ± 0%   115.2n ± 0%        ~ (p=0.474 n=10)
Erfc                     116.4n ± 0%   116.4n ± 0%        ~ (p=0.628 n=10)
Erfinv                   133.3n ± 0%   133.3n ± 0%        ~ (p=1.000 n=10)
Erfcinv                  133.3n ± 0%   133.3n ± 0%        ~ (p=1.000 n=10)
Exp                      194.1n ± 0%   190.3n ± 0%   -1.93% (p=0.000 n=10)
ExpGo                    204.7n ± 0%   200.3n ± 0%   -2.15% (p=0.000 n=10)
Expm1                    137.7n ± 0%   135.2n ± 0%   -1.82% (p=0.000 n=10)
Exp2                     173.4n ± 0%   169.0n ± 0%   -2.54% (p=0.000 n=10)
Exp2Go                   182.8n ± 0%   178.4n ± 0%   -2.41% (p=0.000 n=10)
Abs                      3.756n ± 0%   3.756n ± 0%        ~ (p=0.157 n=10)
Dim                      12.52n ± 0%   12.52n ± 0%        ~ (p=0.737 n=10)
Floor                    25.67n ± 0%   24.42n ± 0%   -4.87% (p=0.000 n=10)
Max                      21.29n ± 0%   20.03n ± 0%   -5.92% (p=0.000 n=10)
Min                      21.28n ± 0%   20.04n ± 0%   -5.85% (p=0.000 n=10)
Mod                      344.9n ± 0%   319.2n ± 0%   -7.45% (p=0.000 n=10)
Frexp                    55.71n ± 0%   48.85n ± 0%  -12.30% (p=0.000 n=10)
Gamma                    165.9n ± 0%   167.8n ± 0%   +1.15% (p=0.000 n=10)
Hypot                    73.24n ± 0%   70.74n ± 0%   -3.41% (p=0.000 n=10)
HypotGo                  84.50n ± 0%   82.63n ± 0%   -2.21% (p=0.000 n=10)
Ilogb                    49.45n ± 0%   45.70n ± 0%   -7.59% (p=0.000 n=10)
J0                       556.5n ± 0%   544.0n ± 0%   -2.25% (p=0.000 n=10)
J1                       555.3n ± 0%   542.8n ± 0%   -2.24% (p=0.000 n=10)
Jn                       1.181µ ± 0%   1.156µ ± 0%   -2.12% (p=0.000 n=10)
Ldexp                    59.47n ± 0%   53.84n ± 0%   -9.47% (p=0.000 n=10)
Lgamma                   167.2n ± 0%   154.6n ± 0%   -7.51% (p=0.000 n=10)
Log                      160.9n ± 0%   154.6n ± 0%   -3.92% (p=0.000 n=10)
Logb                     49.45n ± 0%   45.70n ± 0%   -7.58% (p=0.000 n=10)
Log1p                    147.1n ± 0%   137.1n ± 0%   -6.80% (p=0.000 n=10)
Log10                    162.1n ± 1%   154.6n ± 0%   -4.63% (p=0.000 n=10)
Log2                     66.99n ± 0%   60.72n ± 0%   -9.36% (p=0.000 n=10)
Modf                     29.42n ± 0%   26.29n ± 0%  -10.64% (p=0.000 n=10)
Nextafter32              41.95n ± 0%   37.88n ± 0%   -9.70% (p=0.000 n=10)
Nextafter64              38.82n ± 0%   33.49n ± 0%  -13.73% (p=0.000 n=10)
PowInt                   252.3n ± 0%   237.3n ± 0%   -5.95% (p=0.000 n=10)
PowFrac                  615.5n ± 0%   589.7n ± 0%   -4.19% (p=0.000 n=10)
Pow10Pos                 10.64n ± 0%   10.64n ± 0%        ~ (p=1.000 n=10)
Pow10Neg                 24.42n ± 0%   15.02n ± 0%  -38.49% (p=0.000 n=10)
Round                    21.91n ± 0%   18.16n ± 0%  -17.12% (p=0.000 n=10)
RoundToEven              24.42n ± 0%   21.29n ± 0%  -12.84% (p=0.000 n=10)
Remainder                308.0n ± 0%   291.2n ± 0%   -5.44% (p=0.000 n=10)
Signbit                  10.02n ± 0%   10.02n ± 0%        ~ (p=1.000 n=10)
Sin                      102.7n ± 0%   102.7n ± 0%        ~ (p=0.211 n=10)
Sincos                   124.0n ± 1%   123.3n ± 0%   -0.56% (p=0.002 n=10)
Sinh                     239.1n ± 0%   234.7n ± 0%   -1.84% (p=0.000 n=10)
SqrtIndirect             2.504n ± 0%   2.504n ± 0%        ~ (p=0.303 n=10)
SqrtLatency              15.03n ± 0%   15.02n ± 0%        ~ (p=0.598 n=10)
SqrtIndirectLatency      15.02n ± 0%   15.02n ± 0%        ~ (p=0.907 n=10)
SqrtGoLatency            165.3n ± 0%   157.2n ± 0%   -4.90% (p=0.000 n=10)
SqrtPrime                3.801µ ± 0%   3.802µ ± 0%        ~ (p=1.000 n=10)
Tan                      125.2n ± 0%   125.2n ± 0%        ~ (p=0.458 n=10)
Tanh                     244.2n ± 0%   239.9n ± 0%   -1.76% (p=0.000 n=10)
Trunc                    25.67n ± 0%   24.42n ± 0%   -4.87% (p=0.000 n=10)
Y0                       550.2n ± 0%   538.1n ± 0%   -2.21% (p=0.000 n=10)
Y1                       552.8n ± 0%   540.6n ± 0%   -2.21% (p=0.000 n=10)
Yn                       1.168µ ± 0%   1.143µ ± 0%   -2.14% (p=0.000 n=10)
Float64bits              8.139n ± 0%   4.385n ± 0%  -46.13% (p=0.000 n=10)
Float64frombits          7.512n ± 0%   3.759n ± 0%  -49.96% (p=0.000 n=10)
Float32bits              8.138n ± 0%   9.393n ± 0%  +15.42% (p=0.000 n=10)
Float32frombits          7.513n ± 0%   3.757n ± 0%  -49.98% (p=0.000 n=10)
FMA                      3.756n ± 0%   3.756n ± 0%        ~ (p=0.246 n=10)
geomean                  77.43n        72.42n        -6.47%

Change-Id: I8dac69b1d17cb3d2af78d1c844d2b5d80000d667
Reviewed-on: https://go-review.googlesource.com/c/go/+/599235
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Michael Munday <mikemndy@gmail.com>
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>
2025-08-05 08:27:15 -07:00
Cherry Mui
775fb52745 [dev.simd] all: merge master (7a1679d) into dev.simd
Conflicts:

- src/cmd/compile/internal/amd64/ssa.go
- src/cmd/compile/internal/ssa/rewriteAMD64.go
- src/internal/buildcfg/exp.go
- src/internal/cpu/cpu.go
- src/internal/cpu/cpu_x86.go
- src/internal/goexperiment/flags.go

Merge List:

+ 2025-08-04 7a1679d7ae cmd/compile: move s390x over to new bounds check strategy
+ 2025-08-04 95693816a5 cmd/compile: move riscv64 over to new bounds check strategy
+ 2025-08-04 d7bd7773eb go/parser: remove safePos
+ 2025-08-04 4b6cbc377f cmd/cgo/internal/test: use (syntactic) constant for C array bound
+ 2025-08-03 b2960e3580 cmd/internal/obj/loong64: add {V,XV}{BITCLR/BITSET/BITREV}[I].{B/H/W/D} instructions support
+ 2025-08-03 abeeef1c08 cmd/compile/internal/test: fix typo in comments
+ 2025-08-03 d44749b65b cmd/internal/obj/loong64: add [X]VLDREPL.{B/H/W/D} instructions support
+ 2025-08-03 d6beda863e runtime: add reference to debugPinnerV1
+ 2025-08-01 4ab1aec007 cmd/go: modload should use a read-write lock to improve concurrency
+ 2025-08-01 e666972a67 runtime: deduplicate Windows stdcall
+ 2025-08-01 ef40549786 runtime,syscall: move loadlibrary and getprocaddress to syscall
+ 2025-08-01 336931a4ca cmd/go: use os.Rename to move files on Windows
+ 2025-08-01 eef5f8d930 cmd/compile: enforce that locals are always accessed with SP base register
+ 2025-08-01 e071617222 cmd/compile: optimize multiplication rules on loong64
+ 2025-07-31 eb7f515c4d cmd/compile: use generated loops instead of DUFFZERO on amd64
+ 2025-07-31 c0ee2fd4e3 cmd/go: explicitly reject module paths "go" and "toolchain"
+ 2025-07-30 a4d99770c0 runtime/metrics: add cleanup and finalizer queue metrics
+ 2025-07-30 70a2ff7648 runtime: add cgo call benchmark
+ 2025-07-30 69338a335a cmd/go/internal/gover: fix ModIsPrerelease for toolchain versions
+ 2025-07-30 cedf63616a cmd/compile: add floating point min/max intrinsics on s390x
+ 2025-07-30 82a1921c3b all: remove redundant Swiss prefixes
+ 2025-07-30 2ae059ccaf all: remove GOEXPERIMENT=swissmap
+ 2025-07-30 cc571dab91 cmd/compile: deduplicate instructions when rewrite func results
+ 2025-07-30 2174a7936c crypto/tls: use standard chacha20-poly1305 cipher suite names
+ 2025-07-30 8330fb48a6 cmd/compile: move mips32 over to new bounds check strategy
+ 2025-07-30 9f9d7b50e8 cmd/compile: move mips64 over to new bounds check strategy
+ 2025-07-30 5216fd570e cmd/compile: move loong64 over to new bounds check strategy
+ 2025-07-30 89a0af86b8 cmd/compile: allow ops to specify clobbering input registers
+ 2025-07-30 5e94d72158 cmd/compile: simplify zerorange on arm64
+ 2025-07-30 8cd85e602a cmd/compile: check domination of loop return in both controls
+ 2025-07-30 cefaed0de0 reflect: fix noswiss builder
+ 2025-07-30 3aa1b00081 regexp: fix compiling alternate patterns of different fold case literals
+ 2025-07-30 b1e933d955 cmd/compile: avoid extending when already sufficiently masked on loong64
+ 2025-07-29 880ca333d7 cmd/compile: removing log2uint32 function
+ 2025-07-29 1513661dc3 cmd/compile: simplify logX implementations
+ 2025-07-29 bd94ae8903 cmd/compile: use unsigned power-of-two detector for unsigned mod
+ 2025-07-29 f3582fc80e cmd/compile: add unsigned power-of-two detector
+ 2025-07-29 f7d167fe71 internal/abi: move direct/indirect flag from Kind to TFlag
+ 2025-07-29 e0b07dc22e os/exec: fix incorrect expansion of "", "." and ".." in LookPath
+ 2025-07-29 25816d401c internal/goexperiment: delete RangeFunc goexperiment
+ 2025-07-29 7961bf71f8 internal/goexperiment: delete CacheProg goexperiment
+ 2025-07-29 e15a14c4dd sync: remove synchashtriemap GOEXPERIMENT
+ 2025-07-29 7dccd6395c cmd/compile: move arm32 over to new bounds check strategy
+ 2025-07-29 d79405a344 runtime: only deduct assist credit for arenas during GC
+ 2025-07-29 19a086f716 cmd/go/internal/telemetrystats: count goexperiments
+ 2025-07-29 aa95ab8215 image: fix formatting of godoc link
+ 2025-07-29 4c854b7a3e crypto/elliptic: change a variable name that have the same name as keywords
+ 2025-07-28 b10eb1d042 cmd/compile: simplify zerorange on amd64
+ 2025-07-28 f8eae7a3c3 os/user: fix tests to pass on non-english Windows
+ 2025-07-28 0984264471 internal/poll: remove msg field from Windows' poll.operation
+ 2025-07-28 d7b4114346 internal/poll: remove rsan field from Windows' poll.operation
+ 2025-07-28 361b1ab41f internal/poll: remove sa field from Windows' poll.operation
+ 2025-07-28 9b6bd64e46 internal/poll: remove qty and flags fields from Windows' poll.operation
+ 2025-07-28 cd3655a824 internal/runtime/maps: fix spelling errors in comments
+ 2025-07-28 d5dc36af45 runtime: remove openbsd/mips64 related code
+ 2025-07-28 64ba72474d errors: omit redundant nil check in type assertion for Join
+ 2025-07-28 e151db3e06 all: omit unnecessary type conversions
+ 2025-07-28 4569255f8c cmd/compile: cleanup SelectN rules by indexing into args
+ 2025-07-28 94645d2413 cmd/compile: rewrite cmov(x, x, cond) into x
+ 2025-07-28 10c5cf68d4 net/http: add proper panic message
+ 2025-07-28 46b5839231 test/codegen: fix failing condmove wasm tests
+ 2025-07-28 98f301cf68 runtime,syscall: move SyscallX implementations from runtime to syscall
+ 2025-07-28 c7ed3a1c5a internal/runtime/syscall/windows: factor out code from runtime
+ 2025-07-28 e81eac19d3 hash/crc32: fix incorrect checksums with avx512+race
+ 2025-07-25 6fbad4be75 cmd/compile: remove no-longer-necessary call to calculateDepths
+ 2025-07-25 5045fdd8ff cmd/compile: fix containsUnavoidableCall computation
+ 2025-07-25 d28b27cd8e go/types, types2: use nil to represent incomplete explicit aliases
+ 2025-07-25 7b53d8d06e cmd/compile/internal/types2: add loaded state between loader calls and constraint expansion
+ 2025-07-25 374e3be2eb os/user: user random name for the test user account
+ 2025-07-25 1aa154621d runtime: rename scanobject to scanObject
+ 2025-07-25 41b429881a runtime: duplicate scanobject in greentea and non-greentea files
+ 2025-07-25 aeb256e98a cmd/compile: remove unused arg from gorecover
+ 2025-07-25 08376e1a9c runtime: iterate through inlinings when processing recover()
+ 2025-07-25 c76c3abc54 encoding/json: fix truncated Token error regression in goexperiment.jsonv2
+ 2025-07-25 ebdbfccd98 encoding/json/jsontext: preserve buffer capacity in Encoder.Reset
+ 2025-07-25 91c4f0ccd5 reflect: avoid a bounds check in stack-constrained code
+ 2025-07-24 3636ced112 encoding/json: fix extra data regression under goexperiment.jsonv2
+ 2025-07-24 a6eec8bdc7 encoding/json: reduce error text regressions under goexperiment.jsonv2
+ 2025-07-24 0fa88dec1e time: remove redundant uint32 conversion in split
+ 2025-07-24 ada30b8248 internal/buildcfg: add ability to get GORISCV64 variable in GOGOARCH
+ 2025-07-24 6f6c6c5782 cmd/internal/obj: rip out argp adjustment for wrapper frames
+ 2025-07-24 7b50024330 runtime: detect successful recovers differently
+ 2025-07-24 7b9de668bd unicode/utf8: skip ahead during ascii runs in Valid/ValidString
+ 2025-07-24 076eae436e cmd/compile: move amd64 and 386 over to new bounds check strategy
+ 2025-07-24 f703dc5bef cmd/compile: add missing StringLen rule in prove
+ 2025-07-24 394d0bee8d cmd/compile: move arm64 over to new bounds check strategy
+ 2025-07-24 3024785b92 cmd/compile,runtime: remember idx+len for bounds check failure with less code
+ 2025-07-24 741a19ab41 runtime: move bounds check constants to internal/abi
+ 2025-07-24 ce05ad448f cmd/compile: rewrite condselects into doublings and halvings
+ 2025-07-24 fcd28070fe cmd/compile: add opt branchelim to rewrite some CondSelect into math
+ 2025-07-24 f32cf8e4b0 cmd/compile: learn transitive proofs for safe unsigned subs
+ 2025-07-24 d574856482 cmd/compile: learn transitive proofs for safe negative signed adds
+ 2025-07-24 1a72920f09 cmd/compile: learn transitive proofs for safe positive signed adds
+ 2025-07-24 e5f202bb60 cmd/compile: learn transitive proofs for safe unsigned adds
+ 2025-07-24 bd80f74bc1 cmd/compile: fold shift through AND for slice operations
+ 2025-07-24 5c45fe1385 internal/runtime/syscall: rename to internal/runtime/syscall/linux
+ 2025-07-24 592c2db868 cmd/compile: improve loopRotate to handle nested loops
+ 2025-07-24 dcb479c2f9 cmd/compile: optimize slice bounds checking with SUB/SUBconst comparisons
+ 2025-07-24 f11599b0b9 internal/poll: remove handle field from Windows' poll.operation
+ 2025-07-24 f7432e0230 internal/poll: remove fd field from Windows' poll.operation
+ 2025-07-24 e84ed38641 runtime: add benchmark for small-size memmory operation
+ 2025-07-24 18dbe5b941 hash/crc32: add AVX512 IEEE CRC32 calculation
+ 2025-07-24 c641900f72 cmd/compile: prefer base.Fatalf to panic in dwarfgen
+ 2025-07-24 d71d8aeafd cmd/internal/obj/s390x: add MVCLE instruction
+ 2025-07-24 b6cf1d94dc runtime: optimize memclr on mips64x
+ 2025-07-24 a8edd99479 runtime: improvement in memclr for s390x
+ 2025-07-24 bd04f65511 internal/runtime/exithook: fix a typo
+ 2025-07-24 5c8624a396 cmd/internal/goobj: make error output clear
+ 2025-07-24 44d73dfb4e cmd/go/internal/doc: clean up after merge with cmd/internal/doc
+ 2025-07-24 bd446662dd cmd/internal/doc: merge with cmd/go/internal/doc
+ 2025-07-24 da8b50c830 cmd/doc: delete
+ 2025-07-24 6669aa3b14 runtime: randomize heap base address
+ 2025-07-24 26338a7f69 cmd/compile: use better fatal message for staticValue1
+ 2025-07-24 8587ba272e cmd/cgo: compare malloc return value to NULL instead of literal 0
+ 2025-07-24 cae45167b7 go/types, types2: better error messages for certain type mismatches
+ 2025-07-24 2ddf542e4c cmd/compile: use ,ok return idiom for sparsemap.get
+ 2025-07-24 6505fcbd0a cmd/compile: use generics for sparse map
+ 2025-07-24 14f5eb7812 cmd/api: rerun updategolden
+ 2025-07-24 52b6d7f67a runtime: drop NetBSD kernel bug sysmon workaround fixed in NetBSD 9.2
+ 2025-07-24 1ebebf1cc1 cmd/go: clean should respect workspaces
+ 2025-07-24 6536a93547 encoding/json/jsontext: preserve buffer capacity in Decoder.Reset
+ 2025-07-24 efc37e97c0 cmd/go: always return the cached path from go tool -n
+ 2025-07-23 98a031193b runtime: check TestUsingVDSO ExitError type assertion
+ 2025-07-23 6bb42997c8 doc/next: initialize
+ 2025-07-23 2696a11a97 internal/goversion: update Version to 1.26
+ 2025-07-23 489868f776 cmd/link: scope test to linux & net.sendFile
+ 2025-07-22 71c2bf5513 cmd/compile: fix loclist for heap return vars without optimizations
+ 2025-07-22 c74399e7f5 net: correct comment for ListenConfig.ListenPacket
+ 2025-07-22 4ed9943b26 all: go fmt
+ 2025-07-22 1aaf7422f1 cmd/internal/objabi: remove redundant word in comment
+ 2025-07-21 d5ec0815e6 runtime: relax TestMemoryLimitNoGCPercent a bit
+ 2025-07-21 f7cc61e7d7 cmd/compile: for arm64 epilog, do SP increment with a single instruction
+ 2025-07-21 5dac42363b runtime: fix asan wrapper for riscv64
+ 2025-07-21 e5502e0959 cmd/go: check subcommand properties
+ 2025-07-19 2363897932 cmd/internal/obj: enable got pcrel itype in fips140 for riscv64
+ 2025-07-19 e32255fcc0 cmd/compile/internal/ssa: restrict architectures for TestDebugLines_74576
+ 2025-07-18 0451816430 os: revert the use of AddCleanup to close files and roots
+ 2025-07-18 34b70684ba go/types: infer correct type for y in append(bytes, y...)
+ 2025-07-17 66536242fc cmd/compile/internal/escape: improve DWARF .debug_line numbering for literal rewriting optimizations
+ 2025-07-16 385000b004 runtime: fix idle time double-counting bug
+ 2025-07-16 f506ad2644 cmd/compile/internal/escape: speed up analyzing some functions with many closures
+ 2025-07-16 9c507e7942 cmd/link, runtime: on Wasm, put only function index in method table and func table
+ 2025-07-16 9782dcfd16 runtime: use 32-bit function index on Wasm
+ 2025-07-16 c876bf9346 cmd/internal/obj/wasm: use 64-bit instructions for indirect calls
+ 2025-07-15 b4309ece66 cmd/internal/doc: upgrade godoc pkgsite to 01b046e
+ 2025-07-15 75a19dbcd7 runtime: use memclrNoHeapPointers to clear inline mark bits
+ 2025-07-15 6d4a91c7a5 runtime: only clear inline mark bits on span alloc if necessary
+ 2025-07-15 0c6296ab12 runtime: have mergeInlineMarkBits also clear the inline mark bits
+ 2025-07-15 397d2117ec runtime: merge inline mark bits with gcmarkBits 8 bytes at a time
+ 2025-07-15 7dceabd3be runtime/maps: fix typo in group.go comment (instrinsified -> intrinsified)
+ 2025-07-15 d826bf4d74 os: remove useless error check
+ 2025-07-14 bb07e55aff runtime: expand GOMAXPROCS documentation
+ 2025-07-14 9159cd4ec6 encoding/json: decompose legacy options
+ 2025-07-14 c6556b8eb3 encoding/json/v2: add security section to doc
+ 2025-07-11 6ebb5f56d9 runtime: gofmt after CL 643897 and CL 662455
+ 2025-07-11 1e48ca7020 encoding/json: remove legacy option to EscapeInvalidUTF8
+ 2025-07-11 a0a99cb22b encoding/json/v2: report wrapped io.ErrUnexpectedEOF
+ 2025-07-11 9d04122d24 crypto/rsa: drop contradictory promise to keep PublicKey modulus secret
+ 2025-07-11 1ca23682dd crypto/rsa: fix documentation formatting
+ 2025-07-11 4bc3373c8e runtime: turn off large memmove tests under asan/msan

Change-Id: I1e32d964eba770b85421efb86b305a2242f24466
2025-08-04 15:07:05 -04:00
David Chase
6b9b59e144 [dev.simd] simd, cmd/compile: rename some methods
generated by simdgen CL 692556

these are the "easy" ones
SaturatedOp -> OpSaturated
PairwiseOp -> OpPairs
OpWithPrecision -> OpScaled
DiffWithOpWithPrecision -> OpScaledResidue

Change-Id: I036bf89c0690bcf9922c376d62cef48392942af3
Reviewed-on: https://go-review.googlesource.com/c/go/+/692357
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-04 11:53:11 -07:00
David Chase
d375b95357 [dev.simd] simd: move lots of slice functions and methods to generated code
Lots of handwritten/stenciled code is now untouched by human hands

For certain combinations of operation-arity and type, there
is an option to use a flaky version of a test helper, that only
requires "close enough".  For example:

testFloat32x4TernaryFlaky(t, simd.Float32x4.FusedMultiplyAdd, fmaSlice[float32], 0.001)

Some of the quirkier operations have their behavior captured
in their test-simulation, for example, ceilResidue regards
infinities as integers (therefore their residue is zero).

Change-Id: I8242914e5ab399edbe226da8586988441cffa83f
Reviewed-on: https://go-review.googlesource.com/c/go/+/690575
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-08-04 11:52:48 -07:00
Junyang Shao
3f92aa1eca [dev.simd] cmd/compile, simd: make bitwise logic ops available to all u?int vectors
This CL is generated by CL 692555.

Change-Id: I24e6de83e0408576f385a1c8e861b08c583f9098
Reviewed-on: https://go-review.googlesource.com/c/go/+/692356
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-04 11:23:40 -07:00
Keith Randall
7a1679d7ae cmd/compile: move s390x over to new bounds check strategy
Change-Id: I86ed1a60165b729bb88a8a418da0ea1b59b3dc10
Reviewed-on: https://go-review.googlesource.com/c/go/+/682499
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Michael Munday <mikemndy@gmail.com>
Reviewed-by: Mark Freeman <mark@golang.org>
2025-08-04 10:08:22 -07:00
Keith Randall
95693816a5 cmd/compile: move riscv64 over to new bounds check strategy
Change-Id: Idd9eaf051aa57f7fef7049c12085926030c35d70
Reviewed-on: https://go-review.googlesource.com/c/go/+/682401
Reviewed-by: Mark Freeman <mark@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Joel Sing <joel@sing.id.au>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-04 10:08:13 -07:00
Junyang Shao
c2d775d401 [dev.simd] cmd/compile, simd: change PairDotProdAccumulate to AddDotProd
This CL is generated by CL 692219.

Change-Id: I50fa919f1edc5c6505bc6d3238f65b37fc7628b5
Reviewed-on: https://go-review.googlesource.com/c/go/+/692156
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-08-04 09:52:09 -07:00
Junyang Shao
2c25f3e846 [dev.simd] cmd/compile, simd: change Shift*AndFillUpperFrom to Shift*Concat
This CL is generated by CL 692216.

Change-Id: Ib7530142bcce2a23f90d48866271994c57561955
Reviewed-on: https://go-review.googlesource.com/c/go/+/692215
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-04 09:52:05 -07:00
Mateusz Poliwczak
d7bd7773eb go/parser: remove safePos
The logic in safePos is wrong, since (*token.File).Offset does not panic,
so this function was basically a noop (since CL 559436).

To work properly it would have to be:

return p.file.Pos(p.file.Offset(pos))

Since it effectively acts as a no-op and hasn't been noticed since,
let's go ahead and remove it.

Change-Id: I00a1bcc5af6a996c63de3f1175c15062e85cf89b
Reviewed-on: https://go-review.googlesource.com/c/go/+/692955
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Commit-Queue: Alan Donovan <adonovan@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2025-08-04 09:33:59 -07:00
Cherry Mui
4b6cbc377f cmd/cgo/internal/test: use (syntactic) constant for C array bound
A test in C has an array bound defined as a "const int", which is
technically a variable. The new version of C compiler in Xcode 26
beta emits a warning "variable length array folded to constant
array as an extension" for this (as an error since we build the
test with -Werror). Work around this by using an enum, which is
syntactically a constant.

Change-Id: Icfa943f293f6eac8f41d0615da40c126330d7d11
Reviewed-on: https://go-review.googlesource.com/c/go/+/692877
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-08-04 09:11:25 -07:00
Xiaolin Zhao
b2960e3580 cmd/internal/obj/loong64: add {V,XV}{BITCLR/BITSET/BITREV}[I].{B/H/W/D} instructions support
Go asm syntax:
	 V{BITCLR/BITSET/BITREV}{B/H/W/V}	$1, V2, V3
	XV{BITCLR/BITSET/BITREV}{B/H/W/V}	$1, X2, X3
	 V{BITCLR/BITSET/BITREV}{B/H/W/V}	VK, VJ, VD
	XV{BITCLR/BITSET/BITREV}{B/H/W/V}	XK, XJ, XD

Equivalent platform assembler syntax:
	 v{bitclr/bitset/bitrev}i.{b/h/w/d}	v3, v2, $1
	xv{bitclr/bitset/bitrev}i.{b/h/w/d}	x3, x2, $1
	 v{bitclr/bitset/bitrev}.{b/h/w/d}	vd, vj, vk
	xv{bitclr/bitset/bitrev}.{b/h/w/d}	xd, xj, xk

Change-Id: I244f8ae316f72cc7ea01ca0139ac78c5616a3c5b
Reviewed-on: https://go-review.googlesource.com/c/go/+/677435
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Mark Freeman <mark@golang.org>
2025-08-03 18:26:56 -07:00
Xiaolin Zhao
abeeef1c08 cmd/compile/internal/test: fix typo in comments
Change-Id: Iba6bb7f8252120f56d7e6ae49c9edc9382e8c7e0
Reviewed-on: https://go-review.googlesource.com/c/go/+/679855
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <mark@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-08-03 18:25:35 -07:00
Xiaolin Zhao
d44749b65b cmd/internal/obj/loong64: add [X]VLDREPL.{B/H/W/D} instructions support
Go asm syntax:
	 VMOVQ	offset(Rj), Vd.<T>
	XVMOVQ	offset(Rj), Xd.<T>

<T> can have the following values:
B16, H8, W4, V2, B32, H16, W8, V4

Change-Id: I44af51d58bb62649d3fe360b3abb771565e78a8a
Reviewed-on: https://go-review.googlesource.com/c/go/+/682895
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <mark@golang.org>
2025-08-03 18:25:27 -07:00
limeidan
d6beda863e runtime: add reference to debugPinnerV1
This is intended to be used by debuggers, to keep heap memory reachable
even if it isn't referenced from anywhere else.

Change-Id: I1e900e02b4fe3a188f8173cec70f8de32122489b
Reviewed-on: https://go-review.googlesource.com/c/go/+/682875
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Mark Freeman <mark@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-03 18:25:12 -07:00
David Chase
c25e5c86b2 [dev.simd] cmd/compile: generated code for K-mask-register slice load/stores
plus slice-part load, store and test for a single type.

Generated by arch/internal/simdgen CL 690315

Change-Id: I58052728b544c4a772a2870ac68f3c832813e1ea
Reviewed-on: https://go-review.googlesource.com/c/go/+/690336
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-08-01 14:27:47 -07:00
David Chase
1ac5f3533f [dev.simd] cmd/compile: opcodes and rules and code generation to enable AVX512 masked loads/stores
Change-Id: I9e05fc5031420f60a2e6bac7b9f86365f0f4c0f1
Reviewed-on: https://go-review.googlesource.com/c/go/+/690335
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-08-01 14:26:37 -07:00
David Chase
f39711a03d [dev.simd] cmd/compile: test for int-to-mask conversion
Change-Id: If341cb2c25dc535cdebe6f539db3cab8917d5afe
Reviewed-on: https://go-review.googlesource.com/c/go/+/689937
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-01 14:26:25 -07:00
David Chase
08bec02907 [dev.simd] cmd/compile: add register-to-mask moves, other simd glue
This includes code generated by simdgen CL 689955,
here because of git-facilitated pilot error
(the generated file should have been in the next CL
but that is related to this one, so, oh well).

Change-Id: Ibfea3f1cd93ca9cd12970edf15a013471677a6ba
Reviewed-on: https://go-review.googlesource.com/c/go/+/689936
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-01 14:26:11 -07:00
David Chase
09ff25e350 [dev.simd] simd: add tests for simd conversions to Int32/Uint32.
Change-Id: I71a6c6708e19d210f1fbdc72379f8215356ff02e
Reviewed-on: https://go-review.googlesource.com/c/go/+/689718
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-01 14:14:59 -07:00
David Chase
a24ffe3379 [dev.simd] simd: modify test generation to make it more flexible
This is to support conversions, which are not T -> T.

Change-Id: I323887b116eee8133770a899ed82363bba38a9c4
Reviewed-on: https://go-review.googlesource.com/c/go/+/689717
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-01 14:14:47 -07:00
David Chase
ec5c20ba5a [dev.simd] cmd/compile: generated simd code to add some conversions
Generated by arch/internal/simdgen CL 689735

A small number of conversions for testing purposes

Change-Id: I4d52c643d08c02794c3fea9778bb1ecbb5507de4
Reviewed-on: https://go-review.googlesource.com/c/go/+/689716
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-01 14:14:27 -07:00
David Chase
e62e377ed6 [dev.simd] cmd/compile, simd: generated code from repaired simdgen sort
generated by simdgen CL 689655
(which names a different CL, because it was submitted before realizing
that git had lost a from a stack, somehow)

Change-Id: Iab2868e848c221de98995ba0c632f97e2ee97670
Reviewed-on: https://go-review.googlesource.com/c/go/+/692336
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-01 14:12:56 -07:00
David Chase
761894d4a5 [dev.simd] simd: add partial slice load/store for 32/64-bits on AVX2
These all use int-vector-masked loads and stores.
Partial set of tests (for all NxK shapes, thought not all types).

Change-Id: I8f493aaa9228647e08ea5badb06dcfe716d6925d
Reviewed-on: https://go-review.googlesource.com/c/go/+/689336
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-08-01 13:11:10 -07:00
David Chase
acc1492b7d [dev.simd] cmd/compile: Generated code for AVX2 SIMD masked load/store
This adds to the change in the earlier dev.simd CL.
Generated by arch/internal/simdgen CL 689276 .

Also includes one test for "it at least works once".

Change-Id: I44a268cfc3bea06c5522ac2cfa04fe13a833e1dd
Reviewed-on: https://go-review.googlesource.com/c/go/+/689335
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-01 13:09:29 -07:00
David Chase
a0b87a7478 [dev.simd] cmd/compile: changes for AVX2 SIMD masked load/store
This is "glue" changes and hand work for the AVX2
masked loads/stores.  Does not include generated
function/method declarations or intrinsic registration.

Change-Id: Ic95f90b117d0c471f174407ce3f729f1f517b23c
Reviewed-on: https://go-review.googlesource.com/c/go/+/689295
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-01 13:08:54 -07:00
David Chase
88568519b4 [dev.simd] simd: move test generation into Go repo
This pairs with CL 689275 which removes test generation from simdgen

This uses generics and attempts to encode the tests as compactly as
possible.

Some files, *_helpers_test.go, are generated.

Use t.Helper() to get the line number right for a failure.

Adds helper error return values and early exits to only report a
single test failure per operations and vector shape, for the
generated test failures.

Include the entire got and wanted vectors for that failure.

Provide an option to include the input vectors to failures, also
report the type of the test.

Sample failure test output (obtained by intentionally breaking
the "want" value for AndNot):

=== RUN   TestAndNot
    binary_test.go:214: For int16 vector elements:
    binary_test.go:214: got =[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
    binary_test.go:214: want=[-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1]
    binary_test.go:214: x=[1 -1 0 2 4 8 1024 3 5 7 11 13 3000 5555 7777 11111]
    binary_test.go:214: y=[1 -1 0 2 4 8 1024 3 5 7 11 13 3000 5555 7777 11111]
    binary_test.go:214: at index 0, got=0, want=-1
    binary_test.go:215: For int16 vector elements:
    binary_test.go:215: got =[0 0 0 0 0 0 0 0]
    binary_test.go:215: want=[-1 -1 -1 -1 -1 -1 -1 -1]
    binary_test.go:215: x=[1 -1 0 2 4 8 1024 3]
    binary_test.go:215: y=[1 -1 0 2 4 8 1024 3]
    binary_test.go:215: at index 0, got=0, want=-1
    binary_test.go:216: For int32 vector elements:
    binary_test.go:216: got =[0 0 0 0]
    binary_test.go:216: want=[-1 -1 -1 -1]
    binary_test.go:216: x=[1 -1 0 2]
    binary_test.go:216: y=[1 -1 0 2]
    binary_test.go:216: at index 0, got=0, want=-1
(etc)

Change-Id: I0f6ee8390ebe7a2333002e9415b4d71527fa3c38
Reviewed-on: https://go-review.googlesource.com/c/go/+/686057
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>
2025-08-01 13:08:31 -07:00
Roy Reznik
4ab1aec007 cmd/go: modload should use a read-write lock to improve concurrency
This PR will be imported into Gerrit with the title and first
comment (this text) used to generate the subject and body of
the Gerrit change.

Change-Id: I3f9bc8a2459059a924a04fa02794e258957819b5
GitHub-Last-Rev: 6ad6f6a70e
GitHub-Pull-Request: golang/go#74311
Reviewed-on: https://go-review.googlesource.com/c/go/+/683215
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Ian Alexander <jitsu@google.com>
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-01 11:56:27 -07:00
qmuntal
e666972a67 runtime: deduplicate Windows stdcall
There is no need to have a dedicated stdcall variant for each
number of arguments. Instead, we can use a variadic function
that accepts any number of arguments and handles them uniformly.

While here, improve documentation of syscall_syscalln to make it clear
that it should not be used within the runtime package.

Change-Id: I022afc7f28d969fd7307bb2b1f4594246ac38d18
Reviewed-on: https://go-review.googlesource.com/c/go/+/691215
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Mark Freeman <mark@golang.org>
2025-08-01 09:05:13 -07:00
qmuntal
ef40549786 runtime,syscall: move loadlibrary and getprocaddress to syscall
There is no need for loadlibrary, loadsystemlibrary and getprocaddress
to be implemented in the runtime and linknamed from syscall.

Change-Id: Icefd53a8e8f7012ed0c94c356be4179d5e45a01b
Reviewed-on: https://go-review.googlesource.com/c/go/+/690516
Reviewed-by: Mark Freeman <mark@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-01 09:05:06 -07:00
qmuntal
336931a4ca cmd/go: use os.Rename to move files on Windows
The Go toolchain has been copying files instead of moving them on
Windows since CL 72910. It did this because os.Rename doesn't respect
the destination directory ACL permissions, and we want to honor them.

The drawback is that copying files is slower than moving them.

This CL reintroduces the use of os.Rename, but it also sets the
destination file's ACL to inherit the permissions from the
destination directory.

On my computer this change speeds up a simple "go build" (with warm
cache) by 1 second, going from 3 seconds to 2 seconds.

Updates #22343

Change-Id: I65b2b6f301e9e18bf2588959764eb06b9a01dfa2
Reviewed-on: https://go-review.googlesource.com/c/go/+/691255
Reviewed-by: Mark Freeman <mark@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2025-08-01 09:04:50 -07:00
Keith Randall
eef5f8d930 cmd/compile: enforce that locals are always accessed with SP base register
After CL 678937, we could have a situation where the value of the
stack pointer is in both SP and another register. We need to make sure
that regalloc picks SP when issuing a reference to local variables;
the assembler expects that.

Fixes #74836

Change-Id: I2ac73ece6eb44b4a78c1369f8a69e51ab9748754
Reviewed-on: https://go-review.googlesource.com/c/go/+/692395
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Mark Freeman <mark@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-01 08:57:29 -07:00
Xiaolin Zhao
e071617222 cmd/compile: optimize multiplication rules on loong64
Improve multiplication strength reduction, refer to CL 626998,
add additional 3 linear combination instructions for loong64.

goos: linux
goarch: loong64
pkg: cmd/compile/internal/test
cpu: Loongson-3A6000-HV @ 2500.00MHz
                  |  bench.old   |              bench.new               |
                  |    sec/op    |    sec/op     vs base                |
MulconstI32/3       1.6010n ± 0%   0.8005n ± 0%  -50.00% (p=0.000 n=10)
MulconstI32/5       1.6010n ± 0%   0.8005n ± 0%  -50.00% (p=0.000 n=10)
MulconstI32/12       1.601n ± 0%    1.201n ± 0%  -24.98% (p=0.000 n=10)
MulconstI32/120     1.6010n ± 0%   0.8130n ± 0%  -49.22% (p=0.000 n=10)
MulconstI32/-120    1.6010n ± 0%   0.8109n ± 0%  -49.35% (p=0.000 n=10)
MulconstI32/65537   1.6275n ± 0%   0.8005n ± 0%  -50.81% (p=0.000 n=10)
MulconstI32/65538   1.6290n ± 0%   0.8004n ± 0%  -50.87% (p=0.000 n=10)
MulconstI64/3       1.6010n ± 0%   0.8004n ± 0%  -50.01% (p=0.000 n=10)
MulconstI64/5       1.6010n ± 0%   0.8004n ± 0%  -50.01% (p=0.000 n=10)
MulconstI64/12       1.601n ± 0%    1.201n ± 0%  -24.98% (p=0.000 n=10)
MulconstI64/120     1.6010n ± 0%   0.8005n ± 0%  -50.00% (p=0.000 n=10)
MulconstI64/-120    1.6010n ± 0%   0.8005n ± 0%  -50.00% (p=0.000 n=10)
MulconstI64/65537   1.6270n ± 0%   0.8005n ± 0%  -50.80% (p=0.000 n=10)
MulconstI64/65538   1.6290n ± 0%   0.8071n ± 1%  -50.45% (p=0.000 n=10)
MulconstU32/3       1.6010n ± 0%   0.8004n ± 0%  -50.01% (p=0.000 n=10)
MulconstU32/5       1.6010n ± 0%   0.8004n ± 0%  -50.01% (p=0.000 n=10)
MulconstU32/12       1.601n ± 0%    1.201n ± 0%  -24.98% (p=0.000 n=10)
MulconstU32/120     1.6010n ± 0%   0.8066n ± 0%  -49.62% (p=0.000 n=10)
MulconstU32/65537   1.6290n ± 0%   0.8005n ± 0%  -50.86% (p=0.000 n=10)
MulconstU32/65538   1.6280n ± 0%   0.8005n ± 0%  -50.83% (p=0.000 n=10)
MulconstU64/3       1.6010n ± 0%   0.8005n ± 0%  -50.00% (p=0.000 n=10)
MulconstU64/5       1.6010n ± 0%   0.8005n ± 0%  -50.00% (p=0.000 n=10)
MulconstU64/12       1.601n ± 0%    1.201n ± 0%  -24.98% (p=0.000 n=10)
MulconstU64/120     1.6010n ± 0%   0.8005n ± 0%  -50.00% (p=0.000 n=10)
MulconstU64/65537   1.6290n ± 0%   0.8005n ± 0%  -50.86% (p=0.000 n=10)
MulconstU64/65538   1.6300n ± 0%   0.8067n ± 0%  -50.51% (p=0.000 n=10)
geomean              1.609n        0.8537n       -46.95%

goos: linux
goarch: loong64
pkg: cmd/compile/internal/test
cpu: Loongson-3A5000 @ 2500.00MHz
                  |  bench.old   |              bench.new               |
                  |    sec/op    |    sec/op     vs base                |
MulconstI32/3       1.6010n ± 0%   0.8007n ± 0%  -49.99% (p=0.000 n=10)
MulconstI32/5       1.6010n ± 0%   0.8007n ± 0%  -49.99% (p=0.000 n=10)
MulconstI32/12       1.601n ± 0%    1.202n ± 0%  -24.92% (p=0.000 n=10)
MulconstI32/120     1.6020n ± 0%   0.8012n ± 0%  -49.99% (p=0.000 n=10)
MulconstI32/-120    1.6010n ± 0%   0.8007n ± 0%  -49.99% (p=0.000 n=10)
MulconstI32/65537   1.6020n ± 0%   0.8007n ± 0%  -50.02% (p=0.000 n=10)
MulconstI32/65538   1.6010n ± 0%   0.8007n ± 0%  -49.99% (p=0.000 n=10)
MulconstI64/3       1.6015n ± 0%   0.8007n ± 0%  -50.00% (p=0.000 n=10)
MulconstI64/5       1.6020n ± 0%   0.8007n ± 0%  -50.02% (p=0.000 n=10)
MulconstI64/12       1.602n ± 0%    1.202n ± 0%  -25.00% (p=0.000 n=10)
MulconstI64/120     1.6030n ± 0%   0.8011n ± 0%  -50.02% (p=0.000 n=10)
MulconstI64/-120    1.6020n ± 0%   0.8007n ± 0%  -50.02% (p=0.000 n=10)
MulconstI64/65537   1.6010n ± 0%   0.8007n ± 0%  -49.99% (p=0.000 n=10)
MulconstI64/65538   1.6010n ± 0%   0.8007n ± 0%  -49.99% (p=0.000 n=10)
MulconstU32/3       1.6010n ± 0%   0.8006n ± 0%  -49.99% (p=0.000 n=10)
MulconstU32/5       1.6010n ± 0%   0.8007n ± 0%  -49.99% (p=0.000 n=10)
MulconstU32/12       1.601n ± 0%    1.202n ± 0%  -24.92% (p=0.000 n=10)
MulconstU32/120     1.6010n ± 0%   0.8006n ± 0%  -49.99% (p=0.000 n=10)
MulconstU32/65537   1.6010n ± 0%   0.8007n ± 0%  -49.99% (p=0.000 n=10)
MulconstU32/65538   1.6020n ± 0%   0.8009n ± 0%  -50.01% (p=0.000 n=10)
MulconstU64/3       1.6010n ± 0%   0.8007n ± 0%  -49.99% (p=0.000 n=10)
MulconstU64/5       1.6010n ± 0%   0.8007n ± 0%  -49.98% (p=0.000 n=10)
MulconstU64/12       1.601n ± 0%    1.201n ± 0%  -24.98% (p=0.000 n=10)
MulconstU64/120     1.6020n ± 0%   0.8007n ± 0%  -50.02% (p=0.000 n=10)
MulconstU64/65537   1.6010n ± 0%   0.8007n ± 0%  -49.99% (p=0.000 n=10)
MulconstU64/65538   1.6010n ± 0%   0.8007n ± 0%  -49.99% (p=0.000 n=10)
geomean              1.601n        0.8523n       -46.77%

Change-Id: I9fb0e47ca57875da171a347bf4828adfab41b875
Reviewed-on: https://go-review.googlesource.com/c/go/+/675455
Reviewed-by: Mark Freeman <mark@golang.org>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Keith Randall <khr@golang.org>
2025-08-01 08:42:40 -07:00
Keith Randall
eb7f515c4d cmd/compile: use generated loops instead of DUFFZERO on amd64
goarch: amd64
cpu: 12th Gen Intel(R) Core(TM) i7-12700
                        │     base      │                 exp                 │
                        │    sec/op     │   sec/op     vs base                │
MemclrKnownSize112-20      1.270n ± 14%   1.006n ± 0%  -20.72% (p=0.000 n=10)
MemclrKnownSize128-20      1.266n ±  0%   1.005n ± 0%  -20.58% (p=0.000 n=10)
MemclrKnownSize192-20      1.771n ±  0%   1.579n ± 1%  -10.84% (p=0.000 n=10)
MemclrKnownSize248-20      4.034n ±  0%   3.520n ± 0%  -12.75% (p=0.000 n=10)
MemclrKnownSize256-20      2.269n ±  0%   2.014n ± 0%  -11.26% (p=0.000 n=10)
MemclrKnownSize512-20      4.280n ±  0%   4.030n ± 0%   -5.84% (p=0.000 n=10)
MemclrKnownSize1024-20     8.309n ±  1%   8.057n ± 0%   -3.03% (p=0.000 n=10)

Change-Id: I8f1627e2a1e981ff351dc7178932b32a2627f765
Reviewed-on: https://go-review.googlesource.com/c/go/+/678937
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-07-31 17:12:39 -07:00
Junyang Shao
6f7a1164e7 [dev.simd] cmd/compile, simd: support store to bits for mask
This CL is partially generated by CL 689775.

Change-Id: I0c36fd2a44706c88db1a1d5ea4a6d0b9f891d85f
Reviewed-on: https://go-review.googlesource.com/c/go/+/689795
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-07-31 15:44:39 -07:00
Michael Matloob
c0ee2fd4e3 cmd/go: explicitly reject module paths "go" and "toolchain"
The module paths "go" and "toolchain" are reserved for the dependency on
the go and toolchain versions. Check for those paths in go mod init to
create modules, go mod edit, and in the module loader and return an
error when attempting to use those paths for a work module. Trying to
init or load a work module with a go.mod that specifies the module path
"go" panics since Go 1.21 (when the toolchain switching logic and the
implicit dependencies on the "go" module was introduced), and this
change returns a proper error instead of panicking.

Fixes #74784

Change-Id: I10e712f8fddbea63edaeb37e14c6d783722e623f
Reviewed-on: https://go-review.googlesource.com/c/go/+/691515
Reviewed-by: Ian Alexander <jitsu@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@google.com>
2025-07-31 11:00:08 -07:00
Michael Anthony Knyszek
a4d99770c0 runtime/metrics: add cleanup and finalizer queue metrics
These metrics are useful for identifying finalizer and cleanup problems,
namely slow finalizers and/or cleanups holding up the queue, which can
lead to a memory leak.

Fixes #72948.

Change-Id: I1bb64a9ca751fcb462c96d986d0346e0c2894c95
Reviewed-on: https://go-review.googlesource.com/c/go/+/690396
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
2025-07-30 14:00:16 -07:00
Michael Anthony Knyszek
70a2ff7648 runtime: add cgo call benchmark
Change-Id: I12d2ae7dd6a33ecb7110b7d090871e7143fd609f
Reviewed-on: https://go-review.googlesource.com/c/go/+/646196
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>
2025-07-30 13:37:28 -07:00
Michael Matloob
69338a335a cmd/go/internal/gover: fix ModIsPrerelease for toolchain versions
We forgot to call the IsPrerelease function on FromToolchain(vers)
rather than on vers itself. IsPrerelase expects a version without the
"go" prefix. See the corresponding code in ModIsValid and ModIsPrefix
that call FromToolchain before passing the versions to IsValid and
IsLang respectively.

Fixes #74786

Change-Id: I3cf055e1348e6a9dc0334e414f06fe85eaf78024
Reviewed-on: https://go-review.googlesource.com/c/go/+/691655
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-07-30 13:18:24 -07:00
Michael Munday
cedf63616a cmd/compile: add floating point min/max intrinsics on s390x
Add the VECTOR FP (MINIMUM|MAXIMUM) instructions to the assembler and
use them in the compiler to implement min and max.

Note: I've allowed floating point registers to be used with the single
element instructions (those with the W instead of V prefix) to allow
easier integration into the compiler.

Change-Id: I5f80a510bd248cf483cce95f1979bf63fbae7de6
Reviewed-on: https://go-review.googlesource.com/c/go/+/684715
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <mark@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
2025-07-30 12:29:15 -07:00
Michael Pratt
82a1921c3b all: remove redundant Swiss prefixes
Now that there is only one map implementation we can simplify names.

For #54766.

Change-Id: I6a6a636cc6a8fc5e7712c27782fc0ced7467b939
Reviewed-on: https://go-review.googlesource.com/c/go/+/691596
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-07-30 11:47:17 -07:00
Michael Pratt
2ae059ccaf all: remove GOEXPERIMENT=swissmap
For #54766.

Change-Id: I6a6a636c40b5fe2e8b0d4a5e23933492bc8bb76e
Reviewed-on: https://go-review.googlesource.com/c/go/+/691595
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
2025-07-30 11:47:14 -07:00
Youlin Feng
cc571dab91 cmd/compile: deduplicate instructions when rewrite func results
After CL 628075, do not rely on the memory arg of an OpLocalAddr.

Fixes #74788

Change-Id: I4e893241e3949bb8f2d93c8b88cc102e155b725d
Reviewed-on: https://go-review.googlesource.com/c/go/+/691275
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Mark Freeman <mark@golang.org>
2025-07-30 09:38:10 -07:00
qmuntal
2174a7936c crypto/tls: use standard chacha20-poly1305 cipher suite names
The different chacha20-poly1305 cipher suites were renamed to
include the _SHA256 suffix, which is the canonical naming convention.

The occurrences of the old names were still not updated, which can lead
to confusion when searching for the canonical names in the codebase.

Change-Id: I4f90e9cbedc3552c3481c8b0c616b6f915ddd345
Reviewed-on: https://go-review.googlesource.com/c/go/+/689135
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-07-30 08:48:20 -07:00
Keith Randall
8330fb48a6 cmd/compile: move mips32 over to new bounds check strategy
Change-Id: Ied54ea7bf68c4c943c621ca059aca1048903c041
Reviewed-on: https://go-review.googlesource.com/c/go/+/682497
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Julian Zhu <jz531210@gmail.com>
Reviewed-by: Mark Freeman <mark@golang.org>
2025-07-30 08:33:08 -07:00
Keith Randall
9f9d7b50e8 cmd/compile: move mips64 over to new bounds check strategy
Change-Id: I936f6fdcc24d628f38482d32803ad2ae994ec1ad
Reviewed-on: https://go-review.googlesource.com/c/go/+/682400
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Julian Zhu <jz531210@gmail.com>
Reviewed-by: Mark Freeman <mark@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
2025-07-30 08:33:02 -07:00
Keith Randall
5216fd570e cmd/compile: move loong64 over to new bounds check strategy
Change-Id: I5dec33d10d16a5d5c0dc7231cd1f764a6d1d7598
Reviewed-on: https://go-review.googlesource.com/c/go/+/682399
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn>
2025-07-30 08:32:54 -07:00
khr@golang.org
89a0af86b8 cmd/compile: allow ops to specify clobbering input registers
Same as clobbering fixed registers, but which register is clobbered
depends on which register was assigned to the input.

Add code similar to resultInArg0 processing that makes a register
copy before allowing the op to clobber the last available copy of a value.

(Will be used by subsequent CLs in this stack.)

Change-Id: I6bad88b2cb9ac3303d960ff0fb1611727292cfc4
Reviewed-on: https://go-review.googlesource.com/c/go/+/680335
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Mark Freeman <mark@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-07-30 07:37:25 -07:00
Keith Randall
5e94d72158 cmd/compile: simplify zerorange on arm64
Get rid of large zeroing cases. We only use this code
for small things now.

Change-Id: Iba0a98785c5b4b72cf031763edb69ff741ca41af
Reviewed-on: https://go-review.googlesource.com/c/go/+/678936
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <mark@golang.org>
2025-07-30 07:37:20 -07:00
Jorropo
8cd85e602a cmd/compile: check domination of loop return in both controls
Fixes #74473

Change-Id: I72ff6b95955ae9407271508aa80f230dcf1b6c74
Reviewed-on: https://go-review.googlesource.com/c/go/+/685816
Reviewed-by: Mark Freeman <mark@golang.org>
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2025-07-30 07:31:18 -07:00
Keith Randall
cefaed0de0 reflect: fix noswiss builder
Missed this change in CL 681936

Fixes #74808

Change-Id: I30f6402177c5f8efe9bd11d50fad1770a22762c5
Reviewed-on: https://go-review.googlesource.com/c/go/+/691675
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Mark Freeman <mark@golang.org>
Auto-Submit: Keith Randall <khr@google.com>
2025-07-30 07:28:41 -07:00
itchyny
3aa1b00081 regexp: fix compiling alternate patterns of different fold case literals
Fixing Equal method in regexp/syntax package fixes compilation of
some alternate patterns like "0A|0[aA]".

Fixes #59007

Change-Id: Idd519c6841167f932899b0ada347fb90a38a765e
GitHub-Last-Rev: 6f43cbca63
GitHub-Pull-Request: golang/go#66165
Reviewed-on: https://go-review.googlesource.com/c/go/+/569735
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Mark Freeman <mark@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-07-30 07:25:52 -07:00
Xiaolin Zhao
b1e933d955 cmd/compile: avoid extending when already sufficiently masked on loong64
Reduce the number of go toolchain instructions on loong64 as follows.

        file         before      after      Δ       %
        asm          562400      561348   -1052   -0.1871%
        cgo          488268      487932   -336    -0.0688%
        compile      2505750     2503710  -2040   -0.0814%
        cover        525874      525506   -368    -0.0700%
        link         714162      713562   -600    -0.0840%
        preprofile   240250      240054   -196    -0.0816%
        vet          794074      793742   -332    -0.0418%
        go           1598284     1597680  -604    -0.0378%
        gofmt        324126      323926   -200    -0.0617%
        total        7753188     7747460  -5728   -0.0739%

Change-Id: I3406113553b0fc4947d763ab66e57e69aa98c020
Reviewed-on: https://go-review.googlesource.com/c/go/+/683615
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Mark Freeman <mark@golang.org>
2025-07-30 00:29:40 -07:00
Cuong Manh Le
880ca333d7 cmd/compile: removing log2uint32 function
Just using isUnsignedPowerOfTwo and log32u is enough.

Change-Id: I93d49ab71c6245d05f6507adbcb9ef2a696e75d6
Reviewed-on: https://go-review.googlesource.com/c/go/+/691476
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
2025-07-29 16:22:48 -07:00
Cuong Manh Le
1513661dc3 cmd/compile: simplify logX implementations
By calling logXu instead of duplicating the same ones.

Change-Id: Ide7a3ce072a6abafe1979f0158000457d90645c3
Reviewed-on: https://go-review.googlesource.com/c/go/+/691475
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-07-29 16:22:45 -07:00
Cuong Manh Le
bd94ae8903 cmd/compile: use unsigned power-of-two detector for unsigned mod
Same as CL 689815, but for modulus instead of division.

Updates #74485

Change-Id: I73000231c886a987a1093669ff207fd9117a8160
Reviewed-on: https://go-review.googlesource.com/c/go/+/689895
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2025-07-29 16:22:40 -07:00
Cuong Manh Le
f3582fc80e cmd/compile: add unsigned power-of-two detector
Fixes #74485

Change-Id: Ia22a58ac43bdc36c8414d555672a3a3eafc749ca
Reviewed-on: https://go-review.googlesource.com/c/go/+/689815
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2025-07-29 16:22:37 -07:00
Keith Randall
f7d167fe71 internal/abi: move direct/indirect flag from Kind to TFlag
This info makes more sense in the flags instead of as a high
bit of the kind. This makes kind access simpler because we now
don't need to mask anything.

Cleaned up most direct field accesses to use methods instead.
(reflect making new types is the only remaining direct accessor.)

IfaceIndir -> !IsDirectIface everywhere.

gocore has been updated to handle the new location. So has delve.
TODO: any other tools need updating?

Change-Id: I123f97a4d4bdd0bff1641ee7e276d1cc0bd7e8eb
Reviewed-on: https://go-review.googlesource.com/c/go/+/681936
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-07-29 14:03:07 -07:00
Olivier Mengué
e0b07dc22e os/exec: fix incorrect expansion of "", "." and ".." in LookPath
Fix incorrect expansion of "" and "." when $PATH contains an executable
file or, on Windows, a parent directory of a %PATH% element contains an
file with the same name as the %PATH% element but with one of the
%PATHEXT% extension (ex: C:\utils\bin is in PATH, and C:\utils\bin.exe
exists).

Fix incorrect expansion of ".." when $PATH contains an element which is
an the concatenation of the path to an executable file (or on Windows
a path that can be expanded to an executable by appending a %PATHEXT%
extension), a path separator and a name.

"", "." and ".." are now rejected early with ErrNotFound.

Fixes CVE-2025-47906
Fixes #74466

Change-Id: Ie50cc0a660fce8fbdc952a7f2e05c36062dcb50e
Reviewed-on: https://go-review.googlesource.com/c/go/+/685755
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
2025-07-29 13:53:57 -07:00
Cherry Mui
25816d401c internal/goexperiment: delete RangeFunc goexperiment
It is now always enabeld. The GOEXPERIMENT doesn't control
anything. Remove.

Change-Id: I50eb09f4537f90ec28152eb59a5a689127843fce
Reviewed-on: https://go-review.googlesource.com/c/go/+/684838
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-07-29 12:44:58 -07:00
Cherry Mui
7961bf71f8 internal/goexperiment: delete CacheProg goexperiment
It is now always enabeld. The GOEXPERIMENT doesn't control
anything. Remove.

Change-Id: I24ecf0cd7be5d5dd20f4c558871a3ea97792055e
Reviewed-on: https://go-review.googlesource.com/c/go/+/684837
Reviewed-by: qiu laidongfeng <2645477756@qq.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-07-29 12:44:51 -07:00
Michael Anthony Knyszek
e15a14c4dd sync: remove synchashtriemap GOEXPERIMENT
It's been true by default for a full release. It's time to remove the
old map.

Change-Id: I65507f07725e0084aabd389f37d73ade0b7dc35b
Reviewed-on: https://go-review.googlesource.com/c/go/+/690395
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>
2025-07-29 12:10:02 -07:00
Keith Randall
7dccd6395c cmd/compile: move arm32 over to new bounds check strategy
Change-Id: I529edd805875a4833cabcf4692f0c6d4163b07d2
Reviewed-on: https://go-review.googlesource.com/c/go/+/682398
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-07-29 10:46:49 -07:00
wingrez
d79405a344 runtime: only deduct assist credit for arenas during GC
CL 617876 has changed the original behavior. This modification will restore it.

Change-Id: I72cce82ebed362f99da7548035435397c835c99b
GitHub-Last-Rev: 980ef25b43
GitHub-Pull-Request: golang/go#74705
Reviewed-on: https://go-review.googlesource.com/c/go/+/689436
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <mark@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-07-29 10:40:47 -07:00
qmuntal
19a086f716 cmd/go/internal/telemetrystats: count goexperiments
Knowing which goexperiments are enabled by the users is
useful information to have in the local telemetry database.

It also opens the door for uploading them in the future if
desired.

Change-Id: I12c8eaa3997dec0ed26703885f1c216676f5590d
Reviewed-on: https://go-review.googlesource.com/c/go/+/688135
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2025-07-29 10:38:55 -07:00
Olivier Mengué
aa95ab8215 image: fix formatting of godoc link
Change-Id: I8fa8741e0db174f0c32af0a393ee1b037d5b7e51
Reviewed-on: https://go-review.googlesource.com/c/go/+/680455
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Mark Freeman <mark@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
2025-07-29 08:25:32 -07:00
mohanson
4c854b7a3e crypto/elliptic: change a variable name that have the same name as keywords
Change the variable name from byte to b, and use range over int to
simplify the loop.

Change-Id: I8855053c26ce798311f12505cd5edf21d7caf1f5
GitHub-Last-Rev: 70c80545df
GitHub-Pull-Request: golang/go#74736
Reviewed-on: https://go-review.googlesource.com/c/go/+/690135
Reviewed-by: qiu laidongfeng <2645477756@qq.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-07-29 04:30:34 -07:00
Keith Randall
b10eb1d042 cmd/compile: simplify zerorange on amd64
Get rid of duffzero and large zeroing cases. We only use this code
for small things now.

Change-Id: Idcf330d0ac6433448efa8e32be7eb7f988e10122
Reviewed-on: https://go-review.googlesource.com/c/go/+/678619
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Keith Randall <khr@google.com>
2025-07-28 17:39:26 -07:00
Olivier Mengué
f8eae7a3c3 os/user: fix tests to pass on non-english Windows
Tests on Windows are dependent on the english names of system accounts
and groups.

But on a french install of Windows the system accounts are:
- AUTORITE NT\Système
- AUTORITE NT\SERVICE LOCAL
- AUTORITE NT\SERVICE RÉSEAU

To allow the tests to pass on non-english Windows we only log
differences in user/group names if GetSystemDefaultLCID() reports
a non-english LCID, instead of failing.

Change-Id: Ib81acc2896c45675fa3faf5dc390b57ec5159689
Reviewed-on: https://go-review.googlesource.com/c/go/+/688715
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <mark@golang.org>
Reviewed-by: Quim Muntal <quimmuntal@gmail.com>
2025-07-28 11:52:39 -07:00
qmuntal
0984264471 internal/poll: remove msg field from Windows' poll.operation
There is no need to keep the msg field in the poll.operation struct.

This skims down the size of os.File by 112 bytes.

Change-Id: I5c7b1f3989f9bb5f1748df2cba8128d9c479b35d
Reviewed-on: https://go-review.googlesource.com/c/go/+/685418
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Mark Freeman <mark@golang.org>
2025-07-28 11:52:21 -07:00
qmuntal
d7b4114346 internal/poll: remove rsan field from Windows' poll.operation
There is no need to keep the rsan field in the poll.operation struct.

This skims down the size of os.File by 16 bytes.

Change-Id: I5e99e0e87178b63a19f0b9883b7b3d25abfd9ec3
Reviewed-on: https://go-review.googlesource.com/c/go/+/685417
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Mark Freeman <mark@golang.org>
2025-07-28 11:52:15 -07:00
qmuntal
361b1ab41f internal/poll: remove sa field from Windows' poll.operation
There is no need to keep the sa field in the poll.operation struct.

This skims down the size of os.File by 32 bytes.

Change-Id: I6b021a76f582ead5dccb29b001e7a5b068a2c2ee
Reviewed-on: https://go-review.googlesource.com/c/go/+/685416
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <mark@golang.org>
2025-07-28 11:52:05 -07:00
qmuntal
9b6bd64e46 internal/poll: remove qty and flags fields from Windows' poll.operation
There is no need to keep the qty and flags fields in the poll.operation
struct.

This skims down the size of os.File by 16 bytes and makes poll.operation
harder to misuse.

Change-Id: I8943d88f29ed3c7eefbb83114b0d31052abbe646
Reviewed-on: https://go-review.googlesource.com/c/go/+/685436
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Mark Freeman <mark@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-07-28 11:51:58 -07:00
Ruihua Wen
cd3655a824 internal/runtime/maps: fix spelling errors in comments
Change-Id: I289d26f75bb556b46699159f06ce7eb03d34656d
GitHub-Last-Rev: 10ce76df1d
GitHub-Pull-Request: golang/go#74733
Reviewed-on: https://go-review.googlesource.com/c/go/+/690095
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <mark@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2025-07-28 11:38:50 -07:00
Joel Sing
d5dc36af45 runtime: remove openbsd/mips64 related code
The openbsd/mips64 port has been broken for many years and it has not
been possible to land the changes needed to unbreak it. As such, this
port is considered dead and can be decommissioned in order to remove
technical debt and allow other changes to be completed.

Updates #61546

Change-Id: I9680eab9fb3aa85b83de47c66e9ebaf8c388a3bd
Reviewed-on: https://go-review.googlesource.com/c/go/+/649659
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <mark@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2025-07-28 11:31:21 -07:00
Jes Cok
64ba72474d errors: omit redundant nil check in type assertion for Join
When ok is true, err can't be nil.

Make it behave more like the Unwrap function.

Change-Id: Ieba5de57d60f5ff4d6a3468d703e6f72be02a97d
GitHub-Last-Rev: 6df9365a1d
GitHub-Pull-Request: golang/go#74764
Reviewed-on: https://go-review.googlesource.com/c/go/+/689920
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Mark Freeman <mark@golang.org>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
2025-07-28 11:28:38 -07:00
Jes Cok
e151db3e06 all: omit unnecessary type conversions
Found by github.com/mdempsky/unconvert

Change-Id: Ib78cceb718146509d96dbb6da87b27dbaeba1306
GitHub-Last-Rev: dedf354811
GitHub-Pull-Request: golang/go#74771
Reviewed-on: https://go-review.googlesource.com/c/go/+/690735
Reviewed-by: Mark Freeman <mark@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2025-07-28 11:13:58 -07:00
Jorropo
4569255f8c cmd/compile: cleanup SelectN rules by indexing into args
Change-Id: I7b8e8cd88c4d6d562aa25df91593d35d331ef63c
Reviewed-on: https://go-review.googlesource.com/c/go/+/690595
Reviewed-by: Mark Freeman <mark@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-07-28 11:06:11 -07:00
Jorropo
94645d2413 cmd/compile: rewrite cmov(x, x, cond) into x
I don't think branchelim will intentionally generate theses.
But at the time where branchelim is generating them they might different,
and through opt process they become the same value.

Change-Id: I4a19f1db14c08057b7e782a098f4c18ca36ab7fe
Reviewed-on: https://go-review.googlesource.com/c/go/+/690519
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Mark Freeman <mark@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2025-07-28 11:06:07 -07:00
yazdan
10c5cf68d4 net/http: add proper panic message
Change-Id: Ibfb330eaf24e004ddec60a5ca08cdc780235ad8c
Reviewed-on: https://go-review.googlesource.com/c/go/+/688315
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Mark Freeman <mark@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-07-28 11:02:55 -07:00
Michael Munday
46b5839231 test/codegen: fix failing condmove wasm tests
These recently added tests failed when using the -all_codgen flag.

Fixes #74770

Change-Id: Idea1ea02af2bd9f45c7d0a28d633c7442328e6df
Reviewed-on: https://go-review.googlesource.com/c/go/+/690715
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
Run-TryBot: Michael Munday <mikemndy@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Mark Freeman <mark@golang.org>
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
TryBot-Bypass: Michael Knyszek <mknyszek@google.com>
2025-07-28 11:01:53 -07:00
qmuntal
98f301cf68 runtime,syscall: move SyscallX implementations from runtime to syscall
There is no need for syscall.Syscall{3,6,9,12,15,18} to be implemented
in the runtime and linknamed from syscall. All of them can be
implemented using the single runtime.syscall_syscalln function.

While here, improve the documentation of syscall.SyscallN.

Change-Id: I0e09d42e855d6baf900354c9b7992a4329c4ffc7
Reviewed-on: https://go-review.googlesource.com/c/go/+/690515
Reviewed-by: 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>
2025-07-28 09:47:26 -07:00
qmuntal
c7ed3a1c5a internal/runtime/syscall/windows: factor out code from runtime
Factor out the code related to doing calls using the Windows stdcall
calling convention into a separate package. This will allow us to
reuse it in other low-level packages that can't depend on syscall.

Updates #51087.

Cq-Include-Trybots: luci.golang.try:gotip-windows-arm64,gotip-windows-amd64-longtest,gotip-solaris-amd64
Change-Id: I68640b07091183b50da6bef17406c10a397896e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/689156
Reviewed-by: 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>
2025-07-28 09:47:09 -07:00
Klaus Post
e81eac19d3 hash/crc32: fix incorrect checksums with avx512+race
CRC value loaded from incorrect register, which happened
to line up with actual register on default compile.
Therefore failures would only show up with -race.

Add regression test with longer payloads.

Fix regression from CL 689435.

Fixes #74767.

Change-Id: Ib63ddade998a5630297b285f3d566361f36f28e5
GitHub-Last-Rev: 5074012d2c
GitHub-Pull-Request: golang/go#74775
Reviewed-on: https://go-review.googlesource.com/c/go/+/690855
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-07-28 08:51:49 -07:00
Keith Randall
6fbad4be75 cmd/compile: remove no-longer-necessary call to calculateDepths
We now calculate depths by default, no need to ask.
All calls were removed in CL 680775 when that CL was written, but an
additional call appeared between then and submitting the CL. Oops.

Another case for which a presubmit check would help.

Fixes #74762

Change-Id: I1b70ed7f91b56e4939b4a3d0ad7a5f31fe396b4c
Reviewed-on: https://go-review.googlesource.com/c/go/+/690036
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: t hepudds <thepudds1460@gmail.com>
2025-07-25 17:43:10 -07:00
Keith Randall
5045fdd8ff cmd/compile: fix containsUnavoidableCall computation
The previous algorithm was incorrect, as it reused the dominatedByCall
slice without resetting it. It also used the depth fields even though
they were not yet calculated.

Also, clean up a lot of the loop detector code that we never use.

Always compute depths. It is cheap.

Update #71868

Not really sure how to test this. As it is just an advisory bit,
nothing goes really wrong when the result is incorrect.

Change-Id: Ic0ae87a4d3576554831252d88b05b058ca68af41
Reviewed-on: https://go-review.googlesource.com/c/go/+/680775
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: David Chase <drchase@google.com>
2025-07-25 13:52:00 -07:00
Mark Freeman
d28b27cd8e go/types, types2: use nil to represent incomplete explicit aliases
Using Invalid to represent an incomplete alias is problematic since
it implies that an error has been reported somewhere. This causes
confusion for observers of invalid aliases trying not to emit
follow-on errors.

This change uses nil instead to represent an incomplete alias. This
has a mild benefit of making alias memoization more convenient. We
additionally can now memoize Invalid aliases.

This necessitates a minor change to our cycle error reporting for
aliases. Care is taken to separate logic according to gotypesalias.
Otherwise, a cycle as simple as "type T = T" panics.

A test is also added which uses go/types to inspect for Invalid
types. Currently, the problematic Invalid does not cause an error
in type checking, but rather a panic in noding. Thus, we cannot use
the familiar test facilities relying on error reporting.

Fixes #74181

Change-Id: Iea5ebce567a2805f5647de0fb7ded4a96f6c5f8d
Reviewed-on: https://go-review.googlesource.com/c/go/+/683796
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-07-25 13:43:32 -07:00
Mark Freeman
7b53d8d06e cmd/compile/internal/types2: add loaded state between loader calls and constraint expansion
There is a deadlock issue when calling SetConstraint from a lazy loader
because the loader is called from resolve(), which is holding a lock on
the loaded type.

If the loaded type has a generic constraint which refers back to the
loaded type (such as an argument or result), then we will loop back to
the loaded type and deadlock.

This change postpones calls to SetConstraint and passes them back to
resolve(). At that point, the loaded type is mostly constructed, but
its constraints might be unexpanded.

Similar to how we handle resolved instances, we advance the state for
the loaded type to a, appropriately named, loaded state. When we expand
the constraint, we don't try to acquire the lock on the loaded type.
Thus, no deadlock.

Fixes #63285

Change-Id: Ie0204b58a5b433f6d839ce8fd8a99542246367b7
Reviewed-on: https://go-review.googlesource.com/c/go/+/681875
Commit-Queue: Mark Freeman <mark@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-07-25 13:42:54 -07:00
qmuntal
374e3be2eb os/user: user random name for the test user account
TestImpersonated and TestGroupIdsTestUser are flaky due to sporadic
failures when creating the test user account when running the tests
from different processes at the same time.

This flakiness can be fixed by using a random name for the test user
account.

Fixes #73523
Fixes #74727
Fixes #74728
Fixes #74729
Fixes #74745
Fixes #74751

Cq-Include-Trybots: luci.golang.try:gotip-windows-amd64-longtest
Change-Id: Ib2283a888437420502b1c11d876c975f5af4bc03
Reviewed-on: https://go-review.googlesource.com/c/go/+/690175
Auto-Submit: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Bypass: Dmitri Shuralyov <dmitshur@golang.org>
2025-07-25 12:19:23 -07:00
Michael Anthony Knyszek
1aa154621d runtime: rename scanobject to scanObject
This is long overdue.

Change-Id: I891b114cb581e82b903c20d1c455bbbdad548fe8
Reviewed-on: https://go-review.googlesource.com/c/go/+/690535
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>
2025-07-25 11:35:41 -07:00
Michael Anthony Knyszek
41b429881a runtime: duplicate scanobject in greentea and non-greentea files
This change exists to help differentiate profile samples spent on
Green Tea and non-Green-Tea GC time in mixed contexts.

Change-Id: I8dea340d2d11ba4c410ae939fb5f37020d0b55d1
Reviewed-on: https://go-review.googlesource.com/c/go/+/689477
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>
2025-07-25 11:33:18 -07:00
Keith Randall
aeb256e98a cmd/compile: remove unused arg from gorecover
We don't need this argument anymore to match up
a recover with its corresponding panic.

Change-Id: I5d3646cdd766259ee9d3d995a2f215f02e17abc6
Reviewed-on: https://go-review.googlesource.com/c/go/+/685555
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2025-07-25 11:26:40 -07:00
Keith Randall
08376e1a9c runtime: iterate through inlinings when processing recover()
We care about the wrapper-ness of logical frames, not physical frames.

Fixes #73916
Fixes #73917
Fixex #73920

Change-Id: Ia17c8390e71e6c0e13e23dcbb7bc7273ef25da90
Reviewed-on: https://go-review.googlesource.com/c/go/+/685375
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-07-25 11:26:30 -07:00
Joe Tsai
c76c3abc54 encoding/json: fix truncated Token error regression in goexperiment.jsonv2
The jsontext.Decoder.ReadToken method reports a non-EOF error,
if the token stream is truncated and does not form a valid JSON value.
In contrast, the v1 json.Decoder.Token method would report EOF
so long as the input was a prefix of some valid JSON value.
Modify json.Decoder.Token to preserve historical behavior.

This only modifies code that is compiled in under goexperiment.jsonv2.

Updates #69449
Fixes #74750

Change-Id: Ifd281c46f118f0e748076013fefc7659f77c56ed
Reviewed-on: https://go-review.googlesource.com/c/go/+/689516
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-07-25 10:48:56 -07:00
Joe Tsai
ebdbfccd98 encoding/json/jsontext: preserve buffer capacity in Encoder.Reset
This does the equivalent of CL 681177 for the Encoder.
It preserves the internal buffer between resets.

Change-Id: I5e9353b6d7755e067d4f9a4d1ea3d8f056253027
Reviewed-on: https://go-review.googlesource.com/c/go/+/690375
Reviewed-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Auto-Submit: Joseph Tsai <joetsai@digital-static.net>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-07-25 10:47:45 -07:00
Keith Randall
91c4f0ccd5 reflect: avoid a bounds check in stack-constrained code
Since CL 682496 we need more stack space to handle bounds checks.
The code modified here normally has no bounds checks, but in -N
builds it still does and thus uses too much stack.

Use unsafe arithmetic to avoid the bounds check.

This will hopefully fix some of the arm64 linux builders.

Change-Id: I5b3096a14b4fb9553e635b7f340e60b8ffba8755
Reviewed-on: https://go-review.googlesource.com/c/go/+/690415
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@google.com>
2025-07-25 09:45:13 -07:00
Joe Tsai
3636ced112 encoding/json: fix extra data regression under goexperiment.jsonv2
When operating under v1 semantics in the v2 implementation,
a extra data error should take precedence over any semantic error
that could theoretically occur within the value itself.

This change only affects code compiled under goexperiment.jsonv2.

Fixes #74614

Change-Id: I055a606b053fa66b0c766ae205487b8290109285
Reviewed-on: https://go-review.googlesource.com/c/go/+/689919
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-07-24 20:30:28 -07:00
Joe Tsai
a6eec8bdc7 encoding/json: reduce error text regressions under goexperiment.jsonv2
There were minor and unnecessary error text changes
when v1 was implemented using v2.
Reduce divergences if possible.

Of the cases reported in #74713, there are no more differences for:

	v1: json: cannot unmarshal number into Go value of type chan int
	v2: json: cannot unmarshal number into Go value of type chan int

and

	v1: json: cannot unmarshal number into Go value of type error
	v2: json: cannot unmarshal number into Go value of type error

However, there is a difference between:

	v1: json: cannot unmarshal string into Go struct field .F.V of type int
	v2: json: cannot unmarshal string into Go struct field S.F.V of type int

For reasons unclear, the v1 logic was always inconsistent about
whether it could properly record the root struct type,
while the v1 emulation layer under v2 is always able to.

This only modifies code that is compiled in under goexperiment.jsonv2.

Fixes #74713

Change-Id: I9e87323b1810130cb929288fdd86aff4be82d5f2
Reviewed-on: https://go-review.googlesource.com/c/go/+/689918
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Joseph Tsai <joetsai@digital-static.net>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-07-24 20:30:25 -07:00
cxbdasheng
0fa88dec1e time: remove redundant uint32 conversion in split
cd is a uint32 converted again.

Change-Id: Ia41e247e0644c17cd9e0593d79457db77512fc3e
GitHub-Last-Rev: 1ba8596e27
GitHub-Pull-Request: golang/go#74679
Reviewed-on: https://go-review.googlesource.com/c/go/+/689055
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-07-24 20:30:20 -07:00
Julian Zhu
ada30b8248 internal/buildcfg: add ability to get GORISCV64 variable in GOGOARCH
For #61476

Change-Id: I29f4c1c3c3303e70ec2d7f380112eb2d00754018
Reviewed-on: https://go-review.googlesource.com/c/go/+/665655
Reviewed-by: Mark Ryan <markdryan@rivosinc.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <mark@golang.org>
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
2025-07-24 17:49:15 -07:00
Keith Randall
6f6c6c5782 cmd/internal/obj: rip out argp adjustment for wrapper frames
The previous CL made this adjustment unnecessary. The argp field
is no longer used by the runtime.

Change-Id: I3491eeef4103c6653ec345d604c0acd290af9e8f
Reviewed-on: https://go-review.googlesource.com/c/go/+/685356
Reviewed-by: 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>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2025-07-24 16:24:50 -07:00
Keith Randall
7b50024330 runtime: detect successful recovers differently
Use stack unwinding instead of keeping incremental track of the argp
of defers that are allowed to recover.

It's much simpler, and it lets us get rid of the incremental tracking
by wrapper code. (Ripped out in a subsequent CL.)

We only need to stack unwind a few frames to get the right answer, and
only when recover()ing in a panic situation. It will be more expensive
in that case, but cheaper in all others.

Change-Id: Id095807db6864b7ac1e1baf09285b77a07c46d19
Reviewed-on: https://go-review.googlesource.com/c/go/+/685355
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2025-07-24 16:24:36 -07:00
Keith Randall
7b9de668bd unicode/utf8: skip ahead during ascii runs in Valid/ValidString
When we see an ASCII character, we will probably see many.
Grab & check increasingly large chunks of the string for ASCII-only-ness.

Also redo some of the non-ASCII code to make it more optimizer friendly.

goos: linux
goarch: amd64
pkg: unicode/utf8
cpu: 12th Gen Intel(R) Core(TM) i7-12700
                               │     base     │                 exp                 │
                               │    sec/op    │   sec/op     vs base                │
ValidTenASCIIChars-20             3.596n ± 3%   2.522n ± 1%  -29.86% (p=0.000 n=10)
Valid100KASCIIChars-20            6.094µ ± 2%   2.115µ ± 1%  -65.29% (p=0.000 n=10)
ValidTenJapaneseChars-20          21.02n ± 0%   18.61n ± 2%  -11.44% (p=0.000 n=10)
ValidLongMostlyASCII-20          51.774µ ± 0%   3.836µ ± 1%  -92.59% (p=0.000 n=10)
ValidLongJapanese-20             102.40µ ± 1%   50.95µ ± 1%  -50.24% (p=0.000 n=10)
ValidStringTenASCIIChars-20       2.640n ± 3%   2.526n ± 1%   -4.34% (p=0.000 n=10)
ValidString100KASCIIChars-20      5.585µ ± 7%   2.118µ ± 1%  -62.07% (p=0.000 n=10)
ValidStringTenJapaneseChars-20    21.29n ± 2%   18.67n ± 1%  -12.31% (p=0.000 n=10)
ValidStringLongMostlyASCII-20    52.431µ ± 1%   3.841µ ± 0%  -92.67% (p=0.000 n=10)
ValidStringLongJapanese-20       102.66µ ± 1%   50.90µ ± 1%  -50.42% (p=0.000 n=10)
geomean                           1.152µ        454.8n       -60.53%

This is an attempt to see if we can get enough performance that we don't
need to consider assembly like that in CL 681695.

Change-Id: I8250feb797a6b4e7d335c23929f6e3acc8b24840
Reviewed-on: https://go-review.googlesource.com/c/go/+/682778
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-07-24 16:07:35 -07:00
Keith Randall
076eae436e cmd/compile: move amd64 and 386 over to new bounds check strategy
Change-Id: I13f54f04ccb8452e625dba4249e0d56bafd1fad8
Reviewed-on: https://go-review.googlesource.com/c/go/+/682397
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-07-24 16:06:16 -07:00
Keith Randall
f703dc5bef cmd/compile: add missing StringLen rule in prove
(StringLen (StringMake _ x)) == x, just like the rules we
currently have for slices.

This helps propagate string length knowledge to places which need it.

Change-Id: Ifdcf6d1f2d430c1c4bbac32e0ea74c188eae998e
Reviewed-on: https://go-review.googlesource.com/c/go/+/682777
Reviewed-by: Daniel Morsing <daniel.morsing@gmail.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
2025-07-24 16:06:14 -07:00
Keith Randall
394d0bee8d cmd/compile: move arm64 over to new bounds check strategy
For all the static bounds checks in cmd/go, we have:

    6877    just a single instruction (the call itself)
    139     needs an additional reg-reg move
    602     needs an additional constant load
    25      needs some other instruction

that's ~90% implemented using just a single instruction.

Reduces the text size of cmd/go by ~0.8%.
Total binary size is just barely smaller, ~0.2%. (The difference
is the new pcdata table.)

Change-Id: I416e9c196f5d8d0e8f08e191e6df3045e11dccbe
Reviewed-on: https://go-review.googlesource.com/c/go/+/682496
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-07-24 16:06:09 -07:00
Keith Randall
3024785b92 cmd/compile,runtime: remember idx+len for bounds check failure with less code
Currently we must put the index and length into specific registers so
we can call into the runtime to report a bounds check failure.

So a typical bounds check call is something like:

MOVD  R3, R0
MOVD  R7, R1
CALL  runtime.panicIndex

or, if for instance the index is constant,

MOVD  $7, R0
MOVD  R9, R1
CALL  runtime.panicIndex

Sometimes the MOVD can be avoided, if the value happens to be in the
right register already. But that's not terribly common, and doesn't
work at all for constants.

Let's get rid of those MOVD instructions. They pollute the instruction
cache and are almost never executed.

Instead, we'll encode in a PCDATA table where the runtime should find
the index and length. The table encodes, for each index and length,
whether it is a constant or in a register, and which register or
constant it is.

That way, we can avoid all those useless MOVDs. Instead, we can figure
out the index and length at runtime. This makes the bounds panic path
slower, but that's a good tradeoff.

We can encode registers 0-15 and constants 0-31. Anything outside that
range still needs to use an explicit instruction.

This CL is the foundation, followon CLs will move each architecture
to the new strategy.

Change-Id: I705c511e546e6aac59fed922a8eaed4585e96820
Reviewed-on: https://go-review.googlesource.com/c/go/+/682396
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-07-24 16:05:59 -07:00
Keith Randall
741a19ab41 runtime: move bounds check constants to internal/abi
For future use by the compiler.

Change-Id: Id3da62006b283ac38008261c0ef88aaf71ef5896
Reviewed-on: https://go-review.googlesource.com/c/go/+/682456
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-07-24 16:03:38 -07:00
Jorropo
ce05ad448f cmd/compile: rewrite condselects into doublings and halvings
For performance see CL 685676.

This allows something like:
  if y { x *= 2 }

To be compiled to:
  SHLXQ BX, AX, AX

Instead of:
  MOVQ    AX, CX
  SHLQ    $1, CX
  MOVBLZX BL, DX
  TESTQ   DX, DX
  CMOVQNE CX, AX

While ./make.bash uniqued per LOC, there is 2 doublings and 4 halvings.

Change-Id: Ic0727cbf429528a2dbf17cbfc3b0121db8387444
Reviewed-on: https://go-review.googlesource.com/c/go/+/685695
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2025-07-24 14:42:15 -07:00
Jorropo
fcd28070fe cmd/compile: add opt branchelim to rewrite some CondSelect into math
This allows something like:
  if y { x++ }

To be compiled to:
  MOVBLZX BX, CX
  ADDQ CX, AX

Instead of:
  LEAQ    1(AX), CX
  MOVBLZX BL, DX
  TESTQ   DX, DX
  CMOVQNE CX, AX

While ./make.bash uniqued per LOC, there is 100 additions and 75 substractions.

See benchmark here: https://go.dev/play/p/DJf5COjwhd_s

Either it's a performance no-op or it is faster:

  goos: linux
  goarch: amd64
  cpu: AMD Ryzen 5 3600 6-Core Processor
                                          │ /tmp/old.logs │            /tmp/new.logs             │
                                          │    sec/op     │    sec/op     vs base                │
  CmovInlineConditionAddLatency-12           0.5443n ± 5%   0.5339n ± 3%   -1.90% (p=0.004 n=10)
  CmovInlineConditionAddThroughputBy6-12      1.492n ± 1%    1.494n ± 1%        ~ (p=0.955 n=10)
  CmovInlineConditionSubLatency-12           0.5419n ± 3%   0.5282n ± 3%   -2.52% (p=0.019 n=10)
  CmovInlineConditionSubThroughputBy6-12      1.587n ± 1%    1.584n ± 2%        ~ (p=0.492 n=10)
  CmovOutlineConditionAddLatency-12          0.5223n ± 1%   0.2639n ± 4%  -49.47% (p=0.000 n=10)
  CmovOutlineConditionAddThroughputBy6-12     1.159n ± 1%    1.097n ± 2%   -5.35% (p=0.000 n=10)
  CmovOutlineConditionSubLatency-12          0.5271n ± 3%   0.2654n ± 2%  -49.66% (p=0.000 n=10)
  CmovOutlineConditionSubThroughputBy6-12     1.053n ± 1%    1.050n ± 1%        ~ (p=1.000 n=10)
  geomean

There are other benefits not tested by this benchmark:
- the math form is usually a couple bytes shorter (ICACHE)
- the math form is usually 0~2 uops shorter (UCACHE)
- the math form has usually less register pressure*
- the math form can sometimes be optimized further

*regalloc rarely find how it can use less registers

As far as pass ordering goes there are many possible options,
I've decided to reorder branchelim before late opt since:
- unlike running exclusively the CondSelect rules after branchelim,
  some extra optimizations might trigger on the adds or subs.
- I don't want to maintain a second generic.rules file of only the stuff,
  that can trigger after branchelim.
- rerunning all of opt a third time increase compilation time for little gains.

By elimination moving branchelim seems fine.

Change-Id: I869adf57e4d109948ee157cfc47144445146bafd
Reviewed-on: https://go-review.googlesource.com/c/go/+/685676
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-07-24 14:42:10 -07:00
Jorropo
f32cf8e4b0 cmd/compile: learn transitive proofs for safe unsigned subs
I've split this into it's own CL to make git bisect more effective.

Change-Id: I436ff21a3e2362b3924de25a458534eb9947e013
Reviewed-on: https://go-review.googlesource.com/c/go/+/685821
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
2025-07-24 13:49:07 -07:00
Jorropo
d574856482 cmd/compile: learn transitive proofs for safe negative signed adds
I've split this into it's own CL to make git bisect more effective.

Change-Id: Ib2c6dbc82fb04f50f2d17fbe6626c9fc322fb478
Reviewed-on: https://go-review.googlesource.com/c/go/+/685820
Auto-Submit: Michael Knyszek <mknyszek@google.com>
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: Michael Knyszek <mknyszek@google.com>
2025-07-24 13:49:03 -07:00
Jorropo
1a72920f09 cmd/compile: learn transitive proofs for safe positive signed adds
I've split this into it's own CL to make git bisect more effective.

Change-Id: I3fbb42ec7d29169a29f7f55ef2c188317512f532
Reviewed-on: https://go-review.googlesource.com/c/go/+/685819
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-07-24 13:48:59 -07:00
Jorropo
e5f202bb60 cmd/compile: learn transitive proofs for safe unsigned adds
I've split this into it's own CL to make git bisect more effective.

Change-Id: Iaab5f0bd2ad51e86ced8c6b8fbd371eb75eeef14
Reviewed-on: https://go-review.googlesource.com/c/go/+/685815
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Mark Freeman <mark@golang.org>
2025-07-24 13:48:55 -07:00
Alexander Musman
bd80f74bc1 cmd/compile: fold shift through AND for slice operations
Fold a shift through AND when the AND gets a zero-or-one operand (e.g.
from arithmetic shift by 63 of a 64-bit value) for a common case with
slice operations:

    ASR     $63, R2, R2
    AND     R3<<3, R2, R2
    ADD     R2, R0, R2

As the operands are 64-bit, we can transform it to:

    AND     R2->63, R3, R2
    ADD     R2<<3, R0, R2

Code size improvement:
compile: .text:     9088004 ->  9086292 (-0.02%)
etcd:    .text:    10500276 -> 10498964 (-0.01%)

Change-Id: Ibcd5e67173da39b77ceff77ca67812fb8be5a7b5
Reviewed-on: https://go-review.googlesource.com/c/go/+/679895
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Mark Freeman <mark@golang.org>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-07-24 13:47:20 -07:00
qmuntal
5c45fe1385 internal/runtime/syscall: rename to internal/runtime/syscall/linux
All code in internal/runtime/syscall is Linux-specific, so better
move it to a new linux sub-directory. This way it will be easier
to factor out runtime syscall code from other platforms, e.g.
Windows.

Updates #51087.

Change-Id: Idd2a52444b33bf3ad576b47fd232e990cdc8ae75
Reviewed-on: https://go-review.googlesource.com/c/go/+/689155
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-07-24 13:30:14 -07:00
Alexander Musman
592c2db868 cmd/compile: improve loopRotate to handle nested loops
Enhance loop rotation of nested loops. Currently, loops are processed independently,
resulting in unnecessary jumps between outer and inner loops. By processing inner
loops before their parent loop, we ensure nested loop blocks are
properly placed within their parent loop's block sequence.

There is some code size improvement (as measured on amd64) due to jumps
to/from inner loop are removed by the updated loopRotate block order:

Executable            Old .text  New .text     Change
-------------------------------------------------------
asm                     2147569    2146481     -0.05%
cgo                     1977457    1975761     -0.09%
compile                10447345   10441905     -0.05%
cover                   2110097    2108977     -0.05%
link                    2930289    2929041     -0.04%
preprofile               927345     926769     -0.06%
vet                     3279057    3277009     -0.06%

Change-Id: I4b9e993c2be07fad735e6bcf32d062d099d9cfb5
Reviewed-on: https://go-review.googlesource.com/c/go/+/684335
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-07-24 12:40:00 -07:00
Alexander Musman
dcb479c2f9 cmd/compile: optimize slice bounds checking with SUB/SUBconst comparisons
Optimize ARM64 code generation for slice bounds checking by recognizing
patterns where comparisons to zero involve SUB or SUBconst operations.
This change adds SSA opt rules to simplify:
 (CMPconst [0] (SUB x y)) => (CMP x y)

The optimizations apply to EQ, NE, ULE, and UGT comparisons, enabling
more efficient bounds checking for slice operations.

Code size improvement:
compile: .text:    9088004  ->  9065988 (-0.24%)
etcd:    .text:    10500276 -> 10497092 (-0.03%)
Change-Id: I467cb27674351652bcacc52b87e1f19677bd46a8
Reviewed-on: https://go-review.googlesource.com/c/go/+/679915
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: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
2025-07-24 12:39:53 -07:00
qmuntal
f11599b0b9 internal/poll: remove handle field from Windows' poll.operation
The handle field can be accessed directly wherever needed, there is
no need to store it in the operation struct.

This skims down the size of os.File by 16 bytes.

Change-Id: I87c94cb773437891127b6c36dc7f8883622ffed3
Reviewed-on: https://go-review.googlesource.com/c/go/+/685435
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
2025-07-24 10:50:32 -07:00
qmuntal
f7432e0230 internal/poll: remove fd field from Windows' poll.operation
There is no need to keep the fd in the poll.operation struct,
given that all usages of this field have direct access to the fd struct.

This skims down the size of os.File by 16 bytes.

Change-Id: I837e345250387f62e294cc1772d752865a04ef6d
Reviewed-on: https://go-review.googlesource.com/c/go/+/685415
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
2025-07-24 10:49:17 -07:00
Julian Zhu
e84ed38641 runtime: add benchmark for small-size memmory operation
On RISC-V and MIPS andarchitectures, misaligned load/store is not mandatory for implementations. Therefore, it's important to handle memory operations involving small sizes or data with a remainder when divided by 8 or 4.
This CL add some benchmark for small-size memmory operation, to ensure that SSA rules do not generate unaligned access traps on such architectures.

Change-Id: I6fcdfdb76e9552d5b10df140fa92568ac9468386
Reviewed-on: https://go-review.googlesource.com/c/go/+/682575
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
2025-07-24 10:49:11 -07:00
Klaus Post
18dbe5b941 hash/crc32: add AVX512 IEEE CRC32 calculation
Benchmark:

goos: windows
goarch: amd64
pkg: hash/crc32
cpu: AMD Ryzen 9 9950X 16-Core Processor

benchmark                                               old MB/s     new MB/s     speedup
BenchmarkCRC32/poly=IEEE/size=15/align=0-32             1081.48      1089.42      1.01x
BenchmarkCRC32/poly=IEEE/size=15/align=1-32             1085.87      1082.61      1.00x
BenchmarkCRC32/poly=IEEE/size=40/align=0-32             2756.33      2752.37      1.00x
BenchmarkCRC32/poly=IEEE/size=40/align=1-32             2758.27      2756.99      1.00x
BenchmarkCRC32/poly=IEEE/size=512/align=0-32            18133.44     18076.52     1.00x
BenchmarkCRC32/poly=IEEE/size=512/align=1-32            18151.05     18055.41     0.99x
BenchmarkCRC32/poly=IEEE/size=1kB/align=0-32            19902.93     48581.07     2.44x
BenchmarkCRC32/poly=IEEE/size=1kB/align=1-32            19966.99     48393.25     2.42x
BenchmarkCRC32/poly=IEEE/size=4kB/align=0-32            21690.33     51679.25     2.38x
BenchmarkCRC32/poly=IEEE/size=4kB/align=1-32            21655.30     51731.22     2.39x
BenchmarkCRC32/poly=IEEE/size=32kB/align=0-32           22046.57     46406.90     2.10x
BenchmarkCRC32/poly=IEEE/size=32kB/align=1-32           21986.22     46250.66     2.10x

AVX512 are enabled above 1KB input size.

This rather high limit is due to AVX512 may be slower to ramp up
than the regular SSE4 implementation for smaller inputs.

This is not reflected in the benchmarks,
since consecutive calls means the CPU is "hot".

The 'HasAVX512VPCLMULQDQ' name mirrors the one in golang.org/x/sys/cpu

Change-Id: Id23685d8e3cc412b6d397a7d70056844bdb79271

Change-Id: Id23685d8e3cc412b6d397a7d70056844bdb79271
GitHub-Last-Rev: 6639f07b9f
GitHub-Pull-Request: golang/go#74701
Reviewed-on: https://go-review.googlesource.com/c/go/+/689435
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2025-07-24 10:19:17 -07:00
Derek Parker
c641900f72 cmd/compile: prefer base.Fatalf to panic in dwarfgen
Updates a few spots which call `panic` to instead call `base.Fatalf`.

Change-Id: I30b73c7994caa647245b0e253f20e0b88185e644
GitHub-Last-Rev: b3839bbe42
GitHub-Pull-Request: golang/go#74616
Reviewed-on: https://go-review.googlesource.com/c/go/+/688035
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-07-24 10:17:56 -07:00
kmvijay
d71d8aeafd cmd/internal/obj/s390x: add MVCLE instruction
MVCLE (Move Long Extended) instruction is used to move large data storage-to-storage.
This change will add MVCLE into the Go asm for s390x architecture.
Upcoming PR of runtime/memmove_s390x.s will use this instruction for performance improvement.

Change-Id: I3bbb6668c736a36849917887398c74cebb1c3a99
Reviewed-on: https://go-review.googlesource.com/c/go/+/677455
Reviewed-by: Srinivas Pokala <Pokala.Srinivas@ibm.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Michael Munday <mikemndy@gmail.com>
Reviewed-by: Vishwanatha HD <vishwanatha.hd@ibm.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-07-24 10:12:10 -07:00
Julian Zhu
b6cf1d94dc runtime: optimize memclr on mips64x
Memclr/5-4                          49.94n ±  5%         50.51n ±  1%        ~ (p=0.331 n=6)
Memclr/16-4                         22.71n ±  0%         21.01n ±  2%   -7.47% (p=0.002 n=6)
Memclr/64-4                         49.70n ±  1%         26.09n ±  1%  -47.51% (p=0.002 n=6)
Memclr/256-4                        84.23n ±  3%         44.32n ±  2%  -47.38% (p=0.002 n=6)
Memclr/4096-4                       805.6n ±  1%         220.9n ±  2%  -72.57% (p=0.002 n=6)
Memclr/65536-4                     12.734µ ±  1%         3.287µ ±  1%  -74.19% (p=0.002 n=6)
Memclr/1M-4                         209.1µ ±  0%         105.9µ ±  5%  -49.34% (p=0.002 n=6)
Memclr/4M-4                         838.9µ ±  6%         418.2µ ±  0%  -50.15% (p=0.002 n=6)
Memclr/8M-4                         1.708m ±  4%         1.108m ±  4%  -35.15% (p=0.002 n=6)
Memclr/16M-4                        3.458m ±  1%         2.840m ±  3%  -17.88% (p=0.002 n=6)
Memclr/64M-4                        14.05m ±  0%         11.40m ±  2%  -18.87% (p=0.002 n=6)
MemclrUnaligned/0_5-4               50.57n ±  2%         51.00n ±  0%        ~ (p=0.063 n=6)
MemclrUnaligned/0_16-4              48.82n ±  8%         22.39n ±  1%  -54.14% (p=0.002 n=6)
MemclrUnaligned/0_64-4              52.73n ±  3%         25.29n ±  0%  -52.05% (p=0.002 n=6)
MemclrUnaligned/0_256-4             88.41n ±  1%         50.04n ±  7%  -43.41% (p=0.002 n=6)
MemclrUnaligned/0_4096-4            802.2n ±  1%         220.4n ±  1%  -72.53% (p=0.002 n=6)
MemclrUnaligned/0_65536-4          12.729µ ±  0%         3.341µ ±  6%  -73.76% (p=0.002 n=6)
MemclrUnaligned/1_5-4               50.52n ±  0%         50.99n ±  6%   +0.93% (p=0.002 n=6)
MemclrUnaligned/1_16-4              71.23n ±  1%         71.78n ±  1%   +0.77% (p=0.041 n=6)
MemclrUnaligned/1_64-4              85.11n ±  0%         76.30n ±  1%  -10.36% (p=0.002 n=6)
MemclrUnaligned/1_256-4            133.50n ±  2%         91.91n ±  1%  -31.15% (p=0.002 n=6)
MemclrUnaligned/1_4096-4            849.7n ±  0%         291.3n ±  2%  -65.72% (p=0.002 n=6)
MemclrUnaligned/1_65536-4          12.776µ ±  1%         3.399µ ±  1%  -73.40% (p=0.002 n=6)
MemclrUnaligned/4_5-4               44.34n ±  0%         44.52n ±  7%   +0.41% (p=0.022 n=6)
MemclrUnaligned/4_16-4              70.68n ±  0%         71.24n ±  4%        ~ (p=0.132 n=6)
MemclrUnaligned/4_64-4              81.83n ±  4%         77.98n ±  2%   -4.71% (p=0.002 n=6)
MemclrUnaligned/4_256-4            121.15n ±  3%         87.58n ±  0%  -27.71% (p=0.002 n=6)
MemclrUnaligned/4_4096-4            837.0n ±  2%         278.8n ±  3%  -66.69% (p=0.002 n=6)
MemclrUnaligned/4_65536-4          12.793µ ±  6%         3.373µ ±  3%  -73.64% (p=0.002 n=6)
MemclrUnaligned/7_5-4               43.89n ±  2%         43.10n ±  0%   -1.80% (p=0.002 n=6)
MemclrUnaligned/7_16-4              73.59n ±  2%         72.95n ±  1%   -0.86% (p=0.006 n=6)
MemclrUnaligned/7_64-4              88.67n ±  0%         78.89n ±  1%  -11.03% (p=0.002 n=6)
MemclrUnaligned/7_256-4            123.90n ±  1%         85.41n ±  2%  -31.07% (p=0.002 n=6)
MemclrUnaligned/7_4096-4            842.8n ±  2%         268.0n ±  0%  -68.20% (p=0.002 n=6)
MemclrUnaligned/7_65536-4          12.877µ ± 11%         3.348µ ±  0%  -74.00% (p=0.002 n=6)
MemclrUnaligned/0_1M-4              208.4µ ±  5%         104.6µ ±  1%  -49.80% (p=0.002 n=6)
MemclrUnaligned/0_4M-4              836.1µ ±  7%         419.3µ ±  2%  -49.85% (p=0.002 n=6)
MemclrUnaligned/0_8M-4              1.701m ±  9%         1.136m ± 12%  -33.21% (p=0.002 n=6)
MemclrUnaligned/0_16M-4             3.467m ± 16%         2.832m ±  4%  -18.30% (p=0.002 n=6)
MemclrUnaligned/0_64M-4             14.05m ±  2%         11.33m ±  2%  -19.38% (p=0.002 n=6)
MemclrUnaligned/1_1M-4              208.8µ ±  4%         104.7µ ±  1%  -49.85% (p=0.002 n=6)
MemclrUnaligned/1_4M-4              838.0µ ±  0%         418.3µ ±  2%  -50.09% (p=0.002 n=6)
MemclrUnaligned/1_8M-4              1.692m ±  1%         1.108m ±  3%  -34.53% (p=0.002 n=6)
MemclrUnaligned/1_16M-4             3.463m ± 20%         2.833m ±  6%  -18.21% (p=0.002 n=6)
MemclrUnaligned/1_64M-4             14.05m ±  4%         11.35m ±  2%  -19.28% (p=0.002 n=6)
MemclrUnaligned/4_1M-4              209.2µ ±  1%         104.7µ ±  7%  -49.94% (p=0.002 n=6)
MemclrUnaligned/4_4M-4              836.2µ ±  6%         418.8µ ± 15%  -49.91% (p=0.002 n=6)
MemclrUnaligned/4_8M-4              1.702m ±  0%         1.123m ±  4%  -34.01% (p=0.002 n=6)
MemclrUnaligned/4_16M-4             3.476m ±  8%         2.804m ±  2%  -19.34% (p=0.002 n=6)
MemclrUnaligned/4_64M-4             14.13m ± 25%         11.40m ±  0%  -19.33% (p=0.002 n=6)
MemclrUnaligned/7_1M-4              208.9µ ±  8%         104.9µ ±  6%  -49.81% (p=0.002 n=6)
MemclrUnaligned/7_4M-4              845.6µ ± 12%         418.2µ ±  7%  -50.54% (p=0.002 n=6)
MemclrUnaligned/7_8M-4              1.706m ± 10%         1.101m ±  3%  -35.48% (p=0.002 n=6)
MemclrUnaligned/7_16M-4             3.466m ±  3%         2.812m ±  2%  -18.86% (p=0.002 n=6)
MemclrUnaligned/7_64M-4             14.08m ±  5%         11.35m ± 18%  -19.37% (p=0.002 n=6)
GoMemclr/5-4                        49.79n ±  2%         50.34n ±  0%        ~ (p=0.394 n=6)
GoMemclr/16-4                       21.64n ±  0%         22.04n ±  7%   +1.85% (p=0.002 n=6)
GoMemclr/64-4                       47.93n ±  4%         23.77n ±  4%  -50.41% (p=0.002 n=6)
GoMemclr/256-4                      82.77n ±  2%         43.90n ±  0%  -46.96% (p=0.002 n=6)

Change-Id: I272967d001809ac4948e4118df6cdd0e0661ab96
Reviewed-on: https://go-review.googlesource.com/c/go/+/682195
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
2025-07-24 10:10:58 -07:00
kmvijay
a8edd99479 runtime: improvement in memclr for s390x
The unrolled loop for sizes >= 4KB is further optimized.
Offsets are computed and included in the XC instruction directly.
This reduces code size and instructions, improves performance.

goos: linux
goarch: s390x
pkg: runtime
                        | Orig_Memclr_for_benchstat_2.log | MM_Memclr_for_benchstat_No_VSTL_3.log  |
                        |             sec/op              |    sec/op     vs base                  |
Memclr/5                                     1.925n ±  0%   1.925n ±  0%        ~ (p=0.211 n=10)
Memclr/16                                    2.604n ± 13%   2.633n ± 11%        ~ (p=0.912 n=10)
Memclr/64                                    3.598n ±  2%   3.520n ±  5%        ~ (p=0.190 n=10)
Memclr/256                                   3.571n ± 12%   3.538n ± 11%        ~ (p=0.739 n=10)
Memclr/4096                                  15.15n ±  0%   15.14n ±  0%        ~ (p=0.204 n=10)
Memclr/65536                                 226.3n ±  0%   224.9n ±  0%   -0.62% (p=0.000 n=10)
Memclr/1M                                    12.77µ ±  0%   12.60µ ±  0%   -1.35% (p=0.000 n=10)
Memclr/4M                                    51.07µ ±  0%   50.37µ ±  0%   -1.38% (p=0.000 n=10)
Memclr/8M                                    102.1µ ±  0%   100.7µ ±  0%   -1.36% (p=0.000 n=10)
Memclr/16M                                   204.4µ ±  0%   201.6µ ±  0%   -1.35% (p=0.000 n=10)
Memclr/64M                                   965.4µ ±  0%   935.3µ ±  0%   -3.12% (p=0.000 n=10)
MemclrUnaligned/0_5                          2.671n ±  6%   2.618n ±  0%        ~ (p=0.194 n=10)
MemclrUnaligned/0_16                         3.143n ±  6%   2.955n ±  8%        ~ (p=0.089 n=10)
MemclrUnaligned/0_64                         3.622n ±  3%   3.571n ±  2%        ~ (p=0.304 n=10)
MemclrUnaligned/0_256                        3.712n ±  8%   3.653n ±  5%        ~ (p=0.754 n=10)
MemclrUnaligned/0_4096                       15.14n ±  0%   15.14n ±  0%        ~ (p=1.000 n=10) ¹
MemclrUnaligned/0_65536                      231.9n ±  0%   225.2n ±  0%   -2.91% (p=0.000 n=10)
MemclrUnaligned/1_5                          2.620n ±  8%   2.620n ±  0%        ~ (p=0.866 n=10)
MemclrUnaligned/1_16                         3.103n ±  7%   2.933n ±  9%        ~ (p=0.052 n=10)
MemclrUnaligned/1_64                         3.576n ±  3%   3.568n ±  3%        ~ (p=0.748 n=10)
MemclrUnaligned/1_256                        3.744n ±  9%   3.709n ± 10%        ~ (p=0.853 n=10)
MemclrUnaligned/1_4096                       26.23n ±  0%   26.23n ±  0%        ~ (p=1.000 n=10) ¹
MemclrUnaligned/1_65536                      401.1n ±  0%   399.5n ±  0%   -0.40% (p=0.000 n=10)
MemclrUnaligned/4_5                          2.620n ±  6%   2.623n ±  0%        ~ (p=0.985 n=10)
MemclrUnaligned/4_16                         3.095n ±  7%   3.005n ±  9%        ~ (p=0.247 n=10)
MemclrUnaligned/4_64                         3.586n ±  1%   3.578n ±  3%        ~ (p=1.000 n=10)
MemclrUnaligned/4_256                        3.843n ±  5%   3.742n ± 10%        ~ (p=0.971 n=10)
MemclrUnaligned/4_4096                       26.23n ±  0%   26.23n ±  0%        ~ (p=1.000 n=10)
MemclrUnaligned/4_65536                      401.1n ±  0%   399.5n ±  0%   -0.41% (p=0.000 n=10)
MemclrUnaligned/7_5                          2.634n ±  6%   2.644n ±  4%        ~ (p=0.896 n=10)
MemclrUnaligned/7_16                         3.119n ±  7%   3.044n ±  9%        ~ (p=0.529 n=10)
MemclrUnaligned/7_64                         3.568n ±  1%   3.585n ±  3%        ~ (p=0.499 n=10)
MemclrUnaligned/7_256                        3.741n ±  9%   3.629n ±  6%        ~ (p=0.853 n=10)
MemclrUnaligned/7_4096                       26.23n ±  0%   26.23n ±  0%        ~ (p=1.000 n=10) ¹
MemclrUnaligned/7_65536                      401.1n ±  0%   399.4n ±  0%   -0.42% (p=0.000 n=10)
MemclrUnaligned/0_1M                         12.82µ ±  0%   12.60µ ±  0%   -1.70% (p=0.000 n=10)
MemclrUnaligned/0_4M                         51.28µ ±  0%   50.37µ ±  0%   -1.77% (p=0.000 n=10)
MemclrUnaligned/0_8M                         102.5µ ±  0%   100.8µ ±  0%   -1.75% (p=0.000 n=10)
MemclrUnaligned/0_16M                        205.1µ ±  0%   201.7µ ±  0%   -1.62% (p=0.000 n=10)
MemclrUnaligned/0_64M                        965.2µ ±  0%   934.7µ ±  0%   -3.16% (p=0.000 n=10)
MemclrUnaligned/1_1M                         16.02µ ±  0%   15.81µ ±  0%   -1.34% (p=0.000 n=10)
MemclrUnaligned/1_4M                         64.03µ ±  0%   63.20µ ±  0%   -1.29% (p=0.000 n=10)
MemclrUnaligned/1_8M                         128.0µ ±  0%   126.4µ ±  0%   -1.27% (p=0.000 n=10)
MemclrUnaligned/1_16M                        256.3µ ±  0%   253.2µ ±  0%   -1.21% (p=0.000 n=10)
MemclrUnaligned/1_64M                        1.210m ±  0%   1.187m ±  0%   -1.88% (p=0.000 n=10)
MemclrUnaligned/4_1M                         16.03µ ±  0%   15.81µ ±  0%   -1.37% (p=0.000 n=10)
MemclrUnaligned/4_4M                         64.04µ ±  0%   63.20µ ±  0%   -1.31% (p=0.000 n=10)
MemclrUnaligned/4_8M                         128.0µ ±  0%   126.4µ ±  0%   -1.27% (p=0.000 n=10)
MemclrUnaligned/4_16M                        256.1µ ±  0%   253.0µ ±  0%   -1.20% (p=0.000 n=10)
MemclrUnaligned/4_64M                        1.210m ±  0%   1.188m ±  0%   -1.81% (p=0.000 n=10)
MemclrUnaligned/7_1M                         16.02µ ±  0%   15.81µ ±  0%   -1.32% (p=0.000 n=10)
MemclrUnaligned/7_4M                         64.06µ ±  0%   63.21µ ±  0%   -1.34% (p=0.000 n=10)
MemclrUnaligned/7_8M                         128.1µ ±  0%   126.4µ ±  0%   -1.29% (p=0.000 n=10)
MemclrUnaligned/7_16M                        256.2µ ±  0%   253.2µ ±  0%   -1.18% (p=0.000 n=10)
MemclrUnaligned/7_64M                        1.210m ±  0%   1.188m ±  0%   -1.82% (p=0.000 n=10)
MemclrRange/1K_2K                            841.1n ±  1%   879.0n ±  3%   +4.51% (p=0.002 n=10)
MemclrRange/2K_8K                            1.435µ ±  2%   1.415µ ±  0%   -1.39% (p=0.000 n=10)
MemclrRange/4K_16K                           1.241µ ±  0%   1.209µ ±  0%   -2.58% (p=0.000 n=10)
MemclrRange/160K_228K                        19.83µ ±  0%   19.59µ ±  0%   -1.22% (p=0.000 n=10)
MemclrKnownSize1                             1.732n ±  0%   1.732n ±  0%        ~ (p=0.474 n=10)
MemclrKnownSize2                             1.925n ±  3%   1.925n ±  1%        ~ (p=0.929 n=10)
MemclrKnownSize4                             1.732n ±  0%   1.732n ±  0%        ~ (p=1.000 n=10) ¹
MemclrKnownSize8                             1.732n ±  0%   1.732n ±  0%        ~ (p=1.000 n=10)
MemclrKnownSize16                            2.413n ±  9%   2.681n ± 14%  +11.10% (p=0.004 n=10)
MemclrKnownSize32                            3.284n ±  4%   3.328n ±  2%        ~ (p=0.671 n=10)
MemclrKnownSize64                            4.893n ±  1%   4.882n ±  1%        ~ (p=0.591 n=10)
MemclrKnownSize112                           5.623n ±  2%   5.596n ±  2%   -0.48% (p=0.027 n=10)
MemclrKnownSize128                           5.612n ±  1%   5.599n ±  0%        ~ (p=0.066 n=10)
MemclrKnownSize192                           7.128n ±  1%   7.337n ±  2%   +2.93% (p=0.000 n=10)
MemclrKnownSize248                           6.740n ±  1%   6.829n ±  3%   +1.33% (p=0.005 n=10)
MemclrKnownSize256                           3.657n ±  8%   3.512n ± 14%        ~ (p=0.436 n=10)
MemclrKnownSize512                           3.624n ±  3%   3.982n ±  9%   +9.88% (p=0.017 n=10)
MemclrKnownSize1024                          4.662n ±  0%   4.680n ±  0%   +0.39% (p=0.000 n=10)
MemclrKnownSize4096                          15.14n ±  0%   15.15n ±  0%   +0.07% (p=0.000 n=10)
MemclrKnownSize512KiB                        6.388µ ±  0%   6.309µ ±  0%   -1.24% (p=0.000 n=10)
geomean                                      268.9n         266.9n         -0.75%
¹ all samples are equal

Change-Id: I2911866fb82777311ec4219600fb48c85f7bf862
Reviewed-on: https://go-review.googlesource.com/c/go/+/682595
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-07-24 10:09:39 -07:00
Jes Cok
bd04f65511 internal/runtime/exithook: fix a typo
That is the say -> That is to say

Change-Id: I4a19d4c500103e16e6ae55f41a9fbdddd4bb84a8
GitHub-Last-Rev: 571d49ab8e
GitHub-Pull-Request: golang/go#74741
Reviewed-on: https://go-review.googlesource.com/c/go/+/690195
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
2025-07-24 10:03:26 -07:00
wingrez
5c8624a396 cmd/internal/goobj: make error output clear
Change-Id: Ic8510037e5d745f3c9f1b9c203439d3fe2e2d5a5
GitHub-Last-Rev: 4101a1595b
GitHub-Pull-Request: golang/go#74703
Reviewed-on: https://go-review.googlesource.com/c/go/+/689515
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-07-24 10:03:21 -07:00
Michael Matloob
44d73dfb4e cmd/go/internal/doc: clean up after merge with cmd/internal/doc
This is done in a separate CL to reduce the diffs from the previous CL.
Merge the main.go and doc.go files, and isolate the bootstrap-tagged
code to one file.

For #74667

Change-Id: I11bf0aa18beeb898937135f49f473c1ba1b7e756
Reviewed-on: https://go-review.googlesource.com/c/go/+/689875
Reviewed-by: Michael Matloob <matloob@google.com>
Auto-Submit: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-07-24 09:59:45 -07:00
Michael Matloob
bd446662dd cmd/internal/doc: merge with cmd/go/internal/doc
Now that cmd/doc has been removed, cmd/go/internal/doc is the only user
of the cmd/internal/doc code. Merge cmd/internal/doc into
cmd/go/internal/doc.

For #74667

Change-Id: I16bbe7b1f418b54ee411c8d6e6609c0973e40b3e
Reviewed-on: https://go-review.googlesource.com/c/go/+/689836
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-07-24 09:59:40 -07:00
Michael Matloob
da8b50c830 cmd/doc: delete
Users should not invoke "go tool doc" directly, but should instead run
"go doc". Remove "cmd/doc" because it no longer invokes the "doc" tool
but incorporates its logic directly.

Fixes #74667

Change-Id: I357a3d7e0ca075f028df66e34951a41354c08941
Reviewed-on: https://go-review.googlesource.com/c/go/+/689835
Reviewed-by: Michael Matloob <matloob@google.com>
Auto-Submit: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-07-24 09:59:36 -07:00
Roland Shoemaker
6669aa3b14 runtime: randomize heap base address
During initialization, allow randomizing the heap base address by
generating a random uint64 and using its bits to randomize various
portions of the heap base address.

We use the following method to randomize the base address:

* We first generate a random heapArenaBytes aligned address that we use
  for generating the hints.
* On the first call to mheap.grow, we then generate a random
  PallocChunkBytes aligned offset into the mmap'd heap region, which we
  use as the base for the heap region.
* We then mark a random number of pages within the page allocator as
  allocated.

Our final randomized "heap base address" becomes the first byte of
the first available page returned by the page allocator. This results
in an address with at least heapAddrBits-gc.PageShift-1 bits of
entropy.

Fixes #27583

Change-Id: Ideb4450a5ff747a132f702d563d2a516dec91a88
Reviewed-on: https://go-review.googlesource.com/c/go/+/674835
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-07-24 09:59:23 -07:00
Cuong Manh Le
26338a7f69 cmd/compile: use better fatal message for staticValue1
So the position of the wrong assignment statement will be reported,
instead of using incorrect base.Pos one.

Notice while fixing issue #73823.

Change-Id: I53f240bf99d11b5f5082ee4ca0903d9f099881b6
Reviewed-on: https://go-review.googlesource.com/c/go/+/675495
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Mateusz Poliwczak <mpoliwczak34@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2025-07-24 09:06:19 -07:00
Tobias Klauser
8587ba272e cmd/cgo: compare malloc return value to NULL instead of literal 0
Follow the pattern used in the other _cgoPREFIX_Cfunc* functions. This
also avoids a -Wzero-as-null-pointer-constant warning when compiling
with g++.

Change-Id: I95ac8842df048105f4c738f3603136d9cfa2dfdc
Reviewed-on: https://go-review.googlesource.com/c/go/+/664916
Auto-Submit: Keith Randall <khr@golang.org>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
2025-07-24 09:06:11 -07:00
Robert Griesemer
cae45167b7 go/types, types2: better error messages for certain type mismatches
When an untyped operand of a (typically binary) operation does not
match the type of the operand and an implicit conversion is not
possible, the error message should report a "type mismatch".

The type-checkers mostly did so, but not for untyped numeric types
to other types (e.g. an untyped int vs a function); in those cases
it reported that the (impossible) conversion failed.

Fix this for numeric types.
This also improves the position and messages for some incorrect
min/max built-in calls.

Fixes #73428.

Change-Id: I8af071918b73fcc72f16cc61858d7baca57fc259
Reviewed-on: https://go-review.googlesource.com/c/go/+/682495
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <mark@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
2025-07-24 09:04:33 -07:00
Keith Randall
2ddf542e4c cmd/compile: use ,ok return idiom for sparsemap.get
Change-Id: I89719b94de74a32402d02309515dffc4989484db
Reviewed-on: https://go-review.googlesource.com/c/go/+/681575
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@google.com>
2025-07-24 09:04:29 -07:00
Keith Randall
6505fcbd0a cmd/compile: use generics for sparse map
So it is easier to reuse this code with different key/value types.

Change-Id: I5a9e669769cf359b32f2fe784594868acdee4d02
Reviewed-on: https://go-review.googlesource.com/c/go/+/681175
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-07-24 09:04:22 -07:00
Keith Randall
14f5eb7812 cmd/api: rerun updategolden
Not sure why, but

    go test cmd/api --updategolden

makes changes to the golden files. The changes are just moving things
around, no actual semantic changes. But this is confusing for new
contributors when updating api files.

Change-Id: If27b039f47b94953b7891f8f6b6999ed79953198
Reviewed-on: https://go-review.googlesource.com/c/go/+/675616
Auto-Submit: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
2025-07-24 09:04:17 -07:00
Tobias Klauser
52b6d7f67a runtime: drop NetBSD kernel bug sysmon workaround fixed in NetBSD 9.2
The NetBSD releases supported by the NetBSD project as off today are 9.4
and 10.1. The Go project's NetBSD builders are on 9.3. Thus, it is fine
to drop the workaround which was only needed for NetBSD before 9.2.

Fixes #46495

Cq-Include-Trybots: luci.golang.try:gotip-netbsd-arm64
Change-Id: I3c2ec42fb0f08f7dafdfb7f1dbd97853afc16386
Reviewed-on: https://go-review.googlesource.com/c/go/+/687735
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Auto-Submit: Benny Siegert <bsiegert@gmail.com>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-07-24 09:01:30 -07:00
Adi Aloni
1ebebf1cc1 cmd/go: clean should respect workspaces
The existing implementation doesn't invoke modload.InitWorkfile during
runClean which in turn causes go clean to ignore workspaces and
consequentially workspace vendoring.

Fixes #74337

Change-Id: I295a1fcc5e81d096971c8cee9c9baa840c7725e7
Reviewed-on: https://go-review.googlesource.com/c/go/+/682856
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
Auto-Submit: Sam Thanawalla <samthanawalla@google.com>
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>
2025-07-24 09:01:23 -07:00
Filip Petkovski
6536a93547 encoding/json/jsontext: preserve buffer capacity in Decoder.Reset
The Decoder.Reset method is not preserving the internal buffer between
resets, causing buffer capacity to be lost and resulting in unnecessary
allocations when reusing decoders. This is particularly problematic when
decoding many small messages.

This commit fixes the Reset method to preserve the internal buffer. It
makes sure aliasing is removed if the buffer currently points to an
internal byte slice of a bytes.Buffer. It adds a TestDecoderReset test
structured into subtests to better validate the different scenarios.

Change-Id: Ia685bff47034598224489173bb7f2ffd48e89da5
GitHub-Last-Rev: 462ddc9364
GitHub-Pull-Request: golang/go#74120
Reviewed-on: https://go-review.googlesource.com/c/go/+/681177
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Joseph Tsai <joetsai@digital-static.net>
2025-07-24 09:01:15 -07:00
Michael Matloob
efc37e97c0 cmd/go: always return the cached path from go tool -n
If we're running go tool -n always return the cached path of the tool.
We can't always use the cached path when running the tool because if we
copied the tool to the cached location in the same process and then try
to run it we'll run into #22315, producing spurious ETXTBSYs.

Fixes #72824

Change-Id: I81f23773b9028f955ccc97453627ae4f2573814b
Reviewed-on: https://go-review.googlesource.com/c/go/+/688895
Auto-Submit: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-07-24 08:59:40 -07:00
Michael Pratt
98a031193b runtime: check TestUsingVDSO ExitError type assertion
Currently this test panics if the error is not an ExitError. We aren't
expecting other errors, but we want to continue to the t.Fatal so the
error contents actually get logged.

For #74672.

Change-Id: I6a6a636cee5ddac500ed7ec549340b02944101ab
Reviewed-on: https://go-review.googlesource.com/c/go/+/689956
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Michael Pratt <mpratt@google.com>
2025-07-23 14:21:16 -07:00
Michael Anthony Knyszek
6bb42997c8 doc/next: initialize
Initialize the doc/next directory for the next release by copying the
contents of doc/initial into it.

For #73829.

Change-Id: Ia473d0430043920fc5135844ec6c117eb1b00217
Reviewed-on: https://go-review.googlesource.com/c/go/+/689878
Reviewed-by: Mark Freeman <mark@golang.org>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-07-23 11:41:17 -07:00
Michael Anthony Knyszek
2696a11a97 internal/goversion: update Version to 1.26
Go 1.26 is in the process of being opened for development (to be
eventually released). This change marks the very beginning of its
development cycle, updating the Version value accordingly.

For #40705.
For #73829.

Change-Id: Ie4ce2d38160dd6283c08e10ecbd7d3a43ed92b48
Reviewed-on: https://go-review.googlesource.com/c/go/+/689877
Reviewed-by: Mark Freeman <mark@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-07-23 11:41:10 -07:00
Junyang Shao
41054cdb1c [dev.simd] simd, internal/cpu: support more AVX CPU Feature checks
This CL adds more checks, it also changes HasAVX512GFNI to be exactly
checking GFNI instead of being a virtual feature.

This CL copies its logic from x/sys/arch.

Change-Id: I4612b0409b8a3518928300562ae08bcf123d53a7
Reviewed-on: https://go-review.googlesource.com/c/go/+/688276
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-07-21 14:26:04 -07:00
Junyang Shao
957f06c410 [dev.simd] cmd/compile, simd: support load from bits for mask
This CL is partially generated by CL 688855.

Change-Id: I68d5fbad9445a3d2cf671822be1c0b82e7290396
Reviewed-on: https://go-review.googlesource.com/c/go/+/688875
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-07-21 10:28:59 -07:00
Junyang Shao
f0e9dc0975 [dev.simd] cmd/compile: fix opLen(2|3)Imm8_2I intrinsic function
This function reads the const from the wrong arg, this CL fixes it.

Change-Id: Icd38977a35f0df9064efb290fa6390453d6b9e5b
Reviewed-on: https://go-review.googlesource.com/c/go/+/688595
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-07-21 10:27:18 -07:00
Junyang Shao
03a3887f31 [dev.simd] simd: clean up masked op doc
This CL is generated by CL 688395.

Change-Id: I40c6a64c6002b28040e6af746481b4deb2049179
Reviewed-on: https://go-review.googlesource.com/c/go/+/688396
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-07-17 21:31:20 -07:00
Junyang Shao
c61743e4f0 [dev.simd] cmd/compile, simd: reorder PairDotProdAccumulate
This CL reorderes the param order of PairDotProdAccumulate family to be
dotprod(x, y) + z instead of the old dotprod(y, z) + x.

This CL also updates some documentation of other ML Ops.

This CL added a test to test the behavior is correct.

This CL is partially generated by CL 688115.

Change-Id: I76a6ee55a2ad8e3aff388d7e4fa5218ec0e4800d
Reviewed-on: https://go-review.googlesource.com/c/go/+/688095
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-07-17 21:31:14 -07:00
Junyang Shao
ef5f6cc921 [dev.simd] cmd/compile: adjust param order for AndNot
This CL adjusts the parameter order of AndNot, making it x &^ y instead
of ^x & y.

This CL also added a test.

This CL is partially generated by CL 687977.

Change-Id: I244e7b887991dc97e695131a5287af1b0e6fc3ce
Reviewed-on: https://go-review.googlesource.com/c/go/+/687996
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-07-15 14:54:29 -07:00
Junyang Shao
6d10680141 [dev.simd] cmd/compile, simd: add Compress
This CL is generated by CL 687975.

Change-Id: I21707d108773cc6d8e6f07aaed60e756faa1e6cb
Reviewed-on: https://go-review.googlesource.com/c/go/+/687995
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-07-15 14:54:17 -07:00
Junyang Shao
17baae72db [dev.simd] simd: default mask param's name to mask
This CL is generated by CL 687920.

Change-Id: Iab0d7c28c923380df51806ba572ec59f9b031de8
Reviewed-on: https://go-review.googlesource.com/c/go/+/687955
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-07-15 14:54:09 -07:00
Junyang Shao
01f7f57025 [dev.simd] cmd/compile, simd: add variable Permute
This CL also added some tests for them.

This CL is generated by CL 687919.

Change-Id: I9ddd2cd23bb98ecca91bfbeaffd62faa4bd85e0d
Reviewed-on: https://go-review.googlesource.com/c/go/+/687939
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-07-15 14:53:57 -07:00
Junyang Shao
f5f42753ab [dev.simd] cmd/compile, simd: add VDPPS
This CL is generated by CL 687915.

Change-Id: I1a2fb031c086b2b23fd135c48f8494ba5122493a
Reviewed-on: https://go-review.googlesource.com/c/go/+/687916
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-07-14 11:20:47 -07:00
Junyang Shao
08ffd66ab2 [dev.simd] simd: updates CPU Feature in doc
This CL is generated by CL 687655.

Change-Id: I12d7516a9a51a1d65ec3aa6f0fd754248df1d6de
Reviewed-on: https://go-review.googlesource.com/c/go/+/687675
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-07-14 10:13:23 -07:00
Junyang Shao
3f789721d6 [dev.simd] cmd/compile: mark SIMD types non-fat
This CL fixes the merge locals error.
The culprit is that liveness analysis wrongly mark SIMD structs fat,
hence making `StoreReg` of SIMD vectors not a varkill effect, making the
liveness range of SIMD vectors not closed correctly, further making
mergelocals merged 2 concurrently-live SIMD vectors.

Is looks like mergelocals will treat the live range as one instruction
if it's not closed: [st, st+1). Should we make it [st, +inf) instead? So
that we won't have similar errors in the future.

Also, I feel we really need to examine every "case types.TSTRUCT" or "if
t.Kind() == types.TSTRUCT" in the codebase correctly for SIMD types...

Change-Id: I2f4f4f36a890bd317d582cfa73a8f6a789382d91
Reviewed-on: https://go-review.googlesource.com/c/go/+/687775
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-07-14 09:35:17 -07:00
Junyang Shao
b69622b83e [dev.simd] cmd/compile, simd: adjust Shift.* operations
This CL does:
1. Removes ShiftRightSignExtended, default signed vectors to shift
   arithmetic, and unsigned to shift logical.
2. Add the missing Shifts which were left out by YAML error in the
   generator.

This CL is generated by CL 687595.

Change-Id: I663115498adb91c82e89a8476e6748794e997cfa
Reviewed-on: https://go-review.googlesource.com/c/go/+/687596
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-07-11 15:00:44 -07:00
Junyang Shao
4993a91ae1 [dev.simd] simd: change imm param name to constant
This CL is generated by CL 687416.

Change-Id: I3e878264fe5269635309b904576e8807ac723573
Reviewed-on: https://go-review.googlesource.com/c/go/+/687377
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
2025-07-11 15:00:36 -07:00
Junyang Shao
bbb6dccd84 [dev.simd] simd: fix documentations
This CL is generated by CL 687415.

Change-Id: I2d778717013af613c442116658f42a4a4cc5d734
Reviewed-on: https://go-review.googlesource.com/c/go/+/687376
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-07-11 15:00:25 -07:00
Junyang Shao
1440ff7036 [dev.simd] cmd/compile: exclude simd vars from merge local
It looks like mergelocals pass's liveness analysis does not handle simd
variables well.

The added test forces two vectors to spill in a way that does not work
with mergelocals: if the added check is removed, then `v` and `m` will
be marked merged and spilled to the same location, failing the test.

Change-Id: Ife4e4e939565d817fc24f7180cb791a5084dd191
Reviewed-on: https://go-review.googlesource.com/c/go/+/687375
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-07-11 12:07:31 -07:00
Junyang Shao
ccb43dcec7 [dev.simd] cmd/compile: add VZEROUPPER and VZEROALL inst
Change-Id: I41d60561fefdfa676e8b22648871ff1004711ac9
Reviewed-on: https://go-review.googlesource.com/c/go/+/686840
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-07-11 11:01:55 -07:00
Cherry Mui
21596f2f75 [dev.simd] all: merge master (88cf0c5) into dev.simd
Merge List:

+ 2025-07-11 88cf0c5d55 cmd/link: do size fixups after symbol references are loaded
+ 2025-07-10 7a38975a48 os: trivial comment fix
+ 2025-07-10 aa5de9ebb5 synctest: fix comments for time.Now() in synctests
+ 2025-07-10 63ec70d4e1 crypto/cipher: Fix comment punctuation
+ 2025-07-09 8131635e5a runtime: run TestSignalDuringExec in its own process group
+ 2025-07-09 67c1704444 crypto/tls: empty server_name conf. ext. from server
+ 2025-07-08 54c9d77630 cmd/go: disable support for multiple vcs in one module
+ 2025-07-08 fca43a8436 internal: make struct comment match struct name
+ 2025-07-08 bb917bb030 cmd/compile: document that nosplit directive is unsafe
+ 2025-07-08 a5bda585d5 cmd/compile: run fmt on ssa
+ 2025-07-07 86b5ba7310 internal/trace: only test for sync preemption if async preemption is off
+ 2025-07-07 ef46e1b164 cmd/internal/doc: fix GOROOT skew and path joining bugs
+ 2025-07-07 75b43f9a97 runtime: make traceStack testable and add a benchmark
+ 2025-07-07 20978f46fd crypto/rsa: remove another forgotten note to future self
+ 2025-07-07 33fb4819f5 cmd/compile/internal/ssa: skip EndSequence entries in TestStmtLines
+ 2025-07-07 a995269a93 sort: clarify Less doc
+ 2025-07-03 6c3b5a2798 runtime: correct vdsoSP on S390X
+ 2025-07-03 dd687c3860 hash: document that Clone may only return ErrUnsupported or a nil error
+ 2025-07-02 b325151453 cmd/cgo/internal/testsanitizers: skip asan tests when FIPS140 mode is on
+ 2025-07-02 15d9fe43d6 testing/synctest: explicitly state Run will be removed in Go 1.26
+ 2025-07-01 de646d94f7 cmd/go/internal/modindex: apply changes in CL 502615 to modindex package
+ 2025-07-01 2f653a5a9e crypto/tls: ensure the ECDSA curve matches the signature algorithm
+ 2025-07-01 6e95fd96cc crypto/ecdsa: fix crypto/x509 godoc links
+ 2025-07-01 7755a05209 Revert "crypto/internal/fips140/subtle: add assembly implementation of xorBytes for arm"
+ 2025-07-01 d168ad18e1 slices: update TestIssue68488 to avoid false positives
+ 2025-07-01 27ad1f5013 internal/abi: fix comment on NonEmptyInterface
+ 2025-06-30 86fca3dcb6 encoding/json/jsontext: use bytes.Buffer.AvailableBuffer
+ 2025-06-30 6bd9944c9a encoding/json/v2: avoid escaping jsonopts.Struct
+ 2025-06-30 e46d586edd cmd/compile/internal/escape: add debug hash for literal allocation optimizations
+ 2025-06-30 479b51ee1f cmd/compile/internal/escape: stop disabling literal allocation optimizations when coverage is enabled
+ 2025-06-30 8002d283e8 crypto/tls: update bogo version
+ 2025-06-30 fdd7713fe5 internal/goexperiment: fix godoc formatting

Change-Id: I074e6c75778890930975925c016004aabca2b9d1
2025-07-11 11:41:23 -04:00
Junyang Shao
ab7f839280 [dev.simd] cmd/compile: fix maskreg/simdreg chaos
This CL fixes some errors left by CL 685895.

Change-Id: I35ee36287fc964a82fd3c88764b688bd4491be65
Reviewed-on: https://go-review.googlesource.com/c/go/+/687095
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-07-10 11:16:50 -07:00
Junyang Shao
47b07a87a6 [dev.simd] cmd/compile, simd: fix Int64x2 Greater output type to mask
This CL is generated by CL 686821.

Change-Id: I4bc4fa717ff858299b13955a40e750709a796fba
Reviewed-on: https://go-review.googlesource.com/c/go/+/686998
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Junyang Shao <shaojunyang@google.com>
2025-07-09 14:42:09 -07:00
David Chase
08cd62e9f5 [dev.simd] cmd/compile: remove X15 from register mask
mistakes were made. X15 is reserved zero and
cannot be allocated normally.

Change-Id: I70b24aa07dc31f9b40e306a9aae1d53dfea794f9
Reviewed-on: https://go-review.googlesource.com/c/go/+/686996
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-07-09 12:15:07 -07:00
David Chase
9ea33ed538 [dev.simd] cmd/compile: output of simd generator, more ... rewrite rules
Generated by simdgen CL 686378

Change-Id: I876ab91085c266ced59fc82ea12be709dc7eb721
Reviewed-on: https://go-review.googlesource.com/c/go/+/686495
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-07-09 12:10:45 -07:00
Junyang Shao
aab8b173a9 [dev.simd] cmd/compile, simd: Int64x2 Greater and Uint* Equal
This CL is generated by CL 686817.

Change-Id: I19b8e468594514b2b1c99f8ad766f78b5e194c80
Reviewed-on: https://go-review.googlesource.com/c/go/+/686876
TryBot-Bypass: David Chase <drchase@google.com>
Reviewed-by: David Chase <drchase@google.com>
2025-07-09 11:06:40 -07:00
Junyang Shao
8db7f41674 [dev.simd] cmd/compile: use upper registers for AVX512 simd ops
This CL is generated by CL 686775.

Change-Id: I10606cfdd4be015c8d251ba4275e1191d5bf0944
Reviewed-on: https://go-review.googlesource.com/c/go/+/686695
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-07-09 11:06:34 -07:00
Junyang Shao
574854fd86 [dev.simd] runtime: save Z16-Z31 registers in async preempt
The register allocation will use the upper register soon, this CL is to
enable that.

Change-Id: I4d7285e08b95f4e6ebee72594dfbe8d1199f09ed
Reviewed-on: https://go-review.googlesource.com/c/go/+/686498
TryBot-Bypass: David Chase <drchase@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Commit-Queue: David Chase <drchase@google.com>
2025-07-09 11:06:24 -07:00
Junyang Shao
5429328b0c [dev.simd] cmd/compile: change register mask names for simd ops
This CL contains codes generated by CL 686556.

Change-Id: I4d7287476b478efdc186a64c12de33528c7fb0af
Reviewed-on: https://go-review.googlesource.com/c/go/+/686476
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-07-09 10:48:04 -07:00
Junyang Shao
029d7ec3e9 [dev.simd] cmd/compile, simd: rename Masked$OP to $(OP)Masked.
This CL is generated by CL 686575.

Change-Id: I1483189a1ae9bed51446fd69daab3f7b128549ae
Reviewed-on: https://go-review.googlesource.com/c/go/+/686516
Reviewed-by: David Chase <drchase@google.com>
TryBot-Bypass: David Chase <drchase@google.com>
2025-07-09 10:18:01 -07:00
Junyang Shao
983e81ce57 [dev.simd] simd: rename stubs_amd64.go to ops_amd64.go
Change-Id: I42c3c8aed8bb19e251ae2aa0ee0f08e7796f1f4a
Reviewed-on: https://go-review.googlesource.com/c/go/+/686497
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-07-09 10:17:21 -07:00
Junyang Shao
56ca67682b [dev.simd] cmd/compile, simd: remove FP bitwise logic operations.
This CL is generated by CL 686555.

Change-Id: I0efb86a919692cd97c1c5b6365d77361a30bf7cf
Reviewed-on: https://go-review.googlesource.com/c/go/+/686496
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-07-08 14:01:22 -07:00
Junyang Shao
0870ed04a3 [dev.simd] cmd/compile: make compares between NaNs all false.
This CL updates the predicate immediate value of Equal, GreaterEqual,
Greater.

This CL is generated by Cl 686215.

Change-Id: I77fc411f40f5c790a1be7f3d5ffd11f12df50ec7
Reviewed-on: https://go-review.googlesource.com/c/go/+/686235
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-07-08 13:07:13 -07:00
David Chase
24f2b8ae2e [dev.simd] simd: {Int,Uint}{8x{16,32},16x{8,16}} subvector loads/stores from slices.
Includes tests, which turned out to be necessary.

Change-Id: I13437f3c1b6a614481d4bef332666485dbee4c4e
Reviewed-on: https://go-review.googlesource.com/c/go/+/684839
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-07-08 07:07:21 -07:00
David Chase
2bb45cb8a5 [dev.simd] cmd/compile: minor tweak for race detector
This makes the front-end a little bit less temp-happy
when instrumenting, which repairs the "is it a constant?"
test in the simd intrinsic conversion which is otherwise
broken by race detection.

Also, this will perhaps be better code.

Change-Id: I84b7a45b7bff62bb2c9f9662466b50858d288645
Reviewed-on: https://go-review.googlesource.com/c/go/+/685637
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-07-08 07:06:02 -07:00
David Chase
43a61aef56 [dev.simd] cmd/compile: add EXTRACT[IF]128 instructions
This is generated by simdgen CL 684080
and should be submitted after it.

Also includes tests.

Change-Id: I1d680911134d8fb92f4deccae4ec373f3ed9f752
Reviewed-on: https://go-review.googlesource.com/c/go/+/684115
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-07-07 18:37:28 -07:00
David Chase
292db9b676 [dev.simd] cmd/compile: add INSERT[IF]128 instructions
This CL is created by simdgen CL 684055 and
should be submitted after it.

Also includes a test.

Change-Id: I2ad7ae51d11cfc19745e866150e2eaf010d4ea49
Reviewed-on: https://go-review.googlesource.com/c/go/+/684077
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-07-07 16:52:36 -07:00
Junyang Shao
d8fa853b37 [dev.simd] cmd/compile: make regalloc simd aware on copy
When making a temporary copy, regalloc should be aware of the SIMD-ness
of the type; otherwise it might generate invalid moves.

Change-Id: I722c3a0111d0990af32d84c6aaa151f1ac8c1f00
Reviewed-on: https://go-review.googlesource.com/c/go/+/685895
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-07-07 09:58:31 -07:00
David Chase
dfd75f82d4 [dev.simd] cmd/compile: output of simdgen with invariant type order
The old order was somewhat input-dependent, and sometimes
produced spurious changes.  This is the last spurious change,
"once and for all!!!"

Generated by simdgen CL 685595

Change-Id: Ic66d0263f3dd9f1ef9502c2deeeb8300ca3bac75
Reviewed-on: https://go-review.googlesource.com/c/go/+/685615
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-07-07 08:12:30 -07:00
David Chase
72c39ef834 [dev.simd] cmd/compile: fix the "always panic" code to actually panic
without this change, the intrinsics of non-constant immediates
just substitute a zero, which is wrong.

Change-Id: I2c39ebedcfb0d0d6c072f4434f393027c6f3f033
Reviewed-on: https://go-review.googlesource.com/c/go/+/685575
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-07-04 18:23:14 -07:00
Junyang Shao
1ee72a15a3 [dev.simd] internal/cpu: add GFNI feature check
This CL amends HasAVX512 flag with GFNI check.

This is needed because our SIMD API supports Galois Field operations.

Change-Id: I3e957b7b2215d2b7b6b8a7a0ca3e2e60d453b2e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/685295
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-07-01 13:51:57 -07:00
Austin Clements
0710cce6eb [dev.simd] runtime: remove write barrier in xRegRestore
Currently, there's a write barrier in xRegRestore when it assigns
pp.xRegs.cache = gp.xRegs.state. This is bad because that gets called
on the asyncPreempt return path, where we have really limited stack
space, and we don't currently account for this write barrier.

We can't simply mark xRegState as sys.NotInHeap because it's also
embedded in runtime.p as register scratch space, and runtime.p is heap
allocated.

Hence, to fix this, we rename xRegState to just "xRegs" and introduce
a wrapper "xRegState" type that embeds xRegs and is itself marked
sys.NotInHeap. Then, anywhere we need a manually-managed pointer to
register state, we use the new type.

To ensure this doesn't happen again in the future, we also mark
asyncPreempt2 as go:nowritebarrierrec.

Change-Id: I5ff4841e55ff20047ff7d253ab659ab77aeb3391
Reviewed-on: https://go-review.googlesource.com/c/go/+/684836
Auto-Submit: Austin Clements <austin@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-06-30 14:41:26 -07:00
Junyang Shao
59846af331 [dev.simd] cmd/compile, simd: cleanup operations and documentations
This CL is generated by CL 685035.

Change-Id: Ic3a043e83e62d0be77de97ef63a20d34bf1e2dc0
Reviewed-on: https://go-review.googlesource.com/c/go/+/685055
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-06-30 13:27:40 -07:00
Cherry Mui
f849225b3b [dev.simd] all: merge master (740857f) into dev.simd
Merge List:

+ 2025-06-30 740857f529 runtime: stash allpSnapshot on the M
+ 2025-06-30 9ae38be302 sync: disassociate WaitGroups from bubbles on Wait
+ 2025-06-30 4731832342 crypto/hmac: wrap ErrUnsupported returned by Clone
+ 2025-06-30 03ad694dcb runtime: update skips for TestGdbBacktrace
+ 2025-06-30 9d1cd0b881 iter: add missing type parameter in doc
+ 2025-06-29 acb914f2c2 cmd/doc: fix -http on Windows
+ 2025-06-27 b51f1cdb87 runtime: remove arbitrary 5-second timeout in TestNeedmDeadlock
+ 2025-06-27 f1e6ae2f6f reflect: fix TypeAssert on nil interface values
+ 2025-06-27 e81c624656 os: use minimal file permissions when opening parent directory in RemoveAll
+ 2025-06-27 2a22aefa1f encoding/json: add security section to doc
+ 2025-06-27 742fda9524 runtime: account for missing frame pointer in preamble
+ 2025-06-27 fdc076ce76 net/http: fix RoundTrip context cancellation for js/wasm
+ 2025-06-27 d9d2cadd63 encoding/json: fix typo in hotlink for jsontext.PreserveRawStrings
+ 2025-06-26 0f8ab2db17 cmd/link: permit a larger size BSS reference to a smaller DATA symbol
+ 2025-06-26 988a20c8c5 cmd/compile/internal/escape: evaluate any side effects when rewriting with literals
+ 2025-06-25 b5d555991a encoding/json/jsontext: remove Encoder.UnusedBuffer
+ 2025-06-25 0b4d2eab2f encoding/json/jsontext: rename Encoder.UnusedBuffer as Encoder.AvailableBuffer

Change-Id: Iea44ab825bdf087fbe7570df8d2d66d1d3327c31
2025-06-30 15:10:56 -04:00
Austin Clements
9eeb1e7a9a [dev.simd] runtime: save AVX2 and AVX-512 state on asynchronous preemption
Based on CL 669415 by shaojunyang@google.com.

Change-Id: I574f15c3b18a7179a1573aaf567caf18d8602ef1
Reviewed-on: https://go-review.googlesource.com/c/go/+/680900
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Austin Clements <austin@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-06-30 11:50:37 -07:00
Austin Clements
426cf36b4d [dev.simd] runtime: save scalar registers off stack in amd64 async preemption
Asynchronous preemption must save all registers that could be in use
by Go code. Currently, it saves all of these to the goroutine stack.
As a result, the stack frame requirements of asynchronous preemption
can be rather high. On amd64, this requires 368 bytes of stack space,
most of which is the XMM registers. Several RISC architectures are
around 0.5 KiB.

As we add support for SIMD instructions, this is going to become a
problem. The AVX-512 register state is 2.5 KiB. This well exceeds the
nosplit limit, and even if it didn't, could constrain when we can
asynchronously preempt goroutines on small stacks.

This CL fixes this by moving pure scalar state stored in non-GP
registers off the stack and into an allocated "extended register
state" object. To reduce space overhead, we only allocate these
objects as needed. While in the theoretical limit, every G could need
this register state, in practice very few do at a time.

However, we can't allocate when we're in the middle of saving the
register state during an asynchronous preemption, so we reserve
scratch space on every P to temporarily store the register state,
which can then be copied out to an allocated state object later by Go
code.

This commit only implements this for amd64, since that's where we're
about to add much more vector state, but it lays the groundwork for
doing this on any architecture that could benefit.

Change-Id: I123a95e21c11d5c10942d70e27f84d2d99bbf735
Reviewed-on: https://go-review.googlesource.com/c/go/+/680898
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Austin Clements <austin@google.com>
2025-06-30 11:50:33 -07:00
David Chase
ead249a2e2 [dev.simd] cmd/compile: reorder operands for some simd operations
This adds support for one ad hoc reordering, which
requires a new intrinsic-to-ssa helper matching the
name that is used in the generator (and this in the
generated code).  In this case, it is opLen{2,3}Imm8_2I
which expects the immediate after the self (0) and
first (1) parameters to the method, and before the
mask if there is one.  I.e., the immediate is arg 2
in the call.

The changes to simdintrinsics and stubs are generated
by simdgen CL 684019.

Change-Id: Ia54aab9825d469a2f3efa6d1fb079242181c0ca6
Reviewed-on: https://go-review.googlesource.com/c/go/+/684776
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-06-30 09:43:57 -07:00
David Chase
55665e1e37 [dev.simd] cmd/compile: undoes reorder transform in prior commit, changes names
paired with simdgen CL 684655

Change-Id: I819eb601c07b21747d8a1442eb1efbf9fa5aac1d
Reviewed-on: https://go-review.googlesource.com/c/go/+/684775
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-06-30 09:42:47 -07:00
Junyang Shao
10c9621936 [dev.simd] cmd/compile, simd: add galois field operations
This CL is generated by CL 684275.

Change-Id: Ie1efd0979af0ef0a56781bf9013071bf4d2c52c5
Reviewed-on: https://go-review.googlesource.com/c/go/+/684175
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-06-26 20:59:45 -07:00
Junyang Shao
e61ebfce56 [dev.simd] cmd/compile, simd: add shift operations
This CL is generated by CL 683475.

Change-Id: I9e3ac6aff6f711cb26ff85e4c8729d9e2cc38e7d
Reviewed-on: https://go-review.googlesource.com/c/go/+/683715
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-06-26 20:59:39 -07:00
David Chase
35b8cf7fed [dev.simd] cmd/compile: tweak sort order in generator
This CL is created by simdgen CL 684056

Change-Id: Ie4240098bbe701531ab82d5200e92857726f1ba7
Reviewed-on: https://go-review.googlesource.com/c/go/+/684076
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-06-26 13:34:41 -07:00
David Chase
7fadfa9638 [dev.simd] cmd/compile: add simd VPEXTRA*
This CL is generated by simdgen CL 683836
and this CL should be submitted after its
generator.

Change-Id: I1aa893b185826ad1f9fb60b85c75eda31f70623b
Reviewed-on: https://go-review.googlesource.com/c/go/+/683797
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-06-26 13:34:29 -07:00
David Chase
0d8cb89f5c [dev.simd] cmd/compile: support simd(imm,fp) returns gp
These changes are required to make gp-returning simd
ops work.  amd64/ssa.go includes a new code generator
helper, gc/main.go initializes intrinsics AFTER
the types, ssa/_gen/*AMD64.go add another register
shape to the simd ops function.

This CL should be submitted after simdgen CL 683858
which generated some of the changes.

Change-Id: I0af752ba8882fa131b875ff9c741ef70afbc60d1
Reviewed-on: https://go-review.googlesource.com/c/go/+/683816
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-06-26 05:22:45 -07:00
Cherry Mui
f4a7c124cc [dev.simd] all: merge master (f8ccda2) into dev.simd
Merge List:

+ 2025-06-25 f8ccda2e05 runtime: make explicit nil check in (*spanInlineMarkBits).init
+ 2025-06-25 f069a82998 runtime: note custom GOMAXPROCS even if value doesn't change
+ 2025-06-24 e515ef8bc2 context: fix typo in context_test.go
+ 2025-06-24 47b941f445 cmd/link: add one more linkname to the blocklist
+ 2025-06-24 34cf5f6205 go/types: add test for interface method field type
+ 2025-06-24 6e618cd42a encoding/json: use zstd compressed testdata
+ 2025-06-24 fcb9850859 net/http: reduce allocs in CrossOriginProtection.Check
+ 2025-06-24 11f11f2a00 encoding/json/v2: support ISO 8601 durations
+ 2025-06-24 62deaf4fb8 doc: fix links to runtime Environment Variables
+ 2025-06-24 2e9bb62bfe encoding/json/v2: reject unquoted dash as a JSON field name
+ 2025-06-23 ed7815726d encoding/json/v2: report error on time.Duration without explicit format
+ 2025-06-23 f866958246 cmd/dist: test encoding/json/... with GOEXPERIMENT=jsonv2
+ 2025-06-23 f77a0aa6b6 internal/trace: improve gc-stress test
+ 2025-06-23 4506796a6e encoding/json/jsontext: consistently use JSON terminology
+ 2025-06-23 456a90aa16 runtime: add missing unlock in sysReserveAlignedSbrk
+ 2025-06-23 1cf6386b5e Revert "go/types, types2: don't register interface methods in Info.Types map"
+ 2025-06-20 49cdf0c42e testing, testing/synctest: handle T.Helper in synctest bubbles
+ 2025-06-20 3bf1eecbd3 runtime: fix struct comment
+ 2025-06-20 8ed23a2936 crypto/cipher: fix link to crypto/aes
+ 2025-06-20 ef60769b46 go/doc: add a golden test that reproduces #62640
+ 2025-06-18 8552bcf7c2 cmd/go/internal/fips140: ignore GOEXPERIMENT on error
+ 2025-06-18 4c7567290c runtime: set mspan limit field early and eagerly
+ 2025-06-18 c6ac736288 runtime: prevent mutual deadlock between GC stopTheWorld and suspendG
+ 2025-06-17 53af292aed encoding/json/jsontext: fix spelling error
+ 2025-06-16 d058254689 cmd/dist: always include variant in package names
+ 2025-06-16 3254c2bb83 internal/reflectlite: fix comment about meaning of flag field
+ 2025-06-16 816199e421 runtime: don't let readTrace spin on trace.shutdown
+ 2025-06-16 ea00461b17 internal/trace: make Value follow reflect conventions
+ 2025-06-13 96a6e147b2 runtime: comment that some linknames are used by runtime/trace
+ 2025-06-13 644905891f runtime: remove unused unique.runtime_blockUntilEmptyFinalizerQueue
+ 2025-06-13 683810a368 cmd/link: block new standard library linknames
+ 2025-06-12 9149876112 all: replace a few user-visible mentions of golang.org and godoc.org
+ 2025-06-12 934d5f2cf7 internal/trace: end test programs with SIGQUIT
+ 2025-06-12 5a08865de3 net: remove some BUG entries
+ 2025-06-11 d166a0b03e encoding/json/jsontext, encoding/json/v2: document experimental nature
+ 2025-06-11 d4c6effaa7 cmd/compile: add up-to-date test for generated files
+ 2025-06-10 7fa2c736b3 os: disallow Root.Remove(".") on Plan 9, js, and Windows
+ 2025-06-10 281cfcfc1b runtime: handle system goroutines later in goroutine profiling
+ 2025-06-10 4f86f22671 testing/synctest, runtime: avoid panic when using linker-alloc WG from bubble

Change-Id: I8bbbf40ce053a80395b08977e21b1f34c67de117
2025-06-25 15:00:04 -04:00
Junyang Shao
4fda27c0cc [dev.simd] cmd/compile: glue codes for Shift and Rotate
This CL adds two more intrinsic lowering functions. They can issue an
OpCopy to move a scalar value to vector value. This is needed by Shift
and Rotate APIs.

Change-Id: I8a83197d33207072c4a9221a931e67dddd5cd0bf
Reviewed-on: https://go-review.googlesource.com/c/go/+/683476
Auto-Submit: 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>
2025-06-25 11:26:07 -07:00
Junyang Shao
61c1183342 [dev.simd] simd: add test wrappers
This CL adds test wrappers for unit tests, and change the existing
Add/Sub test to be using wrappers.

This CL is generated by CL 683455.

Change-Id: Ibd388d82632ce56aad7a1ab5fff62db232819bb5
Reviewed-on: https://go-review.googlesource.com/c/go/+/683015
Auto-Submit: Junyang Shao <shaojunyang@google.com>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-06-24 12:48:52 -07:00
David Chase
e32488003d [dev.simd] cmd/compile: make simd regmask naming more like existing conventions
Paired with simdgen CL 682937

Change-Id: Ia826f643ece23bf4c7903dffe2fc15e39fbd5577
Reviewed-on: https://go-review.googlesource.com/c/go/+/683115
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>
2025-06-23 10:57:49 -07:00
David Chase
1fa4bcfcda [dev.simd] simd, cmd/compile: generated code for VPINSR[BWDQ], and test
This is paired with simdgen CL 683055

Change-Id: I91d2c08a97ddd7cf06dd24478d552b962846131c
Reviewed-on: https://go-review.googlesource.com/c/go/+/683035
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>
2025-06-23 10:24:57 -07:00
Junyang Shao
dd63b7aa0e [dev.simd] simd: add AVX512 aggregated check
This added check could make AI test code generation's life easier.

Change-Id: I725f567100159acd1ee537e8b1e6cb9c9e2bc690
Reviewed-on: https://go-review.googlesource.com/c/go/+/683016
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-06-23 08:29:43 -07:00
Cherry Mui
0cdb2697d1 [dev.simd] simd: add tests for intrinsic used as a func value and via reflection
Change-Id: I9d2be86be90c1ce1bfc031202e534df437af7a0f
Reviewed-on: https://go-review.googlesource.com/c/go/+/683036
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-06-23 07:28:17 -07:00
Cherry Mui
88c013d6ff [dev.simd] cmd/compile: generate function body for bodyless intrinsics
For a compiler intrinsic, if it is used in a non-call context, e.g.
as a function pointer, currently it requires fallback
implementation (e.g. assembly code for atomic operations),
otherwise it will result in a build failure. The fallback
implementation needs to be maintained and tested, albeit rarely
used in practice.

Also, for SIMD, we're currently adding a large number of compiler
intrinsics without providing fallback implementations (we might in
the future). As methods, it is not unlikely that they are used in
a non-call context, e.g. referenced from the type descriptor.

This CL lets the compiler generate the function body for
bodyless intrinsics. The compiler already recognizes a call to
the function as an intrinsic and can directly generate code for it.
So we just fill in the body with a call to the same function.

Change-Id: I2636e3128f28301c9abaf2b48bc962ab56e7d1a9
Reviewed-on: https://go-review.googlesource.com/c/go/+/683096
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-06-23 07:27:39 -07:00
Cherry Mui
a8669c78f5 [dev.simd] sync: correct the type of runtime_StoreReluintptr
runtime_StoreReluintptr linknames to internal/runtime/atomic.StoreReluintptr,
which does not have a result.

Change-Id: I468cce82985f391c221768188a5eaff43cbcd037
Reviewed-on: https://go-review.googlesource.com/c/go/+/683095
TryBot-Bypass: Cherry Mui <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
2025-06-20 15:33:37 -07:00
David Chase
7c6ac35275 [dev.simd] cmd/compile: add simdFp1gp1fp1Imm8 helper to amd64 code generation
This is for VPINSRB[BWDQ], coming in a later CL.

Change-Id: I6b4b99be43512623d4d6e5542221c18f0c5c2eb4
Reviewed-on: https://go-review.googlesource.com/c/go/+/682956
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-06-20 14:14:45 -07:00
Cherry Mui
4150372a5d [dev.simd] cmd/compile: don't treat devel compiler as a released compiler
The compiler has a logic to print different messages on internal
compiler error depending on whether this is a released version of
Go. It hides the panic stack trace if it is a released version. It
does this by checking the version and see if it has a "go" prefix.
This includes all the released versions. However, for a non-
released build, if there is no explicit version set, cmd/dist now
sets the toolchain version as go1.X-devel_XXX, which makes it be
treated as a released compiler, and causes the stack trace to be
hidden. Change the logic to not match a devel compiler as a
released compiler.

Change-Id: I5d3b2101527212f825b6e4000b36030c4f83870b
Reviewed-on: https://go-review.googlesource.com/c/go/+/682975
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-06-20 11:51:29 -07:00
David Chase
1b87d52549 [dev.simd] cmd/compile: add fp1gp1fp1 register mask for AMD64
This is paired with a matching simdgen CL 682679

Change-Id: Id494d40b5e64b723a47c1682b71e523a77b0eb87
Reviewed-on: https://go-review.googlesource.com/c/go/+/682656
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-06-18 13:55:07 -07:00
Junyang Shao
1313521f75 [dev.simd] cmd/compile: remove fused mul/add/sub shapes.
This CL only keeps one shape of those fused mul/add/sub operations. The
rest of the instructions will be generated during lowering as an
optimization.

This CL is generated by CL 682436.

Change-Id: Iadee1786185289838e04f3aa8f333844cfacc02e
Reviewed-on: https://go-review.googlesource.com/c/go/+/682435
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-06-18 12:22:24 -07:00
Junyang Shao
1be5eb2686 [dev.simd] cmd/compile: fix signature error of PairDotProdAccumulate.
This CL is generated by CL 682135.

Change-Id: I6f004b2eca6323f1ff22555c85db993386f24c6c
Reviewed-on: https://go-review.googlesource.com/c/go/+/682155
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-06-17 19:03:27 -07:00
David Chase
3a4d10bfca [dev.simd] cmd/compile: removed a map iteration from generator; tweaked type order
Output of CL 682316

Change-Id: I566486085fbd8a5437a5904ed02f718da7fed2c9
Reviewed-on: https://go-review.googlesource.com/c/go/+/682355
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-06-17 09:29:28 -07:00
David Chase
21d6573154 [dev.simd] cmd/compile: alphabetize SIMD intrinsics
This is the output of CL 682036

Change-Id: I432c6e059dff7019a6bba6b777ea7fe48990278f
Reviewed-on: https://go-review.googlesource.com/c/go/+/682295
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-06-17 09:05:31 -07:00
Junyang Shao
ee1d9f3f85 [dev.simd] cmd/compile: reorder stubs
This CL is generated by CL 682035.

Change-Id: I0a8b7382470afb5a6571ab7d4abe038de0ff239e
Reviewed-on: https://go-review.googlesource.com/c/go/+/682055
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>
Auto-Submit: Junyang Shao <shaojunyang@google.com>
2025-06-16 13:45:27 -07:00
David Chase
6c50c8b892 [dev.simd] cmd/compile: move simd helpers into compiler, out of generated code
PAIRED w/ arch/internal/simdgen CL 681615

This moves the helpers out of the generated code.

Change-Id: I6150afd45dbdf8d1499e0b8ee80c1bd8be5d558e
Reviewed-on: https://go-review.googlesource.com/c/go/+/681500
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-06-13 14:27:02 -07:00
David Chase
7392dfd43e [dev.simd] cmd/compile: generated simd*ops files weren't up to date
I re-ran the generator in arch/internal/simd to
verify a clean move of the intrinsics helpers, and
these changes (which look correct) appeared.

Change-Id: I28a0e8bd144d47aec216f557f238362f238d0428
Reviewed-on: https://go-review.googlesource.com/c/go/+/681499
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-06-13 14:26:44 -07:00
David Chase
00a8dacbe4 [dev.simd] cmd/compile: remove unused simd intrinsics "helpers"
turns out they weren't helpful enough.

Change-Id: I4fa99dc0e7513f25acaddd7fb06451b0134172b9
Reviewed-on: https://go-review.googlesource.com/c/go/+/681498
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-06-13 14:25:44 -07:00
David Chase
b9a548775f cmd/compile: add up-to-date test for generated files
This runs the ssa/_gen generator writing files into
a temporary directory, and then checks that there are
no differences with what is currently in the ssa directory,
and also checks that any file with the "generated from
_gen/..." header was actually generated, and checks that
the headers on the generated file match the expected
header prefix.

Change-Id: Ic8eeb0b06cf6f2e576a013e865b331a12d3a77aa
Reviewed-on: https://go-review.googlesource.com/c/go/+/680615
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>
(cherry picked from commit d4c6effaa7)
Reviewed-on: https://go-review.googlesource.com/c/go/+/680975
TryBot-Bypass: David Chase <drchase@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-06-13 13:03:14 -07:00
Junyang Shao
ca01eab9c7 [dev.simd] cmd/compile: add fused mul add sub ops
This CL is generated by CL 680595.

Change-Id: I5e06ea9bc6a62593fc3b00fd44c119a5ed0d9e90
Reviewed-on: https://go-review.googlesource.com/c/go/+/681299
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-06-13 12:15:29 -07:00
Junyang Shao
ded6e0ac71 [dev.simd] cmd/compile: add more dot products
This CL is generated by CL 680215.

Change-Id: Ie085e65e0473a8e96170702d7265d379ec8812ba
Reviewed-on: https://go-review.googlesource.com/c/go/+/681298
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-06-13 12:15:18 -07:00
Junyang Shao
3df41c856e [dev.simd] simd: update documentations
This CL is generated by CL 679955.

Change-Id: Iff92222bfb493730e147e5b7d2cd940d7ca50f1d
Reviewed-on: https://go-review.googlesource.com/c/go/+/681297
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-06-13 12:15:09 -07:00
Junyang Shao
9ba7db36b5 [dev.simd] cmd/compile: add dot product ops
This CL is generated by CL 678515.

Change-Id: Iac7c424bbbffc2514dff3495d6c408fa9c998c2f
Reviewed-on: https://go-review.googlesource.com/c/go/+/681296
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-06-13 11:43:59 -07:00
Junyang Shao
34a9cdef87 [dev.simd] cmd/compile: add round simd ops
This CL is generated by CL 678195.

Change-Id: Ica600229a4e9623fa45f3b5aa370cdd6d9c31686
Reviewed-on: https://go-review.googlesource.com/c/go/+/681295
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2025-06-13 11:43:48 -07:00
Junyang Shao
5289e0f24e [dev.simd] cmd/compile: updates simd ordering and docs
This CL is generated by CL 681395.

Change-Id: Ic930aeeb24fc7f95a4d74c77403532d0b0eb39ff
Reviewed-on: https://go-review.googlesource.com/c/go/+/681215
Auto-Submit: Junyang Shao <shaojunyang@google.com>
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>
2025-06-13 08:02:19 -07:00
Junyang Shao
c81cb05e3e [dev.simd] cmd/compile: add simdGen prog writer
This CL is a synergy between simdgen refactor CL 681195.

Change-Id: I365becf515a261bd22c46824613c2dce309cac45
Reviewed-on: https://go-review.googlesource.com/c/go/+/681036
Reviewed-by: Cherry Mui <cherryyz@google.com>
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>
2025-06-13 07:37:47 -07:00
Austin Clements
9b9af3d638 [dev.simd] internal/cpu: add AVX-512-CD and DQ, and derived "basic AVX-512"
This adds detection for the CD and DQ sub-features of x86 AVX-512.

Building on these, we also add a "derived" AVX-512 feature that
bundles together the basic usable subset of subfeatures. Despite the F
in AVX-512-F standing for "foundation", AVX-512-F+BW+DQ+VL together
really form the basic usable subset of AVX-512 functionality. These
have also all been supported together by almost every CPU, and are
guaranteed by GOAMD64=v4, so there's little point in separating them
out.

Change-Id: I34356502bd1853ba2372e48db0b10d55cffe07a1
Reviewed-on: https://go-review.googlesource.com/c/go/+/680899
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-06-13 07:16:03 -07:00
Austin Clements
dfa6c74263 [dev.simd] runtime: eliminate global state in mkpreempt.go
We're going to start writing two files, so having a single global file
we're writing will be a problem.

This has no effect on the generated code.

Change-Id: I49897ea0c6500a29eac89b597d75c0eb3e9b6706
Reviewed-on: https://go-review.googlesource.com/c/go/+/680897
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-06-13 07:15:51 -07:00
Cherry Mui
b2e8ddba3c [dev.simd] all: merge master (773701a) into dev.simd
Merge List:

+ 2025-06-10 773701a853 internal/trace: pass GOTRACEBACK=crash to testprogs
+ 2025-06-10 fb0c27c514 os: do not follow dangling symlinks in Root when O_CREATE|O_EXCL on AIX
+ 2025-06-10 1cafdfb63b net/http: make the zero value of CrossOriginProtection work
+ 2025-06-10 a35701b352 cmd/dist: only install necessary tools when doing local test
+ 2025-06-10 a189516d3a runtime: don't do a direct G handoff in semrelease on systemstack
+ 2025-06-10 f18d046568 all.{bash,rc}: use "../bin/go tool dist" instead of "%GOTOOLDIR%/dist" print build info
+ 2025-06-09 ee7bfbdbcc cmd/compile/internal/ssa: fix PPC64 merging of (AND (S[RL]Dconst ...)
+ 2025-06-09 985d600f3a runtime: use small struct TestSynctest to ensure cleanups run
+ 2025-06-09 848a768ba7 runtime: clarify stack traces for bubbled goroutines
+ 2025-06-09 049a5e6036 runtime: return a different bubble deadlock error when main goroutine is done
+ 2025-06-09 ac1686752b cmd/internal/doc: increase version of pkgsite doc command that's run
+ 2025-06-09 da0e8c4517 cmd/compile: relax reshaping condition
+ 2025-06-09 7800f4f0ad log/slog: fix level doc on handlers
+ 2025-06-07 d184f8dc02 runtime: check for gsignal in racecall on loong64
+ 2025-06-06 0ccfbc834a os/signal: doc link to syscall.EPIPE
+ 2025-06-06 78eadf5b3d all: update vendored dependencies [generated]
+ 2025-06-05 4d1c255f15 net/http: strip sensitive proxy headers from redirect requests
+ 2025-06-04 3432c68467 runtime: make bubbled timers more consistent with unbubbled
+ 2025-06-04 1aa3362093 Revert "cmd/compile: Enable inlining of tail calls"
+ 2025-06-04 f537061e1b cmd/trace: handle Sync event at the beginning of the trace
+ 2025-06-04 d4bf716793 runtime: reduce per-P memory footprint when greenteagc is disabled
+ 2025-06-04 1f2a4d192d test: add another regression test for issue 73309
+ 2025-06-04 5b748eed9c cmd/compile: better error message when import embed package
+ 2025-06-03 cfb4e9bc4a cmd/dist: don't install tools that won't be shipped in distribution
+ 2025-06-03 94764d0938 cmd/doc: build cmd/doc directly into the go command
+ 2025-06-03 74b70eead7 go/token: remove unreachable code
+ 2025-06-03 0c0094c893 go/token: tweak comment
+ 2025-06-03 792548a483 cmd/go/internal/cfg: fix GOROOT setting when forcing host config
+ 2025-06-02 49f6304724 runtime: additional memmove benchmarks
+ 2025-06-02 eebae283b6 go/token: FileSet: hold Files in a balanced tree
+ 2025-06-02 3bd0eab96f runtime: randomize order of timers at the same instant in bubbles
+ 2025-06-02 a379698521 go/{ast,parser,types}: add signpost to golang.org/x/tools/go/packages
+ 2025-06-02 497cb7c0c3 cmd/compile/internal/noder: document quirk of string elements
+ 2025-06-02 cc119ee391 cmd/compile/internal/noder: stub type section and adjust others
+ 2025-06-02 25ca686a0b cmd/compile/internal/noder: begin filling in SectionObj
+ 2025-06-02 11660d537b cmd/compile/internal/noder: fill in SectionName

Change-Id: I7c0a7c56105f1a6912f4ed122d615d12b1ea7877
2025-06-10 14:57:15 -04:00
Junyang Shao
884f646966 [dev.simd] cmd/compile: add fp3m1fp1 shape to regalloc
Change-Id: Ie89cf521f5ae59de1934f6f49bb5fd3f63cc5883
Reviewed-on: https://go-review.googlesource.com/c/go/+/680236
Auto-Submit: 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>
2025-06-09 13:44:37 -07:00
Junyang Shao
6bc3505773 [dev.simd] cmd/compile: add fp3fp1 regsiter shape
This is to accomodate dot product instructions.

Change-Id: I88b21f848d7a51ad036bb3555c30f12b72571b2b
Reviewed-on: https://go-review.googlesource.com/c/go/+/680235
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Junyang Shao <shaojunyang@google.com>
2025-06-09 11:27:09 -07:00
David Chase
2eaa5a0703 [dev.simd] simd: add functions+methods to load-from/store-to slices
Includes the generator (which is short and uncomplicated)
and a few tests.

Change-Id: Icba9de042935a59bee34b278306c241b7651f5b4
Reviewed-on: https://go-review.googlesource.com/c/go/+/679258
Auto-Submit: 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>
2025-06-05 20:58:55 -07:00
Junyang Shao
8ecbd59ebb [dev.simd] cmd/compile: generated codes for amd64 SIMD
This CL is generated by tool in CL 667155.

Change-Id: I3829d0d2c96fe7000e2dd025a3006f96957d777a
Reviewed-on: https://go-review.googlesource.com/c/go/+/675618
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Auto-Submit: Junyang Shao <shaojunyang@google.com>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-06-05 11:09:40 -07:00
Cherry Mui
baa72c25f1 [dev.simd] all: merge master (711ff94) into dev.simd
Merge List:

+ 2025-06-02 711ff943af testing: add Output method to TB
+ 2025-06-02 e9d3b030ed slices,sort: explicitly discard results in benchmarks
+ 2025-05-30 a8e99ab19c internal/trace: expose the go version read by the reader
+ 2025-05-30 68b51e99f9 cmd/distpack: add test case for pack tool being excluded
+ 2025-05-30 67f052121e cmd/distpack: don't keep the pack tool
+ 2025-05-30 1947c4233a runtime: set HeapGoal to zero when the GC is disabled
+ 2025-05-30 8cd7f17248 testing, testing/synctest: report correct duration after panics
+ 2025-05-30 29782bd347 os: add implementation of fs.ReadLinkFS to *rootFS
+ 2025-05-29 78e86297f5 cmd/compile/internal/noder: rename RelIndex to match codebase
+ 2025-05-29 fece9871bb cmd/compile: update default PGO profile
+ 2025-05-29 9f3dd846e2 cmd/internal/obj/s390x: fix potential recursive String call
+ 2025-05-29 21b7e60c6b runtime, testing/synctest: breaking bubble isolation with Cond is fatal
+ 2025-05-29 555d425d17 testing, testing/synctest: write bubble errors to parent test log
+ 2025-05-29 f14f3aae1c internal/pkgbits: explain the rationale for reference tables
+ 2025-05-29 4878b4471b slices: document and test nilness behavior of all functions
+ 2025-05-29 7b4d065267 runtime: add vgetrandom lock rank
+ 2025-05-29 e481a08e0e runtime: guarantee no GOMAXPROCS update syscalls after GOMAXPROCS call
+ 2025-05-29 dd678172e3 doc/next: delete
+ 2025-05-29 c2f0fe5854 internal/synctest: speed up TestWeak
+ 2025-05-29 b170c7e94c runtime, internal/synctest, sync: associate WaitGroups with bubbles
+ 2025-05-29 3b77085b40 runtime: increment updatemaxprocs metric only when disabled
+ 2025-05-29 f8c51b1a6c go/doc: NewFromFiles: fix panic on Files with SkipObjectResolution
+ 2025-05-29 263bc50c90 api: promote next to go1.25
+ 2025-05-28 dbaa2d3e65 cmd/compile: do nil check before calling duff functions, on arm64 and amd64
+ 2025-05-28 6160fa59b6 runtime: rename updateGOMAXPROCS to updateMaxProcsG
+ 2025-05-28 ae6c098f48 doc/next: add release note for riscv64 plugin build mode
+ 2025-05-28 18ad74dd36 go/types, types2: dump position stack for non-bailout panics
+ 2025-05-28 70109eb326 cmd/link: allow linkname reference to a TEXT symbol regardless of size
+ 2025-05-28 eff3288042 doc/next: tweak runtime release notes
+ 2025-05-28 c61e5e7244 lib/time: update to 2025b/2025b
+ 2025-05-27 ed08d2ad09 os: don't follow symlinks on Windows when O_CREATE|O_EXCL and read-only
+ 2025-05-27 fce9d4515d runtime, testing/synctest: verify cleanups/finalizers run outside bubbles
+ 2025-05-27 b78e38065e runtime: define lock ranking between weak pointers and synctest
+ 2025-05-27 961818e013 cmd/compile/internal/walk: use original type for composite literals in addrTemp
+ 2025-05-27 c8c3d661b0 runtime/trace: add a trace validation test for different trace orders
+ 2025-05-27 0e1b14bc2e cmd/go: fix get with the new 'work' pattern
+ 2025-05-27 09f1546cba log/slog: fix longtests with empty source
+ 2025-05-27 de05282a2c doc/next: add small header to TODO
+ 2025-05-27 c146a61d4c go/token: benchmark FileSet.{Position,AddExistingFiles}
+ 2025-05-27 ae0824883e go/ast: deprecate FilterPackage, PackageExports, MergePackageFiles
+ 2025-05-27 8dd7d2111b runtime: skip nil Ps in allp during cleanup flush
+ 2025-05-27 3a3c006ac0 crypto/tls: enable signature algorithm BoGo tests (and fix two bugs)
+ 2025-05-27 ed70477909 errors: add joinError Unwrap example
+ 2025-05-27 787362327f io/fs: add examples for Glob,ReadFile and ValidPath
+ 2025-05-24 3fd729b2a1 log/slog: make TextHandler discard empty Source
+ 2025-05-24 c07ffe980a testing/synctest: correct duration in doc example
+ 2025-05-24 3db50924e2 hash: mention the new Cloner interface in Hash docs.
+ 2025-05-23 aca9f4e484 crypto/tls: signature_algorithms in CertificateRequest can't be empty
+ 2025-05-23 8cb0941a85 net: use runtime.AddCleanup instead of runtime.SetFinalizer
+ 2025-05-23 68f4434df0 runtime/trace: match traceClockNow types
+ 2025-05-23 8b1978f614 doc/next: add crudely processed todos
+ 2025-05-23 c0e149b6b1 net/http: document that ServeMux.Handler can also synthetize a 405
+ 2025-05-23 db3e02994c runtime/trace: fix flaky test for SetMinAge
+ 2025-05-22 db55b83ce4 doc: fix TBD mark
+ 2025-05-22 aec96d686b doc: mention stack allocation of variable-sized make calls
+ 2025-05-22 c684dfcb8a runtime: don't spin looking for a tiny alloc address with asan or race
+ 2025-05-22 bfbf736564 cmd/compile: do not shapify when reading reshaping expr
+ 2025-05-22 b1f259b1b4 cmd/compile: fix ICE with recursive alias type parameter
+ 2025-05-22 155ba387a9 cmd/doc: properly set GOPROXY to avoid deprecation checks
+ 2025-05-22 ef3bb638de Revert "cmd/doc: better support for no network"
+ 2025-05-22 a0dc7bf084 cmd/compile: fix ICE when transforming loopvar

Change-Id: I9010808984e73ed2de6041127a222f725f0f52e6
2025-06-02 14:42:05 -04:00
David Chase
0ff18a9cca [dev.simd] cmd/compile: disable intrinsics test for new simd stuff
this test has been unpossible to get working correctly/
as-expected across architectures, experiments, trybots.
There benefit is a fairy-tale (we're going to check at the merge),
and it costs us time to keep it happy, so for now it is disabled.

Change-Id: Iad913d2590deec606d29bedfa100310e6e9a75bc
Reviewed-on: https://go-review.googlesource.com/c/go/+/677556
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Auto-Submit: David Chase <drchase@google.com>
Auto-Submit: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-05-30 10:11:30 -07:00
David Chase
7800f3813c [dev.simd] cmd/compile: flip sense of intrinsics test for SIMD
ENABLE when simd experiment is off, to be sure intrinsics
do not leak past the experiment.

DISABLE when simd is on, because all this does is cause tests to
fail, then whoever failed the test regenerates the simd, doesn't look
at the mountain of new intrinsics, and just rubber-stamps the change.
All friction, no benefit.

Change-Id: I2ef7e0c246aaddd4a52c1d6108cb587adc1b8366
Reviewed-on: https://go-review.googlesource.com/c/go/+/677555
Auto-Submit: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-05-30 09:14:44 -07:00
David Chase
eba2430c16 [dev.simd] simd, cmd/compile, go build, go/doc: test tweaks
these are for CL 675618
simd package exists and imports internal/cpu
tweak tests to deal with goexperiment/not

Change-Id: I2de99d048f0a228d5f3cd750c39ee5925107556e
Reviewed-on: https://go-review.googlesource.com/c/go/+/677260
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Junyang Shao <shaojunyang@google.com>
2025-05-29 19:19:18 -07:00
Junyang Shao
71c0e550cd [dev.simd] cmd/dist: disable API check on dev branch
Change-Id: I5a167e95a3275bfc39fddc793b0775976747dc9a
Reviewed-on: https://go-review.googlesource.com/c/go/+/677277
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-05-29 12:45:09 -07:00
David Chase
62e1fccfb9 [dev.simd] internal: delete unused internal/simd directory
this completes the move to "simd"

Change-Id: Id2c2707b7b308fb12eb33af705750ce0db2b0fd8
Reviewed-on: https://go-review.googlesource.com/c/go/+/677258
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-05-29 12:42:11 -07:00
Junyang Shao
1161228bf1 [dev.simd] cmd/compile: add a fp1m1fp1 register shape to amd64
Change-Id: I9dd00cc8bef4712eff16968e4962d850859fc3f0
Reviewed-on: https://go-review.googlesource.com/c/go/+/676997
Commit-Queue: 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>
2025-05-29 08:34:01 -07:00
David Chase
fdb067d946 [dev.simd] simd: initialize directory to make it suitable for testing SIMD
this is a multistep operation between two repos to coordinate
this move.  First copy internal/simd top simd (and adjust so
that it works with future generated SIMD), after this lands,
update golang/arch/internal/simdgen to target this directory
and add it to the end-to-end test (which will also be added
once it works and is truly end-to-end), finally remove internal/simd
once the updated generator has been submitted.

Change-Id: If372baadc0c02e47cc32bc55b39ac19d551b2b21
Reviewed-on: https://go-review.googlesource.com/c/go/+/676955
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-05-28 14:08:17 -07:00
Junyang Shao
11d2b28bff [dev.simd] cmd/compile: add and fix k register supports
This CL marks the "mask" ssa type as a simd type. This will make the
last return of `simdMov` reachable and the spilling of K register
correct.

This CL also makes `simdReg` able to return K registers.

Change-Id: Ia66230d3e5425d9e8bdd0081b008e098382d3827
Reviewed-on: https://go-review.googlesource.com/c/go/+/676876
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-05-28 10:44:36 -07:00
David Chase
04b1030ae4 [dev.simd] cmd/compile: adapters for simd
This combines several CLs into a single patch of "glue"
for the generated SIMD extensions.

This glue includes GOEXPERIMENT checks that disable
the creation of user-visible "simd" types and
that disable the registration of "simd" intrinsics.

The simd type checks were changed to work for either
package "simd" or "internal/simd" so that moving that
package won't be quite so fragile.

cmd/compile, internal/simd: glue for adding SIMD extensions to Go
cmd/compile: theft of Cherry's sample SIMD compilation

Change-Id: Id44e2f4bafe74032c26de576a8691b6f7d977e01
Reviewed-on: https://go-review.googlesource.com/c/go/+/675598
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-05-28 08:46:30 -07:00
David Chase
2ef7106881 [dev.simd] internal/buildcfg: enable SIMD GOEXPERIMENT for amd64
Since we are developing and testing this, the default is on.
This may still cause us a little headache when developing
on other-architecture laptops.

Change-Id: I9e9e5ea4ff2312c0c8385386b5012370f00dbfbd
Reviewed-on: https://go-review.googlesource.com/c/go/+/675735
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-05-27 14:24:38 -07:00
Cherry Mui
4d2c71ebf9 [dev.simd] internal/goexperiment: add SIMD goexperiment
We'll use it to guard the simd package, and the compiler's
handling of SIMD types and intrinsics.

Change-Id: I0356368eea0a98a5016baaaf7acb7da8b6305429
Reviewed-on: https://go-review.googlesource.com/c/go/+/675536
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-05-22 13:37:21 -07:00
Cherry Mui
3ac5f2f962 [dev.simd] codereview.cfg: set up dev.simd branch
Change-Id: I3d9c9f706bdb11cc6786f150be17e68ed06892d3
Reviewed-on: https://go-review.googlesource.com/c/go/+/675595
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-05-22 09:37:20 -07:00
2699 changed files with 322053 additions and 67022 deletions

1
.gitignore vendored
View file

@ -30,6 +30,7 @@ _testmain.go
/misc/cgo/testso/main
/pkg/
/src/*.*/
/src/_artifacts/
/src/cmd/cgo/zdefaultcc.go
/src/cmd/dist/dist
/src/cmd/go/internal/cfg/zdefaultcc.go

185
api/go1.26.txt Normal file
View file

@ -0,0 +1,185 @@
pkg bytes, method (*Buffer) Peek(int) ([]uint8, error) #73794
pkg crypto, type Decapsulator interface { Decapsulate, Encapsulator } #75300
pkg crypto, type Decapsulator interface, Decapsulate([]uint8) ([]uint8, error) #75300
pkg crypto, type Decapsulator interface, Encapsulator() Encapsulator #75300
pkg crypto, type Encapsulator interface { Bytes, Encapsulate } #75300
pkg crypto, type Encapsulator interface, Bytes() []uint8 #75300
pkg crypto, type Encapsulator interface, Encapsulate() ([]uint8, []uint8) #75300
pkg crypto/ecdh, type KeyExchanger interface { Curve, ECDH, PublicKey } #75300
pkg crypto/ecdh, type KeyExchanger interface, Curve() Curve #75300
pkg crypto/ecdh, type KeyExchanger interface, ECDH(*PublicKey) ([]uint8, error) #75300
pkg crypto/ecdh, type KeyExchanger interface, PublicKey() *PublicKey #75300
pkg crypto/ecdsa, type PrivateKey struct, D //deprecated #63963
pkg crypto/ecdsa, type PublicKey struct, X //deprecated #63963
pkg crypto/ecdsa, type PublicKey struct, Y //deprecated #63963
pkg crypto/fips140, func Enforced() bool #74630
pkg crypto/fips140, func Version() string #75301
pkg crypto/fips140, func WithoutEnforcement(func()) #74630
pkg crypto/hpke, func AES128GCM() AEAD #75300
pkg crypto/hpke, func AES256GCM() AEAD #75300
pkg crypto/hpke, func ChaCha20Poly1305() AEAD #75300
pkg crypto/hpke, func DHKEM(ecdh.Curve) KEM #75300
pkg crypto/hpke, func ExportOnly() AEAD #75300
pkg crypto/hpke, func HKDFSHA256() KDF #75300
pkg crypto/hpke, func HKDFSHA384() KDF #75300
pkg crypto/hpke, func HKDFSHA512() KDF #75300
pkg crypto/hpke, func MLKEM1024() KEM #75300
pkg crypto/hpke, func MLKEM1024P384() KEM #75300
pkg crypto/hpke, func MLKEM768() KEM #75300
pkg crypto/hpke, func MLKEM768P256() KEM #75300
pkg crypto/hpke, func MLKEM768X25519() KEM #75300
pkg crypto/hpke, func NewAEAD(uint16) (AEAD, error) #75300
pkg crypto/hpke, func NewDHKEMPrivateKey(ecdh.KeyExchanger) (PrivateKey, error) #75300
pkg crypto/hpke, func NewDHKEMPublicKey(*ecdh.PublicKey) (PublicKey, error) #75300
pkg crypto/hpke, func NewHybridPrivateKey(crypto.Decapsulator, ecdh.KeyExchanger) (PrivateKey, error) #75300
pkg crypto/hpke, func NewHybridPublicKey(crypto.Encapsulator, *ecdh.PublicKey) (PublicKey, error) #75300
pkg crypto/hpke, func NewKDF(uint16) (KDF, error) #75300
pkg crypto/hpke, func NewKEM(uint16) (KEM, error) #75300
pkg crypto/hpke, func NewMLKEMPrivateKey(crypto.Decapsulator) (PrivateKey, error) #75300
pkg crypto/hpke, func NewMLKEMPublicKey(crypto.Encapsulator) (PublicKey, error) #75300
pkg crypto/hpke, func NewRecipient([]uint8, PrivateKey, KDF, AEAD, []uint8) (*Recipient, error) #75300
pkg crypto/hpke, func NewSender(PublicKey, KDF, AEAD, []uint8) ([]uint8, *Sender, error) #75300
pkg crypto/hpke, func Open(PrivateKey, KDF, AEAD, []uint8, []uint8) ([]uint8, error) #75300
pkg crypto/hpke, func SHAKE128() KDF #75300
pkg crypto/hpke, func SHAKE256() KDF #75300
pkg crypto/hpke, func Seal(PublicKey, KDF, AEAD, []uint8, []uint8) ([]uint8, error) #75300
pkg crypto/hpke, method (*Recipient) Export(string, int) ([]uint8, error) #75300
pkg crypto/hpke, method (*Recipient) Open([]uint8, []uint8) ([]uint8, error) #75300
pkg crypto/hpke, method (*Sender) Export(string, int) ([]uint8, error) #75300
pkg crypto/hpke, method (*Sender) Seal([]uint8, []uint8) ([]uint8, error) #75300
pkg crypto/hpke, type AEAD interface, ID() uint16 #75300
pkg crypto/hpke, type AEAD interface, unexported methods #75300
pkg crypto/hpke, type KDF interface, ID() uint16 #75300
pkg crypto/hpke, type KDF interface, unexported methods #75300
pkg crypto/hpke, type KEM interface, DeriveKeyPair([]uint8) (PrivateKey, error) #75300
pkg crypto/hpke, type KEM interface, GenerateKey() (PrivateKey, error) #75300
pkg crypto/hpke, type KEM interface, ID() uint16 #75300
pkg crypto/hpke, type KEM interface, NewPrivateKey([]uint8) (PrivateKey, error) #75300
pkg crypto/hpke, type KEM interface, NewPublicKey([]uint8) (PublicKey, error) #75300
pkg crypto/hpke, type KEM interface, unexported methods #75300
pkg crypto/hpke, type PrivateKey interface, Bytes() ([]uint8, error) #75300
pkg crypto/hpke, type PrivateKey interface, KEM() KEM #75300
pkg crypto/hpke, type PrivateKey interface, PublicKey() PublicKey #75300
pkg crypto/hpke, type PrivateKey interface, unexported methods #75300
pkg crypto/hpke, type PublicKey interface, Bytes() []uint8 #75300
pkg crypto/hpke, type PublicKey interface, KEM() KEM #75300
pkg crypto/hpke, type PublicKey interface, unexported methods #75300
pkg crypto/hpke, type Recipient struct #75300
pkg crypto/hpke, type Sender struct #75300
pkg crypto/mlkem, method (*DecapsulationKey1024) Encapsulator() crypto.Encapsulator #75300
pkg crypto/mlkem, method (*DecapsulationKey768) Encapsulator() crypto.Encapsulator #75300
pkg crypto/mlkem/mlkemtest, func Encapsulate1024(*mlkem.EncapsulationKey1024, []uint8) ([]uint8, []uint8, error) #73627
pkg crypto/mlkem/mlkemtest, func Encapsulate768(*mlkem.EncapsulationKey768, []uint8) ([]uint8, []uint8, error) #73627
pkg crypto/rsa, func DecryptPKCS1v15 //deprecated #75302
pkg crypto/rsa, func DecryptPKCS1v15SessionKey //deprecated #75302
pkg crypto/rsa, func EncryptOAEPWithOptions(io.Reader, *PublicKey, []uint8, *OAEPOptions) ([]uint8, error) #65716
pkg crypto/rsa, func EncryptPKCS1v15 //deprecated #75302
pkg crypto/rsa, type PKCS1v15DecryptOptions //deprecated #75302
pkg crypto/tls, const QUICErrorEvent = 10 #75108
pkg crypto/tls, const QUICErrorEvent QUICEventKind #75108
pkg crypto/tls, const SecP256r1MLKEM768 = 4587 #71206
pkg crypto/tls, const SecP256r1MLKEM768 CurveID #71206
pkg crypto/tls, const SecP384r1MLKEM1024 = 4589 #71206
pkg crypto/tls, const SecP384r1MLKEM1024 CurveID #71206
pkg crypto/tls, type ClientHelloInfo struct, HelloRetryRequest bool #74425
pkg crypto/tls, type ConnectionState struct, HelloRetryRequest bool #74425
pkg crypto/tls, type QUICEvent struct, Err error #75108
pkg crypto/x509, func OIDFromASN1OID(asn1.ObjectIdentifier) (OID, error) #75325
pkg crypto/x509, method (ExtKeyUsage) OID() OID #75325
pkg crypto/x509, method (ExtKeyUsage) String() string #56866
pkg crypto/x509, method (KeyUsage) String() string #56866
pkg database/sql/driver, type RowsColumnScanner interface { Close, Columns, Next, ScanColumn } #67546
pkg database/sql/driver, type RowsColumnScanner interface, Close() error #67546
pkg database/sql/driver, type RowsColumnScanner interface, Columns() []string #67546
pkg database/sql/driver, type RowsColumnScanner interface, Next([]Value) error #67546
pkg database/sql/driver, type RowsColumnScanner interface, ScanColumn(interface{}, int) error #67546
pkg debug/elf, const R_LARCH_CALL36 = 110 #75562
pkg debug/elf, const R_LARCH_CALL36 R_LARCH #75562
pkg debug/elf, const R_LARCH_TLS_DESC32 = 13 #75562
pkg debug/elf, const R_LARCH_TLS_DESC32 R_LARCH #75562
pkg debug/elf, const R_LARCH_TLS_DESC64 = 14 #75562
pkg debug/elf, const R_LARCH_TLS_DESC64 R_LARCH #75562
pkg debug/elf, const R_LARCH_TLS_DESC64_HI12 = 118 #75562
pkg debug/elf, const R_LARCH_TLS_DESC64_HI12 R_LARCH #75562
pkg debug/elf, const R_LARCH_TLS_DESC64_LO20 = 117 #75562
pkg debug/elf, const R_LARCH_TLS_DESC64_LO20 R_LARCH #75562
pkg debug/elf, const R_LARCH_TLS_DESC64_PC_HI12 = 114 #75562
pkg debug/elf, const R_LARCH_TLS_DESC64_PC_HI12 R_LARCH #75562
pkg debug/elf, const R_LARCH_TLS_DESC64_PC_LO20 = 113 #75562
pkg debug/elf, const R_LARCH_TLS_DESC64_PC_LO20 R_LARCH #75562
pkg debug/elf, const R_LARCH_TLS_DESC_CALL = 120 #75562
pkg debug/elf, const R_LARCH_TLS_DESC_CALL R_LARCH #75562
pkg debug/elf, const R_LARCH_TLS_DESC_HI20 = 115 #75562
pkg debug/elf, const R_LARCH_TLS_DESC_HI20 R_LARCH #75562
pkg debug/elf, const R_LARCH_TLS_DESC_LD = 119 #75562
pkg debug/elf, const R_LARCH_TLS_DESC_LD R_LARCH #75562
pkg debug/elf, const R_LARCH_TLS_DESC_LO12 = 116 #75562
pkg debug/elf, const R_LARCH_TLS_DESC_LO12 R_LARCH #75562
pkg debug/elf, const R_LARCH_TLS_DESC_PCREL20_S2 = 126 #75562
pkg debug/elf, const R_LARCH_TLS_DESC_PCREL20_S2 R_LARCH #75562
pkg debug/elf, const R_LARCH_TLS_DESC_PC_HI20 = 111 #75562
pkg debug/elf, const R_LARCH_TLS_DESC_PC_HI20 R_LARCH #75562
pkg debug/elf, const R_LARCH_TLS_DESC_PC_LO12 = 112 #75562
pkg debug/elf, const R_LARCH_TLS_DESC_PC_LO12 R_LARCH #75562
pkg debug/elf, const R_LARCH_TLS_GD_PCREL20_S2 = 125 #75562
pkg debug/elf, const R_LARCH_TLS_GD_PCREL20_S2 R_LARCH #75562
pkg debug/elf, const R_LARCH_TLS_LD_PCREL20_S2 = 124 #75562
pkg debug/elf, const R_LARCH_TLS_LD_PCREL20_S2 R_LARCH #75562
pkg debug/elf, const R_LARCH_TLS_LE_ADD_R = 122 #75562
pkg debug/elf, const R_LARCH_TLS_LE_ADD_R R_LARCH #75562
pkg debug/elf, const R_LARCH_TLS_LE_HI20_R = 121 #75562
pkg debug/elf, const R_LARCH_TLS_LE_HI20_R R_LARCH #75562
pkg debug/elf, const R_LARCH_TLS_LE_LO12_R = 123 #75562
pkg debug/elf, const R_LARCH_TLS_LE_LO12_R R_LARCH #75562
pkg errors, func AsType[$0 error](error) ($0, bool) #51945
pkg go/ast, func ParseDirective(token.Pos, string) (Directive, bool) #68021
pkg go/ast, method (*Directive) End() token.Pos #68021
pkg go/ast, method (*Directive) ParseArgs() ([]DirectiveArg, error) #68021
pkg go/ast, method (*Directive) Pos() token.Pos #68021
pkg go/ast, type BasicLit struct, ValueEnd token.Pos #76031
pkg go/ast, type Directive struct #68021
pkg go/ast, type Directive struct, Args string #68021
pkg go/ast, type Directive struct, ArgsPos token.Pos #68021
pkg go/ast, type Directive struct, Name string #68021
pkg go/ast, type Directive struct, Slash token.Pos #68021
pkg go/ast, type Directive struct, Tool string #68021
pkg go/ast, type DirectiveArg struct #68021
pkg go/ast, type DirectiveArg struct, Arg string #68021
pkg go/ast, type DirectiveArg struct, Pos token.Pos #68021
pkg go/token, method (*File) End() Pos #75849
pkg log/slog, func NewMultiHandler(...Handler) *MultiHandler #65954
pkg log/slog, method (*MultiHandler) Enabled(context.Context, Level) bool #65954
pkg log/slog, method (*MultiHandler) Handle(context.Context, Record) error #65954
pkg log/slog, method (*MultiHandler) WithAttrs([]Attr) Handler #65954
pkg log/slog, method (*MultiHandler) WithGroup(string) Handler #65954
pkg log/slog, type MultiHandler struct #65954
pkg net, method (*Dialer) DialIP(context.Context, string, netip.Addr, netip.Addr) (*IPConn, error) #49097
pkg net, method (*Dialer) DialTCP(context.Context, string, netip.AddrPort, netip.AddrPort) (*TCPConn, error) #49097
pkg net, method (*Dialer) DialUDP(context.Context, string, netip.AddrPort, netip.AddrPort) (*UDPConn, error) #49097
pkg net, method (*Dialer) DialUnix(context.Context, string, *UnixAddr, *UnixAddr) (*UnixConn, error) #49097
pkg net/http, method (*ClientConn) Available() int #75772
pkg net/http, method (*ClientConn) Close() error #75772
pkg net/http, method (*ClientConn) Err() error #75772
pkg net/http, method (*ClientConn) InFlight() int #75772
pkg net/http, method (*ClientConn) Release() #75772
pkg net/http, method (*ClientConn) Reserve() error #75772
pkg net/http, method (*ClientConn) RoundTrip(*Request) (*Response, error) #75772
pkg net/http, method (*ClientConn) SetStateHook(func(*ClientConn)) #75772
pkg net/http, method (*Transport) NewClientConn(context.Context, string, string) (*ClientConn, error) #75772
pkg net/http, type ClientConn struct #75772
pkg net/http, type HTTP2Config struct, StrictMaxConcurrentRequests bool #67813
pkg net/http/httputil, type ReverseProxy struct, Director //deprecated #73161
pkg net/netip, method (Prefix) Compare(Prefix) int #61642
pkg os, method (*Process) WithHandle(func(uintptr)) error #70352
pkg os, var ErrNoHandle error #70352
pkg reflect, method (Value) Fields() iter.Seq2[StructField, Value] #66631
pkg reflect, method (Value) Methods() iter.Seq2[Method, Value] #66631
pkg reflect, type Type interface, Fields() iter.Seq[StructField] #66631
pkg reflect, type Type interface, Ins() iter.Seq[Type] #66631
pkg reflect, type Type interface, Methods() iter.Seq[Method] #66631
pkg reflect, type Type interface, Outs() iter.Seq[Type] #66631
pkg testing, method (*B) ArtifactDir() string #71287
pkg testing, method (*F) ArtifactDir() string #71287
pkg testing, method (*T) ArtifactDir() string #71287
pkg testing, type TB interface, ArtifactDir() string #71287
pkg testing/cryptotest, func SetGlobalRandom(*testing.T, uint64) #70942

View file

@ -1039,6 +1039,12 @@ The value of <code>GOMIPS64</code> environment variable (<code>hardfloat</code>
<code>GOMIPS64_hardfloat</code> or <code>GOMIPS64_softfloat</code>.
</p>
<h3 id="riscv64">RISCV64</h3>
<p>
Reference: <a href="/pkg/cmd/internal/obj/riscv">Go RISCV64 Assembly Instructions Reference Manual</a>
</p>
<h3 id="unsupported_opcodes">Unsupported opcodes</h3>
<p>

View file

@ -231,7 +231,7 @@ do exactly this.
<p>
A read of an array, struct, or complex number
may by implemented as a read of each individual sub-value
may be implemented as a read of each individual sub-value
(array element, struct field, or real/imaginary component),
in any order.
Similarly, a write of an array, struct, or complex number

View file

@ -1,6 +1,6 @@
<!--{
"Title": "The Go Programming Language Specification",
"Subtitle": "Language version go1.25 (Feb 25, 2025)",
"Subtitle": "Language version go1.26 (Dec 2, 2025)",
"Path": "/ref/spec"
}-->
@ -2487,11 +2487,15 @@ type set[P comparable] = map[P]bool
</pre>
<p>
In an alias declaration the given type cannot be a type parameter.
In an alias declaration the given type cannot be a type parameter declared in the same declaration.
</p>
<pre>
type A[P any] = P // illegal: P is a type parameter
type A[P any] = P // illegal: P is a type parameter declared in the declaration of A
func f[P any]() {
type A = P // ok: T is a type parameter declared by the enclosing function
}
</pre>
<h4 id="Type_definitions">Type definitions</h4>
@ -2601,8 +2605,8 @@ In a type definition the given type cannot be a type parameter.
<pre>
type T[P any] P // illegal: P is a type parameter
func f[T any]() {
type L T // illegal: T is a type parameter declared by the enclosing function
func f[P any]() {
type L P // illegal: P is a type parameter declared by the enclosing function
}
</pre>
@ -2686,22 +2690,6 @@ of a <a href="#Method_declarations">method declaration</a> associated
with a generic type.
</p>
<p>
Within a type parameter list of a generic type <code>T</code>, a type constraint
may not (directly, or indirectly through the type parameter list of another
generic type) refer to <code>T</code>.
</p>
<pre>
type T1[P T1[P]] … // illegal: T1 refers to itself
type T2[P interface{ T2[int] }] … // illegal: T2 refers to itself
type T3[P interface{ m(T3[int])}] … // illegal: T3 refers to itself
type T4[P T5[P]] … // illegal: T4 refers to T5 and
type T5[P T4[P]] … // T5 refers to T4
type T6[P int] struct{ f *T6[P] } // ok: reference to T6 is not in type parameter list
</pre>
<h4 id="Type_constraints">Type constraints</h4>
<p>
@ -3173,7 +3161,7 @@ Element = Expression | LiteralValue .
<p>
Unless the LiteralType is a type parameter,
its <a href="#Underlying_types">underlying type
its <a href="#Underlying_types">underlying type</a>
must be a struct, array, slice, or map type
(the syntax enforces this constraint except when the type is given
as a TypeName).
@ -4873,7 +4861,7 @@ For instance, <code>x / y * z</code> is the same as <code>(x / y) * z</code>.
x &lt;= f() // x &lt;= f()
^a &gt;&gt; b // (^a) >> b
f() || g() // f() || g()
x == y+1 &amp;&amp; &lt;-chanInt &gt; 0 // (x == (y+1)) && ((<-chanInt) > 0)
x == y+1 &amp;&amp; &lt;-chanInt &gt; 0 // (x == (y+1)) &amp;&amp; ((&lt;-chanInt) > 0)
</pre>
@ -6635,7 +6623,7 @@ iteration's variable at that moment.
<pre>
var prints []func()
for i := 0; i < 5; i++ {
for i := 0; i &lt; 5; i++ {
prints = append(prints, func() { println(i) })
i++
}
@ -6772,7 +6760,7 @@ if the iteration variable is preexisting, the type of the iteration values is th
variable, which must be of integer type.
Otherwise, if the iteration variable is declared by the "range" clause or is absent,
the type of the iteration values is the <a href="#Constants">default type</a> for <code>n</code>.
If <code>n</code> &lt= 0, the loop does not run any iterations.
If <code>n</code> &lt;= 0, the loop does not run any iterations.
</li>
<li>
@ -6883,7 +6871,7 @@ type Tree[K cmp.Ordered, V any] struct {
}
func (t *Tree[K, V]) walk(yield func(key K, val V) bool) bool {
return t == nil || t.left.walk(yield) && yield(t.key, t.value) && t.right.walk(yield)
return t == nil || t.left.walk(yield) &amp;&amp; yield(t.key, t.value) &amp;&amp; t.right.walk(yield)
}
func (t *Tree[K, V]) Walk(yield func(key K, val V) bool) {
@ -7383,8 +7371,8 @@ The values <code>x</code> are passed to a parameter of type <code>...E</code>
where <code>E</code> is the element type of <code>S</code>
and the respective <a href="#Passing_arguments_to_..._parameters">parameter
passing rules</a> apply.
As a special case, <code>append</code> also accepts a first argument assignable
to type <code>[]byte</code> with a second argument of string type followed by
As a special case, <code>append</code> also accepts a slice whose type is assignable to
type <code>[]byte</code> with a second argument of <code>string</code> type followed by
<code>...</code>.
This form appends the bytes of the string.
</p>
@ -7508,7 +7496,7 @@ returns a received value along with an indication of whether the channel is clos
<p>
If the type of the argument to <code>close</code> is a
<a href="#Type_parameter_declarations">type parameter</a>,
all types in its type set must be channels with the same element type.
all types in its type set must be channels.
It is an error if any of those channels is a receive-only channel.
</p>
@ -7799,27 +7787,39 @@ compared lexically byte-wise:
</p>
<pre>
min(x, y) == if x <= y then x else y
min(x, y) == if x &lt;= y then x else y
min(x, y, z) == min(min(x, y), z)
</pre>
<h3 id="Allocation">Allocation</h3>
<p>
The built-in function <code>new</code> takes a type <code>T</code>,
allocates storage for a <a href="#Variables">variable</a> of that type
at run time, and returns a value of type <code>*T</code>
<a href="#Pointer_types">pointing</a> to it.
The variable is initialized as described in the section on
<a href="#The_zero_value">initial values</a>.
The built-in function <code>new</code> creates a new, initialized
<a href="#Variables">variable</a> and returns
a <a href="#Pointer_types">pointer</a> to it.
It accepts a single argument, which may be either a type or an expression.
</p>
<pre class="grammar">
new(T)
</pre>
<p>
If the argument is a type <code>T</code>, then <code>new(T)</code>
allocates a variable of type <code>T</code> initialized to its
<a href="#The_zero_value">zero value</a>.
</p>
<p>
For instance
If the argument is an expression <code>x</code>, then <code>new(x)</code>
allocates a variable of the type of <code>x</code> initialized to the value of <code>x</code>.
If that value is an untyped constant, it is first implicitly <a href="#Conversions">converted</a>
to its <a href="#Constants">default type</a>;
if it is an untyped boolean value, it is first implicitly converted to type bool.
The predeclared identifier <code>nil</code> cannot be used as an argument to <code>new</code>.
</p>
<p>
For example, <code>new(int)</code> and <code>new(123)</code> each
return a pointer to a new variable of type <code>int</code>.
The value of the first variable is <code>0</code>, and the value
of the second is <code>123</code>. Similarly
</p>
<pre>
@ -7828,13 +7828,12 @@ new(S)
</pre>
<p>
allocates storage for a variable of type <code>S</code>,
allocates a variable of type <code>S</code>,
initializes it (<code>a=0</code>, <code>b=0.0</code>),
and returns a value of type <code>*S</code> containing the address
of the location.
of the variable.
</p>
<h3 id="Handling_panics">Handling panics</h3>
<p> Two built-in functions, <code>panic</code> and <code>recover</code>,

View file

@ -153,6 +153,36 @@ for example,
see the [runtime documentation](/pkg/runtime#hdr-Environment_Variables)
and the [go command documentation](/cmd/go#hdr-Build_and_test_caching).
### Go 1.26
Go 1.26 added a new `httpcookiemaxnum` setting that controls the maximum number
of cookies that net/http will accept when parsing HTTP headers. If the number of
cookie in a header exceeds the number set in `httpcookiemaxnum`, cookie parsing
will fail early. The default value is `httpcookiemaxnum=3000`. Setting
`httpcookiemaxnum=0` will allow the cookie parsing to accept an indefinite
number of cookies. To avoid denial of service attacks, this setting and default
was backported to Go 1.25.2 and Go 1.24.8.
Go 1.26 added a new `urlstrictcolons` setting that controls whether `net/url.Parse`
allows malformed hostnames containing colons outside of a bracketed IPv6 address.
The default `urlstrictcolons=1` rejects URLs such as `http://localhost:1:2` or `http://::1/`.
Colons are permitted as part of a bracketed IPv6 address, such as `http://[::1]/`.
Go 1.26 enabled two additional post-quantum key exchange mechanisms:
SecP256r1MLKEM768 and SecP384r1MLKEM1024. The default can be reverted using the
[`tlssecpmlkem` setting](/pkg/crypto/tls/#Config.CurvePreferences).
Go 1.26 added a new `tracebacklabels` setting that controls the inclusion of
goroutine labels set through the the `runtime/pprof` package. Setting `tracebacklabels=1`
includes these key/value pairs in the goroutine status header of runtime
tracebacks and debug=2 runtime/pprof stack dumps. This format may change in the future.
(see go.dev/issue/76349)
Go 1.26 added a new `cryptocustomrand` setting that controls whether most crypto/...
APIs ignore the random `io.Reader` parameter. For Go 1.26, it defaults
to `cryptocustomrand=0`, ignoring the random parameters. Using `cryptocustomrand=1`
reverts to the pre-Go 1.26 behavior.
### Go 1.25
Go 1.25 added a new `decoratemappings` setting that controls whether the Go
@ -276,7 +306,7 @@ Go 1.23 changed the channels created by package time to be unbuffered
and [`Timer.Reset`](/pkg/time/#Timer.Reset) method results much easier.
The [`asynctimerchan` setting](/pkg/time/#NewTimer) disables this change.
There are no runtime metrics for this change,
This setting may be removed in a future release, Go 1.27 at the earliest.
This setting will be removed in Go 1.27.
Go 1.23 changed the mode bits reported by [`os.Lstat`](/pkg/os#Lstat) and [`os.Stat`](/pkg/os#Stat)
for reparse points, which can be controlled with the `winsymlink` setting.
@ -313,6 +343,7 @@ any effect.
Go 1.23 changed the default TLS cipher suites used by clients and servers when
not explicitly configured, removing 3DES cipher suites. The default can be reverted
using the [`tls3des` setting](/pkg/crypto/tls/#Config.CipherSuites).
This setting will be removed in Go 1.27.
Go 1.23 changed the behavior of [`tls.X509KeyPair`](/pkg/crypto/tls#X509KeyPair)
and [`tls.LoadX509KeyPair`](/pkg/crypto/tls#LoadX509KeyPair) to populate the
@ -320,6 +351,7 @@ Leaf field of the returned [`tls.Certificate`](/pkg/crypto/tls#Certificate).
This behavior is controlled by the `x509keypairleaf` setting. For Go 1.23, it
defaults to `x509keypairleaf=1`. Previous versions default to
`x509keypairleaf=0`.
This setting will be removed in Go 1.27.
Go 1.23 changed
[`net/http.ServeContent`](/pkg/net/http#ServeContent),
@ -353,21 +385,24 @@ Whether the type checker produces `Alias` types or not is controlled by the
[`gotypesalias` setting](/pkg/go/types#Alias).
For Go 1.22 it defaults to `gotypesalias=0`.
For Go 1.23, `gotypesalias=1` will become the default.
This setting will be removed in a future release, Go 1.27 at the earliest.
This setting will be removed in Go 1.27.
Go 1.22 changed the default minimum TLS version supported by both servers
and clients to TLS 1.2. The default can be reverted to TLS 1.0 using the
[`tls10server` setting](/pkg/crypto/tls/#Config).
This setting will be removed in Go 1.27.
Go 1.22 changed the default TLS cipher suites used by clients and servers when
not explicitly configured, removing the cipher suites which used RSA based key
exchange. The default can be reverted using the [`tlsrsakex` setting](/pkg/crypto/tls/#Config).
This setting will be removed in Go 1.27.
Go 1.22 disabled
[`ConnectionState.ExportKeyingMaterial`](/pkg/crypto/tls/#ConnectionState.ExportKeyingMaterial)
when the connection supports neither TLS 1.3 nor Extended Master Secret
(implemented in Go 1.21). It can be reenabled with the [`tlsunsafeekm`
setting](/pkg/crypto/tls/#ConnectionState.ExportKeyingMaterial).
This setting will be removed in Go 1.27.
Go 1.22 changed how the runtime interacts with transparent huge pages on Linux.
In particular, a common default Linux kernel configuration can result in

View file

@ -1,10 +1 @@
### Minor changes to the library {#minor_library_changes}
#### go/types
The `Var.Kind` method returns an enumeration of type `VarKind` that
classifies the variable (package-level, local, receiver, parameter,
result, or struct field). See issue #70250.
Callers of `NewVar` or `NewParam` are encouraged to call `Var.SetKind`
to ensure that this attribute is set correctly in all cases.

View file

@ -30,7 +30,7 @@ v%.zip:
go run ../../src/cmd/go/internal/fips140/mkzip.go v$*
# normally mkzip refuses to overwrite an existing zip file.
# make v1.2.3.rm removes the zip file and and unpacked
# make v1.2.3.rm removes the zip file and unpacked
# copy from the module cache.
v%.rm:
rm -f v$*.zip

View file

@ -9,4 +9,4 @@
#
# go test cmd/go/internal/fips140 -update
#
v1.0.0.zip b50508feaeff05d22516b21e1fd210bbf5d6a1e422eaf2cfa23fe379342713b8
v1.0.0-c2097c7c.zip daf3614e0406f67ae6323c902db3f953a1effb199142362a039e7526dfb9368b

View file

@ -1 +1 @@
v1.0.0
v1.0.0-c2097c7c

1
lib/fips140/v1.0.0.txt Normal file
View file

@ -0,0 +1 @@
v1.0.0-c2097c7c

64
lib/hg/goreposum.py Normal file
View file

@ -0,0 +1,64 @@
# Copyright 2025 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
# Mercurial extension to add a 'goreposum' command that
# computes a hash of a remote repo's tag state.
# Tag definitions can come from the .hgtags file stored in
# any head of any branch, and the server protocol does not
# expose the tags directly. However, the protocol does expose
# the hashes of all the branch heads, so we can use a hash of
# all those branch names and heads as a conservative snapshot
# of the entire remote repo state, and use that as the tag sum.
# Any change on the server then invalidates the tag sum,
# even if it didn't have anything to do with tags, but at least
# we will avoid re-cloning a server when there have been no
# changes at all.
#
# Separately, this extension also adds a 'golookup' command that
# returns the hash of a specific reference, like 'default' or a tag.
# And golookup of a hash confirms that it still exists on the server.
# We can use that to revalidate that specific versions still exist and
# have the same meaning they did the last time we checked.
#
# Usage:
#
# hg --config "extensions.goreposum=$GOROOT/lib/hg/goreposum.py" goreposum REPOURL
import base64, hashlib, sys
from mercurial import registrar, ui, hg, node
from mercurial.i18n import _
cmdtable = {}
command = registrar.command(cmdtable)
@command(b'goreposum', [], _('url'), norepo=True)
def goreposum(ui, url):
"""
goreposum computes a checksum of all the named state in the remote repo.
It hashes together all the branch names and hashes
and then all the bookmark names and hashes.
Tags are stored in .hgtags files in any of the branches,
so the branch metadata includes the tags as well.
"""
h = hashlib.sha256()
peer = hg.peer(ui, {}, url)
for name, revs in peer.branchmap().items():
h.update(name)
for r in revs:
h.update(b' ')
h.update(r)
h.update(b'\n')
if (b'bookmarks' in peer.listkeys(b'namespaces')):
for name, rev in peer.listkeys(b'bookmarks').items():
h.update(name)
h.update(b'=')
h.update(rev)
h.update(b'\n')
print('r1:'+base64.standard_b64encode(h.digest()).decode('utf-8'))
@command(b'golookup', [], _('url rev'), norepo=True)
def golookup(ui, url, rev):
"""
golookup looks up a single identifier in the repo,
printing its hash.
"""
print(node.hex(hg.peer(ui, {}, url).lookup(rev)).decode('utf-8'))

View file

@ -212,7 +212,7 @@ func copyLocalData(dstbase string) (pkgpath string, err error) {
// Copy all immediate files and testdata directories between
// the package being tested and the source root.
pkgpath = ""
for _, element := range strings.Split(finalPkgpath, string(filepath.Separator)) {
for element := range strings.SplitSeq(finalPkgpath, string(filepath.Separator)) {
if debug {
log.Printf("copying %s", pkgpath)
}

View file

@ -39,6 +39,7 @@ var (
errMissData = errors.New("archive/tar: sparse file references non-existent data")
errUnrefData = errors.New("archive/tar: sparse file contains unreferenced data")
errWriteHole = errors.New("archive/tar: write non-NUL byte in sparse hole")
errSparseTooLong = errors.New("archive/tar: sparse map too long")
)
type headerError []string

View file

@ -531,12 +531,17 @@ func readGNUSparseMap1x0(r io.Reader) (sparseDatas, error) {
cntNewline int64
buf bytes.Buffer
blk block
totalSize int
)
// feedTokens copies data in blocks from r into buf until there are
// at least cnt newlines in buf. It will not read more blocks than needed.
feedTokens := func(n int64) error {
for cntNewline < n {
totalSize += len(blk)
if totalSize > maxSpecialFileSize {
return errSparseTooLong
}
if _, err := mustReadFull(r, blk[:]); err != nil {
return err
}
@ -569,8 +574,8 @@ func readGNUSparseMap1x0(r io.Reader) (sparseDatas, error) {
}
// Parse for all member entries.
// numEntries is trusted after this since a potential attacker must have
// committed resources proportional to what this library used.
// numEntries is trusted after this since feedTokens limits the number of
// tokens based on maxSpecialFileSize.
if err := feedTokens(2 * numEntries); err != nil {
return nil, err
}

View file

@ -621,6 +621,11 @@ func TestReader(t *testing.T) {
},
Format: FormatPAX,
}},
}, {
// Small compressed file that uncompresses to
// a file with a very large GNU 1.0 sparse map.
file: "testdata/gnu-sparse-many-zeros.tar.bz2",
err: errSparseTooLong,
}}
for _, v := range vectors {

View file

@ -213,15 +213,17 @@ func parsePAXTime(s string) (time.Time, error) {
}
// Parse the nanoseconds.
if strings.Trim(sn, "0123456789") != "" {
return time.Time{}, ErrHeader
// Initialize an array with '0's to handle right padding automatically.
nanoDigits := [maxNanoSecondDigits]byte{'0', '0', '0', '0', '0', '0', '0', '0', '0'}
for i := range len(sn) {
switch c := sn[i]; {
case c < '0' || c > '9':
return time.Time{}, ErrHeader
case i < len(nanoDigits):
nanoDigits[i] = c
}
}
if len(sn) < maxNanoSecondDigits {
sn += strings.Repeat("0", maxNanoSecondDigits-len(sn)) // Right pad
} else {
sn = sn[:maxNanoSecondDigits] // Right truncate
}
nsecs, _ := strconv.ParseInt(sn, 10, 64) // Must succeed
nsecs, _ := strconv.ParseInt(string(nanoDigits[:]), 10, 64) // Must succeed after validation
if len(ss) > 0 && ss[0] == '-' {
return time.Unix(secs, -1*nsecs), nil // Negative correction
}

View file

@ -439,3 +439,66 @@ func TestFormatPAXRecord(t *testing.T) {
}
}
}
func BenchmarkParsePAXTime(b *testing.B) {
tests := []struct {
name string
in string
want time.Time
ok bool
}{
{
name: "NoNanos",
in: "123456",
want: time.Unix(123456, 0),
ok: true,
},
{
name: "ExactNanos",
in: "1.123456789",
want: time.Unix(1, 123456789),
ok: true,
},
{
name: "WithNanoPadding",
in: "1.123",
want: time.Unix(1, 123000000),
ok: true,
},
{
name: "WithNanoTruncate",
in: "1.123456789123",
want: time.Unix(1, 123456789),
ok: true,
},
{
name: "TrailingError",
in: "1.123abc",
want: time.Time{},
ok: false,
},
{
name: "LeadingError",
in: "1.abc123",
want: time.Time{},
ok: false,
},
}
for _, tt := range tests {
b.Run(tt.name, func(b *testing.B) {
b.ReportAllocs()
for b.Loop() {
ts, err := parsePAXTime(tt.in)
if (err == nil) != tt.ok {
if err != nil {
b.Fatal(err)
}
b.Fatal("expected error")
}
if !ts.Equal(tt.want) {
b.Fatalf("time mismatch: got %v, want %v", ts, tt.want)
}
}
})
}
}

Binary file not shown.

View file

@ -1213,7 +1213,6 @@ func TestFS(t *testing.T) {
[]string{"a/b/c"},
},
} {
test := test
t.Run(test.file, func(t *testing.T) {
t.Parallel()
z, err := OpenReader(test.file)
@ -1247,7 +1246,6 @@ func TestFSWalk(t *testing.T) {
wantErr: true,
},
} {
test := test
t.Run(test.file, func(t *testing.T) {
t.Parallel()
z, err := OpenReader(test.file)

View file

@ -311,10 +311,7 @@ func (b *Reader) ReadRune() (r rune, size int, err error) {
if b.r == b.w {
return 0, 0, b.readErr()
}
r, size = rune(b.buf[b.r]), 1
if r >= utf8.RuneSelf {
r, size = utf8.DecodeRune(b.buf[b.r:b.w])
}
r, size = utf8.DecodeRune(b.buf[b.r:b.w])
b.r += size
b.lastByte = int(b.buf[b.r-1])
b.lastRuneSize = size

View file

@ -77,6 +77,18 @@ func (b *Buffer) String() string {
return string(b.buf[b.off:])
}
// Peek returns the next n bytes without advancing the buffer.
// If Peek returns fewer than n bytes, it also returns [io.EOF].
// The slice is only valid until the next call to a read or write method.
// The slice aliases the buffer content at least until the next buffer modification,
// so immediate changes to the slice will affect the result of future reads.
func (b *Buffer) Peek(n int) ([]byte, error) {
if b.Len() < n {
return b.buf[b.off:], io.EOF
}
return b.buf[b.off : b.off+n], nil
}
// empty reports whether the unread portion of the buffer is empty.
func (b *Buffer) empty() bool { return len(b.buf) <= b.off }

View file

@ -531,6 +531,40 @@ func TestReadString(t *testing.T) {
}
}
var peekTests = []struct {
buffer string
skip int
n int
expected string
err error
}{
{"", 0, 0, "", nil},
{"aaa", 0, 3, "aaa", nil},
{"foobar", 0, 2, "fo", nil},
{"a", 0, 2, "a", io.EOF},
{"helloworld", 4, 3, "owo", nil},
{"helloworld", 5, 5, "world", nil},
{"helloworld", 5, 6, "world", io.EOF},
{"helloworld", 10, 1, "", io.EOF},
}
func TestPeek(t *testing.T) {
for _, test := range peekTests {
buf := NewBufferString(test.buffer)
buf.Next(test.skip)
bytes, err := buf.Peek(test.n)
if string(bytes) != test.expected {
t.Errorf("expected %q, got %q", test.expected, bytes)
}
if err != test.err {
t.Errorf("expected error %v, got %v", test.err, err)
}
if buf.Len() != len(test.buffer)-test.skip {
t.Errorf("bad length after peek: %d, want %d", buf.Len(), len(test.buffer)-test.skip)
}
}
}
func BenchmarkReadString(b *testing.B) {
const n = 32 << 10

View file

@ -508,7 +508,7 @@ func Fields(s []byte) [][]byte {
// It splits the slice s at each run of code points c satisfying f(c) and
// returns a slice of subslices of s. If all code points in s satisfy f(c), or
// len(s) == 0, an empty slice is returned. Every element of the returned slice is
// non-empty. Unlike [SplitFunc], leading and trailing runs of code points
// non-empty. Unlike [Split], leading and trailing runs of code points
// satisfying f(c) are discarded.
//
// FieldsFunc makes no guarantees about the order in which it calls f(c)
@ -528,11 +528,7 @@ func FieldsFunc(s []byte, f func(rune) bool) [][]byte {
// more efficient, possibly due to cache effects.
start := -1 // valid span start if >= 0
for i := 0; i < len(s); {
size := 1
r := rune(s[i])
if r >= utf8.RuneSelf {
r, size = utf8.DecodeRune(s[i:])
}
r, size := utf8.DecodeRune(s[i:])
if f(r) {
if start >= 0 {
spans = append(spans, span{start, i})
@ -614,11 +610,7 @@ func Map(mapping func(r rune) rune, s []byte) []byte {
// fine. It could also shrink but that falls out naturally.
b := make([]byte, 0, len(s))
for i := 0; i < len(s); {
wid := 1
r := rune(s[i])
if r >= utf8.RuneSelf {
r, wid = utf8.DecodeRune(s[i:])
}
r, wid := utf8.DecodeRune(s[i:])
r = mapping(r)
if r >= 0 {
b = utf8.AppendRune(b, r)
@ -917,11 +909,7 @@ func LastIndexFunc(s []byte, f func(r rune) bool) int {
func indexFunc(s []byte, f func(r rune) bool, truth bool) int {
start := 0
for start < len(s) {
wid := 1
r := rune(s[start])
if r >= utf8.RuneSelf {
r, wid = utf8.DecodeRune(s[start:])
}
r, wid := utf8.DecodeRune(s[start:])
if f(r) == truth {
return start
}
@ -1052,10 +1040,7 @@ func trimLeftASCII(s []byte, as *asciiSet) []byte {
func trimLeftUnicode(s []byte, cutset string) []byte {
for len(s) > 0 {
r, n := rune(s[0]), 1
if r >= utf8.RuneSelf {
r, n = utf8.DecodeRune(s)
}
r, n := utf8.DecodeRune(s)
if !containsRune(cutset, r) {
break
}
@ -1117,41 +1102,34 @@ func trimRightUnicode(s []byte, cutset string) []byte {
// TrimSpace returns a subslice of s by slicing off all leading and
// trailing white space, as defined by Unicode.
func TrimSpace(s []byte) []byte {
// Fast path for ASCII: look for the first ASCII non-space byte
start := 0
for ; start < len(s); start++ {
c := s[start]
// Fast path for ASCII: look for the first ASCII non-space byte.
for lo, c := range s {
if c >= utf8.RuneSelf {
// If we run into a non-ASCII byte, fall back to the
// slower unicode-aware method on the remaining bytes
return TrimFunc(s[start:], unicode.IsSpace)
// slower unicode-aware method on the remaining bytes.
return TrimFunc(s[lo:], unicode.IsSpace)
}
if asciiSpace[c] == 0 {
break
if asciiSpace[c] != 0 {
continue
}
s = s[lo:]
// Now look for the first ASCII non-space byte from the end.
for hi := len(s) - 1; hi >= 0; hi-- {
c := s[hi]
if c >= utf8.RuneSelf {
return TrimFunc(s[:hi+1], unicode.IsSpace)
}
if asciiSpace[c] == 0 {
// At this point, s[:hi+1] starts and ends with ASCII
// non-space bytes, so we're done. Non-ASCII cases have
// already been handled above.
return s[:hi+1]
}
}
}
// Now look for the first ASCII non-space byte from the end
stop := len(s)
for ; stop > start; stop-- {
c := s[stop-1]
if c >= utf8.RuneSelf {
return TrimFunc(s[start:stop], unicode.IsSpace)
}
if asciiSpace[c] == 0 {
break
}
}
// At this point s[start:stop] starts and ends with an ASCII
// non-space bytes, so we're done. Non-ASCII cases have already
// been handled above.
if start == stop {
// Special case to preserve previous TrimLeftFunc behavior,
// returning nil instead of empty slice if all spaces.
return nil
}
return s[start:stop]
// Special case to preserve previous TrimLeftFunc behavior,
// returning nil instead of empty slice if all spaces.
return nil
}
// Runes interprets s as a sequence of UTF-8-encoded code points.
@ -1258,19 +1236,10 @@ hasUnicode:
t = t[i:]
for len(s) != 0 && len(t) != 0 {
// Extract first rune from each.
var sr, tr rune
if s[0] < utf8.RuneSelf {
sr, s = rune(s[0]), s[1:]
} else {
r, size := utf8.DecodeRune(s)
sr, s = r, s[size:]
}
if t[0] < utf8.RuneSelf {
tr, t = rune(t[0]), t[1:]
} else {
r, size := utf8.DecodeRune(t)
tr, t = r, t[size:]
}
sr, size := utf8.DecodeRune(s)
s = s[size:]
tr, size := utf8.DecodeRune(t)
t = t[size:]
// If they match, keep going; if not, return false.

View file

@ -693,14 +693,14 @@ func bmIndexRuneUnicode(rt *unicode.RangeTable, needle rune) func(b *testing.B,
for _, r16 := range rt.R16 {
for r := rune(r16.Lo); r <= rune(r16.Hi); r += rune(r16.Stride) {
if r != needle {
rs = append(rs, rune(r))
rs = append(rs, r)
}
}
}
for _, r32 := range rt.R32 {
for r := rune(r32.Lo); r <= rune(r32.Hi); r += rune(r32.Stride) {
if r != needle {
rs = append(rs, rune(r))
rs = append(rs, r)
}
}
}
@ -891,9 +891,7 @@ func BenchmarkCountSingle(b *testing.B) {
b.Fatal("bad count", j, expect)
}
}
for i := 0; i < len(buf); i++ {
buf[i] = 0
}
clear(buf)
})
}
@ -1226,7 +1224,7 @@ func TestMap(t *testing.T) {
// Run a couple of awful growth/shrinkage tests
a := tenRunes('a')
// 1. Grow. This triggers two reallocations in Map.
// 1. Grow. This triggers two reallocations in Map.
maxRune := func(r rune) rune { return unicode.MaxRune }
m := Map(maxRune, []byte(a))
expect := tenRunes(unicode.MaxRune)

View file

@ -117,11 +117,7 @@ func FieldsFuncSeq(s []byte, f func(rune) bool) iter.Seq[[]byte] {
return func(yield func([]byte) bool) {
start := -1
for i := 0; i < len(s); {
size := 1
r := rune(s[i])
if r >= utf8.RuneSelf {
r, size = utf8.DecodeRune(s[i:])
}
r, size := utf8.DecodeRune(s[i:])
if f(r) {
if start >= 0 {
if !yield(s[start:i:i]) {

View file

@ -1,6 +1,6 @@
pkg p1, const A //deprecated
pkg p1, const A = 1
pkg p1, const A ideal-int
pkg p1, const A //deprecated
pkg p1, const A64 = 1
pkg p1, const A64 int64
pkg p1, const AIsLowerA = 11
@ -25,8 +25,8 @@ pkg p1, func TakesFunc(func(int) int)
pkg p1, method (*B) JustOnB()
pkg p1, method (*B) OnBothTandBPtr()
pkg p1, method (*Embedded) OnEmbedded()
pkg p1, method (*S2) SMethod(int8, int16, int64)
pkg p1, method (*S2) SMethod //deprecated
pkg p1, method (*S2) SMethod(int8, int16, int64)
pkg p1, method (*T) JustOnT()
pkg p1, method (*T) OnBothTandBPtr()
pkg p1, method (B) OnBothTandBVal()
@ -53,8 +53,8 @@ pkg p1, type Error interface { Error, Temporary }
pkg p1, type Error interface, Error() string
pkg p1, type Error interface, Temporary() bool
pkg p1, type FuncType func(int, int, string) (*B, error)
pkg p1, type I interface, Get(string) int64
pkg p1, type I interface, Get //deprecated
pkg p1, type I interface, Get(string) int64
pkg p1, type I interface, GetNamed(string) int64
pkg p1, type I interface, Name() string
pkg p1, type I interface, PackageTwoMeth()
@ -63,9 +63,9 @@ pkg p1, type I interface, unexported methods
pkg p1, type MyInt int
pkg p1, type Namer interface { Name }
pkg p1, type Namer interface, Name() string
pkg p1, type Private //deprecated
pkg p1, type Private interface, X()
pkg p1, type Private interface, unexported methods
pkg p1, type Private //deprecated
pkg p1, type Public interface { X, Y }
pkg p1, type Public interface, X()
pkg p1, type Public interface, Y()
@ -84,8 +84,8 @@ pkg p1, type TPtrExported struct
pkg p1, type TPtrExported struct, embedded *Embedded
pkg p1, type TPtrUnexported struct
pkg p1, type Time struct
pkg p1, type URL struct
pkg p1, type URL //deprecated
pkg p1, type URL struct
pkg p1, var Byte uint8
pkg p1, var ByteConv []uint8
pkg p1, var ByteFunc func(uint8) int32
@ -97,8 +97,8 @@ pkg p1, var StrConv string
pkg p1, var V string
pkg p1, var V1 uint64
pkg p1, var V2 p2.Twoer
pkg p1, var VError Error
pkg p1, var VError //deprecated
pkg p1, var VError Error
pkg p1, var X I
pkg p1, var X0 int64
pkg p1, var Y int

View file

@ -1,8 +1,7 @@
pkg p2, func F() string
pkg p2, func F //deprecated
pkg p2, func F() string
pkg p2, func G() Twoer
pkg p2, func NewError(string) error
pkg p2, type Twoer interface { PackageTwoMeth }
pkg p2, type Twoer interface, PackageTwoMeth()
pkg p2, type Twoer interface, PackageTwoMeth //deprecated
pkg p2, type Twoer interface, PackageTwoMeth()

View file

@ -1,6 +1,6 @@
pkg p4, func NewPair[$0 interface{ M }, $1 interface{ ~int }]($0, $1) Pair[$0, $1]
pkg p4, method (Pair[$0, $1]) Second() $1
pkg p4, method (Pair[$0, $1]) First() $0
pkg p4, type Pair[$0 interface{ M }, $1 interface{ ~int }] struct
pkg p4, func Clone[$0 interface{ ~[]$1 }, $1 interface{}]($0) $0
pkg p4, func Clone //deprecated
pkg p4, func Clone[$0 interface{ ~[]$1 }, $1 interface{}]($0) $0
pkg p4, func NewPair[$0 interface{ M }, $1 interface{ ~int }]($0, $1) Pair[$0, $1]
pkg p4, method (Pair[$0, $1]) First() $0
pkg p4, method (Pair[$0, $1]) Second() $1
pkg p4, type Pair[$0 interface{ M }, $1 interface{ ~int }] struct

View file

@ -92,7 +92,8 @@ func jumpX86(word string) bool {
func jumpRISCV(word string) bool {
switch word {
case "BEQ", "BEQZ", "BGE", "BGEU", "BGEZ", "BGT", "BGTU", "BGTZ", "BLE", "BLEU", "BLEZ",
"BLT", "BLTU", "BLTZ", "BNE", "BNEZ", "CALL", "JAL", "JALR", "JMP":
"BLT", "BLTU", "BLTZ", "BNE", "BNEZ", "CALL", "CBEQZ", "CBNEZ", "CJ", "CJALR", "CJR",
"JAL", "JALR", "JMP":
return true
}
return false

View file

@ -195,149 +195,6 @@ func ARM64RegisterShift(reg, op, count int16) (int64, error) {
return int64(reg&31)<<16 | int64(op)<<22 | int64(uint16(count)), nil
}
// ARM64RegisterExtension constructs an ARM64 register with extension or arrangement.
func ARM64RegisterExtension(a *obj.Addr, ext string, reg, num int16, isAmount, isIndex bool) error {
Rnum := (reg & 31) + int16(num<<5)
if isAmount {
if num < 0 || num > 7 {
return errors.New("index shift amount is out of range")
}
}
if reg <= arm64.REG_R31 && reg >= arm64.REG_R0 {
if !isAmount {
return errors.New("invalid register extension")
}
switch ext {
case "UXTB":
if a.Type == obj.TYPE_MEM {
return errors.New("invalid shift for the register offset addressing mode")
}
a.Reg = arm64.REG_UXTB + Rnum
case "UXTH":
if a.Type == obj.TYPE_MEM {
return errors.New("invalid shift for the register offset addressing mode")
}
a.Reg = arm64.REG_UXTH + Rnum
case "UXTW":
// effective address of memory is a base register value and an offset register value.
if a.Type == obj.TYPE_MEM {
a.Index = arm64.REG_UXTW + Rnum
} else {
a.Reg = arm64.REG_UXTW + Rnum
}
case "UXTX":
if a.Type == obj.TYPE_MEM {
return errors.New("invalid shift for the register offset addressing mode")
}
a.Reg = arm64.REG_UXTX + Rnum
case "SXTB":
if a.Type == obj.TYPE_MEM {
return errors.New("invalid shift for the register offset addressing mode")
}
a.Reg = arm64.REG_SXTB + Rnum
case "SXTH":
if a.Type == obj.TYPE_MEM {
return errors.New("invalid shift for the register offset addressing mode")
}
a.Reg = arm64.REG_SXTH + Rnum
case "SXTW":
if a.Type == obj.TYPE_MEM {
a.Index = arm64.REG_SXTW + Rnum
} else {
a.Reg = arm64.REG_SXTW + Rnum
}
case "SXTX":
if a.Type == obj.TYPE_MEM {
a.Index = arm64.REG_SXTX + Rnum
} else {
a.Reg = arm64.REG_SXTX + Rnum
}
case "LSL":
a.Index = arm64.REG_LSL + Rnum
default:
return errors.New("unsupported general register extension type: " + ext)
}
} else if reg <= arm64.REG_V31 && reg >= arm64.REG_V0 {
switch ext {
case "B8":
if isIndex {
return errors.New("invalid register extension")
}
a.Reg = arm64.REG_ARNG + (reg & 31) + ((arm64.ARNG_8B & 15) << 5)
case "B16":
if isIndex {
return errors.New("invalid register extension")
}
a.Reg = arm64.REG_ARNG + (reg & 31) + ((arm64.ARNG_16B & 15) << 5)
case "H4":
if isIndex {
return errors.New("invalid register extension")
}
a.Reg = arm64.REG_ARNG + (reg & 31) + ((arm64.ARNG_4H & 15) << 5)
case "H8":
if isIndex {
return errors.New("invalid register extension")
}
a.Reg = arm64.REG_ARNG + (reg & 31) + ((arm64.ARNG_8H & 15) << 5)
case "S2":
if isIndex {
return errors.New("invalid register extension")
}
a.Reg = arm64.REG_ARNG + (reg & 31) + ((arm64.ARNG_2S & 15) << 5)
case "S4":
if isIndex {
return errors.New("invalid register extension")
}
a.Reg = arm64.REG_ARNG + (reg & 31) + ((arm64.ARNG_4S & 15) << 5)
case "D1":
if isIndex {
return errors.New("invalid register extension")
}
a.Reg = arm64.REG_ARNG + (reg & 31) + ((arm64.ARNG_1D & 15) << 5)
case "D2":
if isIndex {
return errors.New("invalid register extension")
}
a.Reg = arm64.REG_ARNG + (reg & 31) + ((arm64.ARNG_2D & 15) << 5)
case "Q1":
if isIndex {
return errors.New("invalid register extension")
}
a.Reg = arm64.REG_ARNG + (reg & 31) + ((arm64.ARNG_1Q & 15) << 5)
case "B":
if !isIndex {
return nil
}
a.Reg = arm64.REG_ELEM + (reg & 31) + ((arm64.ARNG_B & 15) << 5)
a.Index = num
case "H":
if !isIndex {
return nil
}
a.Reg = arm64.REG_ELEM + (reg & 31) + ((arm64.ARNG_H & 15) << 5)
a.Index = num
case "S":
if !isIndex {
return nil
}
a.Reg = arm64.REG_ELEM + (reg & 31) + ((arm64.ARNG_S & 15) << 5)
a.Index = num
case "D":
if !isIndex {
return nil
}
a.Reg = arm64.REG_ELEM + (reg & 31) + ((arm64.ARNG_D & 15) << 5)
a.Index = num
default:
return errors.New("unsupported simd register extension type: " + ext)
}
} else {
return errors.New("invalid register and extension combination")
}
return nil
}
// ARM64RegisterArrangement constructs an ARM64 vector register arrangement.
func ARM64RegisterArrangement(reg int16, name, arng string) (int64, error) {
var curQ, curSize uint16

View file

@ -23,18 +23,6 @@ func jumpLoong64(word string) bool {
return false
}
// IsLoong64MUL reports whether the op (as defined by an loong64.A* constant) is
// one of the MUL/DIV/REM instructions that require special handling.
func IsLoong64MUL(op obj.As) bool {
switch op {
case loong64.AMUL, loong64.AMULU, loong64.AMULV, loong64.AMULVU,
loong64.ADIV, loong64.ADIVU, loong64.ADIVV, loong64.ADIVVU,
loong64.AREM, loong64.AREMU, loong64.AREMV, loong64.AREMVU:
return true
}
return false
}
// IsLoong64RDTIME reports whether the op (as defined by an loong64.A*
// constant) is one of the RDTIMELW/RDTIMEHW/RDTIMED instructions that
// require special handling.

View file

@ -11,6 +11,7 @@ package arch
import (
"cmd/internal/obj"
"cmd/internal/obj/riscv"
"fmt"
)
// IsRISCV64AMO reports whether op is an AMO instruction that requires
@ -32,6 +33,20 @@ func IsRISCV64VTypeI(op obj.As) bool {
return op == riscv.AVSETVLI || op == riscv.AVSETIVLI
}
// IsRISCV64CSRO reports whether the op is an instruction that uses
// CSR symbolic names and whether that instruction expects a register
// or an immediate source operand.
func IsRISCV64CSRO(op obj.As) (imm bool, ok bool) {
switch op {
case riscv.ACSRRCI, riscv.ACSRRSI, riscv.ACSRRWI:
imm = true
fallthrough
case riscv.ACSRRC, riscv.ACSRRS, riscv.ACSRRW:
ok = true
}
return
}
var riscv64SpecialOperand map[string]riscv.SpecialOperand
// RISCV64SpecialOperand returns the internal representation of a special operand.
@ -39,9 +54,21 @@ func RISCV64SpecialOperand(name string) riscv.SpecialOperand {
if riscv64SpecialOperand == nil {
// Generate mapping when function is first called.
riscv64SpecialOperand = map[string]riscv.SpecialOperand{}
for opd := riscv.SPOP_BEGIN; opd < riscv.SPOP_END; opd++ {
for opd := riscv.SPOP_RVV_BEGIN; opd < riscv.SPOP_RVV_END; opd++ {
riscv64SpecialOperand[opd.String()] = opd
}
// Add the CSRs
for csrCode, csrName := range riscv.CSRs {
// The set of RVV special operand names and the set of CSR special operands
// names are disjoint and so can safely share a single namespace. However,
// it's possible that a future update to the CSRs in inst.go could introduce
// a conflict. This check ensures that such a conflict does not go
// unnoticed.
if _, ok := riscv64SpecialOperand[csrName]; ok {
panic(fmt.Sprintf("riscv64 special operand %q redefined", csrName))
}
riscv64SpecialOperand[csrName] = riscv.SpecialOperand(int(csrCode) + int(riscv.SPOP_CSR_BEGIN))
}
}
if opd, ok := riscv64SpecialOperand[name]; ok {
return opd

View file

@ -248,7 +248,7 @@ func (p *Parser) asmData(operands [][]lex.Token) {
case obj.TYPE_CONST:
switch sz {
case 1, 2, 4, 8:
nameAddr.Sym.WriteInt(p.ctxt, nameAddr.Offset, int(sz), valueAddr.Offset)
nameAddr.Sym.WriteInt(p.ctxt, nameAddr.Offset, sz, valueAddr.Offset)
default:
p.errorf("bad int size for DATA argument: %d", sz)
}
@ -262,10 +262,10 @@ func (p *Parser) asmData(operands [][]lex.Token) {
p.errorf("bad float size for DATA argument: %d", sz)
}
case obj.TYPE_SCONST:
nameAddr.Sym.WriteString(p.ctxt, nameAddr.Offset, int(sz), valueAddr.Val.(string))
nameAddr.Sym.WriteString(p.ctxt, nameAddr.Offset, sz, valueAddr.Val.(string))
case obj.TYPE_ADDR:
if sz == p.arch.PtrSize {
nameAddr.Sym.WriteAddr(p.ctxt, nameAddr.Offset, int(sz), valueAddr.Sym, valueAddr.Offset)
nameAddr.Sym.WriteAddr(p.ctxt, nameAddr.Offset, sz, valueAddr.Sym, valueAddr.Offset)
} else {
p.errorf("bad addr size for DATA argument: %d", sz)
}
@ -782,6 +782,21 @@ func (p *Parser) asmInstruction(op obj.As, cond string, a []obj.Addr) {
prog.RegTo2 = a[2].Reg
break
}
// RISCV64 instructions that reference CSRs with symbolic names.
if isImm, ok := arch.IsRISCV64CSRO(op); ok {
if a[0].Type != obj.TYPE_CONST && isImm {
p.errorf("invalid value for first operand to %s instruction, must be a 5 bit unsigned immediate", op)
return
}
if a[1].Type != obj.TYPE_SPECIAL {
p.errorf("invalid value for second operand to %s instruction, must be a CSR name", op)
return
}
prog.AddRestSourceArgs([]obj.Addr{a[1]})
prog.From = a[0]
prog.To = a[2]
break
}
prog.From = a[0]
prog.Reg = p.getRegister(prog, op, &a[1])
prog.To = a[2]
@ -974,14 +989,6 @@ func (p *Parser) getConstant(prog *obj.Prog, op obj.As, addr *obj.Addr) int64 {
return addr.Offset
}
// getImmediate checks that addr represents an immediate constant and returns its value.
func (p *Parser) getImmediate(prog *obj.Prog, op obj.As, addr *obj.Addr) int64 {
if addr.Type != obj.TYPE_CONST || addr.Name != 0 || addr.Reg != 0 || addr.Index != 0 {
p.errorf("%s: expected immediate constant; found %s", op, obj.Dconv(prog, addr))
}
return addr.Offset
}
// getRegister checks that addr represents a register and returns its value.
func (p *Parser) getRegister(prog *obj.Prog, op obj.As, addr *obj.Addr) int16 {
if addr.Type != obj.TYPE_REG || addr.Offset != 0 || addr.Name != 0 || addr.Index != 0 {

View file

@ -38,7 +38,7 @@ func testEndToEnd(t *testing.T, goarch, file string) {
ctxt.IsAsm = true
defer ctxt.Bso.Flush()
failed := false
ctxt.DiagFunc = func(format string, args ...interface{}) {
ctxt.DiagFunc = func(format string, args ...any) {
failed = true
t.Errorf(format, args...)
}
@ -193,7 +193,7 @@ Diff:
top := pList.Firstpc
var text *obj.LSym
ok = true
ctxt.DiagFunc = func(format string, args ...interface{}) {
ctxt.DiagFunc = func(format string, args ...any) {
t.Errorf(format, args...)
ok = false
}
@ -294,7 +294,7 @@ func testErrors(t *testing.T, goarch, file string, flags ...string) {
failed := false
var errBuf bytes.Buffer
parser.errorWriter = &errBuf
ctxt.DiagFunc = func(format string, args ...interface{}) {
ctxt.DiagFunc = func(format string, args ...any) {
failed = true
s := fmt.Sprintf(format, args...)
if !strings.HasSuffix(s, "\n") {
@ -467,6 +467,7 @@ func TestLOONG64Encoder(t *testing.T) {
testEndToEnd(t, "loong64", "loong64enc3")
testEndToEnd(t, "loong64", "loong64enc4")
testEndToEnd(t, "loong64", "loong64enc5")
testEndToEnd(t, "loong64", "loong64enc6")
testEndToEnd(t, "loong64", "loong64")
}

View file

@ -78,7 +78,7 @@ func NewParser(ctxt *obj.Link, ar *arch.Arch, lexer lex.TokenReader) *Parser {
// and turn it into a recoverable panic.
var panicOnError bool
func (p *Parser) errorf(format string, args ...interface{}) {
func (p *Parser) errorf(format string, args ...any) {
if panicOnError {
panic(fmt.Errorf(format, args...))
}
@ -90,7 +90,7 @@ func (p *Parser) errorf(format string, args ...interface{}) {
if p.lex != nil {
// Put file and line information on head of message.
format = "%s:%d: " + format + "\n"
args = append([]interface{}{p.lex.File(), p.lineNum}, args...)
args = append([]any{p.lex.File(), p.lineNum}, args...)
}
fmt.Fprintf(p.errorWriter, format, args...)
p.errorCount++
@ -775,7 +775,7 @@ func (p *Parser) registerExtension(a *obj.Addr, name string, prefix rune) {
switch p.arch.Family {
case sys.ARM64:
err := arch.ARM64RegisterExtension(a, ext, reg, num, isAmount, isIndex)
err := arm64.ARM64RegisterExtension(a, ext, reg, num, isAmount, isIndex)
if err != nil {
p.errorf("%v", err)
}

View file

@ -169,3 +169,8 @@ TEXT ·a34(SB), 0, $0-0
SHLXQ AX, CX, R15
ADDQ $1, R15
RET
// Ensure from3 get GOT-rewritten without errors.
TEXT ·a35(SB), 0, $0-0
VGF2P8AFFINEQB $0, runtime·writeBarrier(SB), Z1, Z1
RET

View file

@ -400,6 +400,8 @@ TEXT foo(SB), DUPOK|NOSPLIT, $-8
MOVD $0x11110000, R1 // MOVD $286326784, R1 // 2122a2d2
MOVD $0xaaaa0000aaaa1111, R1 // MOVD $-6149102338357718767, R1 // 212282d24155b5f24155f5f2
MOVD $0x1111ffff1111aaaa, R1 // MOVD $1230045644216969898, R1 // a1aa8a922122a2f22122e2f2
MOVD $0xaaaaaaaaaaaaaaab, R1 // MOVD $-6148914691236517205, R1 // e1f301b2615595f2
MOVD $0x0ff019940ff00ff0, R1 // MOVD $1148446028692721648, R1 // e19f0cb28132c3f2
MOVD $0, R1 // e1031faa
MOVD $-1, R1 // 01008092
MOVD $0x210000, R0 // MOVD $2162688, R0 // 2004a0d2
@ -630,6 +632,8 @@ TEXT foo(SB), DUPOK|NOSPLIT, $-8
FMOVS F1, 0x44332211(R2) // FMOVS F1, 1144201745(R2)
FMOVD F1, 0x1007000(R2) // FMOVD F1, 16805888(R2)
FMOVD F1, 0x44332211(R2) // FMOVD F1, 1144201745(R2)
FMOVQ F1, 0x1003000(R2) // FMOVQ F1, 16789504(R2)
FMOVQ F1, 0x44332211(R2) // FMOVQ F1, 1144201745(R2)
MOVB 0x1000000(R1), R2 // MOVB 16777216(R1), R2
MOVB 0x44332211(R1), R2 // MOVB 1144201745(R1), R2
@ -643,6 +647,8 @@ TEXT foo(SB), DUPOK|NOSPLIT, $-8
FMOVS 0x44332211(R1), F2 // FMOVS 1144201745(R1), F2
FMOVD 0x1000000(R1), F2 // FMOVD 16777216(R1), F2
FMOVD 0x44332211(R1), F2 // FMOVD 1144201745(R1), F2
FMOVQ 0x1000000(R1), F2 // FMOVQ 16777216(R1), F2
FMOVQ 0x44332211(R1), F2 // FMOVQ 1144201745(R1), F2
// shifted or extended register offset.
MOVD (R2)(R6.SXTW), R4 // 44c866f8
@ -1894,4 +1900,12 @@ next:
BTI J // 9f2403d5
BTI JC // df2403d5
// Pointer Authentication Codes (PAC)
PACIASP // 3f2303d5
AUTIASP // bf2303d5
PACIBSP // 7f2303d5
AUTIBSP // ff2303d5
AUTIA1716 // 9f2103d5
AUTIB1716 // df2103d5
END

View file

@ -422,4 +422,10 @@ TEXT errors(SB),$0
SHA1H V1.B16, V2.B16 // ERROR "invalid operands"
BTI // ERROR "missing operand"
BTI PLDL1KEEP // ERROR "illegal argument"
PACIASP C // ERROR "illegal combination"
AUTIASP R2 // ERROR "illegal combination"
PACIBSP R0 // ERROR "illegal combination"
AUTIBSP C // ERROR "illegal combination"
AUTIA1716 $45 // ERROR "illegal combination"
AUTIB1716 R0 // ERROR "illegal combination"
RET

View file

@ -33,13 +33,17 @@ lable2:
MOVV R4, R5 // 85001500
MOVBU R4, R5 // 85fc4303
SUB R4, R5, R6 // a6101100
SUBW R4, R5, R6 // a6101100
SUBV R4, R5, R6 // a6901100
ADD R4, R5, R6 // a6101000
ADDW R4, R5, R6 // a6101000
ADDV R4, R5, R6 // a6901000
AND R4, R5, R6 // a6901400
SUB R4, R5 // a5101100
SUBW R4, R5 // a5101100
SUBV R4, R5 // a5901100
ADD R4, R5 // a5101000
ADDW R4, R5 // a5101000
ADDV R4, R5 // a5901000
AND R4, R5 // a5901400
NEGW R4, R5 // 05101100
@ -93,8 +97,8 @@ lable2:
MOVV R4, 1(R5) // a404c029
MOVB R4, 1(R5) // a4040029
MOVBU R4, 1(R5) // a4040029
SC R4, 1(R5) // a4040021
SCV R4, 1(R5) // a4040023
SC R4, 4096(R5) // a4001021
SCV R4, 4096(R5) // a4001023
MOVW y+8(FP), R4 // 64408028
MOVWU y+8(FP), R4 // 6440802a
MOVV y+8(FP), R4 // 6440c028
@ -105,8 +109,8 @@ lable2:
MOVV 1(R5), R4 // a404c028
MOVB 1(R5), R4 // a4040028
MOVBU 1(R5), R4 // a404002a
LL 1(R5), R4 // a4040020
LLV 1(R5), R4 // a4040022
LL 4096(R5), R4 // a4001020
LLV 4096(R5), R4 // a4001022
MOVW $4(R4), R5 // 8510c002
MOVV $4(R4), R5 // 8510c002
MOVW $-1, R4 // 04fcff02
@ -115,6 +119,8 @@ lable2:
MOVV $1, R4 // 04048003
ADD $-1, R4, R5 // 85fcbf02
ADD $-1, R4 // 84fcbf02
ADDW $-1, R4, R5 // 85fcbf02
ADDW $-1, R4 // 84fcbf02
ADDV $-1, R4, R5 // 85fcff02
ADDV $-1, R4 // 84fcff02
AND $1, R4, R5 // 85044003
@ -165,6 +171,8 @@ lable2:
// mul
MUL R4, R5 // a5101c00
MUL R4, R5, R6 // a6101c00
MULW R4, R5 // a5101c00
MULW R4, R5, R6 // a6101c00
MULV R4, R5 // a5901d00
MULV R4, R5, R6 // a6901d00
MULVU R4, R5 // a5901d00
@ -191,20 +199,26 @@ lable2:
MOVHU R4, 1(R5) // a4044029
MOVHU y+8(FP), R4 // 6440402a
MOVHU 1(R5), R4 // a404402a
MULU R4, R5 // a5101c00
MULU R4, R5, R6 // a6101c00
MULH R4, R5 // a5901c00
MULH R4, R5, R6 // a6901c00
MULHU R4, R5 // a5101d00
MULHU R4, R5, R6 // a6101d00
REM R4, R5 // a5902000
REM R4, R5, R6 // a6902000
REMW R4, R5 // a5902000
REMW R4, R5, R6 // a6902000
REMU R4, R5 // a5902100
REMU R4, R5, R6 // a6902100
REMWU R4, R5 // a5902100
REMWU R4, R5, R6 // a6902100
DIV R4, R5 // a5102000
DIV R4, R5, R6 // a6102000
DIVW R4, R5 // a5102000
DIVW R4, R5, R6 // a6102000
DIVU R4, R5 // a5102100
DIVU R4, R5, R6 // a6102100
DIVWU R4, R5 // a5102100
DIVWU R4, R5, R6 // a6102100
SRLV R4, R5 // a5101900
SRLV R4, R5, R6 // a6101900
SRLV $4, R4, R5 // 85104500
@ -212,6 +226,12 @@ lable2:
SRLV $32, R4, R5 // 85804500
SRLV $32, R4 // 84804500
// MULW.D.W[U] instructions
MULWVW R4, R5 // a5101f00
MULWVW R4, R5, R6 // a6101f00
MULWVWU R4, R5 // a5901f00
MULWVWU R4, R5, R6 // a6901f00
MASKEQZ R4, R5, R6 // a6101300
MASKNEZ R4, R5, R6 // a6901300
@ -260,6 +280,31 @@ lable2:
MOVV FCC0, R4 // 04dc1401
MOVV R4, FCC0 // 80d81401
// LDPTR.{W/D} and STPTR.{W/D} instructions
MOVWP R5, 32764(R4) // 85fc7f25
MOVWP R5, 32(R4) // 85200025
MOVWP R5, 4(R4) // 85040025
MOVWP R5, (R4) // 85000025
MOVVP R5, 32764(R4) // 85fc7f27
MOVVP R5, 32(R4) // 85200027
MOVVP R5, 4(R4) // 85040027
MOVVP R5, (R4) // 85000027
MOVWP 32764(R5), R4 // a4fc7f24
MOVWP 32(R5), R4 // a4200024
MOVWP 4(R5), R4 // a4040024
MOVWP (R5), R4 // a4000024
MOVVP 32764(R5), R4 // a4fc7f26
MOVVP 32(R5), R4 // a4200026
MOVVP 4(R5), R4 // a4040026
MOVVP (R5), R4 // a4000026
// ADDU16I.D instruction
ADDV16 $(-32768<<16), R4, R5 // ADDV16 $-2147483648, R4, R5 // 85000012
ADDV16 $(0<<16), R4, R5 // ADDV16 $0, R4, R5 // 85000010
ADDV16 $(8<<16), R4, R5 // ADDV16 $524288, R4, R5 // 85200010
ADDV16 $(32767<<16), R4, R5 // ADDV16 $2147418112, R4, R5 // 85fcff11
ADDV16 $(16<<16), R4 // ADDV16 $1048576, R4 // 84400010
// Loong64 atomic memory access instructions
AMSWAPB R14, (R13), R12 // ac395c38
AMSWAPH R14, (R13), R12 // acb95c38
@ -376,6 +421,10 @@ lable2:
FTINTRNEVF F0, F2 // 02e41a01
FTINTRNEVD F0, F2 // 02e81a01
// FSEL instruction
FSEL FCC0, F1, F2, F3 // 4304000d
FSEL FCC1, F1, F2 // 4284000d
// LDX.{B,BU,H,HU,W,WU,D} instructions
MOVB (R14)(R13), R12 // cc350038
MOVBU (R14)(R13), R12 // cc352038
@ -504,12 +553,44 @@ lable2:
XVMOVQ X28.V[3], X8 // 88ef0377
XVMOVQ X27.V[0], X9 // 69e30377
//Move vector element to vector.
// Move vector element to vector.
VMOVQ V1.B[3], V9.B16 // 298cf772
VMOVQ V2.H[2], V8.H8 // 48c8f772
VMOVQ V3.W[1], V7.W4 // 67e4f772
VMOVQ V4.V[0], V6.V2 // 86f0f772
// Move vector register to vector register.
VMOVQ V1, V9 // 29002d73
VMOVQ V2, V8 // 48002d73
XVMOVQ X3, X7 // 67002d77
XVMOVQ X4, X6 // 86002d77
// Load data from memory and broadcast to each element of a vector register: VMOVQ offset(Rj), <Vd>.<T>
VMOVQ (R4), V0.B16 // 80008030
VMOVQ 1(R4), V0.B16 // 80048030
VMOVQ -3(R4), V0.B16 // 80f4bf30
VMOVQ (R4), V1.H8 // 81004030
VMOVQ 2(R4), V1.H8 // 81044030
VMOVQ -6(R4), V1.H8 // 81f45f30
VMOVQ (R4), V2.W4 // 82002030
VMOVQ 8(R4), V2.W4 // 82082030
VMOVQ -12(R4), V2.W4 // 82f42f30
VMOVQ (R4), V3.V2 // 83001030
VMOVQ 24(R4), V3.V2 // 830c1030
VMOVQ -16(R4), V3.V2 // 83f81730
XVMOVQ (R4), X0.B32 // 80008032
XVMOVQ 1(R4), X0.B32 // 80048032
XVMOVQ -5(R4), X0.B32 // 80ecbf32
XVMOVQ (R4), X1.H16 // 81004032
XVMOVQ 2(R4), X1.H16 // 81044032
XVMOVQ -10(R4), X1.H16 // 81ec5f32
XVMOVQ (R4), X2.W8 // 82002032
XVMOVQ 8(R4), X2.W8 // 82082032
XVMOVQ -20(R4), X2.W8 // 82ec2f32
XVMOVQ (R4), X3.V4 // 83001032
XVMOVQ 24(R4), X3.V4 // 830c1032
XVMOVQ -24(R4), X3.V4 // 83f41732
// VSEQ{B,H,W,V}, XVSEQ{B,H,W,V} instruction
VSEQB V1, V2, V3 // 43040070
VSEQH V1, V2, V3 // 43840070
@ -530,6 +611,42 @@ lable2:
XVSEQV $15, X2, X4 // 44bc8176
XVSEQV $-15, X2, X4 // 44c48176
// VSLTB{B,H,W,V}, XVSLTB{B,H,W,V} instruction
VSLTB V1, V2, V3 // 43040670
VSLTH V1, V2, V3 // 43840670
VSLTW V1, V2, V3 // 43040770
VSLTV V1, V2, V3 // 43840770
XVSLTB X1, X2, X3 // 43040674
XVSLTH X1, X2, X3 // 43840674
XVSLTW X1, X2, X3 // 43040774
XVSLTV X1, X2, X3 // 43840774
VSLTB $1, V2, V3 // 43048672
VSLTH $16, V2, V3 // 43c08672
VSLTW $-16, V2, V3 // 43408772
VSLTV $-15, V2, V3 // 43c48772
XVSLTB $1, X2, X3 // 43048676
XVSLTH $16, X2, X3 // 43c08676
XVSLTW $-16, X2, X3 // 43408776
XVSLTV $-16, X2, X3 // 43c08776
// VSLTB{B,H,W,V}U, XVSLTB{B,H,W,V}U instruction
VSLTBU V1, V2, V3 // 43040870
VSLTHU V1, V2, V3 // 43840870
VSLTWU V1, V2, V3 // 43040970
VSLTVU V1, V2, V3 // 43840970
XVSLTBU X1, X2, X3 // 43040874
XVSLTHU X1, X2, X3 // 43840874
XVSLTWU X1, X2, X3 // 43040974
XVSLTVU X1, X2, X3 // 43840974
VSLTBU $0, V2, V3 // 43008872
VSLTHU $31, V2, V3 // 43fc8872
VSLTWU $16, V2, V3 // 43408972
VSLTVU $1, V2, V3 // 43848972
XVSLTBU $0, X2, X3 // 43008876
XVSLTHU $31, X2, X3 // 43fc8876
XVSLTWU $8, X2, X3 // 43208976
XVSLTVU $0, X2, X3 // 43808976
// VPCNT{B,H,W,V}, XVPCNT{B,H,W,V} instruction
VPCNTB V1, V2 // 22209c72
VPCNTH V1, V2 // 22249c72
@ -782,6 +899,42 @@ lable2:
XVSUBWU $15, X1, X2 // 223c8d76
XVSUBVU $16, X1, X2 // 22c08d76
// [X]VSADD{B,H,W,V}, [X]VSSUB{B,H,W,V} instructions
VSADDB V1, V2, V3 // 43044670
VSADDH V1, V2, V3 // 43844670
VSADDW V1, V2, V3 // 43044770
VSADDV V1, V2, V3 // 43844770
VSSUBB V1, V2, V3 // 43044870
VSSUBH V1, V2, V3 // 43844870
VSSUBW V1, V2, V3 // 43044970
VSSUBV V1, V2, V3 // 43844970
XVSADDB X3, X2, X1 // 410c4674
XVSADDH X3, X2, X1 // 418c4674
XVSADDW X3, X2, X1 // 410c4774
XVSADDV X3, X2, X1 // 418c4774
XVSSUBB X3, X2, X1 // 410c4874
XVSSUBH X3, X2, X1 // 418c4874
XVSSUBW X3, X2, X1 // 410c4974
XVSSUBV X3, X2, X1 // 418c4974
// [X]VSADD{B,H,W,V}U, [X]VSSUB{B,H,W,V}U instructions
VSADDBU V1, V2, V3 // 43044a70
VSADDHU V1, V2, V3 // 43844a70
VSADDWU V1, V2, V3 // 43044b70
VSADDVU V1, V2, V3 // 43844b70
VSSUBBU V1, V2, V3 // 43044c70
VSSUBHU V1, V2, V3 // 43844c70
VSSUBWU V1, V2, V3 // 43044d70
VSSUBVU V1, V2, V3 // 43844d70
XVSADDBU X1, X2, X3 // 43044a74
XVSADDHU X1, X2, X3 // 43044b74
XVSADDWU X1, X2, X3 // 43044b74
XVSADDVU X1, X2, X3 // 43844b74
XVSSUBBU X1, X2, X3 // 43044c74
XVSSUBHU X1, X2, X3 // 43844c74
XVSSUBWU X1, X2, X3 // 43044d74
XVSSUBVU X1, X2, X3 // 43844d74
// [X]VILV{L/H}{B,H,W,V} instructions
VILVLB V1, V2, V3 // 43041a71
VILVLH V1, V2, V3 // 43841a71
@ -936,6 +1089,150 @@ lable2:
XVMULWODVWUW X1, X2, X3 // 4304a374
XVMULWODQVUV X1, X2, X3 // 4384a374
// [X]VADDW{EV/OD}.{H.B/W.H/D.W/Q.D} instructions
VADDWEVHB V1, V2, V3 // 43041e70
VADDWEVWH V1, V2, V3 // 43841e70
VADDWEVVW V1, V2, V3 // 43041f70
VADDWEVQV V1, V2, V3 // 43841f70
VADDWODHB V1, V2, V3 // 43042270
VADDWODWH V1, V2, V3 // 43842270
VADDWODVW V1, V2, V3 // 43042370
VADDWODQV V1, V2, V3 // 43842370
XVADDWEVHB X1, X2, X3 // 43041e74
XVADDWEVWH X1, X2, X3 // 43841e74
XVADDWEVVW X1, X2, X3 // 43041f74
XVADDWEVQV X1, X2, X3 // 43841f74
XVADDWODHB X1, X2, X3 // 43042274
XVADDWODWH X1, X2, X3 // 43842274
XVADDWODVW X1, X2, X3 // 43042374
XVADDWODQV X1, X2, X3 // 43842374
// [X]VSUBW{EV/OD}.{H.B/W.H/D.W/Q.D} instructions
VSUBWEVHB V1, V2, V3 // 43042070
VSUBWEVWH V1, V2, V3 // 43842070
VSUBWEVVW V1, V2, V3 // 43042170
VSUBWEVQV V1, V2, V3 // 43842170
VSUBWODHB V1, V2, V3 // 43042470
VSUBWODWH V1, V2, V3 // 43842470
VSUBWODVW V1, V2, V3 // 43042570
VSUBWODQV V1, V2, V3 // 43842570
XVSUBWEVHB X1, X2, X3 // 43042074
XVSUBWEVWH X1, X2, X3 // 43842074
XVSUBWEVVW X1, X2, X3 // 43042174
XVSUBWEVQV X1, X2, X3 // 43842174
XVSUBWODHB X1, X2, X3 // 43042474
XVSUBWODWH X1, X2, X3 // 43842474
XVSUBWODVW X1, X2, X3 // 43042574
XVSUBWODQV X1, X2, X3 // 43842574
// [X]VADDW{EV/OD}.{H.B/W.H/D.W/Q.D}U instructions
VADDWEVHBU V1, V2, V3 // 43042e70
VADDWEVWHU V1, V2, V3 // 43042f70
VADDWEVVWU V1, V2, V3 // 43042f70
VADDWEVQVU V1, V2, V3 // 43842f70
VADDWODHBU V1, V2, V3 // 43043270
VADDWODWHU V1, V2, V3 // 43843270
VADDWODVWU V1, V2, V3 // 43043370
VADDWODQVU V1, V2, V3 // 43843370
XVADDWEVHBU X1, X2, X3 // 43042e74
XVADDWEVWHU X1, X2, X3 // 43842e74
XVADDWEVVWU X1, X2, X3 // 43042f74
XVADDWEVQVU X1, X2, X3 // 43842f74
XVADDWODHBU X1, X2, X3 // 43043274
XVADDWODWHU X1, X2, X3 // 43843274
XVADDWODVWU X1, X2, X3 // 43043374
XVADDWODQVU X1, X2, X3 // 43843374
// [X]VSUBW{EV/OD}.{H.B/W.H/D.W/Q.D}U instructions
VSUBWEVHBU V1, V2, V3 // 43043070
VSUBWEVWHU V1, V2, V3 // 43843070
VSUBWEVVWU V1, V2, V3 // 43043170
VSUBWEVQVU V1, V2, V3 // 43843170
VSUBWODHBU V1, V2, V3 // 43043470
VSUBWODWHU V1, V2, V3 // 43843470
VSUBWODVWU V1, V2, V3 // 43043570
VSUBWODQVU V1, V2, V3 // 43843570
XVSUBWEVHBU X1, X2, X3 // 43043074
XVSUBWEVWHU X1, X2, X3 // 43843074
XVSUBWEVVWU X1, X2, X3 // 43043174
XVSUBWEVQVU X1, X2, X3 // 43843174
XVSUBWODHBU X1, X2, X3 // 43043474
XVSUBWODWHU X1, X2, X3 // 43843474
XVSUBWODVWU X1, X2, X3 // 43043574
XVSUBWODQVU X1, X2, X3 // 43843574
// [X]VMADD.{B/H/W/D}, [X]VMSUB.{B/H/W/D} instructions
VMADDB V1, V2, V3 // 4304a870
VMADDH V1, V2, V3 // 4384a870
VMADDW V1, V2, V3 // 4304a970
VMADDV V1, V2, V3 // 4384a970
VMSUBB V1, V2, V3 // 4304aa70
VMSUBH V1, V2, V3 // 4384aa70
VMSUBW V1, V2, V3 // 4304ab70
VMSUBV V1, V2, V3 // 4384ab70
XVMADDB X1, X2, X3 // 4304a874
XVMADDH X1, X2, X3 // 4384a874
XVMADDW X1, X2, X3 // 4304a974
XVMADDV X1, X2, X3 // 4384a974
XVMSUBB X1, X2, X3 // 4304aa74
XVMSUBH X1, X2, X3 // 4384aa74
XVMSUBW X1, X2, X3 // 4304ab74
XVMSUBV X1, X2, X3 // 4384ab74
// [X]VMADDW{EV/OD}.{H.B/W.H/D.W/Q.D} instructions
VMADDWEVHB V1, V2, V3 // 4304ac70
VMADDWEVWH V1, V2, V3 // 4384ac70
VMADDWEVVW V1, V2, V3 // 4304ad70
VMADDWEVQV V1, V2, V3 // 4384ad70
VMADDWODHB V1, V2, V3 // 4304ae70
VMADDWODWH V1, V2, V3 // 4384ae70
VMADDWODVW V1, V2, V3 // 4304af70
VMADDWODQV V1, V2, V3 // 4384af70
XVMADDWEVHB X1, X2, X3 // 4304ac74
XVMADDWEVWH X1, X2, X3 // 4384ac74
XVMADDWEVVW X1, X2, X3 // 4304ad74
XVMADDWEVQV X1, X2, X3 // 4384ad74
XVMADDWODHB X1, X2, X3 // 4304ae74
XVMADDWODWH X1, X2, X3 // 4384ae74
XVMADDWODVW X1, X2, X3 // 4304af74
XVMADDWODQV X1, X2, X3 // 4384af74
// [X]VMADDW{EV/OD}.{H.B/W.H/D.W/Q.D}U instructions
VMADDWEVHBU V1, V2, V3 // 4304b470
VMADDWEVWHU V1, V2, V3 // 4384b470
VMADDWEVVWU V1, V2, V3 // 4304b570
VMADDWEVQVU V1, V2, V3 // 4384b570
VMADDWODHBU V1, V2, V3 // 4304b670
VMADDWODWHU V1, V2, V3 // 4384b670
VMADDWODVWU V1, V2, V3 // 4304b770
VMADDWODQVU V1, V2, V3 // 4384b770
XVMADDWEVHBU X1, X2, X3 // 4304b474
XVMADDWEVWHU X1, X2, X3 // 4384b474
XVMADDWEVVWU X1, X2, X3 // 4304b574
XVMADDWEVQVU X1, X2, X3 // 4384b574
XVMADDWODHBU X1, X2, X3 // 4304b674
XVMADDWODWHU X1, X2, X3 // 4384b674
XVMADDWODVWU X1, X2, X3 // 4304b774
XVMADDWODQVU X1, X2, X3 // 4384b774
// [X]VMADDW{EV/OD}.{H.BU.B/W.HU.H/D.WU.W/Q.DU.D} instructions
VMADDWEVHBUB V1, V2, V3 // 4304bc70
VMADDWEVWHUH V1, V2, V3 // 4384bc70
VMADDWEVVWUW V1, V2, V3 // 4304bd70
VMADDWEVQVUV V1, V2, V3 // 4384bd70
VMADDWODHBUB V1, V2, V3 // 4304be70
VMADDWODWHUH V1, V2, V3 // 4384be70
VMADDWODVWUW V1, V2, V3 // 4304bf70
VMADDWODQVUV V1, V2, V3 // 4384bf70
XVMADDWEVHBUB X1, X2, X3 // 4304bc74
XVMADDWEVWHUH X1, X2, X3 // 4384bc74
XVMADDWEVVWUW X1, X2, X3 // 4304bd74
XVMADDWEVQVUV X1, X2, X3 // 4384bd74
XVMADDWODHBUB X1, X2, X3 // 4304be74
XVMADDWODWHUH X1, X2, X3 // 4384be74
XVMADDWODVWUW X1, X2, X3 // 4304bf74
XVMADDWODQVUV X1, X2, X3 // 4384bf74
// [X]VSHUF4I.{B/H/W/D} instructions
VSHUF4IB $0, V2, V1 // 41009073
VSHUF4IB $16, V2, V1 // 41409073
@ -962,6 +1259,32 @@ lable2:
XVSHUF4IV $8, X1, X2 // 22209c77
XVSHUF4IV $15, X1, X2 // 223c9c77
// [X]VSHUF.{B/H/W/V} instructions
VSHUFH V1, V2, V3 // 43847a71
VSHUFW V1, V2, V3 // 43047b71
VSHUFV V1, V2, V3 // 43847b71
XVSHUFH X1, X2, X3 // 43847a75
XVSHUFW X1, X2, X3 // 43047b75
XVSHUFV X1, X2, X3 // 43847b75
VSHUFB V1, V2, V3, V4 // 6488500d
XVSHUFB X1, X2, X3, X4 // 6488600d
// VPERMIW, XVPERMI{W,V,Q} instructions
VPERMIW $0x1B, V1, V2 // VPERMIW $27, V1, V2 // 226ce473
XVPERMIW $0x2B, X1, X2 // XVPERMIW $43, X1, X2 // 22ace477
XVPERMIV $0x3B, X1, X2 // XVPERMIV $59, X1, X2 // 22ece877
XVPERMIQ $0x4B, X1, X2 // XVPERMIQ $75, X1, X2 // 222ced77
// A{,X}VEXTRINS.{B,H,W,V} instructions
VEXTRINSB $0x18, V1, V2 // VEXTRINSB $24, V1, V2 // 22608c73
VEXTRINSH $0x27, V1, V2 // VEXTRINSH $39, V1, V2 // 229c8873
VEXTRINSW $0x36, V1, V2 // VEXTRINSW $54, V1, V2 // 22d88473
VEXTRINSV $0x45, V1, V2 // VEXTRINSV $69, V1, V2 // 22148173
XVEXTRINSB $0x54, X1, X2 // XVEXTRINSB $84, X1, X2 // 22508d77
XVEXTRINSH $0x63, X1, X2 // XVEXTRINSH $99, X1, X2 // 228c8977
XVEXTRINSW $0x72, X1, X2 // XVEXTRINSW $114, X1, X2 // 22c88577
XVEXTRINSV $0x81, X1, X2 // XVEXTRINSV $129, X1, X2 // 22048277
// [X]VSETEQZ.V, [X]VSETNEZ.V
VSETEQV V1, FCC0 // 20989c72
VSETNEV V1, FCC0 // 209c9c72
@ -1035,3 +1358,58 @@ lable2:
PRELD (R4), $0 // 8000c02a
PRELD -1(R4), $8 // 88fcff2a
PRELD 8(R4), $31 // 9f20c02a
// [X]{VBITCLR/VBITSET/VBITREV}{B,H,W,V} instructions
VBITCLRB V1, V2, V3 // 43040c71
VBITCLRH V1, V2, V3 // 43840c71
VBITCLRW V1, V2, V3 // 43040d71
VBITCLRV V1, V2, V3 // 43840d71
VBITSETB V1, V2, V3 // 43040e71
VBITSETH V1, V2, V3 // 43840e71
VBITSETW V1, V2, V3 // 43040f71
VBITSETV V1, V2, V3 // 43840f71
VBITREVB V1, V2, V3 // 43041071
VBITREVH V1, V2, V3 // 43841071
VBITREVW V1, V2, V3 // 43041171
VBITREVV V1, V2, V3 // 43841171
XVBITCLRB X3, X2, X1 // 410c0c75
XVBITCLRH X3, X2, X1 // 418c0c75
XVBITCLRW X3, X2, X1 // 410c0d75
XVBITCLRV X3, X2, X1 // 418c0d75
XVBITSETB X3, X2, X1 // 410c0e75
XVBITSETH X3, X2, X1 // 418c0e75
XVBITSETW X3, X2, X1 // 410c0f75
XVBITSETV X3, X2, X1 // 418c0f75
XVBITREVB X3, X2, X1 // 410c1075
XVBITREVH X3, X2, X1 // 418c1075
XVBITREVW X3, X2, X1 // 410c1175
XVBITREVV X3, X2, X1 // 418c1175
VBITCLRB $7, V2, V3 // 433c1073
VBITCLRH $15, V2, V3 // 437c1073
VBITCLRW $31, V2, V3 // 43fc1073
VBITCLRV $63, V2, V3 // 43fc1173
VBITSETB $7, V2, V3 // 433c1473
VBITSETH $15, V2, V3 // 437c1473
VBITSETW $31, V2, V3 // 43fc1473
VBITSETV $63, V2, V3 // 43fc1573
VBITREVB $7, V2, V3 // 433c1873
VBITREVH $15, V2, V3 // 437c1873
VBITREVW $31, V2, V3 // 43fc1873
VBITREVV $63, V2, V3 // 43fc1973
XVBITCLRB $7, X2, X1 // 413c1077
XVBITCLRH $15, X2, X1 // 417c1077
XVBITCLRW $31, X2, X1 // 41fc1077
XVBITCLRV $63, X2, X1 // 41fc1177
XVBITSETB $7, X2, X1 // 413c1477
XVBITSETH $15, X2, X1 // 417c1477
XVBITSETW $31, X2, X1 // 41fc1477
XVBITSETV $63, X2, X1 // 41fc1577
XVBITREVB $7, X2, X1 // 413c1877
XVBITREVH $15, X2, X1 // 417c1877
XVBITREVW $31, X2, X1 // 41fc1877
XVBITREVV $63, X2, X1 // 41fc1977
// ALSL{W/WU/D}
ALSLW $4, R4, R5, R6 // 86940500
ALSLWU $4, R4, R5, R6 // 86940700
ALSLV $4, R4, R5, R6 // 86942d00

View file

@ -21,6 +21,10 @@ TEXT asmtest(SB),DUPOK|NOSPLIT,$0
ADD $4096, R4, R5 // 3e00001485781000
ADD $65536, R4 // 1e02001484781000
ADD $4096, R4 // 3e00001484781000
ADDW $65536, R4, R5 // 1e02001485781000
ADDW $4096, R4, R5 // 3e00001485781000
ADDW $65536, R4 // 1e02001484781000
ADDW $4096, R4 // 3e00001484781000
ADDV $65536, R4, R5 // 1e02001485f81000
ADDV $4096, R4, R5 // 3e00001485f81000
ADDV $65536, R4 // 1e02001484f81000
@ -37,10 +41,6 @@ TEXT asmtest(SB),DUPOK|NOSPLIT,$0
SGTU $4096, R4, R5 // 3e00001485f81200
SGTU $65536, R4 // 1e02001484f81200
SGTU $4096, R4 // 3e00001484f81200
ADDU $65536, R4, R5 // 1e02001485781000
ADDU $4096, R4, R5 // 3e00001485781000
ADDU $65536, R4 // 1e02001484781000
ADDU $4096, R4 // 3e00001484781000
ADDVU $65536, R4, R5 // 1e02001485f81000
ADDVU $4096, R4, R5 // 3e00001485f81000
ADDVU $65536, R4 // 1e02001484f81000

View file

@ -11,12 +11,16 @@ TEXT asmtest(SB),DUPOK|NOSPLIT,$0
MOVV $4096(R4), R5 // 3e000014de03800385f81000
ADD $74565, R4 // 5e020014de178d0384781000
ADD $4097, R4 // 3e000014de07800384781000
ADDW $74565, R4 // 5e020014de178d0384781000
ADDW $4097, R4 // 3e000014de07800384781000
ADDV $74565, R4 // 5e020014de178d0384f81000
ADDV $4097, R4 // 3e000014de07800384f81000
AND $74565, R4 // 5e020014de178d0384f81400
AND $4097, R4 // 3e000014de07800384f81400
ADD $74565, R4, R5 // 5e020014de178d0385781000
ADD $4097, R4, R5 // 3e000014de07800385781000
ADDW $74565, R4, R5 // 5e020014de178d0385781000
ADDW $4097, R4, R5 // 3e000014de07800385781000
ADDV $74565, R4, R5 // 5e020014de178d0385f81000
ADDV $4097, R4, R5 // 3e000014de07800385f81000
AND $74565, R4, R5 // 5e020014de178d0385f81400
@ -42,8 +46,10 @@ TEXT asmtest(SB),DUPOK|NOSPLIT,$0
MOVB R4, 4096(R5) // 3e000014de971000c4030029
MOVBU R4, 65536(R5) // 1e020014de971000c4030029
MOVBU R4, 4096(R5) // 3e000014de971000c4030029
SC R4, 65536(R5) // 1e020014de971000c4030021
SC R4, 4096(R5) // 3e000014de971000c4030021
SC R4, 65536(R5) // 1e040010de971000c4030021
SCV R4, 65536(R5) // 1e040010de971000c4030023
LL 65536(R5), R4 // 1e040010de971000c4030020
LLV 65536(R5), R4 // 1e040010de971000c4030022
MOVW y+65540(FP), R4 // 1e020014de8f1000c4338028
MOVWU y+65540(FP), R4 // 1e020014de8f1000c433802a
MOVV y+65540(FP), R4 // 1e020014de8f1000c433c028
@ -105,10 +111,6 @@ TEXT asmtest(SB),DUPOK|NOSPLIT,$0
SGTU $74565, R4, R5 // 5e020014de178d0385f81200
SGTU $4097, R4 // 3e000014de07800384f81200
SGTU $4097, R4, R5 // 3e000014de07800385f81200
ADDU $74565, R4 // 5e020014de178d0384781000
ADDU $74565, R4, R5 // 5e020014de178d0385781000
ADDU $4097, R4 // 3e000014de07800384781000
ADDU $4097, R4, R5 // 3e000014de07800385781000
ADDVU $4097, R4 // 3e000014de07800384f81000
ADDVU $4097, R4, R5 // 3e000014de07800385f81000
ADDVU $74565, R4 // 5e020014de178d0384f81000
@ -122,6 +124,21 @@ TEXT asmtest(SB),DUPOK|NOSPLIT,$0
XOR $4097, R4 // 3e000014de07800384f81500
XOR $4097, R4, R5 // 3e000014de07800385f81500
MOVWP R5, -32768(R4) // 1efcff13de931000c5038025
MOVWP R5, 32768(R4) // 1e000010de931000c5038025
MOVWP R5, 65536(R4) // 1e040010de931000c5030025
MOVWP R5, 1048576(R4) // 1e400010de931000c5030025
MOVVP R5, -32768(R4) // 1efcff13de931000c5038027
MOVVP R5, 65536(R4) // 1e040010de931000c5030027
MOVVP R5, 1048576(R4) // 1e400010de931000c5030027
MOVWP -32768(R5), R4 // 1efcff13de971000c4038024
MOVWP 2229248(R5), R4 // 1e880010de971000c4030424
MOVWP -2145518592(R5), R4 // 1e740012de971000c403fc24
MOVVP -32768(R5), R4 // 1efcff13de971000c4038026
MOVVP 2229248(R5), R4 // 1e880010de971000c4030426
MOVVP -2145518592(R5), R4 // 1e740012de971000c403fc26
// MOVV C_DCON32_12S, r
MOVV $0x27312345fffff800, R4 // MOVV $2824077224892692480, R4 // 0400a002a468241684cc0903
MOVV $0xf7312345fffff800, R4 // MOVV $-634687288927848448, R4 // 0400a002a468241684cc3d03

View file

@ -0,0 +1,12 @@
// Copyright 2025 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#include "../../../../../runtime/textflag.h"
TEXT asmtest(SB),DUPOK|NOSPLIT,$0
// MOVWP LOREG_64(Rx), Ry
MOVWP 81985529216486896(R4), R5 // 9e571315dec3b703feac6816de4b000384f8100085000025
MOVWP -81985529216486896(R4), R5 // 7ea8ec14de4388031e539717deb73f0384f8100085000025
MOVWP R4, 81985529216486896(R5) // 9e571315dec3b703feac6816de4b0003a5f81000a4000025
MOVWP R4, -81985529216486896(R5) // 7ea8ec14de4388031e539717deb73f03a5f81000a4000025

View file

@ -5,3 +5,10 @@
TEXT errors(SB),$0
VSHUF4IV $16, V1, V2 // ERROR "operand out of range 0 to 15"
XVSHUF4IV $16, X1, X2 // ERROR "operand out of range 0 to 15"
ADDV16 $1, R4, R5 // ERROR "the constant must be a multiple of 65536."
ADDV16 $65535, R4, R5 // ERROR "the constant must be a multiple of 65536."
SC R4, 1(R5) // ERROR "offset must be a multiple of 4."
SCV R4, 1(R5) // ERROR "offset must be a multiple of 4."
LL 1(R5), R4 // ERROR "offset must be a multiple of 4."
LLV 1(R5), R4 // ERROR "offset must be a multiple of 4."

View file

@ -172,11 +172,35 @@ start:
SD X5, (X6) // 23305300
SD X5, 4(X6) // 23325300
// 7.1: CSR Instructions
CSRRC X0, CYCLE, X5 // f33200c0
CSRRC X0, CYCLE, X0 // 733000c0
CSRRC X10, CYCLE, X5 // f33205c0
CSRRC $2, TIME, X5 // f37211c0
CSRRCI $2, TIME, X5 // f37211c0
CSRRS X0, CYCLE, X5 // f32200c0
CSRRS X0, CYCLE, X0 // 732000c0
CSRRS X10, CYCLE, X5 // f32205c0
CSRRS $2, TIME, X5 // f36211c0
CSRRS X0, VLENB, X5 // f32220c2
CSRRSI $2, TIME, X5 // f36211c0
CSRRW X0, CYCLE, X5 // f31200c0
CSRRW X0, CYCLE, X0 // 731000c0
CSRRW X10, CYCLE, X5 // f31205c0
CSRRW $2, TIME, X5 // f35211c0
CSRRWI $2, TIME, X5 // f35211c0
// 8.1: Base Counters and Timers (Zicntr)
RDCYCLE X5 // f32200c0
RDTIME X5 // f32210c0
RDINSTRET X5 // f32220c0
// 12.3: Integer Conditional Operations (Zicond)
CZEROEQZ X5, X6, X7 // b353530e
CZEROEQZ X5, X7 // b3d3530e
CZERONEZ X5, X6, X7 // b373530e
CZERONEZ X5, X7 // b3f3530e
// 13.1: Multiplication Operations
MUL X5, X6, X7 // b3035302
MULH X5, X6, X7 // b3135302
@ -340,9 +364,84 @@ start:
FNMSUBD F1, F2, F3, F4 // 4b82201a
FNMADDD F1, F2, F3, F4 // 4f82201a
// 21.6: Double-Precision Floating-Point Compare Instructions
FEQD F0, F1, X7 // d3a300a2
FLTD F0, F1, X7 // d39300a2
FLED F0, F1, X7 // d38300a2
// 21.7: Double-Precision Floating-Point Classify Instruction
FCLASSD F0, X5 // d31200e2
//
// "C" Extension for Compressed Instructions, Version 2.0
//
// 26.3.1: Compressed Stack-Pointer-Based Loads and Stores
CLWSP 20(SP), X10 // 5245
CLDSP 24(SP), X10 // 6265
CFLDSP 32(SP), F10 // 0235
CSWSP X10, 20(SP) // 2aca
CSDSP X10, 24(SP) // 2aec
CFSDSP F10, 32(SP) // 2ab0
// 26.3.2: Compressed Register-Based Loads and Stores
CLW 20(X10), X11 // 4c49
CLD 24(X10), X11 // 0c6d
CFLD 32(X10), F11 // 0c31
CSW X11, 20(X10) // 4cc9
CSD X11, 24(X10) // 0ced
CFSD F11, 32(X10) // 0cb1
// 26.4: Compressed Control Transfer Instructions
CJ 1(PC) // 09a0
CJR X5 // 8282
CJALR X5 // 8292
CBEQZ X10, 1(PC) // 09c1
CBNEZ X10, 1(PC) // 09e1
// 26.5.1: Compressed Integer Constant-Generation Instructions
CLI $-32, X5 // 8152
CLI $31, X5 // fd42
CLUI $-32, X5 // 8172
CLUI $31, X5 // fd62
// 26.5.2: Compressed Integer Register-Immediate Operations
CADD $-32, X5 // 8112
CADD $31, X5 // fd02
CADDI $-32, X5 // 8112
CADDI $31, X5 // fd02
CADDW $-32, X5 // 8132
CADDW $31, X5 // fd22
CADDIW $-32, X5 // 8132
CADDIW $31, X5 // fd22
CADDI16SP $-512, SP // 0171
CADDI16SP $496, SP // 7d61
CADDI4SPN $4, SP, X10 // 4800
CADDI4SPN $1020, SP, X10 // e81f
CSLLI $63, X5 // fe12
CSRLI $63, X10 // 7d91
CSRAI $63, X10 // 7d95
CAND $-32, X10 // 0199
CAND $31, X10 // 7d89
CANDI $-32, X10 // 0199
CANDI $31, X10 // 7d89
// 26.5.3: Compressed Integer Register-Register Operations
CMV X6, X5 // 9a82
CADD X9, X8 // 2694
CAND X9, X8 // 658c
COR X9, X8 // 458c
CXOR X9, X8 // 258c
CSUB X9, X8 // 058c
CADDW X9, X8 // 259c
CSUBW X9, X8 // 059c
// 26.5.5: Compressed NOP Instruction
CNOP // 0100
// 26.5.6: Compressed Breakpoint Instruction
CEBREAK // 0290
// 28.4.1: Address Generation Instructions (Zba)
ADDUW X10, X11, X12 // 3b86a508
ADDUW X10, X11 // bb85a508
@ -520,6 +619,588 @@ start:
VSOXEI64V V3, V2, (X10) // a771250e
VSOXEI64V V3, V2, V0, (X10) // a771250c
// 31.7.7: Unit-stride Fault-Only-First Loads
VLE8FFV (X10), V8 // 07040503
VLE16FFV (X10), V8 // 07540503
VLE32FFV (X10), V8 // 07640503
VLE64FFV (X10), V8 // 07740503
VLE8FFV (X10), V0, V8 // 07040501
VLE16FFV (X10), V0, V8 // 07540501
VLE32FFV (X10), V0, V8 // 07640501
VLE64FFV (X10), V0, V8 // 07740501
// 31.7.8: Vector Load/Store Segment Instructions
// 31.7.8.1: Vector Unit-Stride Segment Loads and Stores
VLSEG2E8V (X10), V8 // 07040522
VLSEG2E16V (X10), V8 // 07540522
VLSEG2E32V (X10), V8 // 07640522
VLSEG2E64V (X10), V8 // 07740522
VLSEG2E8V (X10), V0, V8 // 07040520
VLSEG2E16V (X10), V0, V8 // 07540520
VLSEG2E32V (X10), V0, V8 // 07640520
VLSEG2E64V (X10), V0, V8 // 07740520
VLSEG3E8V (X10), V8 // 07040542
VLSEG3E16V (X10), V8 // 07540542
VLSEG3E32V (X10), V8 // 07640542
VLSEG3E64V (X10), V8 // 07740542
VLSEG3E8V (X10), V0, V8 // 07040540
VLSEG3E16V (X10), V0, V8 // 07540540
VLSEG3E32V (X10), V0, V8 // 07640540
VLSEG3E64V (X10), V0, V8 // 07740540
VLSEG4E8V (X10), V8 // 07040562
VLSEG4E16V (X10), V8 // 07540562
VLSEG4E32V (X10), V8 // 07640562
VLSEG4E64V (X10), V8 // 07740562
VLSEG4E8V (X10), V0, V8 // 07040560
VLSEG4E16V (X10), V0, V8 // 07540560
VLSEG4E32V (X10), V0, V8 // 07640560
VLSEG4E64V (X10), V0, V8 // 07740560
VLSEG5E8V (X10), V8 // 07040582
VLSEG5E16V (X10), V8 // 07540582
VLSEG5E32V (X10), V8 // 07640582
VLSEG5E64V (X10), V8 // 07740582
VLSEG5E8V (X10), V0, V8 // 07040580
VLSEG5E16V (X10), V0, V8 // 07540580
VLSEG5E32V (X10), V0, V8 // 07640580
VLSEG5E64V (X10), V0, V8 // 07740580
VLSEG6E8V (X10), V8 // 070405a2
VLSEG6E16V (X10), V8 // 075405a2
VLSEG6E32V (X10), V8 // 076405a2
VLSEG6E64V (X10), V8 // 077405a2
VLSEG6E8V (X10), V0, V8 // 070405a0
VLSEG6E16V (X10), V0, V8 // 075405a0
VLSEG6E32V (X10), V0, V8 // 076405a0
VLSEG6E64V (X10), V0, V8 // 077405a0
VLSEG7E8V (X10), V8 // 070405c2
VLSEG7E16V (X10), V8 // 075405c2
VLSEG7E32V (X10), V8 // 076405c2
VLSEG7E64V (X10), V8 // 077405c2
VLSEG7E8V (X10), V0, V8 // 070405c0
VLSEG7E16V (X10), V0, V8 // 075405c0
VLSEG7E32V (X10), V0, V8 // 076405c0
VLSEG7E64V (X10), V0, V8 // 077405c0
VLSEG8E8V (X10), V8 // 070405e2
VLSEG8E16V (X10), V8 // 075405e2
VLSEG8E32V (X10), V8 // 076405e2
VLSEG8E64V (X10), V8 // 077405e2
VLSEG8E8V (X10), V0, V8 // 070405e0
VLSEG8E16V (X10), V0, V8 // 075405e0
VLSEG8E32V (X10), V0, V8 // 076405e0
VLSEG8E64V (X10), V0, V8 // 077405e0
VSSEG2E8V V24, (X10) // 270c0522
VSSEG2E16V V24, (X10) // 275c0522
VSSEG2E32V V24, (X10) // 276c0522
VSSEG2E64V V24, (X10) // 277c0522
VSSEG2E8V V24, V0, (X10) // 270c0520
VSSEG2E16V V24, V0, (X10) // 275c0520
VSSEG2E32V V24, V0, (X10) // 276c0520
VSSEG2E64V V24, V0, (X10) // 277c0520
VSSEG3E8V V24, (X10) // 270c0542
VSSEG3E16V V24, (X10) // 275c0542
VSSEG3E32V V24, (X10) // 276c0542
VSSEG3E64V V24, (X10) // 277c0542
VSSEG3E8V V24, V0, (X10) // 270c0540
VSSEG3E16V V24, V0, (X10) // 275c0540
VSSEG3E32V V24, V0, (X10) // 276c0540
VSSEG3E64V V24, V0, (X10) // 277c0540
VSSEG4E8V V24, (X10) // 270c0562
VSSEG4E16V V24, (X10) // 275c0562
VSSEG4E32V V24, (X10) // 276c0562
VSSEG4E64V V24, (X10) // 277c0562
VSSEG4E8V V24, V0, (X10) // 270c0560
VSSEG4E16V V24, V0, (X10) // 275c0560
VSSEG4E32V V24, V0, (X10) // 276c0560
VSSEG4E64V V24, V0, (X10) // 277c0560
VSSEG5E8V V24, (X10) // 270c0582
VSSEG5E16V V24, (X10) // 275c0582
VSSEG5E32V V24, (X10) // 276c0582
VSSEG5E64V V24, (X10) // 277c0582
VSSEG5E8V V24, V0, (X10) // 270c0580
VSSEG5E16V V24, V0, (X10) // 275c0580
VSSEG5E32V V24, V0, (X10) // 276c0580
VSSEG5E64V V24, V0, (X10) // 277c0580
VSSEG6E8V V24, (X10) // 270c05a2
VSSEG6E16V V24, (X10) // 275c05a2
VSSEG6E32V V24, (X10) // 276c05a2
VSSEG6E64V V24, (X10) // 277c05a2
VSSEG6E8V V24, V0, (X10) // 270c05a0
VSSEG6E16V V24, V0, (X10) // 275c05a0
VSSEG6E32V V24, V0, (X10) // 276c05a0
VSSEG6E64V V24, V0, (X10) // 277c05a0
VSSEG7E8V V24, (X10) // 270c05c2
VSSEG7E16V V24, (X10) // 275c05c2
VSSEG7E32V V24, (X10) // 276c05c2
VSSEG7E64V V24, (X10) // 277c05c2
VSSEG7E8V V24, V0, (X10) // 270c05c0
VSSEG7E16V V24, V0, (X10) // 275c05c0
VSSEG7E32V V24, V0, (X10) // 276c05c0
VSSEG7E64V V24, V0, (X10) // 277c05c0
VSSEG8E8V V24, (X10) // 270c05e2
VSSEG8E16V V24, (X10) // 275c05e2
VSSEG8E32V V24, (X10) // 276c05e2
VSSEG8E64V V24, (X10) // 277c05e2
VSSEG8E8V V24, V0, (X10) // 270c05e0
VSSEG8E16V V24, V0, (X10) // 275c05e0
VSSEG8E32V V24, V0, (X10) // 276c05e0
VSSEG8E64V V24, V0, (X10) // 277c05e0
VLSEG2E8FFV (X10), V8 // 07040523
VLSEG2E16FFV (X10), V8 // 07540523
VLSEG2E32FFV (X10), V8 // 07640523
VLSEG2E64FFV (X10), V8 // 07740523
VLSEG2E8FFV (X10), V0, V8 // 07040521
VLSEG2E16FFV (X10), V0, V8 // 07540521
VLSEG2E32FFV (X10), V0, V8 // 07640521
VLSEG2E64FFV (X10), V0, V8 // 07740521
VLSEG3E8FFV (X10), V8 // 07040543
VLSEG3E16FFV (X10), V8 // 07540543
VLSEG3E32FFV (X10), V8 // 07640543
VLSEG3E64FFV (X10), V8 // 07740543
VLSEG3E8FFV (X10), V0, V8 // 07040541
VLSEG3E16FFV (X10), V0, V8 // 07540541
VLSEG3E32FFV (X10), V0, V8 // 07640541
VLSEG3E64FFV (X10), V0, V8 // 07740541
VLSEG4E8FFV (X10), V8 // 07040563
VLSEG4E16FFV (X10), V8 // 07540563
VLSEG4E32FFV (X10), V8 // 07640563
VLSEG4E64FFV (X10), V8 // 07740563
VLSEG4E8FFV (X10), V0, V8 // 07040561
VLSEG4E16FFV (X10), V0, V8 // 07540561
VLSEG4E32FFV (X10), V0, V8 // 07640561
VLSEG4E64FFV (X10), V0, V8 // 07740561
VLSEG5E8FFV (X10), V8 // 07040583
VLSEG5E16FFV (X10), V8 // 07540583
VLSEG5E32FFV (X10), V8 // 07640583
VLSEG5E64FFV (X10), V8 // 07740583
VLSEG5E8FFV (X10), V0, V8 // 07040581
VLSEG5E16FFV (X10), V0, V8 // 07540581
VLSEG5E32FFV (X10), V0, V8 // 07640581
VLSEG5E64FFV (X10), V0, V8 // 07740581
VLSEG6E8FFV (X10), V8 // 070405a3
VLSEG6E16FFV (X10), V8 // 075405a3
VLSEG6E32FFV (X10), V8 // 076405a3
VLSEG6E64FFV (X10), V8 // 077405a3
VLSEG6E8FFV (X10), V0, V8 // 070405a1
VLSEG6E16FFV (X10), V0, V8 // 075405a1
VLSEG6E32FFV (X10), V0, V8 // 076405a1
VLSEG6E64FFV (X10), V0, V8 // 077405a1
VLSEG7E8FFV (X10), V8 // 070405c3
VLSEG7E16FFV (X10), V8 // 075405c3
VLSEG7E32FFV (X10), V8 // 076405c3
VLSEG7E64FFV (X10), V8 // 077405c3
VLSEG7E8FFV (X10), V0, V8 // 070405c1
VLSEG7E16FFV (X10), V0, V8 // 075405c1
VLSEG7E32FFV (X10), V0, V8 // 076405c1
VLSEG7E64FFV (X10), V0, V8 // 077405c1
VLSEG8E8FFV (X10), V8 // 070405e3
VLSEG8E16FFV (X10), V8 // 075405e3
VLSEG8E32FFV (X10), V8 // 076405e3
VLSEG8E64FFV (X10), V8 // 077405e3
VLSEG8E8FFV (X10), V0, V8 // 070405e1
VLSEG8E16FFV (X10), V0, V8 // 075405e1
VLSEG8E32FFV (X10), V0, V8 // 076405e1
VLSEG8E64FFV (X10), V0, V8 // 077405e1
// 31.7.8.2: Vector Strided Segment Loads and Stores
VLSSEG2E8V (X10), X11, V8 // 0704b52a
VLSSEG2E16V (X10), X11, V8 // 0754b52a
VLSSEG2E32V (X10), X11, V8 // 0764b52a
VLSSEG2E64V (X10), X11, V8 // 0774b52a
VLSSEG2E8V (X10), X11, V0, V8 // 0704b528
VLSSEG2E16V (X10), X11, V0, V8 // 0754b528
VLSSEG2E32V (X10), X11, V0, V8 // 0764b528
VLSSEG2E64V (X10), X11, V0, V8 // 0774b528
VLSSEG3E8V (X10), X11, V8 // 0704b54a
VLSSEG3E16V (X10), X11, V8 // 0754b54a
VLSSEG3E32V (X10), X11, V8 // 0764b54a
VLSSEG3E64V (X10), X11, V8 // 0774b54a
VLSSEG3E8V (X10), X11, V0, V8 // 0704b548
VLSSEG3E16V (X10), X11, V0, V8 // 0754b548
VLSSEG3E32V (X10), X11, V0, V8 // 0764b548
VLSSEG3E64V (X10), X11, V0, V8 // 0774b548
VLSSEG4E8V (X10), X11, V8 // 0704b56a
VLSSEG4E16V (X10), X11, V8 // 0754b56a
VLSSEG4E32V (X10), X11, V8 // 0764b56a
VLSSEG4E64V (X10), X11, V8 // 0774b56a
VLSSEG4E8V (X10), X11, V0, V8 // 0704b568
VLSSEG4E16V (X10), X11, V0, V8 // 0754b568
VLSSEG4E32V (X10), X11, V0, V8 // 0764b568
VLSSEG4E64V (X10), X11, V0, V8 // 0774b568
VLSSEG5E8V (X10), X11, V8 // 0704b58a
VLSSEG5E16V (X10), X11, V8 // 0754b58a
VLSSEG5E32V (X10), X11, V8 // 0764b58a
VLSSEG5E64V (X10), X11, V8 // 0774b58a
VLSSEG5E8V (X10), X11, V0, V8 // 0704b588
VLSSEG5E16V (X10), X11, V0, V8 // 0754b588
VLSSEG5E32V (X10), X11, V0, V8 // 0764b588
VLSSEG5E64V (X10), X11, V0, V8 // 0774b588
VLSSEG6E8V (X10), X11, V8 // 0704b5aa
VLSSEG6E16V (X10), X11, V8 // 0754b5aa
VLSSEG6E32V (X10), X11, V8 // 0764b5aa
VLSSEG6E64V (X10), X11, V8 // 0774b5aa
VLSSEG6E8V (X10), X11, V0, V8 // 0704b5a8
VLSSEG6E16V (X10), X11, V0, V8 // 0754b5a8
VLSSEG6E32V (X10), X11, V0, V8 // 0764b5a8
VLSSEG6E64V (X10), X11, V0, V8 // 0774b5a8
VLSSEG7E8V (X10), X11, V8 // 0704b5ca
VLSSEG7E16V (X10), X11, V8 // 0754b5ca
VLSSEG7E32V (X10), X11, V8 // 0764b5ca
VLSSEG7E64V (X10), X11, V8 // 0774b5ca
VLSSEG7E8V (X10), X11, V0, V8 // 0704b5c8
VLSSEG7E16V (X10), X11, V0, V8 // 0754b5c8
VLSSEG7E32V (X10), X11, V0, V8 // 0764b5c8
VLSSEG7E64V (X10), X11, V0, V8 // 0774b5c8
VLSSEG8E8V (X10), X11, V8 // 0704b5ea
VLSSEG8E16V (X10), X11, V8 // 0754b5ea
VLSSEG8E32V (X10), X11, V8 // 0764b5ea
VLSSEG8E64V (X10), X11, V8 // 0774b5ea
VLSSEG8E8V (X10), X11, V0, V8 // 0704b5e8
VLSSEG8E16V (X10), X11, V0, V8 // 0754b5e8
VLSSEG8E32V (X10), X11, V0, V8 // 0764b5e8
VLSSEG8E64V (X10), X11, V0, V8 // 0774b5e8
VSSSEG2E8V V24, X11, (X10) // 270cb52a
VSSSEG2E16V V24, X11, (X10) // 275cb52a
VSSSEG2E32V V24, X11, (X10) // 276cb52a
VSSSEG2E64V V24, X11, (X10) // 277cb52a
VSSSEG2E8V V24, X11, V0, (X10) // 270cb528
VSSSEG2E16V V24, X11, V0, (X10) // 275cb528
VSSSEG2E32V V24, X11, V0, (X10) // 276cb528
VSSSEG2E64V V24, X11, V0, (X10) // 277cb528
VSSSEG3E8V V24, X11, (X10) // 270cb54a
VSSSEG3E16V V24, X11, (X10) // 275cb54a
VSSSEG3E32V V24, X11, (X10) // 276cb54a
VSSSEG3E64V V24, X11, (X10) // 277cb54a
VSSSEG3E8V V24, X11, V0, (X10) // 270cb548
VSSSEG3E16V V24, X11, V0, (X10) // 275cb548
VSSSEG3E32V V24, X11, V0, (X10) // 276cb548
VSSSEG3E64V V24, X11, V0, (X10) // 277cb548
VSSSEG4E8V V24, X11, (X10) // 270cb56a
VSSSEG4E16V V24, X11, (X10) // 275cb56a
VSSSEG4E32V V24, X11, (X10) // 276cb56a
VSSSEG4E64V V24, X11, (X10) // 277cb56a
VSSSEG4E8V V24, X11, V0, (X10) // 270cb568
VSSSEG4E16V V24, X11, V0, (X10) // 275cb568
VSSSEG4E32V V24, X11, V0, (X10) // 276cb568
VSSSEG4E64V V24, X11, V0, (X10) // 277cb568
VSSSEG5E8V V24, X11, (X10) // 270cb58a
VSSSEG5E16V V24, X11, (X10) // 275cb58a
VSSSEG5E32V V24, X11, (X10) // 276cb58a
VSSSEG5E64V V24, X11, (X10) // 277cb58a
VSSSEG5E8V V24, X11, V0, (X10) // 270cb588
VSSSEG5E16V V24, X11, V0, (X10) // 275cb588
VSSSEG5E32V V24, X11, V0, (X10) // 276cb588
VSSSEG5E64V V24, X11, V0, (X10) // 277cb588
VSSSEG6E8V V24, X11, (X10) // 270cb5aa
VSSSEG6E16V V24, X11, (X10) // 275cb5aa
VSSSEG6E32V V24, X11, (X10) // 276cb5aa
VSSSEG6E64V V24, X11, (X10) // 277cb5aa
VSSSEG6E8V V24, X11, V0, (X10) // 270cb5a8
VSSSEG6E16V V24, X11, V0, (X10) // 275cb5a8
VSSSEG6E32V V24, X11, V0, (X10) // 276cb5a8
VSSSEG6E64V V24, X11, V0, (X10) // 277cb5a8
VSSSEG7E8V V24, X11, (X10) // 270cb5ca
VSSSEG7E16V V24, X11, (X10) // 275cb5ca
VSSSEG7E32V V24, X11, (X10) // 276cb5ca
VSSSEG7E64V V24, X11, (X10) // 277cb5ca
VSSSEG7E8V V24, X11, V0, (X10) // 270cb5c8
VSSSEG7E16V V24, X11, V0, (X10) // 275cb5c8
VSSSEG7E32V V24, X11, V0, (X10) // 276cb5c8
VSSSEG7E64V V24, X11, V0, (X10) // 277cb5c8
VSSSEG8E8V V24, X11, (X10) // 270cb5ea
VSSSEG8E16V V24, X11, (X10) // 275cb5ea
VSSSEG8E32V V24, X11, (X10) // 276cb5ea
VSSSEG8E64V V24, X11, (X10) // 277cb5ea
VSSSEG8E8V V24, X11, V0, (X10) // 270cb5e8
VSSSEG8E16V V24, X11, V0, (X10) // 275cb5e8
VSSSEG8E32V V24, X11, V0, (X10) // 276cb5e8
VSSSEG8E64V V24, X11, V0, (X10) // 277cb5e8
// 31.7.8.3: Vector Indexed Segment Loads and Stores
VLUXSEG2EI8V (X10), V4, V8 // 07044526
VLUXSEG2EI16V (X10), V4, V8 // 07544526
VLUXSEG2EI32V (X10), V4, V8 // 07644526
VLUXSEG2EI64V (X10), V4, V8 // 07744526
VLUXSEG2EI8V (X10), V4, V0, V8 // 07044524
VLUXSEG2EI16V (X10), V4, V0, V8 // 07544524
VLUXSEG2EI32V (X10), V4, V0, V8 // 07644524
VLUXSEG2EI64V (X10), V4, V0, V8 // 07744524
VLUXSEG3EI8V (X10), V4, V8 // 07044546
VLUXSEG3EI16V (X10), V4, V8 // 07544546
VLUXSEG3EI32V (X10), V4, V8 // 07644546
VLUXSEG3EI64V (X10), V4, V8 // 07744546
VLUXSEG3EI8V (X10), V4, V0, V8 // 07044544
VLUXSEG3EI16V (X10), V4, V0, V8 // 07544544
VLUXSEG3EI32V (X10), V4, V0, V8 // 07644544
VLUXSEG3EI64V (X10), V4, V0, V8 // 07744544
VLUXSEG4EI8V (X10), V4, V8 // 07044566
VLUXSEG4EI16V (X10), V4, V8 // 07544566
VLUXSEG4EI32V (X10), V4, V8 // 07644566
VLUXSEG4EI64V (X10), V4, V8 // 07744566
VLUXSEG4EI8V (X10), V4, V0, V8 // 07044564
VLUXSEG4EI16V (X10), V4, V0, V8 // 07544564
VLUXSEG4EI32V (X10), V4, V0, V8 // 07644564
VLUXSEG4EI64V (X10), V4, V0, V8 // 07744564
VLUXSEG5EI8V (X10), V4, V8 // 07044586
VLUXSEG5EI16V (X10), V4, V8 // 07544586
VLUXSEG5EI32V (X10), V4, V8 // 07644586
VLUXSEG5EI64V (X10), V4, V8 // 07744586
VLUXSEG5EI8V (X10), V4, V0, V8 // 07044584
VLUXSEG5EI16V (X10), V4, V0, V8 // 07544584
VLUXSEG5EI32V (X10), V4, V0, V8 // 07644584
VLUXSEG5EI64V (X10), V4, V0, V8 // 07744584
VLUXSEG6EI8V (X10), V4, V8 // 070445a6
VLUXSEG6EI16V (X10), V4, V8 // 075445a6
VLUXSEG6EI32V (X10), V4, V8 // 076445a6
VLUXSEG6EI64V (X10), V4, V8 // 077445a6
VLUXSEG6EI8V (X10), V4, V0, V8 // 070445a4
VLUXSEG6EI16V (X10), V4, V0, V8 // 075445a4
VLUXSEG6EI32V (X10), V4, V0, V8 // 076445a4
VLUXSEG6EI64V (X10), V4, V0, V8 // 077445a4
VLOXSEG6EI8V (X10), V4, V8 // 070445ae
VLOXSEG6EI16V (X10), V4, V8 // 075445ae
VLOXSEG6EI32V (X10), V4, V8 // 076445ae
VLOXSEG6EI64V (X10), V4, V8 // 077445ae
VLOXSEG6EI8V (X10), V4, V0, V8 // 070445ac
VLOXSEG6EI16V (X10), V4, V0, V8 // 075445ac
VLOXSEG6EI32V (X10), V4, V0, V8 // 076445ac
VLOXSEG6EI64V (X10), V4, V0, V8 // 077445ac
VLUXSEG7EI8V (X10), V4, V8 // 070445c6
VLUXSEG7EI16V (X10), V4, V8 // 075445c6
VLUXSEG7EI32V (X10), V4, V8 // 076445c6
VLUXSEG7EI64V (X10), V4, V8 // 077445c6
VLUXSEG7EI8V (X10), V4, V0, V8 // 070445c4
VLUXSEG7EI16V (X10), V4, V0, V8 // 075445c4
VLUXSEG7EI32V (X10), V4, V0, V8 // 076445c4
VLUXSEG7EI64V (X10), V4, V0, V8 // 077445c4
VLUXSEG8EI8V (X10), V4, V8 // 070445e6
VLUXSEG8EI16V (X10), V4, V8 // 075445e6
VLUXSEG8EI32V (X10), V4, V8 // 076445e6
VLUXSEG8EI64V (X10), V4, V8 // 077445e6
VLUXSEG8EI8V (X10), V4, V0, V8 // 070445e4
VLUXSEG8EI16V (X10), V4, V0, V8 // 075445e4
VLUXSEG8EI32V (X10), V4, V0, V8 // 076445e4
VLUXSEG8EI64V (X10), V4, V0, V8 // 077445e4
VSUXSEG2EI8V V24, V4, (X10) // 270c4526
VSUXSEG2EI16V V24, V4, (X10) // 275c4526
VSUXSEG2EI32V V24, V4, (X10) // 276c4526
VSUXSEG2EI64V V24, V4, (X10) // 277c4526
VSUXSEG2EI8V V24, V4, V0, (X10) // 270c4524
VSUXSEG2EI16V V24, V4, V0, (X10) // 275c4524
VSUXSEG2EI32V V24, V4, V0, (X10) // 276c4524
VSUXSEG2EI64V V24, V4, V0, (X10) // 277c4524
VSUXSEG3EI8V V24, V4, (X10) // 270c4546
VSUXSEG3EI16V V24, V4, (X10) // 275c4546
VSUXSEG3EI32V V24, V4, (X10) // 276c4546
VSUXSEG3EI64V V24, V4, (X10) // 277c4546
VSUXSEG3EI8V V24, V4, V0, (X10) // 270c4544
VSUXSEG3EI16V V24, V4, V0, (X10) // 275c4544
VSUXSEG3EI32V V24, V4, V0, (X10) // 276c4544
VSUXSEG3EI64V V24, V4, V0, (X10) // 277c4544
VSUXSEG4EI8V V24, V4, (X10) // 270c4566
VSUXSEG4EI16V V24, V4, (X10) // 275c4566
VSUXSEG4EI32V V24, V4, (X10) // 276c4566
VSUXSEG4EI64V V24, V4, (X10) // 277c4566
VSUXSEG4EI8V V24, V4, V0, (X10) // 270c4564
VSUXSEG4EI16V V24, V4, V0, (X10) // 275c4564
VSUXSEG4EI32V V24, V4, V0, (X10) // 276c4564
VSUXSEG4EI64V V24, V4, V0, (X10) // 277c4564
VSUXSEG5EI8V V24, V4, (X10) // 270c4586
VSUXSEG5EI16V V24, V4, (X10) // 275c4586
VSUXSEG5EI32V V24, V4, (X10) // 276c4586
VSUXSEG5EI64V V24, V4, (X10) // 277c4586
VSUXSEG5EI8V V24, V4, V0, (X10) // 270c4584
VSUXSEG5EI16V V24, V4, V0, (X10) // 275c4584
VSUXSEG5EI32V V24, V4, V0, (X10) // 276c4584
VSUXSEG5EI64V V24, V4, V0, (X10) // 277c4584
VSUXSEG6EI8V V24, V4, (X10) // 270c45a6
VSUXSEG6EI16V V24, V4, (X10) // 275c45a6
VSUXSEG6EI32V V24, V4, (X10) // 276c45a6
VSUXSEG6EI64V V24, V4, (X10) // 277c45a6
VSUXSEG6EI8V V24, V4, V0, (X10) // 270c45a4
VSUXSEG6EI16V V24, V4, V0, (X10) // 275c45a4
VSUXSEG6EI32V V24, V4, V0, (X10) // 276c45a4
VSUXSEG6EI64V V24, V4, V0, (X10) // 277c45a4
VSUXSEG7EI8V V24, V4, (X10) // 270c45c6
VSUXSEG7EI16V V24, V4, (X10) // 275c45c6
VSUXSEG7EI32V V24, V4, (X10) // 276c45c6
VSUXSEG7EI64V V24, V4, (X10) // 277c45c6
VSUXSEG7EI8V V24, V4, V0, (X10) // 270c45c4
VSUXSEG7EI16V V24, V4, V0, (X10) // 275c45c4
VSUXSEG7EI32V V24, V4, V0, (X10) // 276c45c4
VSUXSEG7EI64V V24, V4, V0, (X10) // 277c45c4
VSUXSEG8EI8V V24, V4, (X10) // 270c45e6
VSUXSEG8EI16V V24, V4, (X10) // 275c45e6
VSUXSEG8EI32V V24, V4, (X10) // 276c45e6
VSUXSEG8EI64V V24, V4, (X10) // 277c45e6
VSUXSEG8EI8V V24, V4, V0, (X10) // 270c45e4
VSUXSEG8EI16V V24, V4, V0, (X10) // 275c45e4
VSUXSEG8EI32V V24, V4, V0, (X10) // 276c45e4
VSUXSEG8EI64V V24, V4, V0, (X10) // 277c45e4
VLOXSEG2EI8V (X10), V4, V8 // 0704452e
VLOXSEG2EI16V (X10), V4, V8 // 0754452e
VLOXSEG2EI32V (X10), V4, V8 // 0764452e
VLOXSEG2EI64V (X10), V4, V8 // 0774452e
VLOXSEG2EI8V (X10), V4, V0, V8 // 0704452c
VLOXSEG2EI16V (X10), V4, V0, V8 // 0754452c
VLOXSEG2EI32V (X10), V4, V0, V8 // 0764452c
VLOXSEG2EI64V (X10), V4, V0, V8 // 0774452c
VLOXSEG3EI8V (X10), V4, V8 // 0704454e
VLOXSEG3EI16V (X10), V4, V8 // 0754454e
VLOXSEG3EI32V (X10), V4, V8 // 0764454e
VLOXSEG3EI64V (X10), V4, V8 // 0774454e
VLOXSEG3EI8V (X10), V4, V0, V8 // 0704454c
VLOXSEG3EI16V (X10), V4, V0, V8 // 0754454c
VLOXSEG3EI32V (X10), V4, V0, V8 // 0764454c
VLOXSEG3EI64V (X10), V4, V0, V8 // 0774454c
VLOXSEG4EI8V (X10), V4, V8 // 0704456e
VLOXSEG4EI16V (X10), V4, V8 // 0754456e
VLOXSEG4EI32V (X10), V4, V8 // 0764456e
VLOXSEG4EI64V (X10), V4, V8 // 0774456e
VLOXSEG4EI8V (X10), V4, V0, V8 // 0704456c
VLOXSEG4EI16V (X10), V4, V0, V8 // 0754456c
VLOXSEG4EI32V (X10), V4, V0, V8 // 0764456c
VLOXSEG4EI64V (X10), V4, V0, V8 // 0774456c
VLOXSEG5EI8V (X10), V4, V8 // 0704458e
VLOXSEG5EI16V (X10), V4, V8 // 0754458e
VLOXSEG5EI32V (X10), V4, V8 // 0764458e
VLOXSEG5EI64V (X10), V4, V8 // 0774458e
VLOXSEG5EI8V (X10), V4, V0, V8 // 0704458c
VLOXSEG5EI16V (X10), V4, V0, V8 // 0754458c
VLOXSEG5EI32V (X10), V4, V0, V8 // 0764458c
VLOXSEG5EI64V (X10), V4, V0, V8 // 0774458c
VLOXSEG7EI8V (X10), V4, V8 // 070445ce
VLOXSEG7EI16V (X10), V4, V8 // 075445ce
VLOXSEG7EI32V (X10), V4, V8 // 076445ce
VLOXSEG7EI64V (X10), V4, V8 // 077445ce
VLOXSEG7EI8V (X10), V4, V0, V8 // 070445cc
VLOXSEG7EI16V (X10), V4, V0, V8 // 075445cc
VLOXSEG7EI32V (X10), V4, V0, V8 // 076445cc
VLOXSEG7EI64V (X10), V4, V0, V8 // 077445cc
VLOXSEG8EI8V (X10), V4, V8 // 070445ee
VLOXSEG8EI16V (X10), V4, V8 // 075445ee
VLOXSEG8EI32V (X10), V4, V8 // 076445ee
VLOXSEG8EI64V (X10), V4, V8 // 077445ee
VLOXSEG8EI8V (X10), V4, V0, V8 // 070445ec
VLOXSEG8EI16V (X10), V4, V0, V8 // 075445ec
VLOXSEG8EI32V (X10), V4, V0, V8 // 076445ec
VLOXSEG8EI64V (X10), V4, V0, V8 // 077445ec
VSOXSEG2EI8V V24, V4, (X10) // 270c452e
VSOXSEG2EI16V V24, V4, (X10) // 275c452e
VSOXSEG2EI32V V24, V4, (X10) // 276c452e
VSOXSEG2EI64V V24, V4, (X10) // 277c452e
VSOXSEG2EI8V V24, V4, V0, (X10) // 270c452c
VSOXSEG2EI16V V24, V4, V0, (X10) // 275c452c
VSOXSEG2EI32V V24, V4, V0, (X10) // 276c452c
VSOXSEG2EI64V V24, V4, V0, (X10) // 277c452c
VSOXSEG3EI8V V24, V4, (X10) // 270c454e
VSOXSEG3EI16V V24, V4, (X10) // 275c454e
VSOXSEG3EI32V V24, V4, (X10) // 276c454e
VSOXSEG3EI64V V24, V4, (X10) // 277c454e
VSOXSEG3EI8V V24, V4, V0, (X10) // 270c454c
VSOXSEG3EI16V V24, V4, V0, (X10) // 275c454c
VSOXSEG3EI32V V24, V4, V0, (X10) // 276c454c
VSOXSEG3EI64V V24, V4, V0, (X10) // 277c454c
VSOXSEG4EI8V V24, V4, (X10) // 270c456e
VSOXSEG4EI16V V24, V4, (X10) // 275c456e
VSOXSEG4EI32V V24, V4, (X10) // 276c456e
VSOXSEG4EI64V V24, V4, (X10) // 277c456e
VSOXSEG4EI8V V24, V4, V0, (X10) // 270c456c
VSOXSEG4EI16V V24, V4, V0, (X10) // 275c456c
VSOXSEG4EI32V V24, V4, V0, (X10) // 276c456c
VSOXSEG4EI64V V24, V4, V0, (X10) // 277c456c
VSOXSEG5EI8V V24, V4, (X10) // 270c458e
VSOXSEG5EI16V V24, V4, (X10) // 275c458e
VSOXSEG5EI32V V24, V4, (X10) // 276c458e
VSOXSEG5EI64V V24, V4, (X10) // 277c458e
VSOXSEG5EI8V V24, V4, V0, (X10) // 270c458c
VSOXSEG5EI16V V24, V4, V0, (X10) // 275c458c
VSOXSEG5EI32V V24, V4, V0, (X10) // 276c458c
VSOXSEG5EI64V V24, V4, V0, (X10) // 277c458c
VSOXSEG6EI8V V24, V4, (X10) // 270c45ae
VSOXSEG6EI16V V24, V4, (X10) // 275c45ae
VSOXSEG6EI32V V24, V4, (X10) // 276c45ae
VSOXSEG6EI64V V24, V4, (X10) // 277c45ae
VSOXSEG6EI8V V24, V4, V0, (X10) // 270c45ac
VSOXSEG6EI16V V24, V4, V0, (X10) // 275c45ac
VSOXSEG6EI32V V24, V4, V0, (X10) // 276c45ac
VSOXSEG6EI64V V24, V4, V0, (X10) // 277c45ac
VSOXSEG7EI8V V24, V4, (X10) // 270c45ce
VSOXSEG7EI16V V24, V4, (X10) // 275c45ce
VSOXSEG7EI32V V24, V4, (X10) // 276c45ce
VSOXSEG7EI64V V24, V4, (X10) // 277c45ce
VSOXSEG7EI8V V24, V4, V0, (X10) // 270c45cc
VSOXSEG7EI16V V24, V4, V0, (X10) // 275c45cc
VSOXSEG7EI32V V24, V4, V0, (X10) // 276c45cc
VSOXSEG7EI64V V24, V4, V0, (X10) // 277c45cc
VSOXSEG8EI8V V24, V4, (X10) // 270c45ee
VSOXSEG8EI16V V24, V4, (X10) // 275c45ee
VSOXSEG8EI32V V24, V4, (X10) // 276c45ee
VSOXSEG8EI64V V24, V4, (X10) // 277c45ee
VSOXSEG8EI8V V24, V4, V0, (X10) // 270c45ec
VSOXSEG8EI16V V24, V4, V0, (X10) // 275c45ec
VSOXSEG8EI32V V24, V4, V0, (X10) // 276c45ec
VSOXSEG8EI64V V24, V4, V0, (X10) // 277c45ec
// 31.7.9: Vector Load/Store Whole Register Instructions
VL1RV (X10), V3 // 87018502
VL1RE8V (X10), V3 // 87018502
@ -1357,12 +2038,23 @@ start:
MOVF 4(X5), F0 // 07a04200
MOVF F0, 4(X5) // 27a20200
MOVF F0, F1 // d3000020
MOVF X1, F3 // d38100f0
MOVF F3, X1 // d38001e0
MOVF X0, F3 // d30100f0
MOVF $(0.0), F3 // d30100f0
// Converted to load of symbol (AUIPC + FLW)
MOVF $(709.78271289338397), F3 // 970f000087a10f00
MOVD 4(X5), F0 // 07b04200
MOVD F0, 4(X5) // 27b20200
MOVD F0, F1 // d3000022
MOVD F3, X1 // d38001e2
MOVD X1, F3 // d38100f2
MOVD X0, F3 // d30100f2
MOVD $(0.0), F3 // d30100f2
// Convert to load of symbol (AUIPC + FLD)
// Converted to load of symbol (AUIPC + FLD)
MOVD $(709.78271289338397), F3 // 970f000087b10f00
// TLS load with local-exec (LUI + ADDIW + ADD of TP + load)

View file

@ -3,6 +3,27 @@
// license that can be found in the LICENSE file.
TEXT errors(SB),$0
CSRRC (X10), CYCLE, X5 // ERROR "integer register or immediate expected for 1st operand"
CSRRC X0, TU, X5 // ERROR "unknown CSR"
CSRRC X0, CYCLE // ERROR "missing CSR name"
CSRRC X0, CYCLE, (X10) // ERROR "needs an integer register output"
CSRRC $-1, TIME, X15 // ERROR "immediate out of range 0 to 31"
CSRRCI $32, TIME, X15 // ERROR "immediate out of range 0 to 31"
CSRRCI $1, TIME, (X15) // ERROR "needs an integer register output"
CSRRS (X10), CYCLE, X5 // ERROR "integer register or immediate expected for 1st operand"
CSRRS X0, CYCLE, (X10) // ERROR "needs an integer register output"
CSRRS X0, TU, X5 // ERROR "unknown CSR"
CSRRS X0, CYCLE // ERROR "missing CSR name"
CSRRS $-1, TIME, X15 // ERROR "immediate out of range 0 to 31"
CSRRSI $32, TIME, X15 // ERROR "immediate out of range 0 to 31"
CSRRSI $1, TIME, (X15) // ERROR "needs an integer register output"
CSRRW (X10), CYCLE, X5 // ERROR "integer register or immediate expected for 1st operand"
CSRRW X0, TU, X5 // ERROR "unknown CSR"
CSRRW X0, CYCLE // ERROR "missing CSR name"
CSRRW X0, CYCLE, (X5) // ERROR "needs an integer register output"
CSRRW $-1, TIME, X15 // ERROR "immediate out of range 0 to 31"
CSRRWI $32, TIME, X15 // ERROR "immediate out of range 0 to 31"
CSRRWI $1, TIME, (X15) // ERROR "needs an integer register output"
MOV $errors(SB), (X5) // ERROR "address load must target register"
MOV $8(SP), (X5) // ERROR "address load must target register"
MOVB $8(SP), X5 // ERROR "unsupported address load"
@ -52,6 +73,7 @@ TEXT errors(SB),$0
//
VSETIVLI X10, E32, M2, TA, MA, X12 // ERROR "expected immediate value"
VLE8V (X10), V1, V3 // ERROR "invalid vector mask register"
VLE8FFV (X10), V1, V3 // ERROR "invalid vector mask register"
VSE8V V3, V1, (X10) // ERROR "invalid vector mask register"
VLSE8V (X10), X10, V1, V3 // ERROR "invalid vector mask register"
VSSE8V V3, X11, V1, (X10) // ERROR "invalid vector mask register"
@ -59,6 +81,15 @@ TEXT errors(SB),$0
VSUXEI8V V3, V2, V1, (X10) // ERROR "invalid vector mask register"
VLOXEI8V (X10), V2, V1, V3 // ERROR "invalid vector mask register"
VSOXEI8V V3, V2, V1, (X10) // ERROR "invalid vector mask register"
VLSEG2E8V (X10), V1, V3 // ERROR "invalid vector mask register"
VLSEG2E8FFV (X10), V1, V3 // ERROR "invalid vector mask register"
VSSEG2E8V V3, V1, (X10) // ERROR "invalid vector mask register"
VLSSEG2E8V (X10), X10, V1, V3 // ERROR "invalid vector mask register"
VSSSEG2E8V V3, X11, V1, (X10) // ERROR "invalid vector mask register"
VLUXSEG2EI8V (X10), V2, V1, V3 // ERROR "invalid vector mask register"
VSUXSEG2EI8V V3, V2, V1, (X10) // ERROR "invalid vector mask register"
VLOXSEG2EI8V (X10), V2, V1, V3 // ERROR "invalid vector mask register"
VSOXSEG2EI8V V3, V2, V1, (X10) // ERROR "invalid vector mask register"
VL1RV (X10), V0, V3 // ERROR "too many operands for instruction"
VS1RV V3, V0, (X11) // ERROR "too many operands for instruction"
VADDVV V1, V2, V4, V3 // ERROR "invalid vector mask register"

View file

@ -12,6 +12,147 @@ TEXT validation(SB),$0
SRLI $1, X5, F1 // ERROR "expected integer register in rd position but got non-integer register F1"
SRLI $1, F1, X5 // ERROR "expected integer register in rs1 position but got non-integer register F1"
WORD $-1 // ERROR "must be in range [0x0, 0xffffffff]"
WORD $0x100000000 // ERROR "must be in range [0x0, 0xffffffff]"
//
// "C" Extension for Compressed Instructions, Version 2.0
//
CLWSP 20(X5), X10 // ERROR "rs2 must be SP/X2"
CLWSP 20(SP), X0 // ERROR "cannot use register X0"
CLWSP 20(SP), F10 // ERROR "expected integer register in rd position"
CLWSP 22(SP), X10 // ERROR "must be a multiple of 4"
CLDSP 24(X5), X10 // ERROR "rs2 must be SP/X2"
CLDSP 24(SP), X0 // ERROR "cannot use register X0"
CLDSP 24(SP), F10 // ERROR "expected integer register in rd position"
CLDSP 28(SP), X10 // ERROR "must be a multiple of 8"
CFLDSP 32(X5), F10 // ERROR "rs2 must be SP/X2"
CFLDSP 32(SP), X10 // ERROR "expected float register in rd position"
CFLDSP 36(SP), F10 // ERROR "must be a multiple of 8"
CSWSP X10, 20(X5) // ERROR "rd must be SP/X2"
CSWSP F10, 20(SP) // ERROR "expected integer register in rs2 position"
CSWSP X10, 22(SP) // ERROR "must be a multiple of 4"
CSDSP X10, 24(X5) // ERROR "rd must be SP/X2"
CSDSP F10, 24(SP) // ERROR "expected integer register in rs2 position"
CSDSP X10, 28(SP) // ERROR "must be a multiple of 8"
CFSDSP F10, 32(X5) // ERROR "rd must be SP/X2"
CFSDSP X10, 32(SP) // ERROR "expected float register in rs2 position"
CFSDSP F10, 36(SP) // ERROR "must be a multiple of 8"
CLW 20(X10), F11 // ERROR "expected integer prime register in rd position"
CLW 20(X5), X11 // ERROR "expected integer prime register in rs1 position"
CLW 20(X10), X5 // ERROR "expected integer prime register in rd position"
CLW -1(X10), X11 // ERROR "must be in range [0, 127]"
CLW 22(X10), X11 // ERROR "must be a multiple of 4"
CLW 128(X10), X11 // ERROR "must be in range [0, 127]"
CLD 24(X10), F11 // ERROR "expected integer prime register in rd position"
CLD 24(X5), X11 // ERROR "expected integer prime register in rs1 position"
CLD -1(X10), X11 // ERROR "must be in range [0, 255]"
CLD 30(X10), X11 // ERROR "must be a multiple of 8"
CLD 256(X10), X11 // ERROR "must be in range [0, 255]"
CFLD 32(X10), X11 // ERROR "expected float prime register in rd position"
CFLD 32(X5), F11 // ERROR "expected integer prime register in rs1 position"
CFLD -1(X10), F11 // ERROR "must be in range [0, 255]"
CFLD 34(X10), F11 // ERROR "must be a multiple of 8"
CFLD 256(X10), F11 // ERROR "must be in range [0, 255]"
CSW F11, 20(X10) // ERROR "expected integer prime register in rs2 position"
CSW X11, -1(X10) // ERROR "must be in range [0, 127]"
CSW X11, 22(X10) // ERROR "must be a multiple of 4"
CSW X11, 128(X10) // ERROR "must be in range [0, 127]"
CSD F11, 24(X10) // ERROR "expected integer prime register in rs2 position"
CSD X11, -1(X10) // ERROR "must be in range [0, 255]"
CSD X11, 28(X10) // ERROR "must be a multiple of 8"
CSD X11, 256(X10) // ERROR "must be in range [0, 255]"
CFSD X11, 32(X10) // ERROR "expected float prime register in rs2 position"
CFSD F11, -1(X10) // ERROR "must be in range [0, 255]"
CFSD F11, 36(X10) // ERROR "must be a multiple of 8"
CFSD F11, 256(X10) // ERROR "must be in range [0, 255]"
CJR X0 // ERROR "cannot use register X0 in rs1"
CJR X10, X11 // ERROR "expected no register in rs2"
CJALR X0 // ERROR "cannot use register X0 in rs1"
CJALR X10, X11 // ERROR "expected no register in rd"
CBEQZ X5, 1(PC) // ERROR "expected integer prime register in rs1"
CBNEZ X5, 1(PC) // ERROR "expected integer prime register in rs1"
CLI $3, X0 // ERROR "cannot use register X0 in rd"
CLI $-33, X5 // ERROR "must be in range [-32, 31]"
CLI $32, X5 // ERROR "must be in range [-32, 31]"
CLUI $0, X5 // ERROR "immediate cannot be zero"
CLUI $3, X0 // ERROR "cannot use register X0 in rd"
CLUI $3, X2 // ERROR "cannot use register SP/X2 in rd"
CLUI $-33, X5 // ERROR "must be in range [-32, 31]"
CLUI $32, X5 // ERROR "must be in range [-32, 31]"
CADD $31, X5, X6 // ERROR "rd must be the same as rs1"
CADD $-33, X5 // ERROR "must be in range [-32, 31]"
CADD $32, X5 // ERROR "must be in range [-32, 31]"
CADDI $0, X5 // ERROR "immediate cannot be zero"
CADDI $31, X5, X6 // ERROR "rd must be the same as rs1"
CADDI $-33, X5 // ERROR "must be in range [-32, 31]"
CADDI $32, X5 // ERROR "must be in range [-32, 31]"
CADDW $-33, X5 // ERROR "must be in range [-32, 31]"
CADDW $32, X5 // ERROR "must be in range [-32, 31]"
CADDIW $-33, X5 // ERROR "must be in range [-32, 31]"
CADDIW $32, X5 // ERROR "must be in range [-32, 31]"
CADDI16SP $0, SP // ERROR "immediate cannot be zero"
CADDI16SP $16, X5 // ERROR "rd must be SP/X2"
CADDI16SP $-513, SP // ERROR "must be in range [-512, 511]"
CADDI16SP $20, SP // ERROR "must be a multiple of 16"
CADDI16SP $512, SP // ERROR "must be in range [-512, 511]"
CADDI4SPN $4, SP, X5 // ERROR "expected integer prime register in rd"
CADDI4SPN $4, X5, X10 // ERROR "SP/X2 must be in rs1"
CADDI4SPN $-1, SP, X10 // ERROR "must be in range [0, 1023]"
CADDI4SPN $0, SP, X10 // ERROR "immediate cannot be zero"
CADDI4SPN $6, SP, X10 // ERROR "must be a multiple of 4"
CADDI4SPN $1024, SP, X10 // ERROR "must be in range [0, 1023]"
CSLLI $63, X5, X6 // ERROR "rd must be the same as rs1"
CSLLI $-1, X5 // ERROR "must be in range [0, 63]"
CSLLI $0, X5 // ERROR "immediate cannot be zero"
CSLLI $64, X5 // ERROR "must be in range [0, 63]"
CSRLI $63, X10, X11 // ERROR "rd must be the same as rs1"
CSRLI $63, X5 // ERROR "expected integer prime register in rd"
CSRLI $-1, X10 // ERROR "must be in range [0, 63]"
CSRLI $0, X10 // ERROR "immediate cannot be zero"
CSRLI $64, X10 // ERROR "must be in range [0, 63]"
CSRAI $63, X10, X11 // ERROR "rd must be the same as rs1"
CSRAI $63, X5 // ERROR "expected integer prime register in rd"
CSRAI $-1, X10 // ERROR "must be in range [0, 63]"
CSRAI $0, X10 // ERROR "immediate cannot be zero"
CSRAI $64, X10 // ERROR "must be in range [0, 63]"
CAND $1, X10, X11 // ERROR "rd must be the same as rs1"
CAND $1, X5 // ERROR "expected integer prime register in rd"
CAND $-64, X10 // ERROR "must be in range [-32, 31]"
CAND $63, X10 // ERROR "must be in range [-32, 31]"
CANDI $1, X10, X11 // ERROR "rd must be the same as rs1"
CANDI $1, X5 // ERROR "expected integer prime register in rd"
CANDI $-64, X10 // ERROR "must be in range [-32, 31]"
CANDI $63, X10 // ERROR "must be in range [-32, 31]"
CMV X0, X5 // ERROR "cannot use register X0 in rs2"
CMV X5, X6, X7 // ERROR "expected no register in rs1"
CMV X5, X0 // ERROR "cannot use register X0 in rd"
CMV F1, X5 // ERROR "expected integer register in rs2"
CMV X5, F1 // ERROR "expected integer register in rd"
CADD X5, X6, X7 // ERROR "rd must be the same as rs1"
CADD X0, X8 // ERROR "cannot use register X0 in rs2"
CADD X8, X0 // ERROR "cannot use register X0 in rd"
CAND X10, X11, X12 // ERROR "rd must be the same as rs1"
CAND X5, X11 // ERROR "expected integer prime register in rs2"
CAND X10, X5 // ERROR "expected integer prime register in rd"
COR X10, X11, X12 // ERROR "rd must be the same as rs1"
COR X5, X11 // ERROR "expected integer prime register in rs2"
COR X10, X5 // ERROR "expected integer prime register in rd"
CXOR X10, X11, X12 // ERROR "rd must be the same as rs1"
CXOR X5, X11 // ERROR "expected integer prime register in rs2"
CXOR X10, X5 // ERROR "expected integer prime register in rd"
CSUB X10, X11, X12 // ERROR "rd must be the same as rs1"
CSUB X5, X11 // ERROR "expected integer prime register in rs2"
CSUB X10, X5 // ERROR "expected integer prime register in rd"
CADDW X10, X11, X12 // ERROR "rd must be the same as rs1"
CADDW X5, X11 // ERROR "expected integer prime register in rs2"
CADDW X10, X5 // ERROR "expected integer prime register in rd"
CSUBW X10, X11, X12 // ERROR "rd must be the same as rs1"
CSUBW X5, X11 // ERROR "expected integer prime register in rs2"
CSUBW X10, X5 // ERROR "expected integer prime register in rd"
CNOP X10 // ERROR "expected no register in rs2"
CEBREAK X10 // ERROR "expected no register in rs2"
//
// "V" Standard Extension for Vector Operations, Version 1.0
//
@ -20,6 +161,8 @@ TEXT validation(SB),$0
VSETVL X10, X11 // ERROR "expected integer register in rs1 position"
VLE8V (X10), X10 // ERROR "expected vector register in vd position"
VLE8V (V1), V3 // ERROR "expected integer register in rs1 position"
VLE8FFV (X10), X10 // ERROR "expected vector register in vd position"
VLE8FFV (V1), V3 // ERROR "expected integer register in rs1 position"
VSE8V X10, (X10) // ERROR "expected vector register in vs1 position"
VSE8V V3, (V1) // ERROR "expected integer register in rd position"
VLSE8V (X10), V3 // ERROR "expected integer register in rs2 position"
@ -43,6 +186,33 @@ TEXT validation(SB),$0
VSOXEI8V X10, V2, (X10) // ERROR "expected vector register in vd position"
VSOXEI8V V3, V2, (V1) // ERROR "expected integer register in rs1 position"
VSOXEI8V V3, X11, V0, (X10) // ERROR "expected vector register in vs2 position"
VLSEG2E8V (X10), X10 // ERROR "expected vector register in vd position"
VLSEG2E8V (V1), V3 // ERROR "expected integer register in rs1 position"
VLSEG2E8FFV (X10), X10 // ERROR "expected vector register in vd position"
VLSEG2E8FFV (V1), V3 // ERROR "expected integer register in rs1 position"
VSSEG2E8V X10, (X10) // ERROR "expected vector register in vs1 position"
VSSEG2E8V V3, (V1) // ERROR "expected integer register in rd position"
VLSSEG2E8V (X10), V3 // ERROR "expected integer register in rs2 position"
VLSSEG2E8V (X10), X10, X11 // ERROR "expected vector register in vd position"
VLSSEG2E8V (V1), X10, V3 // ERROR "expected integer register in rs1 position"
VLSSEG2E8V (X10), V1, V0, V3 // ERROR "expected integer register in rs2 position"
VSSSEG2E8V V3, (X10) // ERROR "expected integer register in rs2 position"
VSSSEG2E8V X10, X11, (X10) // ERROR "expected vector register in vd position"
VSSSEG2E8V V3, X11, (V1) // ERROR "expected integer register in rs1 position"
VSSSEG2E8V V3, V1, V0, (X10) // ERROR "expected integer register in rs2 position"
VLUXSEG2EI8V (X10), V2, X11 // ERROR "expected vector register in vd position"
VLUXSEG2EI8V (X10), V2, X11 // ERROR "expected vector register in vd position"
VLUXSEG2EI8V (V1), V2, V3 // ERROR "expected integer register in rs1 position"
VLUXSEG2EI8V (X10), X11, V0, V3 // ERROR "expected vector register in vs2 position"
VSUXSEG2EI8V X10, V2, (X10) // ERROR "expected vector register in vd position"
VSUXSEG2EI8V V3, V2, (V1) // ERROR "expected integer register in rs1 position"
VSUXSEG2EI8V V3, X11, V0, (X10) // ERROR "expected vector register in vs2 position"
VLOXSEG2EI8V (X10), V2, X11 // ERROR "expected vector register in vd position"
VLOXSEG2EI8V (V1), V2, V3 // ERROR "expected integer register in rs1 position"
VLOXSEG2EI8V (X10), X11, V0, V3 // ERROR "expected vector register in vs2 position"
VSOXSEG2EI8V X10, V2, (X10) // ERROR "expected vector register in vd position"
VSOXSEG2EI8V V3, V2, (V1) // ERROR "expected integer register in rs1 position"
VSOXSEG2EI8V V3, X11, V0, (X10) // ERROR "expected vector register in vs2 position"
VL1RV (X10), X10 // ERROR "expected vector register in vd position"
VL1RV (V1), V3 // ERROR "expected integer register in rs1 position"
VS1RV X11, (X11) // ERROR "expected vector register in vs1 position"

View file

@ -263,10 +263,15 @@ TEXT main·foo(SB),DUPOK|NOSPLIT,$16-0 // TEXT main.foo(SB), DUPOK|NOSPLIT, $16-
NC $8, (R15), n-8(SP) // d407f010f000
OC $8, (R15), n-8(SP) // d607f010f000
MVC $8, (R15), n-8(SP) // d207f010f000
MVC $256, 8192(R1), 8192(R2) // b90400a2c2a800002000b90400b1c2b800002000d2ffa000b000
MVCIN $8, (R15), n-8(SP) // e807f010f000
CLC $8, (R15), n-8(SP) // d507f000f010
XC $256, -8(R15), -8(R15) // b90400afc2a8fffffff8d7ffa000a000
MVC $256, 8192(R1), 8192(R2) // b90400a2c2a800002000b90400b1c2b800002000d2ffa000b000
MVCLE 0, R4, R6 // a8640000
MVCLE 4095, R4, R6 // a8640fff
MVCLE $4095, R4, R6 // a8640fff
MVCLE (R3), R4, R6 // a8643000
MVCLE 10(R3), R4, R6 // a864300a
CMP R1, R2 // b9200012
CMP R3, $32767 // a73f7fff
@ -535,6 +540,18 @@ TEXT main·foo(SB),DUPOK|NOSPLIT,$16-0 // TEXT main.foo(SB), DUPOK|NOSPLIT, $16-
VSTRCZBS V18, V20, V22, V24 // e78240306f8a
VSTRCZHS V18, V20, V22, V24 // e78241306f8a
VSTRCZFS V18, V20, V22, V24 // e78242306f8a
VFMAXSB $1, V2, V3, V4 // e742301020ef
WFMAXSB $2, V5, V6, V7 // e775602820ef
WFMAXSB $2, F5, F6, F7 // e775602820ef
VFMAXDB $3, V8, V9, V10 // e7a8903030ef
WFMAXDB $4, V11, V12, V13 // e7dbc04830ef
WFMAXDB $4, F11, F12, F13 // e7dbc04830ef
VFMINSB $7, V14, V15, V16 // e70ef07028ee
WFMINSB $8, V17, V18, V19 // e73120882eee
WFMINSB $8, F1, F2, F3 // e731208820ee
VFMINDB $9, V20, V21, V22 // e76450903eee
WFMINDB $10, V23, V24, V25 // e79780a83eee
WFMINDB $10, F7, F8, F9 // e79780a830ee
RET
RET foo(SB)

View file

@ -29,8 +29,9 @@ var (
)
var DebugFlags struct {
MayMoreStack string `help:"call named function before all stack growth checks"`
PCTab string `help:"print named pc-value table\nOne of: pctospadj, pctofile, pctoline, pctoinline, pctopcdata"`
CompressInstructions int `help:"use compressed instructions when possible (if supported by architecture)"`
MayMoreStack string `help:"call named function before all stack growth checks"`
PCTab string `help:"print named pc-value table\nOne of: pctospadj, pctofile, pctoline, pctoinline, pctopcdata"`
}
var (
@ -47,6 +48,8 @@ func init() {
flag.Var(objabi.NewDebugFlag(&DebugFlags, nil), "d", "enable debugging settings; try -d help")
objabi.AddVersionFlag() // -V
objabi.Flagcount("S", "print assembly and machine code", &PrintOut)
DebugFlags.CompressInstructions = 1
}
// MultiFlag allows setting a value multiple times to collect a list, as in -I=dir1 -I=dir2.

View file

@ -68,7 +68,7 @@ func predefine(defines flags.MultiFlag) map[string]*Macro {
var panicOnError bool // For testing.
func (in *Input) Error(args ...interface{}) {
func (in *Input) Error(args ...any) {
if panicOnError {
panic(fmt.Errorf("%s:%d: %s", in.File(), in.Line(), fmt.Sprintln(args...)))
}
@ -77,7 +77,7 @@ func (in *Input) Error(args ...interface{}) {
}
// expectText is like Error but adds "got XXX" where XXX is a quoted representation of the most recent token.
func (in *Input) expectText(args ...interface{}) {
func (in *Input) expectText(args ...any) {
in.Error(append(args, "; got", strconv.Quote(in.Stack.Text()))...)
}

View file

@ -40,6 +40,7 @@ func main() {
log.Fatalf("unrecognized architecture %s", GOARCH)
}
ctxt := obj.Linknew(architecture.LinkArch)
ctxt.CompressInstructions = flags.DebugFlags.CompressInstructions != 0
ctxt.Debugasm = flags.PrintOut
ctxt.Debugvlog = flags.DebugV
ctxt.Flag_dynlink = *flags.Dynlink
@ -58,7 +59,7 @@ func main() {
// nothing
case "index":
// known to compiler; ignore here so people can use
// the same list with -gcflags=-spectre=LIST and -asmflags=-spectrre=LIST
// the same list with -gcflags=-spectre=LIST and -asmflags=-spectre=LIST
case "all", "ret":
ctxt.Retpoline = true
}
@ -93,7 +94,7 @@ func main() {
for _, f := range flag.Args() {
lexer := lex.NewLexer(f)
parser := asm.NewParser(ctxt, architecture, lexer)
ctxt.DiagFunc = func(format string, args ...interface{}) {
ctxt.DiagFunc = func(format string, args ...any) {
diag = true
log.Printf(format, args...)
}

View file

@ -199,7 +199,7 @@ func commentText(g *ast.CommentGroup) string {
return strings.Join(pieces, "")
}
func (f *File) validateIdents(x interface{}, context astContext) {
func (f *File) validateIdents(x any, context astContext) {
if x, ok := x.(*ast.Ident); ok {
if f.isMangledName(x.Name) {
error_(x.Pos(), "identifier %q may conflict with identifiers generated by cgo", x.Name)
@ -208,7 +208,7 @@ func (f *File) validateIdents(x interface{}, context astContext) {
}
// Save various references we are going to need later.
func (f *File) saveExprs(x interface{}, context astContext) {
func (f *File) saveExprs(x any, context astContext) {
switch x := x.(type) {
case *ast.Expr:
switch (*x).(type) {
@ -278,7 +278,7 @@ func (f *File) saveCall(call *ast.CallExpr, context astContext) {
}
// If a function should be exported add it to ExpFunc.
func (f *File) saveExport(x interface{}, context astContext) {
func (f *File) saveExport(x any, context astContext) {
n, ok := x.(*ast.FuncDecl)
if !ok {
return
@ -318,7 +318,7 @@ func (f *File) saveExport(x interface{}, context astContext) {
}
// Make f.ExpFunc[i] point at the Func from this AST instead of the other one.
func (f *File) saveExport2(x interface{}, context astContext) {
func (f *File) saveExport2(x any, context astContext) {
n, ok := x.(*ast.FuncDecl)
if !ok {
return
@ -355,7 +355,7 @@ const (
)
// walk walks the AST x, calling visit(f, x, context) for each node.
func (f *File) walk(x interface{}, context astContext, visit func(*File, interface{}, astContext)) {
func (f *File) walk(x any, context astContext, visit func(*File, any, astContext)) {
visit(f, x, context)
switch n := x.(type) {
case *ast.Expr:
@ -363,7 +363,8 @@ func (f *File) walk(x interface{}, context astContext, visit func(*File, interfa
// everything else just recurs
default:
f.walkUnexpected(x, context, visit)
error_(token.NoPos, "unexpected type %T in walk", x)
panic("unexpected type")
case nil:
@ -396,6 +397,9 @@ func (f *File) walk(x interface{}, context astContext, visit func(*File, interfa
case *ast.IndexExpr:
f.walk(&n.X, ctxExpr, visit)
f.walk(&n.Index, ctxExpr, visit)
case *ast.IndexListExpr:
f.walk(&n.X, ctxExpr, visit)
f.walk(n.Indices, ctxExpr, visit)
case *ast.SliceExpr:
f.walk(&n.X, ctxExpr, visit)
if n.Low != nil {
@ -434,8 +438,8 @@ func (f *File) walk(x interface{}, context astContext, visit func(*File, interfa
case *ast.StructType:
f.walk(n.Fields, ctxField, visit)
case *ast.FuncType:
if tparams := funcTypeTypeParams(n); tparams != nil {
f.walk(tparams, ctxParam, visit)
if n.TypeParams != nil {
f.walk(n.TypeParams, ctxParam, visit)
}
f.walk(n.Params, ctxParam, visit)
if n.Results != nil {
@ -524,8 +528,8 @@ func (f *File) walk(x interface{}, context astContext, visit func(*File, interfa
f.walk(n.Values, ctxExpr, visit)
}
case *ast.TypeSpec:
if tparams := typeSpecTypeParams(n); tparams != nil {
f.walk(tparams, ctxParam, visit)
if n.TypeParams != nil {
f.walk(n.TypeParams, ctxParam, visit)
}
f.walk(&n.Type, ctxType, visit)

View file

@ -1,25 +0,0 @@
// Copyright 2021 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build compiler_bootstrap
package main
import (
"go/ast"
"go/token"
)
func (f *File) walkUnexpected(x interface{}, context astContext, visit func(*File, interface{}, astContext)) {
error_(token.NoPos, "unexpected type %T in walk", x)
panic("unexpected type")
}
func funcTypeTypeParams(n *ast.FuncType) *ast.FieldList {
return nil
}
func typeSpecTypeParams(n *ast.TypeSpec) *ast.FieldList {
return nil
}

View file

@ -1,32 +0,0 @@
// Copyright 2021 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build !compiler_bootstrap
package main
import (
"go/ast"
"go/token"
)
func (f *File) walkUnexpected(x interface{}, context astContext, visit func(*File, interface{}, astContext)) {
switch n := x.(type) {
default:
error_(token.NoPos, "unexpected type %T in walk", x)
panic("unexpected type")
case *ast.IndexListExpr:
f.walk(&n.X, ctxExpr, visit)
f.walk(n.Indices, ctxExpr, visit)
}
}
func funcTypeTypeParams(n *ast.FuncType) *ast.FieldList {
return n.TypeParams
}
func typeSpecTypeParams(n *ast.TypeSpec) *ast.FieldList {
return n.TypeParams
}

View file

@ -127,7 +127,7 @@ environment variable when running the go tool: set it to 1 to enable
the use of cgo, and to 0 to disable it. The go tool will set the
build constraint "cgo" if cgo is enabled. The special import "C"
implies the "cgo" build constraint, as though the file also said
"//go:build cgo". Therefore, if cgo is disabled, files that import
"//go:build cgo". Therefore, if cgo is disabled, files that import
"C" will not be built by the go tool. (For more about build constraints
see https://golang.org/pkg/go/build/#hdr-Build_Constraints).

View file

@ -27,6 +27,7 @@ import (
"slices"
"strconv"
"strings"
"sync/atomic"
"unicode"
"unicode/utf8"
@ -182,25 +183,22 @@ func splitQuoted(s string) (r []string, err error) {
return args, err
}
// Translate rewrites f.AST, the original Go input, to remove
// references to the imported package C, replacing them with
// references to the equivalent Go types, functions, and variables.
func (p *Package) Translate(f *File) {
// loadDebug runs gcc to load debug information for the File. The debug
// information will be saved to the debugs field of the file, and be
// processed when Translate is called on the file later.
// loadDebug is called concurrently with different files.
func (f *File) loadDebug(p *Package) {
for _, cref := range f.Ref {
// Convert C.ulong to C.unsigned long, etc.
cref.Name.C = cname(cref.Name.Go)
}
var conv typeConv
conv.Init(p.PtrSize, p.IntSize)
p.typedefs = map[string]bool{}
p.typedefList = nil
ft := fileTypedefs{typedefs: make(map[string]bool)}
numTypedefs := -1
for len(p.typedefs) > numTypedefs {
numTypedefs = len(p.typedefs)
for len(ft.typedefs) > numTypedefs {
numTypedefs = len(ft.typedefs)
// Also ask about any typedefs we've seen so far.
for _, info := range p.typedefList {
for _, info := range ft.typedefList {
if f.Name[info.typedef] != nil {
continue
}
@ -213,7 +211,7 @@ func (p *Package) Translate(f *File) {
}
needType := p.guessKinds(f)
if len(needType) > 0 {
p.loadDWARF(f, &conv, needType)
f.debugs = append(f.debugs, p.loadDWARF(f, &ft, needType))
}
// In godefs mode we're OK with the typedefs, which
@ -223,6 +221,18 @@ func (p *Package) Translate(f *File) {
break
}
}
}
// Translate rewrites f.AST, the original Go input, to remove
// references to the imported package C, replacing them with
// references to the equivalent Go types, functions, and variables.
// Preconditions: File.loadDebug must be called prior to translate.
func (p *Package) Translate(f *File) {
var conv typeConv
conv.Init(p.PtrSize, p.IntSize)
for _, d := range f.debugs {
p.recordTypes(f, d, &conv)
}
p.prepareNames(f)
if p.rewriteCalls(f) {
// Add `import _cgo_unsafe "unsafe"` after the package statement.
@ -241,7 +251,7 @@ func (f *File) loadDefines(gccOptions []string) bool {
stdout := gccDefines(b.Bytes(), gccOptions)
var gccIsClang bool
for _, line := range strings.Split(stdout, "\n") {
for line := range strings.SplitSeq(stdout, "\n") {
if len(line) < 9 || line[0:7] != "#define" {
continue
}
@ -279,6 +289,7 @@ func (f *File) loadDefines(gccOptions []string) bool {
// guessKinds tricks gcc into revealing the kind of each
// name xxx for the references C.xxx in the Go input.
// The kind is either a constant, type, or variable.
// guessKinds is called concurrently with different files.
func (p *Package) guessKinds(f *File) []*Name {
// Determine kinds for names we already know about,
// like #defines or 'struct foo', before bothering with gcc.
@ -417,7 +428,7 @@ func (p *Package) guessKinds(f *File) []*Name {
notDeclared
)
sawUnmatchedErrors := false
for _, line := range strings.Split(stderr, "\n") {
for line := range strings.SplitSeq(stderr, "\n") {
// Ignore warnings and random comments, with one
// exception: newer GCC versions will sometimes emit
// an error on a macro #define with a note referring
@ -522,7 +533,8 @@ func (p *Package) guessKinds(f *File) []*Name {
// loadDWARF parses the DWARF debug information generated
// by gcc to learn the details of the constants, variables, and types
// being referred to as C.xxx.
func (p *Package) loadDWARF(f *File, conv *typeConv, names []*Name) {
// loadDwarf is called concurrently with different files.
func (p *Package) loadDWARF(f *File, ft *fileTypedefs, names []*Name) *debug {
// Extract the types from the DWARF section of an object
// from a well-formed C program. Gcc only generates DWARF info
// for symbols in the object file, so it is not enough to print the
@ -636,13 +648,28 @@ func (p *Package) loadDWARF(f *File, conv *typeConv, names []*Name) {
fatalf("malformed __cgo__ name: %s", name)
}
types[i] = t.Type
p.recordTypedefs(t.Type, f.NamePos[names[i]])
ft.recordTypedefs(t.Type, f.NamePos[names[i]])
}
if e.Tag != dwarf.TagCompileUnit {
r.SkipChildren()
}
}
return &debug{names, types, ints, floats, strs}
}
// debug is the data extracted by running an iteration of loadDWARF on a file.
type debug struct {
names []*Name
types []dwarf.Type
ints []int64
floats []float64
strs []string
}
func (p *Package) recordTypes(f *File, data *debug, conv *typeConv) {
names, types, ints, floats, strs := data.names, data.types, data.ints, data.floats, data.strs
// Record types and typedef information.
for i, n := range names {
if strings.HasSuffix(n.Go, "GetTypeID") && types[i].String() == "func() CFTypeID" {
@ -701,12 +728,17 @@ func (p *Package) loadDWARF(f *File, conv *typeConv, names []*Name) {
}
}
// recordTypedefs remembers in p.typedefs all the typedefs used in dtypes and its children.
func (p *Package) recordTypedefs(dtype dwarf.Type, pos token.Pos) {
p.recordTypedefs1(dtype, pos, map[dwarf.Type]bool{})
type fileTypedefs struct {
typedefs map[string]bool // type names that appear in the types of the objects we're interested in
typedefList []typedefInfo
}
func (p *Package) recordTypedefs1(dtype dwarf.Type, pos token.Pos, visited map[dwarf.Type]bool) {
// recordTypedefs remembers in ft.typedefs all the typedefs used in dtypes and its children.
func (ft *fileTypedefs) recordTypedefs(dtype dwarf.Type, pos token.Pos) {
ft.recordTypedefs1(dtype, pos, map[dwarf.Type]bool{})
}
func (ft *fileTypedefs) recordTypedefs1(dtype dwarf.Type, pos token.Pos, visited map[dwarf.Type]bool) {
if dtype == nil {
return
}
@ -720,25 +752,25 @@ func (p *Package) recordTypedefs1(dtype dwarf.Type, pos token.Pos, visited map[d
// Don't look inside builtin types. There be dragons.
return
}
if !p.typedefs[dt.Name] {
p.typedefs[dt.Name] = true
p.typedefList = append(p.typedefList, typedefInfo{dt.Name, pos})
p.recordTypedefs1(dt.Type, pos, visited)
if !ft.typedefs[dt.Name] {
ft.typedefs[dt.Name] = true
ft.typedefList = append(ft.typedefList, typedefInfo{dt.Name, pos})
ft.recordTypedefs1(dt.Type, pos, visited)
}
case *dwarf.PtrType:
p.recordTypedefs1(dt.Type, pos, visited)
ft.recordTypedefs1(dt.Type, pos, visited)
case *dwarf.ArrayType:
p.recordTypedefs1(dt.Type, pos, visited)
ft.recordTypedefs1(dt.Type, pos, visited)
case *dwarf.QualType:
p.recordTypedefs1(dt.Type, pos, visited)
ft.recordTypedefs1(dt.Type, pos, visited)
case *dwarf.FuncType:
p.recordTypedefs1(dt.ReturnType, pos, visited)
ft.recordTypedefs1(dt.ReturnType, pos, visited)
for _, a := range dt.ParamType {
p.recordTypedefs1(a, pos, visited)
ft.recordTypedefs1(a, pos, visited)
}
case *dwarf.StructType:
for _, f := range dt.Field {
p.recordTypedefs1(f.Type, pos, visited)
for _, l := range dt.Field {
ft.recordTypedefs1(l.Type, pos, visited)
}
}
}
@ -1024,7 +1056,7 @@ func (p *Package) rewriteCall(f *File, call *Call) (string, bool) {
func (p *Package) needsPointerCheck(f *File, t ast.Expr, arg ast.Expr) bool {
// An untyped nil does not need a pointer check, and when
// _cgoCheckPointer returns the untyped nil the type assertion we
// are going to insert will fail. Easier to just skip nil arguments.
// are going to insert will fail. Easier to just skip nil arguments.
// TODO: Note that this fails if nil is shadowed.
if id, ok := arg.(*ast.Ident); ok && id.Name == "nil" {
return false
@ -1089,6 +1121,9 @@ func (p *Package) hasPointer(f *File, t ast.Expr, top bool) bool {
if t.Name == "error" {
return true
}
if t.Name == "any" {
return true
}
if goTypes[t.Name] != nil {
return false
}
@ -1126,7 +1161,7 @@ func (p *Package) hasPointer(f *File, t ast.Expr, top bool) bool {
// If addPosition is true, add position info to the idents of C names in arg.
func (p *Package) mangle(f *File, arg *ast.Expr, addPosition bool) (ast.Expr, bool) {
needsUnsafe := false
f.walk(arg, ctxExpr, func(f *File, arg interface{}, context astContext) {
f.walk(arg, ctxExpr, func(f *File, arg any, context astContext) {
px, ok := arg.(*ast.Expr)
if !ok {
return
@ -1756,20 +1791,24 @@ func gccMachine() []string {
return nil
}
var n atomic.Int64
func gccTmp() string {
return *objDir + "_cgo_.o"
c := strconv.Itoa(int(n.Add(1)))
return *objDir + "_cgo_" + c + ".o"
}
// gccCmd returns the gcc command line to use for compiling
// the input.
func (p *Package) gccCmd() []string {
// gccCommand is called concurrently for different files.
func (p *Package) gccCmd(ofile string) []string {
c := append(gccBaseCmd,
"-w", // no warnings
"-Wno-error", // warnings are not errors
"-o"+gccTmp(), // write object to tmp
"-gdwarf-2", // generate DWARF v2 debugging symbols
"-c", // do not link
"-xc", // input language is C
"-w", // no warnings
"-Wno-error", // warnings are not errors
"-o"+ofile, // write object to tmp
"-gdwarf-2", // generate DWARF v2 debugging symbols
"-c", // do not link
"-xc", // input language is C
)
if p.GccIsClang {
c = append(c,
@ -1805,8 +1844,10 @@ func (p *Package) gccCmd() []string {
// gccDebug runs gcc -gdwarf-2 over the C program stdin and
// returns the corresponding DWARF data and, if present, debug data block.
// gccDebug is called concurrently with different C programs.
func (p *Package) gccDebug(stdin []byte, nnames int) (d *dwarf.Data, ints []int64, floats []float64, strs []string) {
runGcc(stdin, p.gccCmd())
ofile := gccTmp()
runGcc(stdin, p.gccCmd(ofile))
isDebugInts := func(s string) bool {
// Some systems use leading _ to denote non-assembly symbols.
@ -1856,11 +1897,11 @@ func (p *Package) gccDebug(stdin []byte, nnames int) (d *dwarf.Data, ints []int6
}
}
if f, err := macho.Open(gccTmp()); err == nil {
if f, err := macho.Open(ofile); err == nil {
defer f.Close()
d, err := f.DWARF()
if err != nil {
fatalf("cannot load DWARF output from %s: %v", gccTmp(), err)
fatalf("cannot load DWARF output from %s: %v", ofile, err)
}
bo := f.ByteOrder
if f.Symtab != nil {
@ -1934,11 +1975,11 @@ func (p *Package) gccDebug(stdin []byte, nnames int) (d *dwarf.Data, ints []int6
return d, ints, floats, strs
}
if f, err := elf.Open(gccTmp()); err == nil {
if f, err := elf.Open(ofile); err == nil {
defer f.Close()
d, err := f.DWARF()
if err != nil {
fatalf("cannot load DWARF output from %s: %v", gccTmp(), err)
fatalf("cannot load DWARF output from %s: %v", ofile, err)
}
bo := f.ByteOrder
symtab, err := f.Symbols()
@ -2034,11 +2075,11 @@ func (p *Package) gccDebug(stdin []byte, nnames int) (d *dwarf.Data, ints []int6
return d, ints, floats, strs
}
if f, err := pe.Open(gccTmp()); err == nil {
if f, err := pe.Open(ofile); err == nil {
defer f.Close()
d, err := f.DWARF()
if err != nil {
fatalf("cannot load DWARF output from %s: %v", gccTmp(), err)
fatalf("cannot load DWARF output from %s: %v", ofile, err)
}
bo := binary.LittleEndian
for _, s := range f.Symbols {
@ -2106,17 +2147,17 @@ func (p *Package) gccDebug(stdin []byte, nnames int) (d *dwarf.Data, ints []int6
return d, ints, floats, strs
}
if f, err := xcoff.Open(gccTmp()); err == nil {
if f, err := xcoff.Open(ofile); err == nil {
defer f.Close()
d, err := f.DWARF()
if err != nil {
fatalf("cannot load DWARF output from %s: %v", gccTmp(), err)
fatalf("cannot load DWARF output from %s: %v", ofile, err)
}
bo := binary.BigEndian
for _, s := range f.Symbols {
switch {
case isDebugInts(s.Name):
if i := int(s.SectionNumber) - 1; 0 <= i && i < len(f.Sections) {
if i := s.SectionNumber - 1; 0 <= i && i < len(f.Sections) {
sect := f.Sections[i]
if s.Value < sect.Size {
if sdat, err := sect.Data(); err == nil {
@ -2129,7 +2170,7 @@ func (p *Package) gccDebug(stdin []byte, nnames int) (d *dwarf.Data, ints []int6
}
}
case isDebugFloats(s.Name):
if i := int(s.SectionNumber) - 1; 0 <= i && i < len(f.Sections) {
if i := s.SectionNumber - 1; 0 <= i && i < len(f.Sections) {
sect := f.Sections[i]
if s.Value < sect.Size {
if sdat, err := sect.Data(); err == nil {
@ -2143,7 +2184,7 @@ func (p *Package) gccDebug(stdin []byte, nnames int) (d *dwarf.Data, ints []int6
}
default:
if n := indexOfDebugStr(s.Name); n != -1 {
if i := int(s.SectionNumber) - 1; 0 <= i && i < len(f.Sections) {
if i := s.SectionNumber - 1; 0 <= i && i < len(f.Sections) {
sect := f.Sections[i]
if s.Value < sect.Size {
if sdat, err := sect.Data(); err == nil {
@ -2155,7 +2196,7 @@ func (p *Package) gccDebug(stdin []byte, nnames int) (d *dwarf.Data, ints []int6
break
}
if n := indexOfDebugStrlen(s.Name); n != -1 {
if i := int(s.SectionNumber) - 1; 0 <= i && i < len(f.Sections) {
if i := s.SectionNumber - 1; 0 <= i && i < len(f.Sections) {
sect := f.Sections[i]
if s.Value < sect.Size {
if sdat, err := sect.Data(); err == nil {
@ -2176,7 +2217,7 @@ func (p *Package) gccDebug(stdin []byte, nnames int) (d *dwarf.Data, ints []int6
buildStrings()
return d, ints, floats, strs
}
fatalf("cannot parse gcc output %s as ELF, Mach-O, PE, XCOFF object", gccTmp())
fatalf("cannot parse gcc output %s as ELF, Mach-O, PE, XCOFF object", ofile)
panic("not reached")
}
@ -2194,9 +2235,10 @@ func gccDefines(stdin []byte, gccOptions []string) string {
// gccErrors runs gcc over the C program stdin and returns
// the errors that gcc prints. That is, this function expects
// gcc to fail.
// gccErrors is called concurrently with different C programs.
func (p *Package) gccErrors(stdin []byte, extraArgs ...string) string {
// TODO(rsc): require failure
args := p.gccCmd()
args := p.gccCmd(gccTmp())
// Optimization options can confuse the error messages; remove them.
nargs := make([]string, 0, len(args)+len(extraArgs))
@ -2400,7 +2442,7 @@ func (tr *TypeRepr) Empty() bool {
// Set modifies the type representation.
// If fargs are provided, repr is used as a format for fmt.Sprintf.
// Otherwise, repr is used unprocessed as the type representation.
func (tr *TypeRepr) Set(repr string, fargs ...interface{}) {
func (tr *TypeRepr) Set(repr string, fargs ...any) {
tr.Repr = repr
tr.FormatArgs = fargs
}
@ -2674,7 +2716,7 @@ func (c *typeConv) loadType(dtype dwarf.Type, pos token.Pos, parent string) *Typ
// so execute the basic things that the struct case would do
// other than try to determine a Go representation.
tt := *t
tt.C = &TypeRepr{"%s %s", []interface{}{dt.Kind, tag}}
tt.C = &TypeRepr{"%s %s", []any{dt.Kind, tag}}
// We don't know what the representation of this struct is, so don't let
// anyone allocate one on the Go side. As a side effect of this annotation,
// pointers to this type will not be considered pointers in Go. They won't
@ -2704,7 +2746,7 @@ func (c *typeConv) loadType(dtype dwarf.Type, pos token.Pos, parent string) *Typ
t.Align = align
tt := *t
if tag != "" {
tt.C = &TypeRepr{"struct %s", []interface{}{tag}}
tt.C = &TypeRepr{"struct %s", []any{tag}}
}
tt.Go = g
if c.incompleteStructs[tag] {
@ -2971,7 +3013,7 @@ func (c *typeConv) FuncType(dtype *dwarf.FuncType, pos token.Pos) *FuncType {
for i, f := range dtype.ParamType {
// gcc's DWARF generator outputs a single DotDotDotType parameter for
// function pointers that specify no parameters (e.g. void
// (*__cgo_0)()). Treat this special case as void. This case is
// (*__cgo_0)()). Treat this special case as void. This case is
// invalid according to ISO C anyway (i.e. void (*__cgo_1)(...) is not
// legal).
if _, ok := f.(*dwarf.DotDotDotType); ok && i == 0 {
@ -3042,7 +3084,7 @@ func (c *typeConv) Struct(dt *dwarf.StructType, pos token.Pos) (expr *ast.Struct
off := int64(0)
// Rename struct fields that happen to be named Go keywords into
// _{keyword}. Create a map from C ident -> Go ident. The Go ident will
// _{keyword}. Create a map from C ident -> Go ident. The Go ident will
// be mangled. Any existing identifier that already has the same name on
// the C-side will cause the Go-mangled version to be prefixed with _.
// (e.g. in a struct with fields '_type' and 'type', the latter would be
@ -3270,7 +3312,7 @@ func godefsFields(fld []*ast.Field) {
// fieldPrefix returns the prefix that should be removed from all the
// field names when generating the C or Go code. For generated
// C, we leave the names as is (tv_sec, tv_usec), since that's what
// people are used to seeing in C. For generated Go code, such as
// people are used to seeing in C. For generated Go code, such as
// package syscall's data structures, we drop a common prefix
// (so sec, usec, which will get turned into Sec, Usec for exporting).
func fieldPrefix(fld []*ast.Field) string {
@ -3417,7 +3459,7 @@ func (c *typeConv) badCFType(dt *dwarf.TypedefType) bool {
// Tagged pointer support
// Low-bit set means tagged object, next 3 bits (currently)
// define the tagged object class, next 4 bits are for type
// information for the specific tagged object class. Thus,
// information for the specific tagged object class. Thus,
// the low byte is for type info, and the rest of a pointer
// (32 or 64-bit) is for payload, whatever the tagged class.
//

View file

@ -117,7 +117,7 @@ func (p *Package) godefs(f *File, args []string) string {
var gofmtBuf strings.Builder
// gofmt returns the gofmt-formatted string for an AST node.
func gofmt(n interface{}) string {
func gofmt(n any) string {
gofmtBuf.Reset()
err := printer.Fprint(&gofmtBuf, fset, n)
if err != nil {

View file

@ -80,7 +80,7 @@ func mustHaveCxx(t *testing.T) {
if len(args) == 0 {
t.Skip("no C++ compiler")
}
testenv.MustHaveExecPath(t, string(args[0]))
testenv.MustHaveExecPath(t, args[0])
}
var (

View file

@ -4,9 +4,9 @@
package cgotest
// Test that we have no more than one build ID. In the past we used
// Test that we have no more than one build ID. In the past we used
// to generate a separate build ID for each package using cgo, and the
// linker concatenated them all. We don't want that--we only want
// linker concatenated them all. We don't want that--we only want
// one.
import (
@ -42,7 +42,7 @@ sections:
for len(d) > 0 {
// ELF standards differ as to the sizes in
// note sections. Both the GNU linker and
// note sections. Both the GNU linker and
// gold always generate 32-bit sizes, so that
// is what we assume here.

View file

@ -40,7 +40,7 @@ func nestedCall(f func()) {
callbackMutex.Unlock()
// Pass the address of i because the C function was written to
// take a pointer. We could pass an int if we felt like
// take a pointer. We could pass an int if we felt like
// rewriting the C code.
C.callback(unsafe.Pointer(&i))

View file

@ -0,0 +1,11 @@
// Copyright 2025 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build cgo && darwin
package cgotest
import "testing"
func TestIssue76023(t *testing.T) { issue76023(t) }

View file

@ -106,6 +106,7 @@ func TestSetEnv(t *testing.T) { testSetEnv(t) }
func TestThreadLock(t *testing.T) { testThreadLockFunc(t) }
func TestUnsignedInt(t *testing.T) { testUnsignedInt(t) }
func TestZeroArgCallback(t *testing.T) { testZeroArgCallback(t) }
func Test76340(t *testing.T) { test76340(t) }
func BenchmarkCgoCall(b *testing.B) { benchCgoCall(b) }
func BenchmarkGoString(b *testing.B) { benchGoString(b) }

View file

@ -3,7 +3,7 @@
// license that can be found in the LICENSE file.
// Test that it's OK to have C code that does nothing other than
// initialize a global variable. This used to fail with gccgo.
// initialize a global variable. This used to fail with gccgo.
package gcc68255

View file

@ -0,0 +1,27 @@
// Copyright 2025 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build darwin
package cgotest
/*
#cgo LDFLAGS: -Wl,-undefined,dynamic_lookup
extern void __gotest_cgo_null_api(void) __attribute__((weak_import));
int issue76023(void) {
if (__gotest_cgo_null_api) return 1;
return 0;
}
*/
import "C"
import "testing"
func issue76023(t *testing.T) {
r := C.issue76023()
if r != 0 {
t.Error("found __gotest_cgo_null_api")
}
}

View file

@ -245,7 +245,7 @@ static void *thread(void *p) {
return NULL;
}
void testSendSIG() {
const int N = 20;
enum { N = 20 };
int i;
pthread_t tid[N];
for (i = 0; i < N; i++) {
@ -953,6 +953,24 @@ typedef struct {
} issue69086struct;
static int issue690861(issue69086struct* p) { p->b = 1234; return p->c; }
static int issue690862(unsigned long ul1, unsigned long ul2, unsigned int u, issue69086struct s) { return (int)(s.b); }
char issue75751v = 1;
char * const issue75751p = &issue75751v;
#define issue75751m issue75751p
char * const volatile issue75751p2 = &issue75751v;
#define issue75751m2 issue75751p2
typedef struct { void *t; void *v; } GoInterface;
extern int exportAny76340Param(GoInterface);
extern GoInterface exportAny76340Return(int);
int issue76340testFromC(GoInterface obj) {
return exportAny76340Param(obj);
}
GoInterface issue76340returnFromC(int val) {
return exportAny76340Return(val);
}
*/
import "C"
@ -1096,6 +1114,12 @@ func testErrno(t *testing.T) {
}
func testMultipleAssign(t *testing.T) {
if runtime.GOOS == "windows" && usesUCRT(t) {
// UCRT's strtol throws an unrecoverable crash when
// using an invalid base (that is, not 0 or 2..36).
// See go.dev/issue/62887.
t.Skip("skipping test on Windows when linking with UCRT")
}
p := C.CString("234")
n, m := C.strtol(p, nil, 345), C.strtol(p, nil, 10)
defer C.free(unsafe.Pointer(p))
@ -2390,3 +2414,27 @@ func test69086(t *testing.T) {
t.Errorf("call: got %d, want 1234", got)
}
}
// Issue 75751: no runtime test, just make sure it compiles.
func test75751() int {
return int(*C.issue75751m) + int(*C.issue75751m2)
}
// Issue 76340.
func test76340(t *testing.T) {
var emptyInterface C.GoInterface
r1 := C.issue76340testFromC(emptyInterface)
if r1 != 0 {
t.Errorf("issue76340testFromC with nil interface: got %d, want 0", r1)
}
r2 := C.issue76340returnFromC(42)
if r2.t == nil && r2.v == nil {
t.Error("issue76340returnFromC(42) returned nil interface")
}
r3 := C.issue76340returnFromC(0)
if r3.t != nil || r3.v != nil {
t.Errorf("issue76340returnFromC(0) returned non-nil interface: got %v, want nil", r3)
}
}

View file

@ -6,6 +6,13 @@
package cgotest
import "syscall"
import (
"syscall"
"testing"
)
var syscall_dot_SIGCHLD = syscall.SIGCHLD
func usesUCRT(t *testing.T) bool {
return false
}

View file

@ -4,6 +4,20 @@
package cgotest
import "syscall"
import (
"internal/syscall/windows"
"syscall"
"testing"
)
var syscall_dot_SIGCHLD syscall.Signal
// usesUCRT reports whether the test is using the Windows UCRT (Universal C Runtime).
func usesUCRT(t *testing.T) bool {
name, err := syscall.UTF16PtrFromString("ucrtbase.dll")
if err != nil {
t.Fatal(err)
}
h, err := windows.GetModuleHandle(name)
return err == nil && h != 0
}

View file

@ -447,7 +447,7 @@ func issue7978check(t *testing.T, wantFunc string, badFunc string, depth int) {
runtime.GC()
buf := make([]byte, 65536)
trace := string(buf[:runtime.Stack(buf, true)])
for _, goroutine := range strings.Split(trace, "\n\n") {
for goroutine := range strings.SplitSeq(trace, "\n\n") {
if strings.Contains(goroutine, "test.issue7978go") {
trace := strings.Split(goroutine, "\n")
// look for the expected function in the stack
@ -595,3 +595,21 @@ func test49633(t *testing.T) {
t.Errorf("msg = %q, want 'hello'", v.msg)
}
}
//export exportAny76340Param
func exportAny76340Param(obj any) C.int {
if obj == nil {
return 0
}
return 1
}
//export exportAny76340Return
func exportAny76340Return(val C.int) any {
if val == 0 {
return nil
}
return int(val)
}

View file

@ -58,7 +58,7 @@ func TestMain(m *testing.M) {
}
func testMain(m *testing.M) int {
if testing.Short() && os.Getenv("GO_BUILDER_NAME") == "" {
if testing.Short() && testenv.Builder() == "" {
globalSkip = func(t testing.TB) { t.Skip("short mode and $GO_BUILDER_NAME not set") }
return m.Run()
}
@ -102,14 +102,14 @@ func testMain(m *testing.M) int {
bin = cmdToRun("./testp")
ccOut := goEnv("CC")
cc = []string{string(ccOut)}
cc = []string{ccOut}
out := goEnv("GOGCCFLAGS")
quote := '\000'
start := 0
lastSpace := true
backslash := false
s := string(out)
s := out
for i, c := range s {
if quote == '\000' && unicode.IsSpace(c) {
if !lastSpace {

View file

@ -8,6 +8,7 @@ import (
"bufio"
"bytes"
"cmd/cgo/internal/cgotest"
"cmp"
"debug/elf"
"debug/pe"
"encoding/binary"
@ -44,7 +45,7 @@ func TestMain(m *testing.M) {
func testMain(m *testing.M) int {
log.SetFlags(log.Lshortfile)
flag.Parse()
if testing.Short() && os.Getenv("GO_BUILDER_NAME") == "" {
if testing.Short() && testenv.Builder() == "" {
globalSkip = func(t *testing.T) { t.Skip("short mode and $GO_BUILDER_NAME not set") }
return m.Run()
}
@ -75,7 +76,7 @@ func testMain(m *testing.M) int {
start := 0
lastSpace := true
backslash := false
s := string(out)
s := out
for i, c := range s {
if quote == '\000' && unicode.IsSpace(c) {
if !lastSpace {
@ -272,7 +273,7 @@ func createHeaders() error {
// which results in the linkers output implib getting overwritten at each step. So instead build the
// import library the traditional way, using a def file.
err = os.WriteFile("libgo.def",
[]byte("LIBRARY libgo.dll\nEXPORTS\n\tDidInitRun\n\tDidMainRun\n\tDivu\n\tFromPkg\n\t_cgo_dummy_export\n"),
[]byte("LIBRARY libgo.dll\nEXPORTS\n\tDidInitRun\n\tDidMainRun\n\tDivu\n\tFromPkg\n"),
0644)
if err != nil {
return fmt.Errorf("unable to write def file: %v", err)
@ -375,27 +376,22 @@ func TestExportedSymbols(t *testing.T) {
}
}
func checkNumberOfExportedFunctionsWindows(t *testing.T, exportAllSymbols bool) {
const prog = `
func checkNumberOfExportedSymbolsWindows(t *testing.T, exportedSymbols int, wantAll bool) {
t.Parallel()
tmpdir := t.TempDir()
prog := `
package main
import "C"
//export GoFunc
func GoFunc() {
println(42)
}
//export GoFunc2
func GoFunc2() {
println(24)
}
func main() {
}
func main() {}
`
tmpdir := t.TempDir()
for i := range exportedSymbols {
prog += fmt.Sprintf(`
//export GoFunc%d
func GoFunc%d() {}
`, i, i)
}
srcfile := filepath.Join(tmpdir, "test.go")
objfile := filepath.Join(tmpdir, "test.dll")
@ -403,7 +399,7 @@ func main() {
t.Fatal(err)
}
argv := []string{"build", "-buildmode=c-shared"}
if exportAllSymbols {
if wantAll {
argv = append(argv, "-ldflags", "-extldflags=-Wl,--export-all-symbols")
}
argv = append(argv, "-o", objfile, srcfile)
@ -417,11 +413,37 @@ func main() {
t.Fatalf("pe.Open failed: %v", err)
}
defer f.Close()
section := f.Section(".edata")
if section == nil {
t.Skip(".edata section is not present")
_, pe64 := f.OptionalHeader.(*pe.OptionalHeader64)
// grab the export data directory entry
var idd pe.DataDirectory
if pe64 {
idd = f.OptionalHeader.(*pe.OptionalHeader64).DataDirectory[pe.IMAGE_DIRECTORY_ENTRY_EXPORT]
} else {
idd = f.OptionalHeader.(*pe.OptionalHeader32).DataDirectory[pe.IMAGE_DIRECTORY_ENTRY_EXPORT]
}
// figure out which section contains the import directory table
var section *pe.Section
for _, s := range f.Sections {
if s.Offset == 0 {
continue
}
if s.VirtualAddress <= idd.VirtualAddress && idd.VirtualAddress-s.VirtualAddress < s.VirtualSize {
section = s
break
}
}
if section == nil {
t.Fatal("no section contains export directory")
}
d, err := section.Data()
if err != nil {
t.Fatal(err)
}
// seek to the virtual address specified in the export data directory
d = d[idd.VirtualAddress-section.VirtualAddress:]
// TODO: deduplicate this struct from cmd/link/internal/ld/pe.go
type IMAGE_EXPORT_DIRECTORY struct {
_ [2]uint32
@ -432,26 +454,23 @@ func main() {
_ [3]uint32
}
var e IMAGE_EXPORT_DIRECTORY
if err := binary.Read(section.Open(), binary.LittleEndian, &e); err != nil {
if err := binary.Read(bytes.NewReader(d), binary.LittleEndian, &e); err != nil {
t.Fatalf("binary.Read failed: %v", err)
}
// Only the two exported functions and _cgo_dummy_export should be exported
expectedNumber := uint32(3)
exportedSymbols = cmp.Or(exportedSymbols, 1) // _cgo_stub_export is exported if there are no other symbols exported
if exportAllSymbols {
if e.NumberOfFunctions <= expectedNumber {
t.Fatalf("missing exported functions: %v", e.NumberOfFunctions)
}
if e.NumberOfNames <= expectedNumber {
t.Fatalf("missing exported names: %v", e.NumberOfNames)
// NumberOfNames is the number of functions exported with a unique name.
// NumberOfFunctions can be higher than that because it also counts
// functions exported only by ordinal, a unique number asigned by the linker,
// and linkers might add an unknown number of their own ordinal-only functions.
if wantAll {
if e.NumberOfNames <= uint32(exportedSymbols) {
t.Errorf("got %d exported names, want > %d", e.NumberOfNames, exportedSymbols)
}
} else {
if e.NumberOfFunctions != expectedNumber {
t.Fatalf("got %d exported functions; want %d", e.NumberOfFunctions, expectedNumber)
}
if e.NumberOfNames != expectedNumber {
t.Fatalf("got %d exported names; want %d", e.NumberOfNames, expectedNumber)
if e.NumberOfNames != uint32(exportedSymbols) {
t.Errorf("got %d exported names, want %d", e.NumberOfNames, exportedSymbols)
}
}
}
@ -467,12 +486,14 @@ func TestNumberOfExportedFunctions(t *testing.T) {
t.Parallel()
t.Run("OnlyExported", func(t *testing.T) {
checkNumberOfExportedFunctionsWindows(t, false)
})
t.Run("All", func(t *testing.T) {
checkNumberOfExportedFunctionsWindows(t, true)
})
for i := range 3 {
t.Run(fmt.Sprintf("OnlyExported/%d", i), func(t *testing.T) {
checkNumberOfExportedSymbolsWindows(t, i, false)
})
t.Run(fmt.Sprintf("All/%d", i), func(t *testing.T) {
checkNumberOfExportedSymbolsWindows(t, i, true)
})
}
}
// test1: shared library can be dynamically loaded and exported symbols are accessible.

View file

@ -186,7 +186,7 @@ func cCompilerCmd(t *testing.T) []string {
start := 0
lastSpace := true
backslash := false
s := string(out)
s := out
for i, c := range s {
if quote == '\000' && unicode.IsSpace(c) {
if !lastSpace {

View file

@ -14,6 +14,7 @@ import (
"os"
"os/exec"
"path/filepath"
"regexp"
"slices"
"strings"
"sync/atomic"
@ -24,15 +25,16 @@ var tmp = flag.String("tmp", "", "use `dir` for temporary files and do not clean
// ptrTest is the tests without the boilerplate.
type ptrTest struct {
name string // for reporting
c string // the cgo comment
c1 string // cgo comment forced into non-export cgo file
imports []string // a list of imports
support string // supporting functions
body string // the body of the main function
extra []extra // extra files
fail bool // whether the test should fail
expensive bool // whether the test requires the expensive check
name string // for reporting
c string // the cgo comment
c1 string // cgo comment forced into non-export cgo file
imports []string // a list of imports
support string // supporting functions
body string // the body of the main function
extra []extra // extra files
fail bool // whether the test should fail
expensive bool // whether the test requires the expensive check
errTextRegexp string // error text regexp; if empty, use the pattern `.*unpinned Go.*`
}
type extra struct {
@ -489,6 +491,27 @@ var ptrTests = []ptrTest{
body: `i := 0; a := &[2]unsafe.Pointer{nil, unsafe.Pointer(&i)}; C.f45(&a[0])`,
fail: true,
},
{
// Passing a Go map as argument to C.
name: "argmap",
c: `void f46(void* p) {}`,
imports: []string{"unsafe"},
body: `m := map[int]int{0: 1,}; C.f46(unsafe.Pointer(&m))`,
fail: true,
errTextRegexp: `.*argument of cgo function has Go pointer to unpinned Go map`,
},
{
// Returning a Go map to C.
name: "retmap",
c: `extern void f47();`,
support: `//export GoMap47
func GoMap47() map[int]int { return map[int]int{0: 1,} }`,
body: `C.f47()`,
c1: `extern void* GoMap47();
void f47() { GoMap47(); }`,
fail: true,
errTextRegexp: `.*result of Go function GoMap47 called from cgo is unpinned Go map or points to unpinned Go map.*`,
},
}
func TestPointerChecks(t *testing.T) {
@ -519,7 +542,6 @@ func TestPointerChecks(t *testing.T) {
// after testOne finishes.
var pending int32
for _, pt := range ptrTests {
pt := pt
t.Run(pt.name, func(t *testing.T) {
atomic.AddInt32(&pending, +1)
defer func() {
@ -690,11 +712,17 @@ func testOne(t *testing.T, pt ptrTest, exe, exe2 string) {
}
buf, err := runcmd(cgocheck)
var pattern string = pt.errTextRegexp
if pt.errTextRegexp == "" {
pattern = `.*unpinned Go.*`
}
if pt.fail {
if err == nil {
t.Logf("%s", buf)
t.Fatalf("did not fail as expected")
} else if !bytes.Contains(buf, []byte("Go pointer")) {
} else if ok, _ := regexp.Match(pattern, buf); !ok {
t.Logf("%s", buf)
t.Fatalf("did not print expected error (failed with %v)", err)
}

View file

@ -0,0 +1,144 @@
// Copyright 2025 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package out_test
import (
"bufio"
"bytes"
"fmt"
"internal/goarch"
"internal/testenv"
"os"
"path/filepath"
"regexp"
"strconv"
"strings"
"testing"
)
type methodAlign struct {
Method string
Align int
}
var wantAligns = map[string]int{
"ReturnEmpty": 1,
"ReturnOnlyUint8": 1,
"ReturnOnlyUint16": 2,
"ReturnOnlyUint32": 4,
"ReturnOnlyUint64": goarch.PtrSize,
"ReturnOnlyInt": goarch.PtrSize,
"ReturnOnlyPtr": goarch.PtrSize,
"ReturnByteSlice": goarch.PtrSize,
"ReturnString": goarch.PtrSize,
"InputAndReturnUint8": 1,
"MixedTypes": goarch.PtrSize,
}
// TestAligned tests that the generated _cgo_export.c file has the wanted
// align attributes for struct types used as arguments or results of
// //exported functions.
func TestAligned(t *testing.T) {
testenv.MustHaveGoRun(t)
testenv.MustHaveCGO(t)
testdata, err := filepath.Abs("testdata")
if err != nil {
t.Fatal(err)
}
objDir := t.TempDir()
cmd := testenv.Command(t, testenv.GoToolPath(t), "tool", "cgo",
"-objdir", objDir,
filepath.Join(testdata, "aligned.go"))
cmd.Stderr = new(bytes.Buffer)
err = cmd.Run()
if err != nil {
t.Fatalf("%#q: %v\n%s", cmd, err, cmd.Stderr)
}
haveAligns, err := parseAlign(filepath.Join(objDir, "_cgo_export.c"))
if err != nil {
t.Fatal(err)
}
// Check that we have all the wanted methods
if len(haveAligns) != len(wantAligns) {
t.Fatalf("have %d methods with aligned, want %d", len(haveAligns), len(wantAligns))
}
for i := range haveAligns {
method := haveAligns[i].Method
haveAlign := haveAligns[i].Align
wantAlign, ok := wantAligns[method]
if !ok {
t.Errorf("method %s: have aligned %d, want missing entry", method, haveAlign)
} else if haveAlign != wantAlign {
t.Errorf("method %s: have aligned %d, want %d", method, haveAlign, wantAlign)
}
}
}
func parseAlign(filename string) ([]methodAlign, error) {
file, err := os.Open(filename)
if err != nil {
return nil, fmt.Errorf("failed to open file: %w", err)
}
defer file.Close()
var results []methodAlign
scanner := bufio.NewScanner(file)
// Regex to match function declarations like "struct MethodName_return MethodName("
funcRegex := regexp.MustCompile(`^struct\s+(\w+)_return\s+(\w+)\(`)
// Regex to match simple function declarations like "GoSlice MethodName("
simpleFuncRegex := regexp.MustCompile(`^Go\w+\s+(\w+)\(`)
// Regex to match void-returning exported functions like "void ReturnEmpty("
voidFuncRegex := regexp.MustCompile(`^void\s+(\w+)\(`)
// Regex to match align attributes like "__attribute__((aligned(8)))"
alignRegex := regexp.MustCompile(`__attribute__\(\(aligned\((\d+)\)\)\)`)
var currentMethod string
for scanner.Scan() {
line := strings.TrimSpace(scanner.Text())
// Check if this line declares a function with struct return type
if matches := funcRegex.FindStringSubmatch(line); matches != nil {
currentMethod = matches[2] // Extract the method name
} else if matches := simpleFuncRegex.FindStringSubmatch(line); matches != nil {
// Check if this line declares a function with simple return type (like GoSlice)
currentMethod = matches[1] // Extract the method name
} else if matches := voidFuncRegex.FindStringSubmatch(line); matches != nil {
// Check if this line declares a void-returning function
currentMethod = matches[1] // Extract the method name
}
// Check if this line contains align information
if alignMatches := alignRegex.FindStringSubmatch(line); alignMatches != nil && currentMethod != "" {
alignStr := alignMatches[1]
align, err := strconv.Atoi(alignStr)
if err != nil {
// Skip this entry if we can't parse the align as integer
currentMethod = ""
continue
}
results = append(results, methodAlign{
Method: currentMethod,
Align: align,
})
currentMethod = "" // Reset for next method
}
}
if err := scanner.Err(); err != nil {
return nil, fmt.Errorf("error reading file: %w", err)
}
return results, nil
}

View file

@ -0,0 +1,63 @@
// Copyright 2025 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import "C"
//export ReturnEmpty
func ReturnEmpty() {
return
}
//export ReturnOnlyUint8
func ReturnOnlyUint8() (uint8, uint8, uint8) {
return 1, 2, 3
}
//export ReturnOnlyUint16
func ReturnOnlyUint16() (uint16, uint16, uint16) {
return 1, 2, 3
}
//export ReturnOnlyUint32
func ReturnOnlyUint32() (uint32, uint32, uint32) {
return 1, 2, 3
}
//export ReturnOnlyUint64
func ReturnOnlyUint64() (uint64, uint64, uint64) {
return 1, 2, 3
}
//export ReturnOnlyInt
func ReturnOnlyInt() (int, int, int) {
return 1, 2, 3
}
//export ReturnOnlyPtr
func ReturnOnlyPtr() (*int, *int, *int) {
a, b, c := 1, 2, 3
return &a, &b, &c
}
//export ReturnString
func ReturnString() string {
return "hello"
}
//export ReturnByteSlice
func ReturnByteSlice() []byte {
return []byte{1, 2, 3}
}
//export InputAndReturnUint8
func InputAndReturnUint8(a, b, c uint8) (uint8, uint8, uint8) {
return a, b, c
}
//export MixedTypes
func MixedTypes(a uint8, b uint16, c uint32, d uint64, e int, f *int) (uint8, uint16, uint32, uint64, int, *int) {
return a, b, c, d, e, f
}

View file

@ -37,7 +37,7 @@ func TestMain(m *testing.M) {
var tmpDir string
// prettyPrintf prints lines with tmpDir sanitized.
func prettyPrintf(format string, args ...interface{}) {
func prettyPrintf(format string, args ...any) {
s := fmt.Sprintf(format, args...)
if tmpDir != "" {
s = strings.ReplaceAll(s, tmpDir, "$TMPDIR")
@ -46,7 +46,7 @@ func prettyPrintf(format string, args ...interface{}) {
}
func testMain(m *testing.M) int {
if testing.Short() && os.Getenv("GO_BUILDER_NAME") == "" {
if testing.Short() && testenv.Builder() == "" {
globalSkip = func(t *testing.T) { t.Skip("short mode and $GO_BUILDER_NAME not set") }
return m.Run()
}
@ -422,3 +422,11 @@ func TestIssue67976(t *testing.T) {
globalSkip(t)
goCmd(t, "build", "-buildmode=plugin", "-o", "issue67976.so", "./issue67976/plugin.go")
}
func TestIssue75102(t *testing.T) {
globalSkip(t)
// add gcflags different from the executable file to trigger plugin open failed.
goCmd(t, "build", "-gcflags=all=-N -l", "-buildmode=plugin", "-o", "issue75102.so", "./issue75102/plugin.go")
goCmd(t, "build", "-o", "issue75102.exe", "./issue75102/main.go")
run(t, "./issue75102.exe")
}

View file

@ -0,0 +1,21 @@
// Copyright 2025 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
"fmt"
"plugin"
)
func init() {
_, err := plugin.Open("issue75102.so")
if err == nil {
panic("unexpected success to open a different version plugin")
}
}
func main() {
fmt.Println("done")
}

View file

@ -0,0 +1,11 @@
// Copyright 2025 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
func init() {
panic("unexpected call to init")
}
func main() {}

View file

@ -0,0 +1,78 @@
// Copyright 2025 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
/*
// Defined in tracebackctxt_c.c.
extern void C1(void);
extern void C2(void);
extern void tcContext(void*);
extern void tcTraceback(void*);
extern void tcSymbolizer(void*);
*/
import "C"
import (
"fmt"
"runtime"
"sync"
"unsafe"
)
// Regression test for https://go.dev/issue/73949. TSAN should not report races
// on writes to the argument passed to the symbolizer function.
//
// Triggering this race requires calls to the symbolizer function with the same
// argument pointer on multiple threads. The runtime passes a stack variable to
// this function, so that means we need to get a single goroutine to execute on
// two threads, calling the symbolizer function on each.
//
// runtime.CallersFrames / Next will call the symbolizer function (if there are
// C frames). So the approach here is, with GOMAXPROCS=2, have 2 goroutines
// that use CallersFrames over and over, both frequently calling Gosched in an
// attempt to get picked up by the other P.
var tracebackOK bool
func main() {
runtime.GOMAXPROCS(2)
runtime.SetCgoTraceback(0, unsafe.Pointer(C.tcTraceback), unsafe.Pointer(C.tcContext), unsafe.Pointer(C.tcSymbolizer))
C.C1()
if tracebackOK {
fmt.Println("OK")
}
}
//export G1
func G1() {
C.C2()
}
//export G2
func G2() {
pc := make([]uintptr, 32)
n := runtime.Callers(0, pc)
var wg sync.WaitGroup
for range 2 {
wg.Go(func() {
for range 1000 {
cf := runtime.CallersFrames(pc[:n])
var frames []runtime.Frame
for {
frame, more := cf.Next()
frames = append(frames, frame)
if !more {
break
}
}
runtime.Gosched()
}
})
}
wg.Wait()
tracebackOK = true
}

View file

@ -0,0 +1,70 @@
// Copyright 2025 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// The C definitions for tracebackctxt.go. That file uses //export so
// it can't put function definitions in the "C" import comment.
#include <stdint.h>
#include <stdio.h>
// Functions exported from Go.
extern void G1(void);
extern void G2(void);
void C1() {
G1();
}
void C2() {
G2();
}
struct cgoContextArg {
uintptr_t context;
};
struct cgoTracebackArg {
uintptr_t context;
uintptr_t sigContext;
uintptr_t* buf;
uintptr_t max;
};
struct cgoSymbolizerArg {
uintptr_t pc;
const char* file;
uintptr_t lineno;
const char* func;
uintptr_t entry;
uintptr_t more;
uintptr_t data;
};
void tcContext(void* parg) {
struct cgoContextArg* arg = (struct cgoContextArg*)(parg);
if (arg->context == 0) {
arg->context = 1;
}
}
void tcTraceback(void* parg) {
int base, i;
struct cgoTracebackArg* arg = (struct cgoTracebackArg*)(parg);
if (arg->max < 1) {
return;
}
arg->buf[0] = 6; // Chosen by fair dice roll.
}
void tcSymbolizer(void *parg) {
struct cgoSymbolizerArg* arg = (struct cgoSymbolizerArg*)(parg);
if (arg->pc == 0) {
return;
}
// Report two lines per PC returned by traceback, to test more handling.
arg->more = arg->file == NULL;
arg->file = "tracebackctxt.go";
arg->func = "cFunction";
arg->lineno = arg->pc + (arg->more << 16);
}

View file

@ -56,6 +56,7 @@ func TestTSAN(t *testing.T) {
{src: "tsan13.go", needsRuntime: true},
{src: "tsan14.go", needsRuntime: true},
{src: "tsan15.go", needsRuntime: true},
{src: "tsan_tracebackctxt", needsRuntime: true}, // Subdirectory
}
for _, tc := range cases {
tc := tc
@ -67,7 +68,7 @@ func TestTSAN(t *testing.T) {
defer dir.RemoveAll(t)
outPath := dir.Join(name)
mustRun(t, config.goCmd("build", "-o", outPath, srcPath(tc.src)))
mustRun(t, config.goCmd("build", "-o", outPath, "./"+srcPath(tc.src)))
cmdArgs := []string{outPath}
if goos == "linux" {

View file

@ -96,7 +96,7 @@ func goCmd(t *testing.T, args ...string) string {
// TestMain calls testMain so that the latter can use defer (TestMain exits with os.Exit).
func testMain(m *testing.M) (int, error) {
if testing.Short() && os.Getenv("GO_BUILDER_NAME") == "" {
if testing.Short() && testenv.Builder() == "" {
globalSkip = func(t testing.TB) { t.Skip("short mode and $GO_BUILDER_NAME not set") }
return m.Run(), nil
}
@ -554,7 +554,7 @@ func checkPIE(t *testing.T, name string) {
}
func TestTrivialPIE(t *testing.T) {
if strings.HasSuffix(os.Getenv("GO_BUILDER_NAME"), "-alpine") {
if strings.Contains(testenv.Builder(), "-alpine") {
t.Skip("skipping on alpine until issue #54354 resolved")
}
globalSkip(t)

View file

@ -5,7 +5,7 @@
//go:build test_run
// Compute Fibonacci numbers with two goroutines
// that pass integers back and forth. No actual
// that pass integers back and forth. No actual
// concurrency, just threads and synchronization
// and foreign code on multiple pthreads.

View file

@ -30,6 +30,7 @@ import (
"cmd/internal/edit"
"cmd/internal/hash"
"cmd/internal/objabi"
"cmd/internal/par"
"cmd/internal/telemetry/counter"
)
@ -49,8 +50,6 @@ type Package struct {
GoFiles []string // list of Go files
GccFiles []string // list of gcc output files
Preamble string // collected preamble for _cgo_export.h
typedefs map[string]bool // type names that appear in the types of the objects we're interested in
typedefList []typedefInfo
noCallbacks map[string]bool // C function names with #cgo nocallback directive
noEscapes map[string]bool // C function names with #cgo noescape directive
}
@ -73,9 +72,11 @@ type File struct {
ExpFunc []*ExpFunc // exported functions for this file
Name map[string]*Name // map from Go name to Name
NamePos map[*Name]token.Pos // map from Name to position of the first reference
NoCallbacks map[string]bool // C function names that with #cgo nocallback directive
NoEscapes map[string]bool // C function names that with #cgo noescape directive
NoCallbacks map[string]bool // C function names with #cgo nocallback directive
NoEscapes map[string]bool // C function names with #cgo noescape directive
Edit *edit.Buffer
debugs []*debug // debug data from iterations of gccDebug. Initialized by File.loadDebug.
}
func (f *File) offset(p token.Pos) int {
@ -147,7 +148,7 @@ type ExpFunc struct {
// A TypeRepr contains the string representation of a type.
type TypeRepr struct {
Repr string
FormatArgs []interface{}
FormatArgs []any
}
// A Type collects information about a type in both the C and Go worlds.
@ -393,7 +394,7 @@ func main() {
h := hash.New32()
io.WriteString(h, *importPath)
var once sync.Once
var wg sync.WaitGroup
q := par.NewQueue(runtime.GOMAXPROCS(0))
fs := make([]*File, len(goFiles))
for i, input := range goFiles {
if *srcDir != "" {
@ -415,9 +416,7 @@ func main() {
fatalf("%s", err)
}
wg.Add(1)
go func() {
defer wg.Done()
q.Add(func() {
// Apply trimpath to the file path. The path won't be read from after this point.
input, _ = objabi.ApplyRewrites(input, *trimpath)
if strings.ContainsAny(input, "\r\n") {
@ -438,10 +437,12 @@ func main() {
})
fs[i] = f
}()
f.loadDebug(p)
})
}
wg.Wait()
<-q.Idle()
cPrefix = fmt.Sprintf("_%x", h.Sum(nil)[0:6])

View file

@ -457,6 +457,36 @@ func checkImportSymName(s string) {
// Also assumes that gc convention is to word-align the
// input and output parameters.
func (p *Package) structType(n *Name) (string, int64) {
// It's possible for us to see a type with a top-level const here,
// which will give us an unusable struct type. See #75751.
// The top-level const will always appear as a final qualifier,
// constructed by typeConv.loadType in the dwarf.QualType case.
// The top-level const is meaningless here and can simply be removed.
stripConst := func(s string) string {
i := strings.LastIndex(s, "const")
if i == -1 {
return s
}
// A top-level const can only be followed by other qualifiers.
if r, ok := strings.CutSuffix(s, "const"); ok {
return strings.TrimSpace(r)
}
var nonConst []string
for _, f := range strings.Fields(s[i:]) {
switch f {
case "const":
case "restrict", "volatile":
nonConst = append(nonConst, f)
default:
return s
}
}
return strings.TrimSpace(s[:i]) + " " + strings.Join(nonConst, " ")
}
var buf strings.Builder
fmt.Fprint(&buf, "struct {\n")
off := int64(0)
@ -468,7 +498,7 @@ func (p *Package) structType(n *Name) (string, int64) {
}
c := t.Typedef
if c == "" {
c = t.C.String()
c = stripConst(t.C.String())
}
fmt.Fprintf(&buf, "\t\t%s p%d;\n", c, i)
off += t.Size
@ -484,7 +514,7 @@ func (p *Package) structType(n *Name) (string, int64) {
fmt.Fprintf(&buf, "\t\tchar __pad%d[%d];\n", off, pad)
off += pad
}
fmt.Fprintf(&buf, "\t\t%s r;\n", t.C)
fmt.Fprintf(&buf, "\t\t%s r;\n", stripConst(t.C.String()))
off += t.Size
}
if off%p.PtrSize != 0 {
@ -649,13 +679,15 @@ func (p *Package) writeDefsFunc(fgo2 io.Writer, n *Name, callsMalloc *bool) {
if p.noEscapes[n.C] && p.noCallbacks[n.C] {
touchFunc = "_Cgo_keepalive"
}
fmt.Fprintf(fgo2, "\tif _Cgo_always_false {\n")
if d.Type.Params != nil {
if len(paramnames) > 0 {
fmt.Fprintf(fgo2, "\tif _Cgo_always_false {\n")
for _, name := range paramnames {
fmt.Fprintf(fgo2, "\t\t%s(%s)\n", touchFunc, name)
}
fmt.Fprintf(fgo2, "\t}\n")
}
fmt.Fprintf(fgo2, "\t}\n")
fmt.Fprintf(fgo2, "\treturn\n")
fmt.Fprintf(fgo2, "}\n")
}
@ -949,7 +981,9 @@ func (p *Package) writeExports(fgo2, fm, fgcc, fgcch io.Writer) {
fmt.Fprintf(gotype, "struct {\n")
off := int64(0)
npad := 0
argField := func(typ ast.Expr, namePat string, args ...interface{}) {
// the align is at least 1 (for char)
maxAlign := int64(1)
argField := func(typ ast.Expr, namePat string, args ...any) {
name := fmt.Sprintf(namePat, args...)
t := p.cgoType(typ)
if off%t.Align != 0 {
@ -963,6 +997,11 @@ func (p *Package) writeExports(fgo2, fm, fgcc, fgcch io.Writer) {
noSourceConf.Fprint(gotype, fset, typ)
fmt.Fprintf(gotype, "\n")
off += t.Size
// keep track of the maximum alignment among all fields
// so that we can align the struct correctly
if t.Align > maxAlign {
maxAlign = t.Align
}
}
if fn.Recv != nil {
argField(fn.Recv.List[0].Type, "recv")
@ -1005,12 +1044,8 @@ func (p *Package) writeExports(fgo2, fm, fgcc, fgcch io.Writer) {
}
// Build the wrapper function compiled by gcc.
gccExport := ""
if goos == "windows" {
gccExport = "__declspec(dllexport) "
}
var s strings.Builder
fmt.Fprintf(&s, "%s%s %s(", gccExport, gccResult, exp.ExpName)
fmt.Fprintf(&s, "%s %s(", gccResult, exp.ExpName)
if fn.Recv != nil {
s.WriteString(p.cgoType(fn.Recv.List[0].Type).C.String())
s.WriteString(" recv")
@ -1051,7 +1086,11 @@ func (p *Package) writeExports(fgo2, fm, fgcc, fgcch io.Writer) {
// string.h for memset, and is also robust to C++
// types with constructors. Both GCC and LLVM optimize
// this into just zeroing _cgo_a.
fmt.Fprintf(fgcc, "\ttypedef %s %v _cgo_argtype;\n", ctype.String(), p.packedAttribute())
//
// The struct should be aligned to the maximum alignment
// of any of its fields. This to avoid alignment
// issues.
fmt.Fprintf(fgcc, "\ttypedef %s %v __attribute__((aligned(%d))) _cgo_argtype;\n", ctype.String(), p.packedAttribute(), maxAlign)
fmt.Fprintf(fgcc, "\tstatic _cgo_argtype _cgo_zero;\n")
fmt.Fprintf(fgcc, "\t_cgo_argtype _cgo_a = _cgo_zero;\n")
if gccResult != "void" && (len(fntype.Results.List) > 1 || len(fntype.Results.List[0].Names) > 1) {
@ -1137,6 +1176,10 @@ func (p *Package) writeExports(fgo2, fm, fgcc, fgcch io.Writer) {
if !p.hasPointer(nil, atype, false) {
return
}
// Use the export'ed file/line in error messages.
pos := fset.Position(exp.Func.Pos())
fmt.Fprintf(fgo2, "//line %s:%d\n", pos.Filename, pos.Line)
fmt.Fprintf(fgo2, "\t_cgoCheckResult(a.r%d)\n", i)
})
}
@ -1399,7 +1442,7 @@ func forFieldList(fl *ast.FieldList, fn func(int, string, ast.Expr)) {
}
}
func c(repr string, args ...interface{}) *TypeRepr {
func c(repr string, args ...any) *TypeRepr {
return &TypeRepr{repr, args}
}
@ -1515,6 +1558,9 @@ func (p *Package) doCgoType(e ast.Expr, m map[ast.Expr]bool) *Type {
if t.Name == "error" {
return &Type{Size: 2 * p.PtrSize, Align: p.PtrSize, C: c("GoInterface")}
}
if t.Name == "any" {
return &Type{Size: 2 * p.PtrSize, Align: p.PtrSize, C: c("GoInterface")}
}
if r, ok := goTypes[t.Name]; ok {
return goTypesFixup(r)
}
@ -1812,7 +1858,7 @@ void _cgoPREFIX_Cfunc__Cmalloc(void *v) {
void *ret;
_cgo_tsan_acquire();
ret = malloc(a->p0);
if (ret == 0 && a->p0 == 0) {
if (ret == NULL && a->p0 == 0) {
ret = malloc(1);
}
a->r1 = ret;

View file

@ -75,7 +75,7 @@ func lineno(pos token.Pos) string {
}
// Die with an error message.
func fatalf(msg string, args ...interface{}) {
func fatalf(msg string, args ...any) {
// If we've already printed other errors, they might have
// caused the fatal condition. Assume they're enough.
if nerrors == 0 {
@ -86,7 +86,7 @@ func fatalf(msg string, args ...interface{}) {
var nerrors int
func error_(pos token.Pos, msg string, args ...interface{}) {
func error_(pos token.Pos, msg string, args ...any) {
nerrors++
if pos.IsValid() {
fmt.Fprintf(os.Stderr, "%s: ", fset.Position(pos).String())

View file

@ -57,7 +57,7 @@ terms of these, so the next step after type checking is to convert the syntax
and types2 representations to ir and types. This process is referred to as
"noding."
Noding using a process called Unified IR, which builds a node representation
Noding uses a process called Unified IR, which builds a node representation
using a serialized version of the typechecked code from step 2.
Unified IR is also involved in import/export of packages and inlining.
@ -281,17 +281,17 @@ dependencies, so is not suitable for distributed build systems.)
```
$ go install golang.org/x/tools/cmd/toolstash@latest
$ git clone https://go.googlesource.com/go
$ cd go
$ export PATH=$PWD/go/bin:$PATH
$ cd go/src
$ git checkout -b mybranch
$ ./src/all.bash # build and confirm good starting point
$ export PATH=$PWD/bin:$PATH
$ toolstash save # save current tools
$ ./all.bash # build and confirm good starting point
$ toolstash save # save current tools
```
After that, your edit/compile/test cycle can be similar to:
```
<... make edits to cmd/compile source ...>
[... make edits to cmd/compile source ...]
$ toolstash restore && go install cmd/compile # restore known good tools to build compiler
<... 'go build', 'go test', etc. ...> # use freshly built compiler
[... 'go build', 'go test', etc. ...] # use freshly built compiler
```
* toolstash also allows comparing the installed vs. stashed copy of

View file

@ -833,6 +833,51 @@ The riscv64 has Zicsr extension for control and status register (CSR) and
treated as scratch register.
All bits in CSR are system flags and are not modified by Go.
### s390x architecture
The s390x architecture uses R2 R9 for integer arguments and integer results.
It uses F0 F15 for floating-point arguments and results.
Special-purpose registers used within Go generated code and Go assembly code
are as follows:
| Register | Call meaning | Return meaning | Body meaning |
| --- | --- | --- | --- |
| R0 | Zero value | Same | Same |
| R1 | Scratch | Scratch | Scratch |
| R10, R11 | used by the assembler | Same | Same |
| R12 | Closure context pointer | Same | Same |
| R13 | Current goroutine | Same | Same |
| R14 | Link register | Link register | Scratch |
| R15 | Stack pointer | Same | Same |
*Rationale*: These register meanings are compatible with Gos stack-based
calling convention.
#### Stack layout
The stack pointer, R15, grows down and is aligned to 8 bytes.
A function's stack frame, after the frame is created, is laid out as
follows:
+------------------------------+
| ... locals ... |
| ... outgoing arguments ... |
| return PC | ← R15 points to
+------------------------------+ ↓ lower addresses
This stack layout is used by both register-based (ABIInternal) and
stack-based (ABI0) calling conventions.
The "return PC" is loaded to the link register R14, as part of the
s390x `BL` operation.
#### Flags
The s390x architecture maintains a single condition code (CC) field in the Program Status Word (PSW).
Go-generated code sets and tests this condition code to control conditional branches.
## Future directions
### Spill path improvements

View file

@ -150,12 +150,12 @@ func appendParamTypes(rts []*types.Type, t *types.Type) []*types.Type {
if w == 0 {
return rts
}
if t.IsScalar() || t.IsPtrShaped() {
if t.IsScalar() || t.IsPtrShaped() || t.IsSIMD() {
if t.IsComplex() {
c := types.FloatForComplex(t)
return append(rts, c, c)
} else {
if int(t.Size()) <= types.RegSize {
if int(t.Size()) <= types.RegSize || t.IsSIMD() {
return append(rts, t)
}
// assume 64bit int on 32-bit machine
@ -199,6 +199,9 @@ func appendParamOffsets(offsets []int64, at int64, t *types.Type) ([]int64, int6
if w == 0 {
return offsets, at
}
if t.IsSIMD() {
return append(offsets, at), at + w
}
if t.IsScalar() || t.IsPtrShaped() {
if t.IsComplex() || int(t.Size()) > types.RegSize { // complex and *int64 on 32-bit
s := w / 2
@ -521,11 +524,11 @@ func (state *assignState) allocateRegs(regs []RegIndex, t *types.Type) []RegInde
}
ri := state.rUsed.intRegs
rf := state.rUsed.floatRegs
if t.IsScalar() || t.IsPtrShaped() {
if t.IsScalar() || t.IsPtrShaped() || t.IsSIMD() {
if t.IsComplex() {
regs = append(regs, RegIndex(rf+state.rTotal.intRegs), RegIndex(rf+1+state.rTotal.intRegs))
rf += 2
} else if t.IsFloat() {
} else if t.IsFloat() || t.IsSIMD() {
regs = append(regs, RegIndex(rf+state.rTotal.intRegs))
rf += 1
} else {
@ -661,9 +664,7 @@ func (state *assignState) tryAllocRegs(typ *types.Type) []RegIndex {
func (pa *ABIParamAssignment) ComputePadding(storage []uint64) []uint64 {
nr := len(pa.Registers)
padding := storage[:nr]
for i := 0; i < nr; i++ {
padding[i] = 0
}
clear(padding)
if pa.Type.Kind() != types.TSTRUCT || nr == 0 {
return padding
}

View file

@ -28,7 +28,7 @@ type T struct {
type node32 struct {
// Standard conventions hold for left = smaller, right = larger
left, right *node32
data interface{}
data any
key int32
height_ int8
}
@ -49,21 +49,21 @@ func (t *T) IsSingle() bool {
// VisitInOrder applies f to the key and data pairs in t,
// with keys ordered from smallest to largest.
func (t *T) VisitInOrder(f func(int32, interface{})) {
func (t *T) VisitInOrder(f func(int32, any)) {
if t.root == nil {
return
}
t.root.visitInOrder(f)
}
func (n *node32) nilOrData() interface{} {
func (n *node32) nilOrData() any {
if n == nil {
return nil
}
return n.data
}
func (n *node32) nilOrKeyAndData() (k int32, d interface{}) {
func (n *node32) nilOrKeyAndData() (k int32, d any) {
if n == nil {
k = NOT_KEY32
d = nil
@ -83,7 +83,7 @@ func (n *node32) height() int8 {
// Find returns the data associated with x in the tree, or
// nil if x is not in the tree.
func (t *T) Find(x int32) interface{} {
func (t *T) Find(x int32) any {
return t.root.find(x).nilOrData()
}
@ -92,7 +92,7 @@ func (t *T) Find(x int32) interface{} {
// x was already a key in the tree. The previous data associated
// with x is returned, and is nil if x was not previously a
// key in the tree.
func (t *T) Insert(x int32, data interface{}) interface{} {
func (t *T) Insert(x int32, data any) any {
if x == NOT_KEY32 {
panic("Cannot use sentinel value -0x80000000 as key")
}
@ -105,7 +105,7 @@ func (t *T) Insert(x int32, data interface{}) interface{} {
} else {
newroot, n, o = n.aInsert(x)
}
var r interface{}
var r any
if o != nil {
r = o.data
} else {
@ -121,7 +121,7 @@ func (t *T) Copy() *T {
return &u
}
func (t *T) Delete(x int32) interface{} {
func (t *T) Delete(x int32) any {
n := t.root
if n == nil {
return nil
@ -135,7 +135,7 @@ func (t *T) Delete(x int32) interface{} {
return d.data
}
func (t *T) DeleteMin() (int32, interface{}) {
func (t *T) DeleteMin() (int32, any) {
n := t.root
if n == nil {
return NOT_KEY32, nil
@ -149,7 +149,7 @@ func (t *T) DeleteMin() (int32, interface{}) {
return d.key, d.data
}
func (t *T) DeleteMax() (int32, interface{}) {
func (t *T) DeleteMax() (int32, any) {
n := t.root
if n == nil {
return NOT_KEY32, nil
@ -172,7 +172,7 @@ func (t *T) Size() int {
// not be symmetric. If f returns nil, then the key and data are not
// added to the result. If f itself is nil, then whatever value was
// already present in the smaller set is used.
func (t *T) Intersection(u *T, f func(x, y interface{}) interface{}) *T {
func (t *T) Intersection(u *T, f func(x, y any) any) *T {
if t.Size() == 0 || u.Size() == 0 {
return &T{}
}
@ -227,7 +227,7 @@ func (t *T) Intersection(u *T, f func(x, y interface{}) interface{}) *T {
// is given by f(t's data, u's data) -- f need not be symmetric. If f returns nil,
// then the key and data are not added to the result. If f itself is nil, then
// whatever value was already present in the larger set is used.
func (t *T) Union(u *T, f func(x, y interface{}) interface{}) *T {
func (t *T) Union(u *T, f func(x, y any) any) *T {
if t.Size() == 0 {
return u
}
@ -284,7 +284,7 @@ func (t *T) Union(u *T, f func(x, y interface{}) interface{}) *T {
// of f applied to data corresponding to equal keys. If f returns nil
// (or if f is nil) then the key+data are excluded, as usual. If f
// returns not-nil, then that key+data pair is inserted. instead.
func (t *T) Difference(u *T, f func(x, y interface{}) interface{}) *T {
func (t *T) Difference(u *T, f func(x, y any) any) *T {
if t.Size() == 0 {
return &T{}
}
@ -365,7 +365,7 @@ func (t *node32) equals(u *node32) bool {
return it.done() == iu.done()
}
func (t *T) Equiv(u *T, eqv func(x, y interface{}) bool) bool {
func (t *T) Equiv(u *T, eqv func(x, y any) bool) bool {
if t == u {
return true
}
@ -375,7 +375,7 @@ func (t *T) Equiv(u *T, eqv func(x, y interface{}) bool) bool {
return t.root.equiv(u.root, eqv)
}
func (t *node32) equiv(u *node32, eqv func(x, y interface{}) bool) bool {
func (t *node32) equiv(u *node32, eqv func(x, y any) bool) bool {
if t == u {
return true
}
@ -404,7 +404,7 @@ type Iterator struct {
it iterator
}
func (it *Iterator) Next() (int32, interface{}) {
func (it *Iterator) Next() (int32, any) {
x := it.it.next()
if x == nil {
return NOT_KEY32, nil
@ -461,37 +461,37 @@ func (it *iterator) next() *node32 {
// Min returns the minimum element of t.
// If t is empty, then (NOT_KEY32, nil) is returned.
func (t *T) Min() (k int32, d interface{}) {
func (t *T) Min() (k int32, d any) {
return t.root.min().nilOrKeyAndData()
}
// Max returns the maximum element of t.
// If t is empty, then (NOT_KEY32, nil) is returned.
func (t *T) Max() (k int32, d interface{}) {
func (t *T) Max() (k int32, d any) {
return t.root.max().nilOrKeyAndData()
}
// Glb returns the greatest-lower-bound-exclusive of x and the associated
// data. If x has no glb in the tree, then (NOT_KEY32, nil) is returned.
func (t *T) Glb(x int32) (k int32, d interface{}) {
func (t *T) Glb(x int32) (k int32, d any) {
return t.root.glb(x, false).nilOrKeyAndData()
}
// GlbEq returns the greatest-lower-bound-inclusive of x and the associated
// data. If x has no glbEQ in the tree, then (NOT_KEY32, nil) is returned.
func (t *T) GlbEq(x int32) (k int32, d interface{}) {
func (t *T) GlbEq(x int32) (k int32, d any) {
return t.root.glb(x, true).nilOrKeyAndData()
}
// Lub returns the least-upper-bound-exclusive of x and the associated
// data. If x has no lub in the tree, then (NOT_KEY32, nil) is returned.
func (t *T) Lub(x int32) (k int32, d interface{}) {
func (t *T) Lub(x int32) (k int32, d any) {
return t.root.lub(x, false).nilOrKeyAndData()
}
// LubEq returns the least-upper-bound-inclusive of x and the associated
// data. If x has no lubEq in the tree, then (NOT_KEY32, nil) is returned.
func (t *T) LubEq(x int32) (k int32, d interface{}) {
func (t *T) LubEq(x int32) (k int32, d any) {
return t.root.lub(x, true).nilOrKeyAndData()
}
@ -499,7 +499,7 @@ func (t *node32) isLeaf() bool {
return t.left == nil && t.right == nil && t.height_ == LEAF_HEIGHT
}
func (t *node32) visitInOrder(f func(int32, interface{})) {
func (t *node32) visitInOrder(f func(int32, any)) {
if t.left != nil {
t.left.visitInOrder(f)
}

View file

@ -317,7 +317,7 @@ func applicIterator(te *testing.T, x []int32) {
}
}
func equiv(a, b interface{}) bool {
func equiv(a, b any) bool {
sa, sb := a.(*sstring), b.(*sstring)
return *sa == *sb
}
@ -450,16 +450,16 @@ func TestEquals(t *testing.T) {
[]int32{1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 24, 22, 20, 18, 16, 14, 12, 10, 8, 6, 4, 2})
}
func first(x, y interface{}) interface{} {
func first(x, y any) any {
return x
}
func second(x, y interface{}) interface{} {
func second(x, y any) any {
return y
}
func alwaysNil(x, y interface{}) interface{} {
func alwaysNil(x, y any) any {
return nil
}
func smaller(x, y interface{}) interface{} {
func smaller(x, y any) any {
xi, _ := strconv.Atoi(fmt.Sprint(x))
yi, _ := strconv.Atoi(fmt.Sprint(y))
if xi < yi {
@ -560,7 +560,7 @@ func (s *sstring) String() string {
return s.s
}
func stringer(s string) interface{} {
func stringer(s string) any {
return &sstring{s}
}

View file

@ -5,113 +5,23 @@
package amd64
import (
"cmd/compile/internal/ir"
"cmd/compile/internal/objw"
"cmd/compile/internal/types"
"cmd/internal/obj"
"cmd/internal/obj/x86"
)
// DUFFZERO consists of repeated blocks of 4 MOVUPSs + LEAQ,
// See runtime/mkduff.go.
const (
dzBlocks = 16 // number of MOV/ADD blocks
dzBlockLen = 4 // number of clears per block
dzBlockSize = 23 // size of instructions in a single block
dzMovSize = 5 // size of single MOV instruction w/ offset
dzLeaqSize = 4 // size of single LEAQ instruction
dzClearStep = 16 // number of bytes cleared by each MOV instruction
dzClearLen = dzClearStep * dzBlockLen // bytes cleared by one block
dzSize = dzBlocks * dzBlockSize
)
// dzOff returns the offset for a jump into DUFFZERO.
// b is the number of bytes to zero.
func dzOff(b int64) int64 {
off := int64(dzSize)
off -= b / dzClearLen * dzBlockSize
tailLen := b % dzClearLen
if tailLen >= dzClearStep {
off -= dzLeaqSize + dzMovSize*(tailLen/dzClearStep)
}
return off
}
// duffzeroDI returns the pre-adjustment to DI for a call to DUFFZERO.
// b is the number of bytes to zero.
func dzDI(b int64) int64 {
tailLen := b % dzClearLen
if tailLen < dzClearStep {
return 0
}
tailSteps := tailLen / dzClearStep
return -dzClearStep * (dzBlockLen - tailSteps)
}
func zerorange(pp *objw.Progs, p *obj.Prog, off, cnt int64, state *uint32) *obj.Prog {
const (
r13 = 1 << iota // if R13 is already zeroed.
)
if cnt == 0 {
return p
if cnt%8 != 0 {
panic("zeroed region not aligned")
}
if cnt == 8 {
for cnt >= 16 {
p = pp.Append(p, x86.AMOVUPS, obj.TYPE_REG, x86.REG_X15, 0, obj.TYPE_MEM, x86.REG_SP, off)
off += 16
cnt -= 16
}
if cnt != 0 {
p = pp.Append(p, x86.AMOVQ, obj.TYPE_REG, x86.REG_X15, 0, obj.TYPE_MEM, x86.REG_SP, off)
} else if cnt <= int64(8*types.RegSize) {
for i := int64(0); i < cnt/16; i++ {
p = pp.Append(p, x86.AMOVUPS, obj.TYPE_REG, x86.REG_X15, 0, obj.TYPE_MEM, x86.REG_SP, off+i*16)
}
if cnt%16 != 0 {
p = pp.Append(p, x86.AMOVUPS, obj.TYPE_REG, x86.REG_X15, 0, obj.TYPE_MEM, x86.REG_SP, off+cnt-int64(16))
}
} else if cnt <= int64(128*types.RegSize) {
// Save DI to r12. With the amd64 Go register abi, DI can contain
// an incoming parameter, whereas R12 is always scratch.
p = pp.Append(p, x86.AMOVQ, obj.TYPE_REG, x86.REG_DI, 0, obj.TYPE_REG, x86.REG_R12, 0)
// Emit duffzero call
p = pp.Append(p, leaptr, obj.TYPE_MEM, x86.REG_SP, off+dzDI(cnt), obj.TYPE_REG, x86.REG_DI, 0)
p = pp.Append(p, obj.ADUFFZERO, obj.TYPE_NONE, 0, 0, obj.TYPE_ADDR, 0, dzOff(cnt))
p.To.Sym = ir.Syms.Duffzero
if cnt%16 != 0 {
p = pp.Append(p, x86.AMOVUPS, obj.TYPE_REG, x86.REG_X15, 0, obj.TYPE_MEM, x86.REG_DI, -int64(8))
}
// Restore DI from r12
p = pp.Append(p, x86.AMOVQ, obj.TYPE_REG, x86.REG_R12, 0, obj.TYPE_REG, x86.REG_DI, 0)
} else {
// When the register ABI is in effect, at this point in the
// prolog we may have live values in all of RAX,RDI,RCX. Save
// them off to registers before the REPSTOSQ below, then
// restore. Note that R12 and R13 are always available as
// scratch regs; here we also use R15 (this is safe to do
// since there won't be any globals accessed in the prolog).
// See rewriteToUseGot() in obj6.go for more on r15 use.
// Save rax/rdi/rcx
p = pp.Append(p, x86.AMOVQ, obj.TYPE_REG, x86.REG_DI, 0, obj.TYPE_REG, x86.REG_R12, 0)
p = pp.Append(p, x86.AMOVQ, obj.TYPE_REG, x86.REG_AX, 0, obj.TYPE_REG, x86.REG_R13, 0)
p = pp.Append(p, x86.AMOVQ, obj.TYPE_REG, x86.REG_CX, 0, obj.TYPE_REG, x86.REG_R15, 0)
// Set up the REPSTOSQ and kick it off.
p = pp.Append(p, x86.AXORL, obj.TYPE_REG, x86.REG_AX, 0, obj.TYPE_REG, x86.REG_AX, 0)
p = pp.Append(p, x86.AMOVQ, obj.TYPE_CONST, 0, cnt/int64(types.RegSize), obj.TYPE_REG, x86.REG_CX, 0)
p = pp.Append(p, leaptr, obj.TYPE_MEM, x86.REG_SP, off, obj.TYPE_REG, x86.REG_DI, 0)
p = pp.Append(p, x86.AREP, obj.TYPE_NONE, 0, 0, obj.TYPE_NONE, 0, 0)
p = pp.Append(p, x86.ASTOSQ, obj.TYPE_NONE, 0, 0, obj.TYPE_NONE, 0, 0)
// Restore rax/rdi/rcx
p = pp.Append(p, x86.AMOVQ, obj.TYPE_REG, x86.REG_R12, 0, obj.TYPE_REG, x86.REG_DI, 0)
p = pp.Append(p, x86.AMOVQ, obj.TYPE_REG, x86.REG_R13, 0, obj.TYPE_REG, x86.REG_AX, 0)
p = pp.Append(p, x86.AMOVQ, obj.TYPE_REG, x86.REG_R15, 0, obj.TYPE_REG, x86.REG_CX, 0)
// Record the fact that r13 is no longer zero.
*state &= ^uint32(r13)
}
return p
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -18,6 +18,7 @@ import (
"cmd/compile/internal/types"
"cmd/internal/obj"
"cmd/internal/obj/arm"
"internal/abi"
)
// loadByType returns the load instruction of the given type.
@ -244,6 +245,7 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
p.To.Type = obj.TYPE_REG
p.To.Reg = r
case ssa.OpARMADDS,
ssa.OpARMADCS,
ssa.OpARMSUBS:
r := v.Reg0()
r1 := v.Args[0].Reg()
@ -712,18 +714,167 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
p.To.Name = obj.NAME_EXTERN
// AuxInt encodes how many buffer entries we need.
p.To.Sym = ir.Syms.GCWriteBarrier[v.AuxInt-1]
case ssa.OpARMLoweredPanicBoundsA, ssa.OpARMLoweredPanicBoundsB, ssa.OpARMLoweredPanicBoundsC:
p := s.Prog(obj.ACALL)
case ssa.OpARMLoweredPanicBoundsRR, ssa.OpARMLoweredPanicBoundsRC, ssa.OpARMLoweredPanicBoundsCR, ssa.OpARMLoweredPanicBoundsCC,
ssa.OpARMLoweredPanicExtendRR, ssa.OpARMLoweredPanicExtendRC:
// Compute the constant we put in the PCData entry for this call.
code, signed := ssa.BoundsKind(v.AuxInt).Code()
xIsReg := false
yIsReg := false
xVal := 0
yVal := 0
extend := false
switch v.Op {
case ssa.OpARMLoweredPanicBoundsRR:
xIsReg = true
xVal = int(v.Args[0].Reg() - arm.REG_R0)
yIsReg = true
yVal = int(v.Args[1].Reg() - arm.REG_R0)
case ssa.OpARMLoweredPanicExtendRR:
extend = true
xIsReg = true
hi := int(v.Args[0].Reg() - arm.REG_R0)
lo := int(v.Args[1].Reg() - arm.REG_R0)
xVal = hi<<2 + lo // encode 2 register numbers
yIsReg = true
yVal = int(v.Args[2].Reg() - arm.REG_R0)
case ssa.OpARMLoweredPanicBoundsRC:
xIsReg = true
xVal = int(v.Args[0].Reg() - arm.REG_R0)
c := v.Aux.(ssa.PanicBoundsC).C
if c >= 0 && c <= abi.BoundsMaxConst {
yVal = int(c)
} else {
// Move constant to a register
yIsReg = true
if yVal == xVal {
yVal = 1
}
p := s.Prog(arm.AMOVW)
p.From.Type = obj.TYPE_CONST
p.From.Offset = c
p.To.Type = obj.TYPE_REG
p.To.Reg = arm.REG_R0 + int16(yVal)
}
case ssa.OpARMLoweredPanicExtendRC:
extend = true
xIsReg = true
hi := int(v.Args[0].Reg() - arm.REG_R0)
lo := int(v.Args[1].Reg() - arm.REG_R0)
xVal = hi<<2 + lo // encode 2 register numbers
c := v.Aux.(ssa.PanicBoundsC).C
if c >= 0 && c <= abi.BoundsMaxConst {
yVal = int(c)
} else {
// Move constant to a register
for yVal == hi || yVal == lo {
yVal++
}
p := s.Prog(arm.AMOVW)
p.From.Type = obj.TYPE_CONST
p.From.Offset = c
p.To.Type = obj.TYPE_REG
p.To.Reg = arm.REG_R0 + int16(yVal)
}
case ssa.OpARMLoweredPanicBoundsCR:
yIsReg = true
yVal = int(v.Args[0].Reg() - arm.REG_R0)
c := v.Aux.(ssa.PanicBoundsC).C
if c >= 0 && c <= abi.BoundsMaxConst {
xVal = int(c)
} else if signed && int64(int32(c)) == c || !signed && int64(uint32(c)) == c {
// Move constant to a register
xIsReg = true
if xVal == yVal {
xVal = 1
}
p := s.Prog(arm.AMOVW)
p.From.Type = obj.TYPE_CONST
p.From.Offset = c
p.To.Type = obj.TYPE_REG
p.To.Reg = arm.REG_R0 + int16(xVal)
} else {
// Move constant to two registers
extend = true
xIsReg = true
hi := 0
lo := 1
if hi == yVal {
hi = 2
}
if lo == yVal {
lo = 2
}
xVal = hi<<2 + lo
p := s.Prog(arm.AMOVW)
p.From.Type = obj.TYPE_CONST
p.From.Offset = c >> 32
p.To.Type = obj.TYPE_REG
p.To.Reg = arm.REG_R0 + int16(hi)
p = s.Prog(arm.AMOVW)
p.From.Type = obj.TYPE_CONST
p.From.Offset = int64(int32(c))
p.To.Type = obj.TYPE_REG
p.To.Reg = arm.REG_R0 + int16(lo)
}
case ssa.OpARMLoweredPanicBoundsCC:
c := v.Aux.(ssa.PanicBoundsCC).Cx
if c >= 0 && c <= abi.BoundsMaxConst {
xVal = int(c)
} else if signed && int64(int32(c)) == c || !signed && int64(uint32(c)) == c {
// Move constant to a register
xIsReg = true
p := s.Prog(arm.AMOVW)
p.From.Type = obj.TYPE_CONST
p.From.Offset = c
p.To.Type = obj.TYPE_REG
p.To.Reg = arm.REG_R0 + int16(xVal)
} else {
// Move constant to two registers
extend = true
xIsReg = true
hi := 0
lo := 1
xVal = hi<<2 + lo
p := s.Prog(arm.AMOVW)
p.From.Type = obj.TYPE_CONST
p.From.Offset = c >> 32
p.To.Type = obj.TYPE_REG
p.To.Reg = arm.REG_R0 + int16(hi)
p = s.Prog(arm.AMOVW)
p.From.Type = obj.TYPE_CONST
p.From.Offset = int64(int32(c))
p.To.Type = obj.TYPE_REG
p.To.Reg = arm.REG_R0 + int16(lo)
}
c = v.Aux.(ssa.PanicBoundsCC).Cy
if c >= 0 && c <= abi.BoundsMaxConst {
yVal = int(c)
} else {
// Move constant to a register
yIsReg = true
yVal = 2
p := s.Prog(arm.AMOVW)
p.From.Type = obj.TYPE_CONST
p.From.Offset = c
p.To.Type = obj.TYPE_REG
p.To.Reg = arm.REG_R0 + int16(yVal)
}
}
c := abi.BoundsEncode(code, signed, xIsReg, yIsReg, xVal, yVal)
p := s.Prog(obj.APCDATA)
p.From.SetConst(abi.PCDATA_PanicBounds)
p.To.SetConst(int64(c))
p = s.Prog(obj.ACALL)
p.To.Type = obj.TYPE_MEM
p.To.Name = obj.NAME_EXTERN
p.To.Sym = ssagen.BoundsCheckFunc[v.AuxInt]
s.UseArgs(8) // space used in callee args area by assembly stubs
case ssa.OpARMLoweredPanicExtendA, ssa.OpARMLoweredPanicExtendB, ssa.OpARMLoweredPanicExtendC:
p := s.Prog(obj.ACALL)
p.To.Type = obj.TYPE_MEM
p.To.Name = obj.NAME_EXTERN
p.To.Sym = ssagen.ExtendCheckFunc[v.AuxInt]
s.UseArgs(12) // space used in callee args area by assembly stubs
if extend {
p.To.Sym = ir.Syms.PanicExtend
} else {
p.To.Sym = ir.Syms.PanicBounds
}
case ssa.OpARMDUFFZERO:
p := s.Prog(obj.ADUFFZERO)
p.To.Type = obj.TYPE_MEM

View file

@ -5,9 +5,7 @@
package arm64
import (
"cmd/compile/internal/ir"
"cmd/compile/internal/objw"
"cmd/compile/internal/types"
"cmd/internal/obj"
"cmd/internal/obj/arm64"
)
@ -22,47 +20,20 @@ func padframe(frame int64) int64 {
}
func zerorange(pp *objw.Progs, p *obj.Prog, off, cnt int64, _ *uint32) *obj.Prog {
if cnt == 0 {
return p
if cnt%8 != 0 {
panic("zeroed region not aligned")
}
if cnt < int64(4*types.PtrSize) {
for i := int64(0); i < cnt; i += int64(types.PtrSize) {
p = pp.Append(p, arm64.AMOVD, obj.TYPE_REG, arm64.REGZERO, 0, obj.TYPE_MEM, arm64.REGSP, 8+off+i)
}
} else if cnt <= int64(128*types.PtrSize) {
if cnt%(2*int64(types.PtrSize)) != 0 {
p = pp.Append(p, arm64.AMOVD, obj.TYPE_REG, arm64.REGZERO, 0, obj.TYPE_MEM, arm64.REGSP, 8+off)
off += int64(types.PtrSize)
cnt -= int64(types.PtrSize)
}
p = pp.Append(p, arm64.AMOVD, obj.TYPE_REG, arm64.REGSP, 0, obj.TYPE_REG, arm64.REG_R20, 0)
p = pp.Append(p, arm64.AADD, obj.TYPE_CONST, 0, 8+off, obj.TYPE_REG, arm64.REG_R20, 0)
p.Reg = arm64.REG_R20
p = pp.Append(p, obj.ADUFFZERO, obj.TYPE_NONE, 0, 0, obj.TYPE_MEM, 0, 0)
p.To.Name = obj.NAME_EXTERN
p.To.Sym = ir.Syms.Duffzero
p.To.Offset = 4 * (64 - cnt/(2*int64(types.PtrSize)))
} else {
// Not using REGTMP, so this is async preemptible (async preemption clobbers REGTMP).
// We are at the function entry, where no register is live, so it is okay to clobber
// other registers
const rtmp = arm64.REG_R20
p = pp.Append(p, arm64.AMOVD, obj.TYPE_CONST, 0, 8+off-8, obj.TYPE_REG, rtmp, 0)
p = pp.Append(p, arm64.AMOVD, obj.TYPE_REG, arm64.REGSP, 0, obj.TYPE_REG, arm64.REGRT1, 0)
p = pp.Append(p, arm64.AADD, obj.TYPE_REG, rtmp, 0, obj.TYPE_REG, arm64.REGRT1, 0)
p.Reg = arm64.REGRT1
p = pp.Append(p, arm64.AMOVD, obj.TYPE_CONST, 0, cnt, obj.TYPE_REG, rtmp, 0)
p = pp.Append(p, arm64.AADD, obj.TYPE_REG, rtmp, 0, obj.TYPE_REG, arm64.REGRT2, 0)
p.Reg = arm64.REGRT1
p = pp.Append(p, arm64.AMOVD, obj.TYPE_REG, arm64.REGZERO, 0, obj.TYPE_MEM, arm64.REGRT1, int64(types.PtrSize))
p.Scond = arm64.C_XPRE
p1 := p
p = pp.Append(p, arm64.ACMP, obj.TYPE_REG, arm64.REGRT1, 0, obj.TYPE_NONE, 0, 0)
p.Reg = arm64.REGRT2
p = pp.Append(p, arm64.ABNE, obj.TYPE_NONE, 0, 0, obj.TYPE_BRANCH, 0, 0)
p.To.SetTarget(p1)
off += 8 // return address was ignored in offset calculation
for cnt >= 16 && off < 512 {
p = pp.Append(p, arm64.ASTP, obj.TYPE_REGREG, arm64.REGZERO, arm64.REGZERO, obj.TYPE_MEM, arm64.REGSP, off)
off += 16
cnt -= 16
}
for cnt != 0 {
p = pp.Append(p, arm64.AMOVD, obj.TYPE_REG, arm64.REGZERO, 0, obj.TYPE_MEM, arm64.REGSP, off)
off += 8
cnt -= 8
}
return p
}

View file

@ -16,6 +16,7 @@ import (
"cmd/compile/internal/types"
"cmd/internal/obj"
"cmd/internal/obj/arm64"
"internal/abi"
)
// loadByType returns the load instruction of the given type.
@ -1049,68 +1050,268 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
p.From.Offset = int64(condCode)
p.To.Type = obj.TYPE_REG
p.To.Reg = v.Reg()
case ssa.OpARM64DUFFZERO:
// runtime.duffzero expects start address in R20
p := s.Prog(obj.ADUFFZERO)
p.To.Type = obj.TYPE_MEM
p.To.Name = obj.NAME_EXTERN
p.To.Sym = ir.Syms.Duffzero
p.To.Offset = v.AuxInt
case ssa.OpARM64CCMP,
ssa.OpARM64CCMN,
ssa.OpARM64CCMPconst,
ssa.OpARM64CCMNconst,
ssa.OpARM64CCMPW,
ssa.OpARM64CCMNW,
ssa.OpARM64CCMPWconst,
ssa.OpARM64CCMNWconst:
p := s.Prog(v.Op.Asm())
p.Reg = v.Args[0].Reg()
params := v.AuxArm64ConditionalParams()
p.From.Type = obj.TYPE_SPECIAL // assembler encodes conditional bits in Offset
p.From.Offset = int64(condBits[params.Cond()])
constValue, ok := params.ConstValue()
if ok {
p.AddRestSourceConst(constValue)
} else {
p.AddRestSourceReg(v.Args[1].Reg())
}
p.To.Type = obj.TYPE_CONST
p.To.Offset = params.Nzcv()
case ssa.OpARM64LoweredZero:
// STP.P (ZR,ZR), 16(R16)
// CMP Rarg1, R16
// BLE -2(PC)
// arg1 is the address of the last 16-byte unit to zero
p := s.Prog(arm64.ASTP)
p.Scond = arm64.C_XPOST
p.From.Type = obj.TYPE_REGREG
p.From.Reg = arm64.REGZERO
p.From.Offset = int64(arm64.REGZERO)
p.To.Type = obj.TYPE_MEM
p.To.Reg = arm64.REG_R16
p.To.Offset = 16
p2 := s.Prog(arm64.ACMP)
p2.From.Type = obj.TYPE_REG
p2.From.Reg = v.Args[1].Reg()
p2.Reg = arm64.REG_R16
p3 := s.Prog(arm64.ABLE)
p3.To.Type = obj.TYPE_BRANCH
p3.To.SetTarget(p)
case ssa.OpARM64DUFFCOPY:
p := s.Prog(obj.ADUFFCOPY)
p.To.Type = obj.TYPE_MEM
p.To.Name = obj.NAME_EXTERN
p.To.Sym = ir.Syms.Duffcopy
p.To.Offset = v.AuxInt
ptrReg := v.Args[0].Reg()
n := v.AuxInt
if n < 16 {
v.Fatalf("Zero too small %d", n)
}
// Generate zeroing instructions.
var off int64
for n >= 16 {
// STP (ZR, ZR), off(ptrReg)
zero16(s, ptrReg, off, false)
off += 16
n -= 16
}
// Write any fractional portion.
// An overlapping 16-byte write can't be used here
// because STP's offsets must be a multiple of 8.
if n > 8 {
// MOVD ZR, off(ptrReg)
zero8(s, ptrReg, off)
off += 8
n -= 8
}
if n != 0 {
// MOVD ZR, off+n-8(ptrReg)
// TODO: for n<=4 we could use a smaller write.
zero8(s, ptrReg, off+n-8)
}
case ssa.OpARM64LoweredZeroLoop:
ptrReg := v.Args[0].Reg()
countReg := v.RegTmp()
n := v.AuxInt
loopSize := int64(64)
if n < 3*loopSize {
// - a loop count of 0 won't work.
// - a loop count of 1 is useless.
// - a loop count of 2 is a code size ~tie
// 3 instructions to implement the loop
// 4 instructions in the loop body
// vs
// 8 instructions in the straightline code
// Might as well use straightline code.
v.Fatalf("ZeroLoop size too small %d", n)
}
// Put iteration count in a register.
// MOVD $n, countReg
p := s.Prog(arm64.AMOVD)
p.From.Type = obj.TYPE_CONST
p.From.Offset = n / loopSize
p.To.Type = obj.TYPE_REG
p.To.Reg = countReg
cntInit := p
// Zero loopSize bytes starting at ptrReg.
// Increment ptrReg by loopSize as a side effect.
for range loopSize / 16 {
// STP.P (ZR, ZR), 16(ptrReg)
zero16(s, ptrReg, 0, true)
// TODO: should we use the postincrement form,
// or use a separate += 64 instruction?
// postincrement saves an instruction, but maybe
// it requires more integer units to do the +=16s.
}
// Decrement loop count.
// SUB $1, countReg
p = s.Prog(arm64.ASUB)
p.From.Type = obj.TYPE_CONST
p.From.Offset = 1
p.To.Type = obj.TYPE_REG
p.To.Reg = countReg
// Jump to loop header if we're not done yet.
// CBNZ head
p = s.Prog(arm64.ACBNZ)
p.From.Type = obj.TYPE_REG
p.From.Reg = countReg
p.To.Type = obj.TYPE_BRANCH
p.To.SetTarget(cntInit.Link)
// Multiples of the loop size are now done.
n %= loopSize
// Write any fractional portion.
var off int64
for n >= 16 {
// STP (ZR, ZR), off(ptrReg)
zero16(s, ptrReg, off, false)
off += 16
n -= 16
}
if n > 8 {
// Note: an overlapping 16-byte write can't be used
// here because STP's offsets must be a multiple of 8.
// MOVD ZR, off(ptrReg)
zero8(s, ptrReg, off)
off += 8
n -= 8
}
if n != 0 {
// MOVD ZR, off+n-8(ptrReg)
// TODO: for n<=4 we could use a smaller write.
zero8(s, ptrReg, off+n-8)
}
// TODO: maybe we should use the count register to instead
// hold an end pointer and compare against that?
// ADD $n, ptrReg, endReg
// then
// CMP ptrReg, endReg
// BNE loop
// There's a past-the-end pointer here, any problem with that?
case ssa.OpARM64LoweredMove:
// LDP.P 16(R16), (R25, Rtmp)
// STP.P (R25, Rtmp), 16(R17)
// CMP Rarg2, R16
// BLE -3(PC)
// arg2 is the address of the last element of src
p := s.Prog(arm64.ALDP)
p.Scond = arm64.C_XPOST
p.From.Type = obj.TYPE_MEM
p.From.Reg = arm64.REG_R16
p.From.Offset = 16
p.To.Type = obj.TYPE_REGREG
p.To.Reg = arm64.REG_R25
p.To.Offset = int64(arm64.REGTMP)
p2 := s.Prog(arm64.ASTP)
p2.Scond = arm64.C_XPOST
p2.From.Type = obj.TYPE_REGREG
p2.From.Reg = arm64.REG_R25
p2.From.Offset = int64(arm64.REGTMP)
p2.To.Type = obj.TYPE_MEM
p2.To.Reg = arm64.REG_R17
p2.To.Offset = 16
p3 := s.Prog(arm64.ACMP)
p3.From.Type = obj.TYPE_REG
p3.From.Reg = v.Args[2].Reg()
p3.Reg = arm64.REG_R16
p4 := s.Prog(arm64.ABLE)
p4.To.Type = obj.TYPE_BRANCH
p4.To.SetTarget(p)
dstReg := v.Args[0].Reg()
srcReg := v.Args[1].Reg()
if dstReg == srcReg {
break
}
tmpReg1 := int16(arm64.REG_R25)
tmpFReg1 := int16(arm64.REG_F16)
tmpFReg2 := int16(arm64.REG_F17)
n := v.AuxInt
if n < 16 {
v.Fatalf("Move too small %d", n)
}
// Generate copying instructions.
var off int64
for n >= 32 {
// FLDPQ off(srcReg), (tmpFReg1, tmpFReg2)
// FSTPQ (tmpFReg1, tmpFReg2), off(dstReg)
move32(s, srcReg, dstReg, tmpFReg1, tmpFReg2, off, false)
off += 32
n -= 32
}
for n >= 16 {
// FMOVQ off(src), tmpFReg1
// FMOVQ tmpFReg1, off(dst)
move16(s, srcReg, dstReg, tmpFReg1, off, false)
off += 16
n -= 16
}
if n > 8 {
// MOVD off(srcReg), tmpReg1
// MOVD tmpReg1, off(dstReg)
move8(s, srcReg, dstReg, tmpReg1, off)
off += 8
n -= 8
}
if n != 0 {
// MOVD off+n-8(srcReg), tmpReg1
// MOVD tmpReg1, off+n-8(dstReg)
move8(s, srcReg, dstReg, tmpReg1, off+n-8)
}
case ssa.OpARM64LoweredMoveLoop:
dstReg := v.Args[0].Reg()
srcReg := v.Args[1].Reg()
if dstReg == srcReg {
break
}
countReg := int16(arm64.REG_R24)
tmpReg1 := int16(arm64.REG_R25)
tmpFReg1 := int16(arm64.REG_F16)
tmpFReg2 := int16(arm64.REG_F17)
n := v.AuxInt
loopSize := int64(64)
if n < 3*loopSize {
// - a loop count of 0 won't work.
// - a loop count of 1 is useless.
// - a loop count of 2 is a code size ~tie
// 3 instructions to implement the loop
// 4 instructions in the loop body
// vs
// 8 instructions in the straightline code
// Might as well use straightline code.
v.Fatalf("ZeroLoop size too small %d", n)
}
// Put iteration count in a register.
// MOVD $n, countReg
p := s.Prog(arm64.AMOVD)
p.From.Type = obj.TYPE_CONST
p.From.Offset = n / loopSize
p.To.Type = obj.TYPE_REG
p.To.Reg = countReg
cntInit := p
// Move loopSize bytes starting at srcReg to dstReg.
// Increment srcReg and destReg by loopSize as a side effect.
for range loopSize / 32 {
// FLDPQ.P 32(srcReg), (tmpFReg1, tmpFReg2)
// FSTPQ.P (tmpFReg1, tmpFReg2), 32(dstReg)
move32(s, srcReg, dstReg, tmpFReg1, tmpFReg2, 0, true)
}
// Decrement loop count.
// SUB $1, countReg
p = s.Prog(arm64.ASUB)
p.From.Type = obj.TYPE_CONST
p.From.Offset = 1
p.To.Type = obj.TYPE_REG
p.To.Reg = countReg
// Jump to loop header if we're not done yet.
// CBNZ head
p = s.Prog(arm64.ACBNZ)
p.From.Type = obj.TYPE_REG
p.From.Reg = countReg
p.To.Type = obj.TYPE_BRANCH
p.To.SetTarget(cntInit.Link)
// Multiples of the loop size are now done.
n %= loopSize
// Copy any fractional portion.
var off int64
for n >= 32 {
// FLDPQ off(srcReg), (tmpFReg1, tmpFReg2)
// FSTPQ (tmpFReg1, tmpFReg2), off(dstReg)
move32(s, srcReg, dstReg, tmpFReg1, tmpFReg2, off, false)
off += 32
n -= 32
}
for n >= 16 {
// FMOVQ off(src), tmpFReg1
// FMOVQ tmpFReg1, off(dst)
move16(s, srcReg, dstReg, tmpFReg1, off, false)
off += 16
n -= 16
}
if n > 8 {
// MOVD off(srcReg), tmpReg1
// MOVD tmpReg1, off(dstReg)
move8(s, srcReg, dstReg, tmpReg1, off)
off += 8
n -= 8
}
if n != 0 {
// MOVD off+n-8(srcReg), tmpReg1
// MOVD tmpReg1, off+n-8(dstReg)
move8(s, srcReg, dstReg, tmpReg1, off+n-8)
}
case ssa.OpARM64CALLstatic, ssa.OpARM64CALLclosure, ssa.OpARM64CALLinter:
s.Call(v)
case ssa.OpARM64CALLtail:
@ -1121,13 +1322,97 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
p.To.Name = obj.NAME_EXTERN
// AuxInt encodes how many buffer entries we need.
p.To.Sym = ir.Syms.GCWriteBarrier[v.AuxInt-1]
case ssa.OpARM64LoweredPanicBoundsA, ssa.OpARM64LoweredPanicBoundsB, ssa.OpARM64LoweredPanicBoundsC:
case ssa.OpARM64LoweredMemEq:
p := s.Prog(obj.ACALL)
p.To.Type = obj.TYPE_MEM
p.To.Name = obj.NAME_EXTERN
p.To.Sym = ssagen.BoundsCheckFunc[v.AuxInt]
s.UseArgs(16) // space used in callee args area by assembly stubs
p.To.Sym = ir.Syms.Memequal
case ssa.OpARM64LoweredPanicBoundsRR, ssa.OpARM64LoweredPanicBoundsRC, ssa.OpARM64LoweredPanicBoundsCR, ssa.OpARM64LoweredPanicBoundsCC:
// Compute the constant we put in the PCData entry for this call.
code, signed := ssa.BoundsKind(v.AuxInt).Code()
xIsReg := false
yIsReg := false
xVal := 0
yVal := 0
switch v.Op {
case ssa.OpARM64LoweredPanicBoundsRR:
xIsReg = true
xVal = int(v.Args[0].Reg() - arm64.REG_R0)
yIsReg = true
yVal = int(v.Args[1].Reg() - arm64.REG_R0)
case ssa.OpARM64LoweredPanicBoundsRC:
xIsReg = true
xVal = int(v.Args[0].Reg() - arm64.REG_R0)
c := v.Aux.(ssa.PanicBoundsC).C
if c >= 0 && c <= abi.BoundsMaxConst {
yVal = int(c)
} else {
// Move constant to a register
yIsReg = true
if yVal == xVal {
yVal = 1
}
p := s.Prog(arm64.AMOVD)
p.From.Type = obj.TYPE_CONST
p.From.Offset = c
p.To.Type = obj.TYPE_REG
p.To.Reg = arm64.REG_R0 + int16(yVal)
}
case ssa.OpARM64LoweredPanicBoundsCR:
yIsReg = true
yVal = int(v.Args[0].Reg() - arm64.REG_R0)
c := v.Aux.(ssa.PanicBoundsC).C
if c >= 0 && c <= abi.BoundsMaxConst {
xVal = int(c)
} else {
// Move constant to a register
if xVal == yVal {
xVal = 1
}
p := s.Prog(arm64.AMOVD)
p.From.Type = obj.TYPE_CONST
p.From.Offset = c
p.To.Type = obj.TYPE_REG
p.To.Reg = arm64.REG_R0 + int16(xVal)
}
case ssa.OpARM64LoweredPanicBoundsCC:
c := v.Aux.(ssa.PanicBoundsCC).Cx
if c >= 0 && c <= abi.BoundsMaxConst {
xVal = int(c)
} else {
// Move constant to a register
xIsReg = true
p := s.Prog(arm64.AMOVD)
p.From.Type = obj.TYPE_CONST
p.From.Offset = c
p.To.Type = obj.TYPE_REG
p.To.Reg = arm64.REG_R0 + int16(xVal)
}
c = v.Aux.(ssa.PanicBoundsCC).Cy
if c >= 0 && c <= abi.BoundsMaxConst {
yVal = int(c)
} else {
// Move constant to a register
yIsReg = true
yVal = 1
p := s.Prog(arm64.AMOVD)
p.From.Type = obj.TYPE_CONST
p.From.Offset = c
p.To.Type = obj.TYPE_REG
p.To.Reg = arm64.REG_R0 + int16(yVal)
}
}
c := abi.BoundsEncode(code, signed, xIsReg, yIsReg, xVal, yVal)
p := s.Prog(obj.APCDATA)
p.From.SetConst(abi.PCDATA_PanicBounds)
p.To.SetConst(int64(c))
p = s.Prog(obj.ACALL)
p.To.Type = obj.TYPE_MEM
p.To.Name = obj.NAME_EXTERN
p.To.Sym = ir.Syms.PanicBounds
case ssa.OpARM64LoweredNilCheck:
// Issue a load which will fault if arg is nil.
p := s.Prog(arm64.AMOVB)
@ -1402,3 +1687,114 @@ func spillArgReg(pp *objw.Progs, p *obj.Prog, f *ssa.Func, t *types.Type, reg in
p.Pos = p.Pos.WithNotStmt()
return p
}
// zero16 zeroes 16 bytes at reg+off.
// If postInc is true, increment reg by 16.
func zero16(s *ssagen.State, reg int16, off int64, postInc bool) {
// STP (ZR, ZR), off(reg)
p := s.Prog(arm64.ASTP)
p.From.Type = obj.TYPE_REGREG
p.From.Reg = arm64.REGZERO
p.From.Offset = int64(arm64.REGZERO)
p.To.Type = obj.TYPE_MEM
p.To.Reg = reg
p.To.Offset = off
if postInc {
if off != 0 {
panic("can't postinc with non-zero offset")
}
// STP.P (ZR, ZR), 16(reg)
p.Scond = arm64.C_XPOST
p.To.Offset = 16
}
}
// zero8 zeroes 8 bytes at reg+off.
func zero8(s *ssagen.State, reg int16, off int64) {
// MOVD ZR, off(reg)
p := s.Prog(arm64.AMOVD)
p.From.Type = obj.TYPE_REG
p.From.Reg = arm64.REGZERO
p.To.Type = obj.TYPE_MEM
p.To.Reg = reg
p.To.Offset = off
}
// move32 copies 32 bytes at src+off to dst+off.
// Uses registers tmp1 and tmp2.
// If postInc is true, increment src and dst by 32.
func move32(s *ssagen.State, src, dst, tmp1, tmp2 int16, off int64, postInc bool) {
// FLDPQ off(src), (tmp1, tmp2)
ld := s.Prog(arm64.AFLDPQ)
ld.From.Type = obj.TYPE_MEM
ld.From.Reg = src
ld.From.Offset = off
ld.To.Type = obj.TYPE_REGREG
ld.To.Reg = tmp1
ld.To.Offset = int64(tmp2)
// FSTPQ (tmp1, tmp2), off(dst)
st := s.Prog(arm64.AFSTPQ)
st.From.Type = obj.TYPE_REGREG
st.From.Reg = tmp1
st.From.Offset = int64(tmp2)
st.To.Type = obj.TYPE_MEM
st.To.Reg = dst
st.To.Offset = off
if postInc {
if off != 0 {
panic("can't postinc with non-zero offset")
}
ld.Scond = arm64.C_XPOST
st.Scond = arm64.C_XPOST
ld.From.Offset = 32
st.To.Offset = 32
}
}
// move16 copies 16 bytes at src+off to dst+off.
// Uses register tmp1
// If postInc is true, increment src and dst by 16.
func move16(s *ssagen.State, src, dst, tmp1 int16, off int64, postInc bool) {
// FMOVQ off(src), tmp1
ld := s.Prog(arm64.AFMOVQ)
ld.From.Type = obj.TYPE_MEM
ld.From.Reg = src
ld.From.Offset = off
ld.To.Type = obj.TYPE_REG
ld.To.Reg = tmp1
// FMOVQ tmp1, off(dst)
st := s.Prog(arm64.AFMOVQ)
st.From.Type = obj.TYPE_REG
st.From.Reg = tmp1
st.To.Type = obj.TYPE_MEM
st.To.Reg = dst
st.To.Offset = off
if postInc {
if off != 0 {
panic("can't postinc with non-zero offset")
}
ld.Scond = arm64.C_XPOST
st.Scond = arm64.C_XPOST
ld.From.Offset = 16
st.To.Offset = 16
}
}
// move8 copies 8 bytes at src+off to dst+off.
// Uses register tmp.
func move8(s *ssagen.State, src, dst, tmp int16, off int64) {
// MOVD off(src), tmp
ld := s.Prog(arm64.AMOVD)
ld.From.Type = obj.TYPE_MEM
ld.From.Reg = src
ld.From.Offset = off
ld.To.Type = obj.TYPE_REG
ld.To.Reg = tmp
// MOVD tmp, off(dst)
st := s.Prog(arm64.AMOVD)
st.From.Type = obj.TYPE_REG
st.From.Reg = tmp
st.To.Type = obj.TYPE_MEM
st.To.Reg = dst
st.To.Offset = off
}

View file

@ -5,11 +5,7 @@
package base
import (
"fmt"
"os"
"runtime"
"runtime/debug"
"runtime/metrics"
)
var atExitFuncs []func()
@ -29,193 +25,3 @@ func Exit(code int) {
// To enable tracing support (-t flag), set EnableTrace to true.
const EnableTrace = false
// forEachGC calls fn each GC cycle until it returns false.
func forEachGC(fn func() bool) {
type T [32]byte // large enough to avoid runtime's tiny object allocator
var finalizer func(*T)
finalizer = func(p *T) {
if fn() {
runtime.SetFinalizer(p, finalizer)
}
}
finalizer(new(T))
}
// AdjustStartingHeap modifies GOGC so that GC should not occur until the heap
// grows to the requested size. This is intended but not promised, though it
// is true-mostly, depending on when the adjustment occurs and on the
// compiler's input and behavior. Once this size is approximately reached
// GOGC is reset to 100; subsequent GCs may reduce the heap below the requested
// size, but this function does not affect that.
//
// -d=gcadjust=1 enables logging of GOGC adjustment events.
//
// NOTE: If you think this code would help startup time in your own
// application and you decide to use it, please benchmark first to see if it
// actually works for you (it may not: the Go compiler is not typical), and
// whatever the outcome, please leave a comment on bug #56546. This code
// uses supported interfaces, but depends more than we like on
// current+observed behavior of the garbage collector, so if many people need
// this feature, we should consider/propose a better way to accomplish it.
func AdjustStartingHeap(requestedHeapGoal uint64) {
logHeapTweaks := Debug.GCAdjust == 1
mp := runtime.GOMAXPROCS(0)
gcConcurrency := Flag.LowerC
const (
goal = "/gc/heap/goal:bytes"
count = "/gc/cycles/total:gc-cycles"
allocs = "/gc/heap/allocs:bytes"
frees = "/gc/heap/frees:bytes"
)
sample := []metrics.Sample{{Name: goal}, {Name: count}, {Name: allocs}, {Name: frees}}
const (
GOAL = 0
COUNT = 1
ALLOCS = 2
FREES = 3
)
// Assumptions and observations of Go's garbage collector, as of Go 1.17-1.20:
// - the initial heap goal is 4M, by fiat. It is possible for Go to start
// with a heap as small as 512k, so this may change in the future.
// - except for the first heap goal, heap goal is a function of
// observed-live at the previous GC and current GOGC. After the first
// GC, adjusting GOGC immediately updates GOGC; before the first GC,
// adjusting GOGC does not modify goal (but the change takes effect after
// the first GC).
// - the before/after first GC behavior is not guaranteed anywhere, it's
// just behavior, and it's a bad idea to rely on it.
// - we don't know exactly when GC will run, even after we adjust GOGC; the
// first GC may not have happened yet, may have already happened, or may
// be currently in progress, and GCs can start for several reasons.
// - forEachGC above will run the provided function at some delay after each
// GC's mark phase terminates; finalizers are run after marking as the
// spans containing finalizable objects are swept, driven by GC
// background activity and allocation demand.
// - "live at last GC" is not available through the current metrics
// interface. Instead, live is estimated by knowing the adjusted value of
// GOGC and the new heap goal following a GC (this requires knowing that
// at least one GC has occurred):
// estLive = 100 * newGoal / (100 + currentGogc)
// this new value of GOGC
// newGogc = 100*requestedHeapGoal/estLive - 100
// will result in the desired goal. The logging code checks that the
// resulting goal is correct.
// There's a small risk that the finalizer will be slow to run after a GC
// that expands the goal to a huge value, and that this will lead to
// out-of-memory. This doesn't seem to happen; in experiments on a variety
// of machines with a variety of extra loads to disrupt scheduling, the
// worst overshoot observed was 50% past requestedHeapGoal.
metrics.Read(sample)
for _, s := range sample {
if s.Value.Kind() == metrics.KindBad {
// Just return, a slightly slower compilation is a tolerable outcome.
if logHeapTweaks {
fmt.Fprintf(os.Stderr, "GCAdjust: Regret unexpected KindBad for metric %s\n", s.Name)
}
return
}
}
// Tinker with GOGC to make the heap grow rapidly at first.
currentGoal := sample[GOAL].Value.Uint64() // Believe this will be 4MByte or less, perhaps 512k
myGogc := 100 * requestedHeapGoal / currentGoal
if myGogc <= 150 {
return
}
if logHeapTweaks {
sample := append([]metrics.Sample(nil), sample...) // avoid races with GC callback
AtExit(func() {
metrics.Read(sample)
goal := sample[GOAL].Value.Uint64()
count := sample[COUNT].Value.Uint64()
oldGogc := debug.SetGCPercent(100)
if oldGogc == 100 {
fmt.Fprintf(os.Stderr, "GCAdjust: AtExit goal %d gogc %d count %d maxprocs %d gcConcurrency %d\n",
goal, oldGogc, count, mp, gcConcurrency)
} else {
inUse := sample[ALLOCS].Value.Uint64() - sample[FREES].Value.Uint64()
overPct := 100 * (int(inUse) - int(requestedHeapGoal)) / int(requestedHeapGoal)
fmt.Fprintf(os.Stderr, "GCAdjust: AtExit goal %d gogc %d count %d maxprocs %d gcConcurrency %d overPct %d\n",
goal, oldGogc, count, mp, gcConcurrency, overPct)
}
})
}
debug.SetGCPercent(int(myGogc))
adjustFunc := func() bool {
metrics.Read(sample)
goal := sample[GOAL].Value.Uint64()
count := sample[COUNT].Value.Uint64()
if goal <= requestedHeapGoal { // Stay the course
if logHeapTweaks {
fmt.Fprintf(os.Stderr, "GCAdjust: Reuse GOGC adjust, current goal %d, count is %d, current gogc %d\n",
goal, count, myGogc)
}
return true
}
// Believe goal has been adjusted upwards, else it would be less-than-or-equal than requestedHeapGoal
calcLive := 100 * goal / (100 + myGogc)
if 2*calcLive < requestedHeapGoal { // calcLive can exceed requestedHeapGoal!
myGogc = 100*requestedHeapGoal/calcLive - 100
if myGogc > 125 {
// Not done growing the heap.
oldGogc := debug.SetGCPercent(int(myGogc))
if logHeapTweaks {
// Check that the new goal looks right
inUse := sample[ALLOCS].Value.Uint64() - sample[FREES].Value.Uint64()
metrics.Read(sample)
newGoal := sample[GOAL].Value.Uint64()
pctOff := 100 * (int64(newGoal) - int64(requestedHeapGoal)) / int64(requestedHeapGoal)
// Check that the new goal is close to requested. 3% of make.bash fails this test. Why, TBD.
if pctOff < 2 {
fmt.Fprintf(os.Stderr, "GCAdjust: Retry GOGC adjust, current goal %d, count is %d, gogc was %d, is now %d, calcLive %d pctOff %d\n",
goal, count, oldGogc, myGogc, calcLive, pctOff)
} else {
// The GC is being annoying and not giving us the goal that we requested, say more to help understand when/why.
fmt.Fprintf(os.Stderr, "GCAdjust: Retry GOGC adjust, current goal %d, count is %d, gogc was %d, is now %d, calcLive %d pctOff %d inUse %d\n",
goal, count, oldGogc, myGogc, calcLive, pctOff, inUse)
}
}
return true
}
}
// In this case we're done boosting GOGC, set it to 100 and don't set a new finalizer.
oldGogc := debug.SetGCPercent(100)
// inUse helps estimate how late the finalizer ran; at the instant the previous GC ended,
// it was (in theory) equal to the previous GC's heap goal. In a growing heap it is
// expected to grow to the new heap goal.
inUse := sample[ALLOCS].Value.Uint64() - sample[FREES].Value.Uint64()
overPct := 100 * (int(inUse) - int(requestedHeapGoal)) / int(requestedHeapGoal)
if logHeapTweaks {
fmt.Fprintf(os.Stderr, "GCAdjust: Reset GOGC adjust, old goal %d, count is %d, gogc was %d, calcLive %d inUse %d overPct %d\n",
goal, count, oldGogc, calcLive, inUse, overPct)
}
return false
}
forEachGC(adjustFunc)
}

View file

@ -20,6 +20,8 @@ type DebugFlags struct {
Append int `help:"print information about append compilation"`
Checkptr int `help:"instrument unsafe pointer conversions\n0: instrumentation disabled\n1: conversions involving unsafe.Pointer are instrumented\n2: conversions to unsafe.Pointer force heap allocation" concurrent:"ok"`
Closure int `help:"print information about closure compilation"`
CompressInstructions int `help:"use compressed instructions when possible (if supported by architecture)"`
Converthash string `help:"hash value for use in debugging changes to platform-dependent float-to-[u]int conversion" concurrent:"ok"`
Defer int `help:"print information about defer compilation"`
DisableNil int `help:"disable nil checks" concurrent:"ok"`
DumpInlFuncProps string `help:"dump function properties from inl heuristics to specified file"`
@ -30,12 +32,16 @@ type DebugFlags struct {
DwarfInl int `help:"print information about DWARF inlined function creation"`
EscapeMutationsCalls int `help:"print extra escape analysis diagnostics about mutations and calls" concurrent:"ok"`
EscapeDebug int `help:"print information about escape analysis and resulting optimizations" concurrent:"ok"`
EscapeAlias int `help:"print information about alias analysis" concurrent:"ok"`
EscapeAliasCheck int `help:"enable additional validation for alias analysis" concurrent:"ok"`
Export int `help:"print export data"`
FIPSHash string `help:"hash value for FIPS debugging" concurrent:"ok"`
Fmahash string `help:"hash value for use in debugging platform-dependent multiply-add use" concurrent:"ok"`
FreeAppend int `help:"insert frees of append results when proven safe (0 disabled, 1 enabled, 2 enabled + log)" concurrent:"ok"`
GCAdjust int `help:"log adjustments to GOGC" concurrent:"ok"`
GCCheck int `help:"check heap/gc use by compiler" concurrent:"ok"`
GCProg int `help:"print dump of GC programs"`
GCStart int `help:"specify \"starting\" compiler's heap size in MiB" concurrent:"ok"`
Gossahash string `help:"hash value for use in debugging the compiler"`
InlFuncsWithClosures int `help:"allow functions with closures to be inlined" concurrent:"ok"`
InlStaticInit int `help:"allow static initialization of inlined calls" concurrent:"ok"`

View file

@ -177,10 +177,12 @@ func ParseFlags() {
Flag.WB = true
Debug.ConcurrentOk = true
Debug.CompressInstructions = 1
Debug.MaxShapeLen = 500
Debug.AlignHot = 1
Debug.InlFuncsWithClosures = 1
Debug.InlStaticInit = 1
Debug.FreeAppend = 1
Debug.PGOInline = 1
Debug.PGODevirtualize = 2
Debug.SyncFrames = -1 // disable sync markers by default
@ -262,6 +264,12 @@ func ParseFlags() {
Debug.LoopVar = 1
}
if Debug.Converthash != "" {
ConvertHash = NewHashDebug("converthash", Debug.Converthash, nil)
} else {
// quietly disable the convert hash changes
ConvertHash = NewHashDebug("converthash", "qn", nil)
}
if Debug.Fmahash != "" {
FmaHash = NewHashDebug("fmahash", Debug.Fmahash, nil)
}
@ -293,6 +301,7 @@ func ParseFlags() {
}
parseSpectre(Flag.Spectre) // left as string for RecordFlags
Ctxt.CompressInstructions = Debug.CompressInstructions != 0
Ctxt.Flag_shared = Ctxt.Flag_dynlink || Ctxt.Flag_shared
Ctxt.Flag_optimize = Flag.N == 0
Ctxt.Debugasm = int(Flag.S)
@ -383,14 +392,14 @@ func ParseFlags() {
// See the comment on type CmdFlags for the rules.
func registerFlags() {
var (
boolType = reflect.TypeOf(bool(false))
intType = reflect.TypeOf(int(0))
stringType = reflect.TypeOf(string(""))
ptrBoolType = reflect.TypeOf(new(bool))
ptrIntType = reflect.TypeOf(new(int))
ptrStringType = reflect.TypeOf(new(string))
countType = reflect.TypeOf(CountFlag(0))
funcType = reflect.TypeOf((func(string))(nil))
boolType = reflect.TypeFor[bool]()
intType = reflect.TypeFor[int]()
stringType = reflect.TypeFor[string]()
ptrBoolType = reflect.TypeFor[*bool]()
ptrIntType = reflect.TypeFor[*int]()
ptrStringType = reflect.TypeFor[*string]()
countType = reflect.TypeFor[CountFlag]()
funcType = reflect.TypeFor[func(string)]()
)
v := reflect.ValueOf(&Flag).Elem()
@ -570,7 +579,7 @@ func readEmbedCfg(file string) {
// parseSpectre parses the spectre configuration from the string s.
func parseSpectre(s string) {
for _, f := range strings.Split(s, ",") {
for f := range strings.SplitSeq(s, ",") {
f = strings.TrimSpace(f)
switch f {
default:

Some files were not shown because too many files have changed in this diff Show more