67028 Commits

Author SHA1 Message Date
qiulaidongfeng
698882a459 testing/synctest: add Subtest
Fixes #77320

Change-Id: I1ca7480dceb0a95d223ae1618c0e9dd23abe5d49
Reviewed-on: https://go-review.googlesource.com/c/go/+/787940
Auto-Submit: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2026-07-17 13:24:49 -07:00
Julian Soreavis
41b2f7fd6b testing: name the conflicting operation in t.Parallel panics
t.Parallel and the operations that forbid it (t.Setenv, t.Chdir, and
cryptotest.SetGlobalRandom) shared a single panic message that listed all
three operations, so the panic never named the one that actually caused the
conflict. A test that only calls t.Setenv could panic with a message
mentioning cryptotest.SetGlobalRandom, which is confusing.

Record the specific operation that denies parallelism and report it in both
directions: when t.Parallel is called after one of those operations, and
when one of them is called on a test that is already parallel.

Fixes #80267

Change-Id: I749e22f3e6df3552795c512636a5d2466d95af4f
GitHub-Last-Rev: 68ecf1b19a73937c99f7db5ea3c4122541bfd6d0
GitHub-Pull-Request: golang/go#80313
Reviewed-on: https://go-review.googlesource.com/c/go/+/798641
Reviewed-by: Sean Liao <sean@liao.dev>
Auto-Submit: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
2026-07-17 12:13:35 -07:00
Simon Law
1beab65af5 cmd/compile/internal/noder: run gofmt on the documentation
Added a newline after each section header and its following paragraph,
so the sections would render properly.

Ran gofmt, which indented the code blocks with tab characters and
replaced * bullets with - ones.

Note: this documentation is intentionally NOT general package
documentation, but is now formatted consistently with other doc
comments.

For #80397

Change-Id: Ib651e204fc9813122934357a67f3c75bd453483c
Reviewed-on: https://go-review.googlesource.com/c/go/+/801900
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Mark Freeman <markfreeman@google.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-07-17 12:09:26 -07:00
MITSUNARI Shigeo
1b0e91bf6e cmd/compile: optimize 32-bit unsigned division by pre-shifted magic constant
For unsigned 32-bit division by a constant d on 64-bit targets (amd64,
arm64, riscv64, ...), when the magic multiplier M = 2^32 + m has m odd
(i.e. M is truly 33-bit and cannot be halved to fit in 32 bits), use a
pre-shifted constant C = M << (32 - s) so that a single Hmul64u gives
the quotient directly:

      x / d = Hmul64u(ZeroExt32to64(x), C)

This replaces the avg-based sequence for odd divisors (Case 3) and the
SHR+IMULQ+SHR sequence for even divisors whose underlying magic is
33-bit (e.g. d=14=2×7). Divisors where m is even (Case 6) keep their
existing 32-bit constant path to avoid loading a large 64-bit constant
on arm64/riscv64.

Benchmark on Intel Xeon w9-3495X (3 divisions per iteration, go1.26.3):
  BenchmarkOdd  (d=7,19,107):   3.07 ns/op → 1.92 ns/op  (~38% faster)
  BenchmarkEven (d=14,38,214):  2.04 ns/op → 1.92 ns/op  (~6% faster)

Ref: https://arxiv.org/abs/2604.07902
     https://github.com/llvm/llvm-project/pull/181288

Fixes #79780

Change-Id: I33f551f4f6715ddbcc39f9f56c1331f31f0eca33
Reviewed-on: https://go-review.googlesource.com/c/go/+/785960
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2026-07-17 11:47:21 -07:00
Damien Neil
2e161e3833 net/http/httputil: don't forward Upgrade: h2c headers
Somewhat surprisingly, ReverseProxy will forward "Upgrade: h2c" headers
which attempt to switch an HTTP/1 connection to an unencrypted HTTP/2 one.
If the backend supports this deprecated protocol switch mechanism,
this lets a client send HTTP requests that bypass the ReverseProxy's
handlers. This is surprising at best, a security issue at worst.

Refuse to forward "Upgrade: h2c" headers.

In the unlikely event anyone actually wants this behavior,
they can use a Rewrite function to add the Upgrade: h2c
to the forwarded request.

Fixes #80416

Change-Id: I3a7d80fadf2eccbcce97f423556f8bf26a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/801722
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Nicholas Husin <husin@google.com>
Reviewed-by: Nicholas Husin <nsh@golang.org>
2026-07-17 10:51:01 -07:00
Damien Neil
2f897224b9 net/http/httputil: reject upgrade requests on non-HTTP/1.1 connections
The Upgrade header is only valid on HTTP/1.1 connections.
(HTTP/2 has a different mechanism, see RFC 8441.)
Reject upgrade requests received on a non-HTTP/1.1 connection.

For #80416

Change-Id: I322ff6a3b4585c560f9ecaa206cd77446a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/801721
Reviewed-by: Nicholas Husin <nsh@golang.org>
Reviewed-by: Nicholas Husin <husin@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-07-17 10:50:58 -07:00
Damien Neil
65396524b2 net/http/httputil: document that upgrade requests are forwarded
Fix the ReverseProxy documentation to indicate that upgrade
requests (like requests establishing a WebSocket connection)
are forwarded.

For #80416

Change-Id: Ia75f01692faf498215a05756637c8be46a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/801720
Reviewed-by: Nicholas Husin <husin@google.com>
Reviewed-by: Nicholas Husin <nsh@golang.org>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Damien Neil <dneil@google.com>
2026-07-17 10:28:36 -07:00
Michael Matloob
f48a3fc8f1 cmd/go: move TestBinaryOnlyPackages to a script test
Change-Id: I449460069673e63d527b1b981da3947e6a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/799001
Reviewed-by: Hongxiang Jiang <hxjiang@golang.org>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@google.com>
2026-07-17 09:38:44 -07:00
Jake Bailey
21ae06fe28 Revert "cmd/compile: optimize abi.Type.TFlag loads"
This reverts CL 701299 (commit 86eb9afa8c7dbab5180c618d63c3e5fc09bc13dc).

Reason for revert: broke relui compile

Fixes #80450

Change-Id: Icdad4b66c5a95df6d936f8280496d53fefea4631
Reviewed-on: https://go-review.googlesource.com/c/go/+/802140
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2026-07-17 09:19:41 -07:00
Michael Pratt
2b80068e2e Revert "cmd/compile: speedup large synthetic init function compile time"
This reverts CL 795261.

Reason for revert: Causing failures on perf builders due to map initialization issues in CockroachDB.

Updates #80141
Updates #77153
Fixes #80423

Change-Id: I365f20eec2220894923d4748d730484f6e6ef5c7
Reviewed-on: https://go-review.googlesource.com/c/go/+/802120
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
2026-07-17 07:32:16 -07:00
Mauri de Souza Meneguzzo
c122d7e6c5 cmd/internal/obj/arm64: add CASPA/CASPAL/CASPL pair atomic instructions
https://developer.arm.com/documentation/111108/2026-03/Base-Instructions/CASP--CASPA--CASPAL--CASPL--Compare-and-swap-pair-of-words-or-doublewords-in-memory-

For #61236.

Change-Id: I48d6c2548a5bc6c09ad50cef6261b455761db389
GitHub-Last-Rev: b5fa3b3ae8c228d0ccda2e11824fe6dd96c0907e
GitHub-Pull-Request: golang/go#79992
Reviewed-on: https://go-review.googlesource.com/c/go/+/790321
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2026-07-16 13:30:49 -07:00
Mark Freeman
c7abbff510 go/types, types2: pass in some targets for composite literal types
This change handles the more straightforward targets for composite
literal type inference; they are typically identical to the targets
passed for generic function values.

A variety of test cases are added. Those which are awaiting
implementation are commented out for now.

For #12854

Change-Id: I776e160dd7bce0768589a552c4e7913b1c70220f
Reviewed-on: https://go-review.googlesource.com/c/go/+/794088
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Mark Freeman <markfreeman@google.com>
2026-07-16 12:53:35 -07:00
Mark Freeman
39cc89aa11 go/types, types2: check for composite literal type target
This change checks for a type target for composite literals and performs
the appropriate type inference. Note that U is currently always nil; we
still need to pipe in the types for the relevant contexts. Thus, this
change is a no-op for now.

For #12854

Change-Id: I8517ef72da3b09328be5661021f700b6b00e5f1f
Reviewed-on: https://go-review.googlesource.com/c/go/+/794060
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-07-16 12:53:30 -07:00
Mark Freeman
17810c616f go/types, types2: thread composite literal target through expressions
This change threads a type target through the major expression type
checking logic in Checker.expr and its related methods. For now,
this new argument isn't used.

This is done to reduce the surface area of upcoming changes.

For #12854

Change-Id: I0e21c010c5d0d6ea3fd6dd09b5289b1479a88f7f
Reviewed-on: https://go-review.googlesource.com/c/go/+/794040
Auto-Submit: Mark Freeman <markfreeman@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-07-16 12:53:22 -07:00
Mark Freeman
54539e7c9e go/types, types2: reorder channel sends to extract value target type
For channel sends, we currently check the sent value before inspecting
the channel element type. If we check the channel element type first,
we can extract a target type for the value. This change reorders
processing to do so.

This is a necessary prerequisite for composite literal type inference.

For #12854

Change-Id: I19b1ef73a2f82b3c45cd3f4a3f0dc32cd795e7ac
Reviewed-on: https://go-review.googlesource.com/c/go/+/793980
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Mark Freeman <markfreeman@google.com>
2026-07-16 12:53:06 -07:00
Robert Griesemer
0ca95db05f go/parser: allow untyped composite literals
For #12854.

Change-Id: I10ad6e979165903be43d0d4a0eddbca897e9d767
Reviewed-on: https://go-review.googlesource.com/c/go/+/785002
Reviewed-by: Russ Cox <rsc@golang.org>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
2026-07-16 11:43:38 -07:00
Robert Griesemer
a3edc4c682 cmd/compile/internal/syntax: allow untyped composite literals
For #12854.

Change-Id: I424abb56fc2abb4d94425adba1aab04ebf974810
Reviewed-on: https://go-review.googlesource.com/c/go/+/785200
Reviewed-by: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Russ Cox <rsc@golang.org>
2026-07-16 11:43:31 -07:00
Michael Pratt
ebdf81fda7 Revert "cmd/compile: on AMD64 use leave instruction for go compiled functions"
This reverts CL 548317.

Reason for revert: breaks darwin-amd64

Change-Id: I2dec9a5f9b5213b0e3e2b2788ff4e92ee56d3b7c
Reviewed-on: https://go-review.googlesource.com/c/go/+/801740
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
2026-07-16 11:34:38 -07:00
Nicholas S. Husin
297d5911b5 all: update vendored dependencies
The Go 1.28 development tree has opened. 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: I11731202ff1ede6ed905c667b5bbd7546a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/801060
Reviewed-by: Nicholas Husin <husin@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Nicholas Husin <nsh@golang.org>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2026-07-16 11:23:36 -07:00
Julian Zhu
1ad6b283d4 crypto/internal/fips140/subtle: re-add assembly implementation of xorBytes for mips64x
This CL reapplies CL 666255 , and fixes the previous implementation's unaligned access and panic on mips64x.

Updates #74998

Change-Id: I8e58d25ba5f11520bfbe6e515d378c805bd5984f
Reviewed-on: https://go-review.googlesource.com/c/go/+/696075
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2026-07-16 10:34:46 -07:00
Julian Zhu
73aaa406fb crypto/internal/fips140/subtle: re-add assembly implementation of xorBytes for mipsx
This CL reapplies CL 666275 , and fixes the previous implementation's unaligned access and panic on mipsx.

Updates #74998

Change-Id: I26cd3fdeb54419407bdc0a2f9616924e2e825bc3
Reviewed-on: https://go-review.googlesource.com/c/go/+/696076
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2026-07-16 10:34:34 -07:00
Alex Brainman
a28f0001b7 cmd/go/testdata/script/build_cwd_newline.txt: update go list output
CL 787320 changed

go list -compiled -x -f '{{.CompiledGoFiles}}' .

output. But the CL did not changed build_cwd_newline.txt
test because it is only running when CGO_ENABLED=0.

Adjust the test.

Updates #75238

Change-Id: I675abd19ef8fc75e0a8367ef937b202e8ba768ca
Reviewed-on: https://go-review.googlesource.com/c/go/+/801420
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Quim Muntal <quimmuntal@gmail.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-07-16 10:19:52 -07:00
Cuong Manh Le
c252639210 cmd/compile: fix broken 386 softfloat builder
CL 782461 added new test for avoiding temporary on non-softfloat system.
However, the test was set to be run unconditionally, thus it would be
failed on softfloat builders.

Fixing this by moving the test to be run under cmd/internal/testdir, so
it's possible to exclude unwanted softfloat platforms. While at it, also
tighten the test to ensure there would be temporary if the compiler is
forced to emit softfloat code.

Updates #28698
Fixes #80422

Cq-Include-Trybots: luci.golang.try:gotip-linux-386-softfloat
Change-Id: I5f7b3a19fe36d070d819d58cc29d43e4b44bb1fe
Reviewed-on: https://go-review.googlesource.com/c/go/+/801560
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
2026-07-16 10:12:04 -07:00
Mauri de Souza Meneguzzo
ce608609c1 internal/bytealg: use NEON for compare_arm64.s large-input path
Replace the scalar chunk loop with a 64-byte/iter NEON loop.

For inputs >= 64 bytes, each iteration loads and compares 64 bytes from
both sides using NEON. The compare results are reduced to a single byte;
zero indicates a mismatch.

On mismatch, both pointers are rewound by 64 bytes and the existing
scalar chunk16 path locates the first differing byte pair and produces
the lexicographic result. This fallback is taken at most once.

Inputs < 64 bytes continue to use the existing scalar chunk16 and tail
paths unchanged.

This brings the overall structure closer to equal_arm64.s.

     goos: darwin
     goarch: arm64
     pkg: bytes
     cpu: Apple M3 Pro
                                              │   old.txt   │                new.txt                │
                                              │   sec/op    │   sec/op     vs base                  │
     CompareBytesBigUnaligned/offset=1-11       26.55µ ± 1%   19.21µ ± 1%  -27.63% (p=0.000 n=10)
     CompareBytesBigUnaligned/offset=2-11       26.83µ ± 3%   19.11µ ± 1%  -28.78% (p=0.000 n=10)
     CompareBytesBigUnaligned/offset=3-11       26.59µ ± 1%   19.28µ ± 2%  -27.50% (p=0.000 n=10)
     CompareBytesBigUnaligned/offset=4-11       26.49µ ± 1%   19.11µ ± 1%  -27.84% (p=0.000 n=10)
     CompareBytesBigUnaligned/offset=5-11       27.04µ ± 3%   19.05µ ± 1%  -29.54% (p=0.000 n=10)
     CompareBytesBigUnaligned/offset=6-11       27.12µ ± 1%   18.92µ ± 1%  -30.24% (p=0.000 n=10)
     CompareBytesBigUnaligned/offset=7-11       27.00µ ± 0%   18.90µ ± 0%  -30.01% (p=0.000 n=10)
     CompareBytesBigBothUnaligned/offset=0-11   26.56µ ± 1%   18.01µ ± 1%  -32.20% (p=0.000 n=10)
     CompareBytesBigBothUnaligned/offset=1-11   27.27µ ± 1%   19.43µ ± 0%  -28.77% (p=0.000 n=10)
     CompareBytesBigBothUnaligned/offset=2-11   26.83µ ± 2%   18.68µ ± 1%  -30.38% (p=0.000 n=10)
     CompareBytesBigBothUnaligned/offset=3-11   27.24µ ± 0%   19.45µ ± 0%  -28.62% (p=0.000 n=10)
     CompareBytesBigBothUnaligned/offset=4-11   27.07µ ± 1%   18.67µ ± 1%  -31.03% (p=0.000 n=7+10)
     geomean                                    26.88µ        10.82µ       -29.39%

                                              │   old.txt    │                new.txt                 │
                                              │     B/s      │     B/s       vs base                  │
     CompareBytesBigUnaligned/offset=1-11       36.78Gi ± 1%   50.82Gi ± 1%  +38.18% (p=0.000 n=10)
     CompareBytesBigUnaligned/offset=2-11       36.40Gi ± 3%   51.11Gi ± 1%  +40.41% (p=0.000 n=10)
     CompareBytesBigUnaligned/offset=3-11       36.73Gi ± 1%   50.66Gi ± 2%  +37.93% (p=0.000 n=10)
     CompareBytesBigUnaligned/offset=4-11       36.87Gi ± 1%   51.09Gi ± 1%  +38.59% (p=0.000 n=10)
     CompareBytesBigUnaligned/offset=5-11       36.12Gi ± 3%   51.27Gi ± 1%  +41.92% (p=0.000 n=10)
     CompareBytesBigUnaligned/offset=6-11       36.00Gi ± 1%   51.61Gi ± 1%  +43.35% (p=0.000 n=10)
     CompareBytesBigUnaligned/offset=7-11       36.17Gi ± 0%   51.68Gi ± 0%  +42.88% (p=0.000 n=10)
     CompareBytesBigBothUnaligned/offset=0-11   36.77Gi ± 1%   54.23Gi ± 1%  +47.48% (p=0.000 n=10)
     CompareBytesBigBothUnaligned/offset=1-11   35.81Gi ± 1%   50.27Gi ± 0%  +40.39% (p=0.000 n=10)
     CompareBytesBigBothUnaligned/offset=2-11   36.40Gi ± 2%   52.29Gi ± 1%  +43.64% (p=0.000 n=10)
     CompareBytesBigBothUnaligned/offset=3-11   35.85Gi ± 0%   50.22Gi ± 0%  +40.09% (p=0.000 n=10)
     CompareBytesBigBothUnaligned/offset=4-11   36.07Gi ± 1%   52.30Gi ± 1%  +45.00% (p=0.000 n=7+10)
     geomean                                    36.33Gi        90.30Gi       +41.63%

Change-Id: I4ce9a26f7d434eb4f6447d8a5cbebee5d0901753
GitHub-Last-Rev: 1bf14dc111f1a848cce2193af0f17170b1dc7e73
GitHub-Pull-Request: golang/go#79800
Reviewed-on: https://go-review.googlesource.com/c/go/+/786560
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
2026-07-16 09:48:39 -07:00
Michael Matloob
fb355d8a3c cmd/compile: rewrite x*y-z to fused multiply subtract for GOAMD64=v3
This is done similarly to in CL 646335.

Fixes #80278

Change-Id: Idc0abb682797b9f4e23842b332428a486a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/799984
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-07-16 08:15:48 -07:00
Mauri de Souza Meneguzzo
c2dcde178d cmd/compile: add align128 compiler marker for 128-bit struct alignment
Add an align128 sentinel type to sync/atomic and
internal/runtime/atomic, analogous to align64. Embedding `_ align128`
in a struct causes the compiler to enforce 16-byte alignment on the
containing struct.

This is required for 128-bit atomic operations (CMPXCHG16B on amd64,
CASP on arm64), which require a 16-byte-aligned memory operand. A
struct containing two uint64 fields has natural alignment of 8 bytes,
so it may otherwise be placed at a non-16-byte-aligned offset within a
larger struct, causing faults or incorrect behavior.

No test: align128 is unexported in sync/atomic, and testing it in internal
would create cyclic dependencies with reflect.

For #61236.

Change-Id: Iab0502776141aed309457b462f2fdb60ec0d5245
GitHub-Last-Rev: 8cf379404d04c1fbe2b011975d5932eb9d9225da
GitHub-Pull-Request: golang/go#79991
Reviewed-on: https://go-review.googlesource.com/c/go/+/790320
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2026-07-16 07:44:12 -07:00
Meng Zhuo
61b0b6dd84 runtime: use sigaction syscalls when cgo is enabled on riscv64
This ensures that runtime's signal handlers pass through the TSAN and
MSAN like arm64/loong64 does.

Change-Id: I3f6ef61a96e5f1f4c5b68eb5703e77b2dba7dbe9
Reviewed-on: https://go-review.googlesource.com/c/go/+/796100
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2026-07-16 02:31:20 -07:00
Alex Brainman
339fd9cf0a cmd/internal/script: correct interrupt process implementation
Interrupt process uses cmd.Process.Signal(os.Interrupt).
But that call is not implemented on Windows.
Use cmd.Process.Kill() instead.

This CL also adds small test to test the code.

Updates #77485.

Change-Id: Ie0e2326aa3c4c49a20c71e48caf1409c699c41c2
Reviewed-on: https://go-review.googlesource.com/c/go/+/796480
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Quim Muntal <quimmuntal@gmail.com>
2026-07-15 23:33:52 -07:00
Dmitri Shuralyov
d888e9e419 cmd/go/internal/telemetrystats: drop go/platform/target/{goos,goarch}:*
They provide a subset of the information that the newer port:*-* counter
provides, making them generally redundant. They were never uploaded, and
there are no plans to start using them, so remove them.

For #79214.

Change-Id: I74b0d8b51c2566b04a980c61e67edfb5a6a1d4a3
Reviewed-on: https://go-review.googlesource.com/c/go/+/775982
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-07-15 20:35:58 -07:00
Keith Randall
831c5835d9 cmd/compile: use right shift to compute >= 0 and < 0
Just move the sign bit down to where it is needed for a boolean.

Change-Id: Ib6543273396d64cf150650d242d1869e1fd46f5d
Reviewed-on: https://go-review.googlesource.com/c/go/+/801282
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
2026-07-15 17:53:37 -07:00
Hongxiang Jiang
d31e2b6711 cmd/go/internal/doc: always return cached executable
On a clean GOCACHE, buildPkgsite returned a temporary path deleted
by b.Close() before the command execution.

Instead, this CL always returns the cached executable path even
it is fresh built ensuring the existence of the doc executable.

+test

Fixes golang/go#80287

Change-Id: I949d01dceac817082fa5e38450d0b0b39fc325a3
Reviewed-on: https://go-review.googlesource.com/c/go/+/800720
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
2026-07-15 17:25:41 -07:00
Sean Liao
9f1012d9a1 go/doc/comment: never rewrite into smart quotes
Since Go source code is in UTF-8, smart quotes
should be part of the original source
if they are desired. Characters important to
programming languages should not be mangled.

Fixes #54312
Fixes #76975

Change-Id: I20331669bb691eafe66ebcc3f8513c4f6a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/732420
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: kortschak <dan@kortschak.io>
Reviewed-by: Rob Pike <r@golang.org>
2026-07-15 15:11:42 -07:00
Neitrino Photonov
4bbe2752b3 cmd/go: retry ETXTBSY when running a cached builtin tool
go test -cover runs "go tool covdata", which links covdata, caches the
executable into $GOCACHE (CacheExecutable), and execs it from there via
runBuiltTool. When many packages are tested at once (go test ./...), the
covdata invocations share one build cache. A concurrent go process can
still hold a writable descriptor to the freshly written cached file when
this process execs it, so the exec fails with ETXTBSY ("text file busy"):

	go tool covdata: fork/exec $GOCACHE/<hash>/covdata: text file busy

Every other exec-from-cache path already retries this race: base.RunStdin
and (*runTestActor).Act in cmd/go/internal/test both loop on ETXTBSY with
backoff (see #22220, #22315). runBuiltTool was the one path that did not.

The race became observable in 1.26 after CL 668035 (test barrier actions)
reordered the scheduling of test/coverage run actions; the underlying
missing-retry bug was latent before that.

Wrap toolCmd.Start() in the same bounded retry. Retrying Start() is safe:
once it succeeds the exec has happened (no ETXTBSY is possible after), and
on failure the child never ran, so re-execing has no side effects.

Fixes #78204

Change-Id: I77d0a5804e69d4fb386bbdb4aa9c5f3b179261b6
Reviewed-on: https://go-review.googlesource.com/c/go/+/790840
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Auto-Submit: Michael Pratt <mpratt@google.com>
2026-07-15 15:09:00 -07:00
Simon Li
e7d8668a6a cmd/compile: use a value slice for SSA Func.Names
Func.Names was []*LocalSlot, so every entry was a separately
heap-allocated LocalSlot. Most named values are scalars that are never
decomposed, yet each one still allocated a LocalSlot when it was first
recorded in addNamedValue.

Change Func.Names to []LocalSlot. addNamedValue now appends the slot by
value and no longer eagerly fills CanonicalLocalSlots. The canonical
*LocalSlot used for SplitOf chains and split deduplication is created
lazily by localSlotAddr, so only slots that are actually decomposed pay
for it. The names stay contiguous and the garbage collector has one
fewer pointer per name to scan.

This is a follow-up to CL 790300, the addNamedValue escape fix for
issue #79990. That change stopped the slot escaping; this one removes
the remaining per-name allocation for slots that are never decomposed.

Passes toolstash -cmp; std and cmd build byte-identical.

allocs/op via compilebench -alloc, linux/amd64 (-count 20); all packages
±0%, p<=0.001. "vs parent" is the win over CL 790300, "vs master" folds
in CL 790300 too:

           allocs/op  vs parent  vs master
Template      814.0k     -0.16%     -0.76%
Unicode       573.7k     -0.03%     -0.10%
GoTypes       4.956M     -0.26%     -1.08%
SSA           46.32M     -0.37%     -1.51%
Flate         811.6k     -0.30%     -1.45%
GoParser      785.8k     -0.23%     -0.78%
Reflect       2.293M     -0.41%     -1.11%
Tar           927.5k     -0.34%     -1.02%
XML           1.088M     -0.32%     -0.92%
geomean       1.755M     -0.27%     -0.97%

Updates #79990

Change-Id: Ib277056a47585d7805438955062c2f59bd77d42f
Reviewed-on: https://go-review.googlesource.com/c/go/+/790920
Reviewed-by: Michael Podtserkovskii <michaelpo@meta.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
2026-07-15 15:05:00 -07:00
Julian Soreavis
9b1a726059 text/template, html/template: correct the documentation for IsTrue
The IsTrue comment says a value is 'true' when it is not the zero
value of its type. That contradicts the implementation for structs,
which are always true, and is wrong for a negative floating-point
zero, which is untruthy without being 'the' zero of its type.
Describe the rules the implementation actually applies instead.

The comment is duplicated in html/template; update both copies.

Fixes #28394

Change-Id: Idbbabec39ce46bddbbdd4877ac8cfe2b5d4a08dc
GitHub-Last-Rev: 435105c83ac18f4cb64cd8cbc3cc4e00a91f476f
GitHub-Pull-Request: golang/go#80338
Reviewed-on: https://go-review.googlesource.com/c/go/+/799063
Auto-Submit: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2026-07-15 14:59:43 -07:00
cuishuang
6bb1bf7890 bytes, strings: add example for CutLast
Change-Id: I7eb441028af0f3e579c87f63458029d8125c4046
Reviewed-on: https://go-review.googlesource.com/c/go/+/790102
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Sean Liao <sean@liao.dev>
Reviewed-by: Russ Cox <rsc@golang.org>
2026-07-15 14:54:00 -07:00
cuishuang
dd9e8d9bbd reflect: add example for TypeAssert
Change-Id: I619224cb379d917a2766dfce5ada9f9bf4617d81
Reviewed-on: https://go-review.googlesource.com/c/go/+/800500
Auto-Submit: Sean Liao <sean@liao.dev>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-07-15 14:52:01 -07:00
cuishuang
f28114cca0 bytes: add example for Buffer.Peek
Change-Id: I173f165dea17d21cb344a208bce9b70e6dd6a35a
Reviewed-on: https://go-review.googlesource.com/c/go/+/767160
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Sean Liao <sean@liao.dev>
2026-07-15 14:51:29 -07:00
Tobias Klauser
940c49c26a debug/elf: use bytes.IndexByte in getString
Use bytes.IndexByte insted of open-coding it in getString.

Change-Id: I306074b092c879cc1f20cae2acb236d2e9775b59
Reviewed-on: https://go-review.googlesource.com/c/go/+/789540
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Florian Lehner <lhnr.flrn@gmail.com>
2026-07-15 14:47:56 -07:00
Julian Soreavis
10981ef137 cmd/go: avoid a blank line before ok when discarded output lacks a newline
When a passing test in package list mode writes output that does not end
in a newline, and that output is discarded (the default non-verbose,
non-JSON case), cmd/go printed a spurious blank line before the "ok"
summary line.

The newline-before-"ok" guard tested out, a snapshot of the captured
output taken before buf.Reset() discards it, but wrote the newline into
buf, which Reset had already emptied. Test buf itself, so no newline is
added when the captured output was discarded.

Fixes #79786

Change-Id: Iab32de2d8fa9db85681e2e4f01d7af3f08a0f626
GitHub-Last-Rev: 86aaa23984a33a4057e755467156234d35fb24cd
GitHub-Pull-Request: golang/go#80352
Reviewed-on: https://go-review.googlesource.com/c/go/+/799182
Reviewed-by: Russ Cox <rsc@golang.org>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Sean Liao <sean@liao.dev>
2026-07-15 14:40:26 -07:00
Julian Soreavis
1e28d9f580 encoding/base64, encoding/base32: panic when encoded length overflows int
EncodedLen computes the encoded length with int arithmetic that can
wrap for very large n, returning a negative or wrapped value. Callers
that size an allocation from the result (EncodeToString, AppendEncode)
then panic with no indication of the cause, or allocate an undersized
buffer. CL 510635 and CL 512200 raised the overflow threshold of the
unpadded branches but did not eliminate it, and the padded branches
were unchanged: on 32-bit platforms
base64.StdEncoding.EncodedLen(1610612736) still returns -2147483648.

Make EncodedLen panic when the encoded length does not fit in an int,
document the panic, and document the largest n that is guaranteed not
to panic. DecodedLen needs no change: its result is at most n and
cannot overflow.

Fixes #20235

Change-Id: I963a55062a790017b42f49fc3a9178fc3bb024ef
GitHub-Last-Rev: 2a7abbb35f7f5e3a2b74c379c29464e01e2206f5
GitHub-Pull-Request: golang/go#80373
Reviewed-on: https://go-review.googlesource.com/c/go/+/799800
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2026-07-15 14:30:36 -07:00
Simon Li
d3c517908d cmd/compile: avoid heap-allocating LocalSlot in addNamedValue
addNamedValue takes &loc of a local and stores it in the long-lived
f.Names and f.CanonicalLocalSlots, causing loc to escape on every call.
Allocate only on the first-sighting path, mirroring localSlotAddr.

Passes toolstash -cmp.

compilebench -alloc, allocs/op, linux/amd64 (-count 20):

                         │ /tmp/old.txt │            /tmp/new.txt            │
                         │  allocs/op   │  allocs/op   vs base               │
Template                    820.9k ± 0%   816.2k ± 0%  -0.58% (p=0.000 n=20)
Unicode                     574.2k ± 0%   573.7k ± 0%  -0.07% (p=0.000 n=20)
GoTypes                     5.013M ± 0%   4.971M ± 0%  -0.83% (p=0.000 n=20)
Compiler                    702.2k ± 0%   698.6k ± 0%  -0.51% (p=0.000 n=20)
SSA                         47.02M ± 0%   46.50M ± 0%  -1.12% (p=0.000 n=20)
Flate                       823.9k ± 0%   813.8k ± 0%  -1.23% (p=0.000 n=20)
GoParser                    791.3k ± 0%   788.1k ± 0%  -0.41% (p=0.000 n=20)
Reflect                     2.318M ± 0%   2.302M ± 0%  -0.69% (p=0.000 n=20)
Tar                         937.7k ± 0%   930.1k ± 0%  -0.81% (p=0.000 n=20)
XML                         1.099M ± 0%   1.090M ± 0%  -0.77% (p=0.000 n=20)
LinkCompiler                729.0k ± 0%   729.1k ± 0%       ~ (p=0.101 n=20)
ExternalLinkCompiler        731.6k ± 0%   731.6k ± 0%       ~ (p=0.449 n=20)
LinkWithoutDebugCompiler    143.3k ± 0%   143.3k ± 0%       ~ (p=0.358 n=20)
geomean                     1.187M        1.181M       -0.54%

Fixes #79990

Change-Id: Ia0dfff98d4135912f4b008ea44a6e732f72c0d8a
Reviewed-on: https://go-review.googlesource.com/c/go/+/790300
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Podtserkovskii <michaelpo@meta.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2026-07-15 14:20:34 -07:00
Jake Bailey
86eb9afa8c cmd/compile: optimize abi.Type.TFlag loads
Extend the rttype fold in (*ssa.Func).isFixedLoad / rewriteFixedLoad
to also handle abi.Type.TFlag, so that loads of *(*abi.Type)(p).TFlag
are constant-folded against the static type.

Store the abi.TFlag value as a cached field on types.Type, computed
on first use by (*Type).TFlag with no side effects, so the parallel
SSA backend can invoke it safely. TFlagGCMaskOnDemand is derived
directly from PtrDataSize without calling dgcsym, and the new
hasUncommon predicate covers TFlagUncommon without generating
method wrappers. hasUncommon requires typecheck.CalcMethods to
have run on the receiver base type and asserts a new
(*Type).MethodsComputed bit, set by CalcMethods, to catch missing
preparation.

compilecmp HEAD^ -> HEAD
HEAD^ (920fc8d5f3be): cmd/compile/internal/types: store SIMD flags in Type.flags bitset
HEAD (9053d82f4827): cmd/compile: optimize abi.Type.TFlag loads

    file       before   after    Δ       %
    asm        7220974  7220918  -56     -0.001%
    cgo        6199238  6198918  -320    -0.005%
    compile    35848643 35846357 -2286   -0.006%
    cover      7907279  7895727  -11552  -0.146%
    fix        12695300 12695124 -176    -0.001%
    link       10090470 10088702 -1768   -0.018%
    preprofile 3380078  3379006  -1072   -0.032%
    vet        12295155 12288275 -6880   -0.056%
    total      95637137 95613027 -24110  -0.025%

    cmd/cgo/internal/test
    cmd/cgo/internal/test.test45451 319 -> 255  (-20.06%)

    cmd/compile/internal/base
    cmd/compile/internal/base.registerFlags 3120 -> 3088  (-1.03%)

    cmd/compile/internal/reflectdata
    cmd/compile/internal/reflectdata.dcommontype 2079 -> 1886  (-9.28%)

    cmd/compile/internal/ssa
    cmd/compile/internal/ssa.isFixedLoad 702 -> 712  (+1.42%)
    cmd/compile/internal/ssa.rewriteFixedLoad 2757 -> 2853  (+3.48%)

    cmd/compile/internal/typecheck
    cmd/compile/internal/typecheck.InitUniverse 3916 -> 3965  (+1.25%)

    cmd/compile/internal/types
    inserted cmd/compile/internal/types.(*Type).TFlag
    inserted cmd/compile/internal/types.(*Type).TFlag.deferwrap1
    inserted cmd/compile/internal/types.computeTFlag
    inserted cmd/compile/internal/types.hasUncommon

    cmd/gofmt
    main.init 1100 -> 1068  (-2.91%)
    main.rewriteFile 716 -> 696  (-2.79%)
    main.rewriteFile.func1 538 -> 517  (-3.90%)

    cmd/vendor/github.com/google/pprof/internal/driver
    cmd/vendor/github.com/google/pprof/internal/driver.(*config).fieldPtr 133 -> 113  (-15.04%)

    cmd/vendor/golang.org/x/telemetry/internal/crashmonitor
    cmd/vendor/golang.org/x/telemetry/internal/crashmonitor.sentinel 72 -> 51  (-29.17%)

    cmd/vendor/golang.org/x/tools/go/ast/astutil
    cmd/vendor/golang.org/x/tools/go/ast/astutil.updateBasicLitPos 317 -> 302  (-4.73%)

    cmd/vendor/golang.org/x/tools/internal/refactor/inline
    cmd/vendor/golang.org/x/tools/internal/refactor/inline.clearPositions.func1 525 -> 505  (-3.81%)

    cmd/vendor/golang.org/x/tools/internal/typesinternal
    cmd/vendor/golang.org/x/tools/internal/typesinternal.ErrorCodeStartEnd 631 -> 599  (-5.07%)
    cmd/vendor/golang.org/x/tools/internal/typesinternal.SetUsesCgo 185 -> 165  (-10.81%)

    encoding/asn1
    encoding/asn1.parseField 9101 -> 9037  (-0.70%)

    encoding/gob
    encoding/gob.(*Decoder).recvType 340 -> 325  (-4.41%)
    encoding/gob.(*Encoder).sendActualType 1117 -> 1103  (-1.25%)

    encoding/json/v2
    encoding/json/v2.makeInterfaceArshaler.func1 2840 -> 2760  (-2.82%)
    encoding/json/v2.marshalArrayAny 1463 -> 1431  (-2.19%)
    encoding/json/v2.marshalObjectAny 2490 -> 2416  (-2.97%)
    encoding/json/v2.unmarshalInlinedFallbackNext 2813 -> 2768  (-1.60%)

    encoding/xml
    encoding/xml.(*Decoder).unmarshal 8725 -> 8597  (-1.47%)
    encoding/xml.(*Decoder).unmarshalAttr 1838 -> 1816  (-1.20%)
    encoding/xml.(*printer).marshalSimple 1064 -> 1034  (-2.82%)

    fmt
    fmt.(*pp).fmtBytes 1716 -> 1690  (-1.52%)

    internal/buildcfg
    internal/buildcfg.ParseGOEXPERIMENT 2040 -> 2021  (-0.93%)
    internal/buildcfg.expList 1350 -> 1306  (-3.26%)

    net/http/internal/http2
    net/http/internal/http2.StreamError.As 1208 -> 1112  (-7.95%)

    reflect
    reflect.Value.Seq.func1.1 229 -> 178  (-22.27%)
    reflect.Value.Seq.func2 167 -> 134  (-19.76%)
    reflect.Value.Seq.func3 208 -> 178  (-14.42%)
    reflect.Value.Seq.func4 255 -> 221  (-13.33%)
    reflect.Value.Seq2.func1.1 261 -> 217  (-16.86%)
    reflect.Value.Seq2.func2 335 -> 293  (-12.54%)
    reflect.Value.Seq2.func3 284 -> 245  (-13.73%)
    reflect.Value.Seq2.func4 336 -> 284  (-15.48%)

    runtime
    runtime.stkobjinit 202 -> 165  (-18.32%)

    testing
    testing.(*F).Fuzz.func1.1 856 -> 824  (-3.74%)

    text/template
    text/template.(*state).evalArg 2252 -> 2228  (-1.07%)
    text/template.(*state).evalCall 4188 -> 4156  (-0.76%)
    text/template.(*state).evalCommand 1301 -> 1266  (-2.69%)
    text/template.(*state).evalEmptyInterface 988 -> 955  (-3.34%)
    text/template.(*state).evalField 3211 -> 3115  (-2.99%)
    text/template.(*state).idealConstant 504 -> 445  (-11.71%)
    text/template.(*state).validateType 1655 -> 1640  (-0.91%)
    text/template.(*state).walkRange 3269 -> 3205  (-1.96%)
    text/template.init 459 -> 431  (-6.10%)

Change-Id: I5ffefdc4e09586ab4f154e560b99b2d9cd30c2ea
Reviewed-on: https://go-review.googlesource.com/c/go/+/701299
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
2026-07-15 14:19:16 -07:00
Sean Liao
e75c0ec6b3 crypto: clarify allowed overlap for AEAD
Fixes #75968

Change-Id: I3ce84d01d0db6560ceb042915ec8fa11aa871a34
Reviewed-on: https://go-review.googlesource.com/c/go/+/714620
Auto-Submit: Sean Liao <sean@liao.dev>
Reviewed-by: Eric Grosse <grosse@gmail.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-07-15 14:17:51 -07:00
cuishuang
59468eb957 html/template: test JavaScript escaping of cyclic values
CL 248358 changed encoding/json to detect cyclic maps and slices and return an error, so jsValEscaper no longer risks unbounded recursion for these values.

Add regression tests verifying that cyclic values produce a safely commented error followed by null, and remove the stale TODO.

Change-Id: I83b6171b1d043c43d54890bd40983e2aef01ff4b
Reviewed-on: https://go-review.googlesource.com/c/go/+/796121
Reviewed-by: Neal Patel <neal@golang.org>
Reviewed-by: Neal Patel <nealpatel@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-07-15 14:17:20 -07:00
Bob Put
d060863557 cmd/compile: avoid temporaries for float division call args
mayCall treats division as potentially panicking, forcing it into a temporary before marshaling call arguments. That is necessary for integer division, but ordinary float division does not panic or call unless the target uses soft-float lowering.

Handle float division like the other soft-float-sensitive arithmetic ops so hard-float targets can pass it directly as a call argument.

Fixes #28698.

Change-Id: I6b2377176255aef1ae31be16a578641f75e71f75
Reviewed-on: https://go-review.googlesource.com/c/go/+/782461
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
2026-07-15 14:16:28 -07:00
Cherry Mui
c78af9ddc8 reflect: improve escape analysis for Value.Set
For Value.Set, when assigning to an interface, we use the
receiver's storage as a scratch space for the implicit conversion
to interface, which then assigns back to the receiver. The
compiler does not know 1. this occurs only when assigning to an
interface with an implicit conversion, 2. this is actually a self-
assignment. So it treats the receiver escape. Mark the scratch
space noescape to help the compiler. So now Value.Set does not
leak the receiver.

Change-Id: If904277fa15912653936fd4038173691170e8789
Reviewed-on: https://go-review.googlesource.com/c/go/+/799480
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: David Chase <drchase@google.com>
2026-07-15 14:14:36 -07:00
harjoth
a6351c94fb encoding/xml: reject invalid comment tokens
EncodeToken currently rejects comment contents only when they contain "-->",
which allows other occurrences of "--" and emits invalid XML. It also emits
"--->" when comment content ends in a hyphen.

Reject any "--" in Comment tokens, as required by XML 1.0, and insert a space
before the closing delimiter when comment content ends in a hyphen. This
matches encoding of struct fields tagged ",comment".

Fixes #80155

Change-Id: I9ca9af44af15d58908cd471a9cf7ddd76baae33f
GitHub-Last-Rev: 8e5beca65adca57d47a9d388c976db2e9fd6cc67
GitHub-Pull-Request: golang/go#80395
Reviewed-on: https://go-review.googlesource.com/c/go/+/800361
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2026-07-15 14:12:36 -07:00
kinsonnee
58e8638c80 cmd/compile: require alignment for memcombine on riscv64
On strict-alignment targets, only combine loads and stores when the merged memory access is known to be aligned.

Share pointer-alignment analysis between load and store combining. Keep it conservative by deriving alignment from typed base pointers and constant offsets, and by treating unknown pointer operations as minimally aligned.

Add riscv64 codegen tests covering aligned and unaligned load and store memcombine cases.

Fixes #71778

Change-Id: If6fbd040edb43fc02b7f343085fa20027695c77d
Reviewed-on: https://go-review.googlesource.com/c/go/+/795260
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
2026-07-15 14:11:59 -07:00
David Chase
cff61723f3 reflect: extract potentially embedded reflect types before use
Embedding types can override exported reflect methods,
which can cause problems.

Initially Gemini-authored, extensively revised.

This addresses some of the issues mentioned in comments
on CL 799481.

Fixes #80332.

Change-Id: Icbaf2ba83cf372e611a432d732094bcfe50a2e6c
Reviewed-on: https://go-review.googlesource.com/c/go/+/801180
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: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-07-15 14:11:08 -07:00