67046 Commits

Author SHA1 Message Date
Alan Donovan
d1c1356637 cmd/vet: fix misspelled analyzer name in test
(See CL 804960.)

Change-Id: Ie8ca868fb57283846164cceb4810e8eb9101f7f6
Reviewed-on: https://go-review.googlesource.com/c/go/+/805800
Auto-Submit: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David du Colombier <0intro@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2026-07-26 21:47:10 -07:00
Jakub Ciolek
6e88b3b4b6 cmd/compile: order functions by IR node count
Count nodes during the existing pre-walk traversal and use that
count instead of the number of top-level statements when ordering
functions for compilation.

compilebench Intel Alder Lake 12600k (P cores):

                         │ /home/jake/26jul/costmodel.master │   /home/jake/26jul/costmodel.new    │
                         │              sec/op               │   sec/op     vs base                │
Template                                         87.92m ± 1%   88.16m ± 1%        ~ (p=0.341 n=20)
Unicode                                          61.10m ± 1%   61.17m ± 1%        ~ (p=0.429 n=20)
GoTypes                                          544.1m ± 0%   542.9m ± 1%   -0.23% (p=0.046 n=20)
Compiler                                         83.30m ± 1%   81.97m ± 1%   -1.60% (p=0.000 n=20)
SSA                                               5.170 ± 0%    5.061 ± 0%   -2.11% (p=0.000 n=20)
Flate                                            95.04m ± 0%   94.80m ± 0%        ~ (p=0.192 n=20)
GoParser                                         96.25m ± 0%   84.29m ± 1%  -12.43% (p=0.000 n=20)
Reflect                                          229.2m ± 0%   227.6m ± 1%   -0.69% (p=0.000 n=20)
Tar                                             100.23m ± 1%   99.12m ± 0%   -1.11% (p=0.000 n=20)
XML                                              114.7m ± 1%   113.3m ± 0%   -1.29% (p=0.000 n=20)
LinkCompiler                                     286.8m ± 1%   285.6m ± 1%        ~ (p=0.820 n=20)
ExternalLinkCompiler                             760.9m ± 0%   760.8m ± 0%        ~ (p=0.841 n=20)
LinkWithoutDebugCompiler                         182.8m ± 1%   179.5m ± 1%   -1.83% (p=0.000 n=20)
StdCmd                                            36.82 ± 0%    36.60 ± 0%   -0.61% (p=0.001 n=20)
geomean                                          298.5m        293.6m        -1.63%

                         │ /home/jake/26jul/costmodel.master │   /home/jake/26jul/costmodel.new   │
                         │            user-sec/op            │ user-sec/op  vs base               │
Template                                         225.9m ± 1%   225.2m ± 2%       ~ (p=0.846 n=20)
Unicode                                          67.70m ± 4%   67.59m ± 4%       ~ (p=0.841 n=20)
GoTypes                                           1.791 ± 1%    1.775 ± 1%  -0.87% (p=0.038 n=20)
Compiler                                         164.4m ± 2%   163.8m ± 2%       ~ (p=0.142 n=20)
SSA                                               17.56 ± 1%    17.63 ± 1%       ~ (p=0.989 n=20)
Flate                                            269.2m ± 2%   270.1m ± 1%       ~ (p=0.738 n=20)
GoParser                                         232.4m ± 2%   232.0m ± 2%       ~ (p=0.779 n=20)
Reflect                                          644.1m ± 1%   642.5m ± 0%       ~ (p=0.547 n=20)
Tar                                              267.3m ± 1%   261.6m ± 1%  -2.13% (p=0.000 n=20)
XML                                              313.7m ± 1%   304.0m ± 1%  -3.11% (p=0.000 n=20)
LinkCompiler                                     462.1m ± 1%   468.6m ± 1%  +1.41% (p=0.013 n=20)
ExternalLinkCompiler                             848.9m ± 1%   846.6m ± 1%       ~ (p=0.779 n=20)
LinkWithoutDebugCompiler                         213.1m ± 2%   213.3m ± 2%       ~ (p=0.429 n=20)
geomean                                          438.7m        436.9m       -0.43%

Change-Id: I0389d056d5759117b768881f8ac1697f6cab366a
Reviewed-on: https://go-review.googlesource.com/c/go/+/802361
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
2026-07-26 14:21:14 -07:00
Jorropo
6db72bb92b cmd/compile: remove HI LO mips support from regalloc
This is a plain lie but the alternative would be to
make HI LO incompatible with load store and spilling
but this requires a register allocator for the register allocator,
which would be complex and low ROI.

Change-Id: Idf53dc619bcf40afcdac5142efa7f6f43b63a9df
Reviewed-on: https://go-review.googlesource.com/c/go/+/805460
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>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2026-07-25 06:25:00 -07:00
Jorropo
af4b02c461 cmd/compile: do not home mul/div results in HI/LO
On mips and mips64, multiply/divide results were tuple outputs in the
special HI/LO registers, and regalloc kept live values homed there.
Spilling such a value must route the data through REGTMP (there is no
direct store from HI/LO). When the stack frame is too large for a
16-bit offset, the assembler also materializes the spill slot address
in REGTMP:

	MOVV	LO, R23
	LUI	R23, $1
	DADDU	R23, R23, SP
	SD	R23, off(R23)

clobbering the value and silently storing SP+0x10000 instead.

Instead, make MULV/MULVU/DIVV/DIVVU (mips64) and MULT/MULTU/DIV/DIVU
(mips) produce their results in two general registers, moving out of
HI and LO as part of the op itself.

Since register-register moves do not depend on REGTMP it can't get
the dual use bug.

Fixes #80563

Change-Id: I2a0cb5ec7103ab2b0cbbeb67edd38ff5cb33bf77
Reviewed-on: https://go-review.googlesource.com/c/go/+/805420
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>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
2026-07-25 06:24:58 -07:00
ArsenySamoylov
7b4aab82eb internal/strconv: remove stale comment after CL 714161
Change-Id: If3392a2d4bf5acc6896d39aa8a24d8b3db2b8b88
Reviewed-on: https://go-review.googlesource.com/c/go/+/804880
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-07-24 20:27:52 -07:00
Hana Kim
a961f702a4 cmd/go/internal/doc: update pkgsite version
This picks up the fix for encoding/json package documentation.
(CL 803941)

Fixes golang/go#80556

Change-Id: I3bc17f4d5905a27a4228f2ca2a8816b044fe9a97
Reviewed-on: https://go-review.googlesource.com/c/go/+/804661
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: David Chase <drchase@google.com>
Auto-Submit: Hyang-Ah Hana Kim <hyangah@gmail.com>
2026-07-24 14:36:24 -07:00
Alan Donovan
a3b0982e18 cmd/vet: update TestVet to cover all analyzers in vet.Suite
The intent of this test was a minimal integration test
of each analyzer, but we have added many over the years
without tests. This CL ensures that the tests exhaustively
cover all the analyzers, and adds minimal missing tests.

Many of the existing tests were renamed to match the analyzer
name exactly. The loopclosure test was deleted in accordance
with the TODO.

This CL also uses proper Go string literal parsing in // ERROR
comments instead of the hackish old logic derived from the
Go compiler.

Change-Id: Ie488fbb525d76f02dfea1a43008208db43d438f2
Reviewed-on: https://go-review.googlesource.com/c/go/+/804960
Reviewed-by: Alex Putman <aputman@golang.org>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-07-24 14:26:50 -07:00
Alan Donovan
f0dbb9bd0b cmd: update x/tools to master
go get golang.org/x/tools@master
go mod vendor
go mod tidy
go generate cmd/go/internal/test

Also, fix a handful of uses of Scanner that triggered
a diagnostic from the newly imported vet check.

+ relnotes for new vet checks

Fixes #17747

Change-Id: I06f480ce9a11b23add59f578763bcc76730d5fb1
Reviewed-on: https://go-review.googlesource.com/c/go/+/804522
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
2026-07-24 11:48:31 -07:00
Meng Zhuo
0b02c60612 cmd/asm, cmd/internal/obj: add crypto algorithm suites for riscv64
Adds crypto algorithm suites' intrinsic encoding and testcase:

* Zvkg - Vector GCM/GMAC
* Zvkned - NIST Suite: Vector AES Block Cipher
* Zvknh[ab] - NIST Suite: Vector SHA-2 Secure Hash
* Zvksed - ShangMi Suite: SM4 Block Cipher
* Zvksh - ShangMi Suite: SM3 Secure Hash

Updates #77328

Change-Id: I0d841cce0fd734c28e409d6b6edbcfdc0c7da9d4
Reviewed-on: https://go-review.googlesource.com/c/go/+/664155
Reviewed-by: Julian Zhu <jz531210@gmail.com>
Reviewed-by: Joel Sing <joel@sing.id.au>
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2026-07-23 17:34:56 -07:00
Damien Neil
ca4a27f0b1 net/http: rework HTTP/3 registration to allow using a fake network
This is the net/http half of a paired set of changes which modify
the mechanism by which x/net/http3 integrates with net/http.
The other half of the change is CL 801940. See that CL for a more
in-depth description of the change.

This change drops support for HTTP/3 in ListenAndServeTLS (for now).
Tests use ServeTLS instead.

Change-Id: If6fcea4be6638a4670477c6472e480476a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/803380
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-23 14:42:35 -07:00
Michael Matloob
325f9a9e91 cmd/go/internal/modload: remove state manipulation functions
Remove setState, EnterWorkspace, and Reset from the moudle loader. They're no
longer necessary because we can just create new loaders with jitsu's work
removing the use of global state!

Change-Id: I93146f3692a5d3077a6d8913d7ff501d6a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/801340
Auto-Submit: 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: Michael Matloob <matloob@google.com>
Reviewed-by: Ian Alexander <jitsu@google.com>
2026-07-23 14:32:43 -07:00
Ian Alexander
70b963a5c7 cmd/go/internal/base: small modernizations
Change-Id: Ic107cd924ded4eac13215d1dde9c7db37d6c2ad4
Reviewed-on: https://go-review.googlesource.com/c/go/+/763662
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-23 14:27:09 -07:00
Ian Alexander
f05f3cdd21 cmd/go/internal/modload: remove unused parameters
Change-Id: I39f33fe55efb649e10fbd39c642c2504fca89a52
Reviewed-on: https://go-review.googlesource.com/c/go/+/763661
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-23 14:26:47 -07:00
Ian Alexander
4fb25ce6c5 cmd/go/internal/modload: use tagged switch
Change-Id: Ia594062a785fba2776954c5bf5fbe92358724aec
Reviewed-on: https://go-review.googlesource.com/c/go/+/763660
Reviewed-by: Michael Matloob <matloob@google.com>
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>
2026-07-23 14:26:15 -07:00
Ian Alexander
626cc8d64a cmd/go/internal/modload: omit type in declaration
The type can be inferred from the right hand side of the expression.

Change-Id: Ib10889f4be1db2c48162d643b20765267b618cfa
Reviewed-on: https://go-review.googlesource.com/c/go/+/763621
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-23 14:25:15 -07:00
Damien Neil
479772fe59 net/http: consistent port stripping when setting expected TLS ServerName
New client TLS connections set the tls.Config.ServerName field to verify
the hostname on the peer's certificate.

The name is the peer's address, minus the port.

We used different port stripping implementations when stripping the
port from a request target, and from a proxy. Consistently use
net.SplitHostPort in both paths.

Change-Id: Iaa2b06b3182d231503b0f1247bb232236a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/803340
Reviewed-by: Nicholas Husin <nsh@golang.org>
Reviewed-by: Nicholas Husin <husin@google.com>
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-23 13:55:54 -07:00
Ilya Torbin
80a6dffae3 cmd/cover: use Scanner.End for token end positions
Now that go/scanner has an End method (accepted in #74958), the
range-building code can use it directly instead of estimating a
token's end position from pos+len(lit). The estimate was inaccurate
for raw string literals, whose lit value has carriage returns
stripped; Scanner.End reflects the true source offset.

Updates #74958.

Change-Id: I573bd039585d699cc1aeb325b749c422c874a097
Reviewed-on: https://go-review.googlesource.com/c/go/+/802144
Reviewed-by: Mark Freeman <markfreeman@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
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>
2026-07-23 12:29:55 -07:00
cuishuang
543ead71a8 os/exec: make the Cmd.Start example runnable in the playground
The Cmd.Start example runs sleep for five seconds, which exceeds the
playground execution timeout when the example is run from pkg.go.dev.

Use echo instead. This keeps the example focused on the Start and Wait
workflow while allowing it to complete within the playground timeout.

Fixes #80236

Change-Id: I2fabac10fd0bb7b00af7473b957802b8f3afb644
Reviewed-on: https://go-review.googlesource.com/c/go/+/800120
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: Carlos Amedee <carlos@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2026-07-23 08:21:46 -07:00
Inada Naoki
ef032c2be4 database/sql/driver: fix Rows.Next() comment
CL 89936 introduced restriction that Rows.Close() shouldn't modify dest
in previous Next().
CL 497675 for #60304 removed that restriction. But it didn't remove doc
about the restriction.

Change-Id: Idc0f16462fba4d2013ec069d251b8ebffbc4bdd1
GitHub-Last-Rev: f37493acd7aa3ad7863ad9c29b41290ad557d9cd
GitHub-Pull-Request: golang/go#73632
Reviewed-on: https://go-review.googlesource.com/c/go/+/670895
Auto-Submit: Sean Liao <sean@liao.dev>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2026-07-23 08:06:28 -07:00
carrerasdarren-cell
b590fd1075 cmd/compile: truncate uint64 indices for imm8 jump tables
Variable uint64 arguments lowered through immJumpTable were converted
directly to uintptr. Since the generated table has 256 entries, values
above 255 could dispatch outside the table and corrupt control flow. With
-spectre=ret, the binary-search fallback instead selected case 255,
differing from constant lowering.

Convert uint64 indices to uint8 before either dispatch path, matching
imm8 constant encoding. Extend the ShiftAllRightConcatMod32 tests through
the first out-of-range value.

Tests:

- GOEXPERIMENT=simd ./bin/go test simd/...
- GOEXPERIMENT=simd ./bin/go test -short cmd/compile/...
- GOEXPERIMENT=simd ./bin/go vet cmd/compile/internal/ssagen simd/...
- linux/amd64 PoC, ordinary and -spectre=ret dispatch

Fixes #80522.

Change-Id: I4a663f91c561e8212509b155e10acfc7245a59a1
GitHub-Last-Rev: 18cbbde1817affdce75d96be0a10ec908e0a785a
GitHub-Pull-Request: golang/go#80526
Reviewed-on: https://go-review.googlesource.com/c/go/+/803273
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-07-23 08:01:30 -07:00
cuishuang
cfa7d06396 simd: make function comment match function name
Change-Id: Ia474eb19df92cfdb4122564a87a9837b4ff03348
Reviewed-on: https://go-review.googlesource.com/c/go/+/797120
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2026-07-23 07:56:00 -07:00
Filippo Valsorda
e88582c5e1 crypto/tls: reject known extensions in disallowed handshake messages
Change-Id: I9f3d9f3575359fb4730e0fb278d2d6a16a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/804180
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
2026-07-23 07:48:21 -07:00
Klaus Post
5a957dc766 internal/fuzz: fix race between context deadline and error suppression
When the coordinator's context deadline expires, there is a brief
window where ctx.Err() is set but fuzzCtx (a child context) has not
yet been canceled. If the coordinator's event loop observes <-doneC
during this window, the stop function compares the error against
fuzzCtx.Err() which is still nil, so the deadline error is not
suppressed and leaks out as a spurious test failure.

Fix this by also comparing against ctx.Err() in the suppression check.
ctx.Err() is guaranteed to be set before ctx.Done() is closed because
cancelCtx.cancel stores the error before closing the done channel.

Fixes #75804

Change-Id: I5262227c80b98387471a22e3cb8fe8491057e51e
GitHub-Last-Rev: a99ddf64fe05a99952516050c379673ed278a6f9
GitHub-Pull-Request: golang/go#79199
Reviewed-on: https://go-review.googlesource.com/c/go/+/774140
Auto-Submit: Sean Liao <sean@liao.dev>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-07-23 07:47:46 -07:00
David Chase
bef396c339 cmd/compile: add '-d=ssa/phase/@keyword=value' option
This is intended to simplify tuning and experiments.

Change-Id: I8ec2245b868fe4d508df1bc880c69568c90d8f93
Reviewed-on: https://go-review.googlesource.com/c/go/+/803700
Reviewed-by: Jakub Ciolek <jakub@ciolek.dev>
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>
2026-07-22 18:53:39 -07:00
Sean Liao
9c0ab29165 cmd/go/internal/cfg: test GOAMD64 propagation using impossible value
Unlike what CL 778622 assumed, the default for cmd/go is
whatever was set at the time of make.bash, not amd64.v1.
To test this properly, use a value that's higher than
what will reasonably be set.

Updates #73294
Fixes #80525

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-goamd64v3
Change-Id: Ia8f9b9871ee9886201fa0a129c05a3636a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/804060
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: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2026-07-22 15:01:55 -07:00
Cuong Manh Le
b4e7afa4c6 test: add regression test for go.dev/issue/80520
The issue was fixed unintentionally by CL 767161.

Fixes #80520

Change-Id: I212af69f0d7ccdc8e48f9a17e207de57be85e9e8
Reviewed-on: https://go-review.googlesource.com/c/go/+/804280
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: 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>
2026-07-22 14:36:18 -07:00
Keith Randall
3a171a2aca cmd/compile: fix mergelocals on mips/mips64
Change-Id: Ibc7526823677cf8aa3769e79676b18d3a56dfd01
Reviewed-on: https://go-review.googlesource.com/c/go/+/803274
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: Junyang Shao <shaojunyang@google.com>
2026-07-22 14:36:07 -07:00
Nicholas S. Husin
9145bdabf8 crypto/tls: avoid overflow in parseECHConfigList
When parsing an ECHConfigList, length fields were previously evaluated
as a uint16. This would cause an infinite loop to occur when parsing a
65532 bytes long ECHConfig with a declared outer length header of 0.

Triggering this condition requires a payload of at least 65538 bytes. As
ECHConfigList payloads are typically delivered via protocols that limit
them to 65535 bytes (DNS HTTPS records and TLS extensions), regular
clients are safe from this issue.

Thank you to Nguyễn Hoàng Hải (facebookmark2022@gmail.com) for reporting
this issue.

Fixes #80513

Change-Id: I8c5011d3b375c24794dd38b915bb4dc06a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/804040
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: Nicholas Husin <husin@google.com>
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>
2026-07-22 11:18:40 -07:00
khr@golang.org
5d5c7ff1f0 cmd/compile: fix mergelocals for arm32/s390x/riscv64
LoweredZero on arm32 and s390x also take an end-of-zero-range
address. That input is also an address sink.

Also allow propagation of addresses from input to output of a value,
so that we handle at least simple address arithmetic. This is required
to fix riscv64 because it has no indexed load/store, and thus does
a bunch more explicit address arithmetic than other archs.

Fixes #80484

Change-Id: I126eec1e2cc6c2ab5a39611ccc4d3371dca28292
Reviewed-on: https://go-review.googlesource.com/c/go/+/803660
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: David du Colombier <0intro@gmail.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>
Auto-Submit: Keith Randall <khr@golang.org>
2026-07-22 09:47:51 -07:00
Damien Neil
5f42859303 os: don't symlink on Root.Mkdir("symlink/") on openbsd
POSIX says you follow the symlink, but some platforms don't.
Add OpenBSD to the list of ones that don't.

Fixes #80386

Change-Id: Ifcfed66c934ba1ec74836f883dfba3f86a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/800700
Reviewed-by: Nicholas Husin <nsh@golang.org>
Reviewed-by: Nicholas Husin <husin@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-07-22 08:59:11 -07:00
Michael Matloob
47ee8952f5 cmd/go/internal/work: break out helpers from buildActionID
We're going to use these for the run cgo action once it's cached
separately.

Change-Id: I8c1ae6db015f89739a7f21525abd79e06a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/799900
Reviewed-by: 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 Matloob <matloob@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2026-07-22 07:20:09 -07:00
Ilya Torbin
7e88c37cf0 cmd/go: use countertest.SupportedPlatform in checkCounters
The disabledOnPlatform constant was hand-copied from
x/telemetry/internal/telemetry until a public API became available.
The vendored golang.org/x/telemetry/counter/countertest package now
exports SupportedPlatform, so use it and delete the copy.

This also picks up the mips/mipsle entries, which were added to
DisabledOnPlatform in x/telemetry after the constant was copied here.

For #66205

Change-Id: I9d4b6bb0939f0a32f78583d7a450167489a3d3be
Reviewed-on: https://go-review.googlesource.com/c/go/+/802520
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>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Auto-Submit: Hyang-Ah Hana Kim <hyangah@gmail.com>
2026-07-22 05:41:18 -07:00
Josh Bleecher Snyder
be79f93983 cmd/compile: free doomed registers at loop headers
At the header of a loop that makes an unavoidable call,
values that are unused before that call needn't be in registers.
The call will clobber them anyway,
and the back-edge will do pointless reloads.
Free them. They'll be loaded lazily again when needed.

This shrinks total generated code size for std a bit,
from -0.07% to -0.2% depending on GOARCH.

More interesting, I instrumented the toolchain to
count spills at runtime on amd64.
Using the compiler as a test case, this reduces
spills by 3.1% while building std+cmd.
Using a subset of std tests that have fairly
stable execution paths as a test case, spills drop 2%.

There are a few microbenchmarks that jump noticeably,
such as a 16% sort.StableInt1K speed-up on arm64,
and a few minor regressions,
but most I tried are either neutral or small improvements,
which is about what you'd expect from
an average 2% reduction in spills.

Change-Id: I8fa88a665fb51fdd2c1fd13695c37ed7d50c89d4
Reviewed-on: https://go-review.googlesource.com/c/go/+/802740
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Carlos Amedee <carlos@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@golang.org>
2026-07-21 19:12:41 -07:00
kinsonnee
1e5fadf0a3 test/codegen: add riscv64 checks for conditional subtractions
Add riscv64 asmcheck coverage for the conditional subtraction cases in condmove.go.

Verify that rva20u64 and rva22u64 keep using the existing SNEZ/NEG/AND/OR sequence. Verify that rva23u64 uses CZERONEZ/CZEROEQZ/OR without the older fallback sequence.

Co-authored-by: YuanSheng <yuansheng@isrc.iscas.ac.cn>
Change-Id: I7df5c57e36e57c6309ce0fb0efd2d53bd9e06b76
Reviewed-on: https://go-review.googlesource.com/c/go/+/801360
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
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: Meng Zhuo <mengzhuo1203@gmail.com>
2026-07-21 17:36:45 -07:00
Sean Liao
bf664a5855 cmd/go/internal/cfg: pass arch specific envs as build tags
cmd/compile uses internal/buildcfg directly for reading the
arch specific envs, which only reads from the environment
and not cmd/go's GOENV config file.
Setting the build context build tag allows both build and list
operations to select the right files.

Fixes #73294

Change-Id: Ib1dd4c1d18c49d12de1a6c99d1a15be96a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/778622
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: Carlos Amedee <carlos@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
2026-07-21 16:41:12 -07:00
Ilya Torbin
0327d495b2 cmd/dist: remove unused omitVariant field
No test sets omitVariant to true anymore, so !opts.omitVariant is
always true and the field is dead. Remove it, as its TODO suggests:
having timing information in ResultDB that corresponds directly with
dist test names is too valuable to give up.

Change-Id: I4b8e2d054770f5224dbb8e4c5ea136f058f2d48c
Reviewed-on: https://go-review.googlesource.com/c/go/+/802540
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2026-07-21 16:22:52 -07:00
guoguangwu
c31d826b06 debug: fix comment error
Change-Id: Icfe3063a5390105cf0796046348bcaa9e88bbfde
GitHub-Last-Rev: 4df263e334c7011a0a08b7eb5d1722290302b15f
GitHub-Pull-Request: golang/go#65803
Reviewed-on: https://go-review.googlesource.com/c/go/+/565276
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
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: Ian Lance Taylor <iant@google.com>
Auto-Submit: Carlos Amedee <carlos@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2026-07-21 16:21:31 -07:00
Jake Bailey
c6f3bb5503 cmd/go: use module index for local wildcard search
Local wildcard matching checks whether each matched directory contains a
package. In module mode, answer that from the module index when available
instead of reading each directory again.

For typescript-go, the Windows local-wildcard go list query used by
gopls drops from about 4.3s to about 2.1s.

Change-Id: I7b6d8ee33031da61beec22926f1f8744d048a58e
Reviewed-on: https://go-review.googlesource.com/c/go/+/795741
Reviewed-by: Carlos Amedee <carlos@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>
Reviewed-by: Quim Muntal <quimmuntal@gmail.com>
2026-07-21 15:03:34 -07:00
harjoth
022c548790 cmd/go: emit coverage for selected build dependencies
When -coverpkg excludes the main package, SelectCoverPackages returns
before the existing regonly path can add the main package's coverage
registration hook. Allow unmatched main packages through that gate so
covered dependencies can emit metadata and counters.

Add a script regression for building with coverage limited to an
external dependency, and align the fixture's required module with its
imported package for deterministic cold-cache resolution.

Fixes #80307

Change-Id: I8867cd40069a897a52a89085acbfc743f531aec5
Reviewed-on: https://go-review.googlesource.com/c/go/+/801381
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>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2026-07-21 15:03:00 -07:00
Sean Liao
21efdeed18 cmd/go: print flags in -h / -help
For #63659

Change-Id: I0bb318f6bae169b04d39af2d295be0296a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/802680
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-07-21 14:47:40 -07:00
Zxilly
9d2ed75ac0 runtime: don't emit write barrier for code pointers in itabInit
itabInit filled m.Fun by storing code pointers through an
unsafe.Pointer slice, which makes the compiler emit a write barrier.
On wasm a code PC is a function index shifted left 16 bits, a small
value that can fall inside a live heap span, so the GC mistakes it
for a bad heap pointer and crashes.

Store through a uintptr slice instead so no write barrier is emitted,
and mark itabInit //go:nowritebarrier so the same mistake fails to
compile.

Fixes #80472

Change-Id: If9532c01b66b8c4ceb47c932017569488b6143d5
GitHub-Last-Rev: 6e1374c083518bb9f994092acca4f5ea28b38dfa
GitHub-Pull-Request: golang/go#80487
Reviewed-on: https://go-review.googlesource.com/c/go/+/803460
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Carlos Amedee <carlos@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@golang.org>
2026-07-21 14:32:52 -07:00
dorbmon
d461d8f704 sync: avoid redundant private-slot clear in Pool.Get
Pool.Get currently clears the current P's private slot before checking whether the saved interface is nil. For empty or starved pools, this performs two unnecessary zero stores and a write-barrier check.

On amd64, private and the shared queue header occupy the first 32 bytes of poolLocal. When other Ps inspect shared queues while stealing, the redundant private write can cause cache-line contention.

Check the saved value first and clear private only when it is non-nil. This preserves typed-nil behavior because an interface containing a typed nil compares non-nil. Add BenchmarkPoolGetEmpty to cover the affected miss path.

Median results on linux/amd64:

name                       old time/op  new time/op  delta
PoolGetEmpty/P=1              7.802ns      7.445ns   -4.58%
PoolGetEmpty/P=10             23.06ns      2.587ns  -88.78%
PoolStarvation/P=10            3.696µs      2.987µs  -19.18%
PoolOverflow/P=10              190.6ns      189.2ns   -0.73%

Fixes #80486

Change-Id: I6c1794a27c1d848ed7e983f22ac4bd3f45857084
Reviewed-on: https://go-review.googlesource.com/c/go/+/803161
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Daniel Morsing <daniel.morsing@gmail.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Daniel Morsing <daniel.morsing@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
2026-07-21 14:29:39 -07:00
Jorropo
3d45c38896 cmd/compile: on AMD64 use leave instruction for ABIinternal ASM functions
Change-Id: Ib8f93845bd0857d12cfacfe83ce8f57ea23a4ba1
Reviewed-on: https://go-review.googlesource.com/c/go/+/798100
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: 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-21 14:29:25 -07:00
Jorropo
38b5f91aa5 cmd/compile: on AMD64 use leave instruction for go compiled functions
This is a second try for CL 548317.

When the go compiler compiles a function it saves the frame pointer
on the stack and pushes the stack pointer. Thus it is safe to restore
from the stack.

For assembly function still use the mathematical based
restore as users might use the frame pointer as scratch space.

The results are very good, file size down 0.8%
codesize down 2%.

Files:
  file       before    after     Δ        %
  addr2line  3950752   3919200   -31552   -0.799%
  asm        7228164   7176284   -51880   -0.718%
  buildid    3813377   3782545   -30832   -0.809%
  cgo        6184696   6135728   -48968   -0.792%
  compile    37066595  36734315  -332280  -0.896%
  covdata    4529478   4497638   -31840   -0.703%
  cover      7906781   7840805   -65976   -0.834%
  dist       5329896   5285504   -44392   -0.833%
  distpack   4028506   3996578   -31928   -0.793%
  fix        12706126  12614110  -92016   -0.724%
  link       10097646  10020534  -77112   -0.764%
  nm         3924002   3896858   -27144   -0.692%
  objdump    6570663   6523399   -47264   -0.719%
  pack       3255175   3229463   -25712   -0.790%
  pprof      20273692  20094988  -178704  -0.881%
  preprofile 3373625   3351201   -22424   -0.665%
  test2json  4563667   4524259   -39408   -0.864%
  trace      18675260  18526132  -149128  -0.799%
  vet        12297424  12200576  -96848   -0.788%
  total      175775525 174350117 -1425408 -0.811%

Code: total 45787786 44851997 -935789 -2.044%

Change-Id: Ie20cb5a90b25e5dfe3b2ce2d6e73a6b049bc53a5
Reviewed-on: https://go-review.googlesource.com/c/go/+/801860
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Jorropo <jorropo.pgm@gmail.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: Keith Randall <khr@golang.org>
2026-07-21 14:29:18 -07:00
Egon Elbre
4dfb312b5f cmd/compile/internal/ssa: lower bits.Mul64 to MULXQ on GOAMD64>=v3
Add a MULXQ SSA op (BMI2 unsigned 64x64->128 multiply) and switch
the AMD64 lowering of Mul64uhilo to emit MULXQ when GOAMD64>=v3.
Unlike MULQ, MULXQ takes its first operand implicitly in RDX, places
both halves of the product in any general-purpose registers, and
does not affect the flags. The latter makes it interleavable with
ADCX/ADOX carry chains, which is the prerequisite for the
dual-carry-chain Montgomery multiplication.

The downside is that MULXQ ends up encoding as 5-6 bytes instead
of 3 bytes. However for bits.Mul64 it tends to balance out due
to needing less register shuffling.

On its own the change is modest but measurable on the fiat-based
P-384/P-521 paths in crypto/ecdsa, where bits.Mul64 dominates:

goos: linux
goarch: amd64
pkg: crypto/ecdsa
cpu: AMD Ryzen Threadripper 2950X 16-Core Processor
                    │     old     │                new                │
                    │   sec/op    │   sec/op     vs base              │
Sign/P256-32          53.39µ ± 4%   53.23µ ± 5%       ~ (p=1.000 n=6)
Sign/P384-32          284.3µ ± 3%   284.2µ ± 3%       ~ (p=0.699 n=6)
Sign/P521-32          650.1µ ± 2%   663.1µ ± 2%  +1.99% (p=0.015 n=6)
Verify/P256-32        76.27µ ± 2%   75.07µ ± 4%  -1.57% (p=0.041 n=6)
Verify/P384-32        840.5µ ± 1%   793.1µ ± 2%  -5.64% (p=0.002 n=6)
Verify/P521-32        2.147m ± 1%   2.091m ± 1%  -2.65% (p=0.002 n=6)
GenerateKey/P256-32   16.79µ ± 3%   16.63µ ± 5%       ~ (p=0.589 n=6)
GenerateKey/P384-32   183.1µ ± 3%   171.8µ ± 2%  -6.20% (p=0.002 n=6)
GenerateKey/P521-32   445.7µ ± 2%   432.4µ ± 0%  -2.98% (p=0.002 n=6)
geomean               230.8µ        226.1µ       -2.07%

Change-Id: I40a9753ccc511bf6f55d3ca428a439807906c292
Reviewed-on: https://go-review.googlesource.com/c/go/+/781841
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>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
2026-07-21 14:29:13 -07:00
Jorropo
1b99a8da6c runtime: fix uninitialized 7th argument in mach_vm_region_trampoline
This fixes a bug in mach_vm_region_trampoline.
object_name is the 7th integer argument, so per the SysV AMD64 C ABI
it is passed on the stack rather than in a register,
but the trampoline only loaded it into R10 and never stored it,
handing libc_mach_vm_region an uninitialized argument.

I have no idea if this has negative impacts, but it would cause
corrupted BPs to be loaded which needs to be fixed for the LEAVE
commit comming later in that series.

Fixes #80439

Change-Id: I006f947c47ceda3c7b04e90ebccbee500493ec91
Reviewed-on: https://go-review.googlesource.com/c/go/+/801920
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2026-07-21 14:29:10 -07:00
Michael Matloob
6f82edc12a cmd/go: use separate package caches for separate module loaders
Different module loaders have different package graphs so we can't share
the package cache. This change moves the package cache from being a global
to being a field on the loader. This solves an old todo, but also fixes
a race we were running into when making changes to cmd/go where creating
a new package in swigIntSize would share dependency packages and setPackageFlags
would modify package structs that were being read from.

Change-Id: I7b744dbbd03a14edf4b54e5ea10b4c9d6a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/800520
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Alexander <jitsu@google.com>
Reviewed-by: Michael Matloob <matloob@google.com>
2026-07-21 14:24:38 -07:00
Cherry Mui
3ebc191975 reflect: rework method Value representation
Currently, a method Value (aquired from e.g. Value.Method(i)) is
represented with its receiver and the index of the method, with
a special flag, instead of a regular func Value (as a method value
is a function). When the func value is needed (e.g. with
Value.Interface), it is lazily converted to the func Value
representation. The lazy conversion has a bad escape behavior: it
flows the Value to the a heap-allocated methodValue structure,
which causes the Value to escape. This in turn causes operations
like Value.Interface or Value.Convert escape its receiver to heap,
as they have a code path to handle the lazy conversion of method
Value, even if this code path is not taken.

To avoid the unnecessary escape, this CL changes the method Value
representation to eagerly creating the func Value. This eliminates
the code path with bad escape behavior in operations like
Value.Interface.

The lazy representation does have an advantage: Call on the method
Value is simple, as the method's code expects the receiver as the
first parameter, instead of a closure with the receiver pre-bound.
Keeping the receiver and the method index in the Value allows Call
to find the code pointer and pass the receiver directly. With the
func Value representation, Call has to unmarshal and re-marshal
the arguments in order to shift them by one. To avoid this problem,
we save the receiver and the method index in the closure structure
(i.e. methodValue structure), and set a special flag, so Call on
such a Value can still take the fast path, instead of going
through the closure. Benchmark result shows that Call on such a
Value is as fast as before, but creating the method Value is
slower as it involes an allocation. Creating a method Value and
then doing operations like Interface/Convert/Set is mostly
unchanged, as it just moves a lazy operation earlier.

Change-Id: I70beab0b816c8b0587a1b414e804ec3061c39e43
Reviewed-on: https://go-review.googlesource.com/c/go/+/799760
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2026-07-21 08:21:38 -07:00
Filippo Valsorda
fb60d8cdb2 crypto/mldsa: handle some uninitialized and nil values more gracefully
Fixes #79959
Fixes #80339
Fixes #80344

Change-Id: Id1b7d1a726e138b9b3f4df91c00259586a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/800860
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2026-07-21 04:24:11 -07:00
Nicholas S. Husin
1c3a1bac8b net/http: prioritize lowercase proxy environment variables
This CL vendors in CL 801700, making ProxyFromEnvironment follow the
recently updated behavior of x/net/http/httpproxy.FromEnvironment.

Fixes #79656

Change-Id: Id01c8c4011eb6cc8f51a81231622b7d16a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/803022
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Nicholas Husin <husin@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-07-20 14:58:22 -07:00