Damien Neil [Thu, 14 Aug 2025 17:27:54 +0000 (10:27 -0700)]
runtime: make all synctest bubble violations fatal panics
Unblocking a bubbled goroutine from outside the bubble is an error
and panics. Currently, some of those panics are regular panics
and some are fatal. We use fatal panics in cases where its difficult
to panic without leaving something in an inconsistent state.
Change the regular panics (channel and timer operations) to be fatal.
This makes our behavior more consistent: All bubble violations are
always fatal.
More importantly, it avoids introducing new, recoverable panics.
A motivating example for this change is the context package,
which performs channel operations with a mutex held in the
expectation that those operations can never panic. These operations
can now panic as a result of a bubble violation, potentially
leaving a context.Context in an inconsistent state.
Fixes #74837
Change-Id: Ie6efd916b7f505c0f13dde42de1572992401f15c
Reviewed-on: https://go-review.googlesource.com/c/go/+/696195
Auto-Submit: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com>
Michael Munday [Wed, 8 Sep 2021 13:48:48 +0000 (13:48 +0000)]
cmd/compile: emit classify instructions for infinity tests on riscv64
The 'classify' instruction on RISC-V sets a bit in a mask to indicate
the class a floating point value belongs to (e.g. whether the value is
an infinity, a normal number, a subnormal number and so on). There are
other places this instruction is useful but for now I've just used it
for infinity tests.
The gains are relatively small (~1-2 instructions per IsInf call) but
using FCLASSD does potentially unlock further optimizations. It also
reduces the number of loads from memory and the number of moves
between general purpose and floating point register files.
Joe Tsai [Thu, 24 Jul 2025 22:07:39 +0000 (15:07 -0700)]
encoding/json/v2: cleanup error constructors
There is no need to explicitly pass in the options
since this contained within the Encoder or Decoder struct
ever since https://github.com/go-json-experiment/json/pull/163.
Thus, remove it as an argument and fetch it from the coder.
This only modifies code that is compiled in under goexperiment.jsonv2.
Change-Id: I6c928b864bf7869889d7ee7d5c1d396fbe71296b
Reviewed-on: https://go-review.googlesource.com/c/go/+/695278 Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Joe Tsai [Tue, 12 Aug 2025 08:56:43 +0000 (01:56 -0700)]
encoding/json/v2: fix incorrect marshaling of NaN in float64 any
There is a fast-path optimization for marshaling an any type
that should be semantically identical to when the optimization
is not active (i.e., optimizeCommon is false).
Unfortunately, the optimization accidentally allows NaN,
which this change fixes.
The source of this discrepency is that Encoder.WriteToken(Float(math.NaN()))
emits a JSON string with "NaN", rather than report an error.
The rationale for this behavior is because we needed to decide what to do
with Float(math.NaN()), whether it would return an error, panic, or allow it.
To keep the API simpler (no errors) and less sharp (no panics), we permitted NaN.
The fact that WriteToken allowed it is a logical extension of that decision,
but we could decide to disallow it at least within WriteToken.
As things stand, it is already inconsistent between json/v2 and jsontext, where
json/v2 rejects NaN by default in Marshal, but jsontext allows it in WriteToken.
This only modifies code that is compiled under goexperiment.jsonv2.
Fixes #74797
Change-Id: Ib0708cfbf93c2b059c0a85e4c4544c0604573448
Reviewed-on: https://go-review.googlesource.com/c/go/+/695276 Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Joe Tsai [Tue, 12 Aug 2025 08:45:44 +0000 (01:45 -0700)]
encoding/json/v2: fix wrong type with cyclic marshal error in map[string]any
The type reported in a ErrCycle is the wrong type due to a typo.
This discrepency was detected by setting optimizeCommon to false
and running the tests.
This only modifies code that is compiled in under goexperiment.jsonv2.
Change-Id: I68268f5c719d8b79a67424a35ed0647adf12288c
Reviewed-on: https://go-review.googlesource.com/c/go/+/695277 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Damien Neil <dneil@google.com>
Pull in the latest published version of github.com/google/pprof
as part of the continuous process of keeping Go's dependencies
up to date.
For #36905.
[git-generate]
cd src/cmd
go get github.com/google/pprof@v0.0.0-20250630185457-6e76a2b096b5
go mod tidy
go mod vendor
Change-Id: Icfa35291f629fcffae67238704e59e17ee05e0b5
Reviewed-on: https://go-review.googlesource.com/c/go/+/696015 Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Richard Miller [Thu, 7 Aug 2025 10:15:23 +0000 (11:15 +0100)]
os/exec: fix incorrect expansion of ".." in LookPath on plan9
The correction in CL 685755 is incomplete for plan9, where path
search is performed even on file strings containing "/". By
applying filepath.Clean to the argument of validateLookPath,
we can check for bogus file strings containing ".." where the
later call to filepath.Join would transform a path like
"badfile/dir/.." to "badfile" even where "dir" isn't a directory
or doesn't exist.
For #74466
Fixes #74892
Change-Id: I3f8b73a1de6bc7d8001b1ca8e74b78722408548e
Reviewed-on: https://go-review.googlesource.com/c/go/+/693935 Reviewed-by: David du Colombier <0intro@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Keith Randall [Wed, 13 Aug 2025 21:01:30 +0000 (14:01 -0700)]
cmd/compile: during regalloc, fixedreg values are always available
It is ok to clobber registers that have a copy of a fixedreg value,
as that value is always available in its original location later
if we need it. (See 14 lines below the change.)
This CL will fix the regalloc infinite loop that CL 678620 introduced.
That CL requests that the stack pointer value be materialized in a
non-stack-pointer register, which is atypical. That condition
triggered the infinite loop that this CL fixes. The infinite loop is
the compiler trying to reuse that non-stack-pointer register for
something else, but then refusing to give it up because it thought
that non-stack-pointer register held the last copy of the original SP
value.
Change-Id: Id604d0937fb9d3753ee273bf1917753d3ef2d5d7
Reviewed-on: https://go-review.googlesource.com/c/go/+/696035 Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Felix Geisendörfer [Wed, 2 Jul 2025 19:49:45 +0000 (21:49 +0200)]
internal/trace: fix wrong scope for Event.Range or EvGCSweepActive
Change-Id: I6a6a69643e804c75914e6eedd32463cb825ab69f
Reviewed-on: https://go-review.googlesource.com/c/go/+/694695 Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Xiaolin Zhao [Tue, 12 Aug 2025 11:23:46 +0000 (19:23 +0800)]
cmd/compile: absorb NEGV into branch on loong64
Removes 132 instructions from the go binary on loong64.
Change-Id: Ia02dc305b12f63a64f3f48d120ef852d45cc2a7b
Reviewed-on: https://go-review.googlesource.com/c/go/+/695115 Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: David Chase <drchase@google.com>
Dmitri Shuralyov [Sat, 9 Aug 2025 02:06:27 +0000 (22:06 -0400)]
all: update vendored dependencies [generated]
The tree has opened for Go 1.26 development. This is a time to update
all golang.org/x/... module versions that contribute packages to the
std and cmd modules in the standard library to latest master versions.
For #36905.
[git-generate]
go install golang.org/x/build/cmd/updatestd@latest
go install golang.org/x/tools/cmd/bundle@latest
updatestd -goroot=$(pwd) -branch=master
# Update a cmd/vet test case.
patch <<EOF
--- src/cmd/vet/testdata/assign/assign.go
+++ src/cmd/vet/testdata/assign/assign.go
@@ -18 +18 @@ func (s *ST) SetX(x int, ch chan int) {
- x = x // ERROR "self-assignment of x to x"
+ x = x // ERROR "self-assignment of x"
@@ -20 +20 @@ func (s *ST) SetX(x int, ch chan int) {
- s.x = s.x // ERROR "self-assignment of s.x to s.x"
+ s.x = s.x // ERROR "self-assignment of s.x"
@@ -22 +22 @@ func (s *ST) SetX(x int, ch chan int) {
- s.l[0] = s.l[0] // ERROR "self-assignment of s.l.0. to s.l.0."
+ s.l[0] = s.l[0] // ERROR "self-assignment of s.l.0."
EOF
Change-Id: I3fc77d49fa7b47803d363287910b0e37bedefb60
Reviewed-on: https://go-review.googlesource.com/c/go/+/694536 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Now that there are no Go OpenBSD ports that are using non-libc based
system calls, remove the buildid that was generated to permit
binaries using direct syscalls to execute.
Updates #36435
Change-Id: I7bc70b47b2a3781eafef85b974baee9a1d334e21
Reviewed-on: https://go-review.googlesource.com/c/go/+/694355 Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
Cherry Mui [Tue, 12 Aug 2025 19:51:45 +0000 (15:51 -0400)]
runtime/race: restore previous version of LLVM TSAN on macOS
Apparently CL 692996 made the Darwin race builders to be very
flaky. That CL does two things: 1. uses "ld -r" to strip out the
dynamic symbol table; 2. updates to a newer version of LLVM TSAN.
To narrow it down, this CL undoes the second part, restpring the
previous version of LLVM TSAN, but keeps the "ld -r" part.
For #74978.
Change-Id: I0611d733232b18440f249cd5a0b76f7e1ff99a55
Reviewed-on: https://go-review.googlesource.com/c/go/+/695137 Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Bypass: Cherry Mui <cherryyz@google.com>
Commit-Queue: Cherry Mui <cherryyz@google.com>
Reason for revert: causing regalloc to get into an infinite loop
Change-Id: Ie53c58c6126804af6d6883ea4acdcfb632a172bd
Reviewed-on: https://go-review.googlesource.com/c/go/+/695196
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Felix Geisendörfer [Sun, 6 Jul 2025 15:16:10 +0000 (17:16 +0200)]
internal/trace: clarify which StateTransition events have stacks
Clarify that EvGoDestroy, EvGoSyscallEnd and EvGoSyscallEndBlocked do
not have a stack trace by removing the code that tries to assign an
empty stack.
Change-Id: I6a6a696479ac7f753b3c6f6f48d8b9b67f6e3b95
Reviewed-on: https://go-review.googlesource.com/c/go/+/694621 Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Felix Geisendörfer [Mon, 11 Aug 2025 06:33:05 +0000 (08:33 +0200)]
internal/trace: fix Sync.ClockSnapshot comment
The old comment said "clocks take in close in time" which was probably
due to rewording this a few times.
Replace the comment with the one of the ClockSnapshot type as there
doesn't seem to be a good reason for using a different wording here.
Change-Id: I6a6a69648c8470c2f45f6f8e728f5dc8b121a82b
Reviewed-on: https://go-review.googlesource.com/c/go/+/694620 Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Felix Geisendörfer [Wed, 2 Jul 2025 18:13:01 +0000 (20:13 +0200)]
internal/trace: remove unused StateTransition.id field
Change-Id: I6a6a69647e6d91f9fd937032d95cbaf5d737fd5d
Reviewed-on: https://go-review.googlesource.com/c/go/+/694619
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Felix Geisendörfer [Wed, 2 Jul 2025 06:51:16 +0000 (08:51 +0200)]
internal/trace/tracev2: adjust comment for consistency
Adjust the EvGoStatus comment to use the term M ID in favor of thread ID
in order to be consistent with the documentation for the other events.
Change-Id: Ie9f6d52df6eea809682a33aa2bc9922a57fe03db
Reviewed-on: https://go-review.googlesource.com/c/go/+/694618
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
Felix Geisendörfer [Sun, 22 Jun 2025 13:29:34 +0000 (15:29 +0200)]
internal/trace/tracev2: fix EvSTWBegin comment to include stack ID
Change-Id: I6a6a69644fb9a6e765933384cdb17c63458be69a
Reviewed-on: https://go-review.googlesource.com/c/go/+/694617
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
Change-Id: I6a6a6964c9c1322bfe289394d5d3937d1f7097bb
Reviewed-on: https://go-review.googlesource.com/c/go/+/694616 Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Michael Anthony Knyszek [Wed, 5 Mar 2025 20:12:47 +0000 (20:12 +0000)]
internal/runtime/gc/scan: import scan kernel from gclab [green tea]
This change imports the AVX512 GC scanning kernel from CL 593938 into a
new package, internal/runtime/gc/scan. Credit to Austin Clements for
most of this work. I did some cleanup, added support for more size
classes to the expanders, and added more testing. I also restructured
the code to make it easier and clearer to add new scan kernels for new
architectures.
For #73581.
Change-Id: I76bcbc889fa6cad73ba0084620fae084a5912e6b
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64_avx512,gotip-linux-amd64_avx512-greenteagc
Reviewed-on: https://go-review.googlesource.com/c/go/+/655280
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com> Reviewed-by: Michael Pratt <mpratt@google.com>
Brad Fitzpatrick [Mon, 11 Aug 2025 17:21:50 +0000 (10:21 -0700)]
net/http: fix data race in client
Fixes #73522
Co-authored-by: Damien Neil <dneil@google.com>
Change-Id: I6fb408a0b03bc387f443e17e6f9d0bac32eff31e
Reviewed-on: https://go-review.googlesource.com/c/go/+/694815
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Damien Neil <dneil@google.com> Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: David Chase <drchase@google.com>
Reason for revert: leads to a very expensive prove pass, see #74974
(Maybe not this CL's fault, just tickling some superlinear behavior.)
Change-Id: I75302c04cfc5e1e075aeb80edb73080bfb1efcac
Reviewed-on: https://go-review.googlesource.com/c/go/+/695175 Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Daniel Morsing <daniel.morsing@gmail.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reason for revert: still causing compiler failures on Google test code
Change-Id: I5cd482fd607fd060a523257082d48821b5f965d6
Reviewed-on: https://go-review.googlesource.com/c/go/+/695016 Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reason for revert: still causing compiler failures on Google test code
Change-Id: I2a9b0f9a57fe2b6977238bbfbefb572545210b9f
Reviewed-on: https://go-review.googlesource.com/c/go/+/694995
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Michael Fraenkel [Sun, 30 Apr 2023 15:12:27 +0000 (09:12 -0600)]
net: context aware Dialer.Dial functions
Add context aware dial functions for TCP, UDP, IP and Unix networks.
Fixes #49097
Updates #59897
Change-Id: I7523452e8e463a587a852e0555cec822d8dcb3dd
Reviewed-on: https://go-review.googlesource.com/c/go/+/490975
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Sean Liao <sean@liao.dev>
Dmitri Shuralyov [Sat, 9 Aug 2025 00:20:47 +0000 (20:20 -0400)]
cmd/dist: require Go 1.24.6 as minimum bootstrap toolchain
This is a minimal change to start to require the new minimum bootstrap.
Taking advantage of the newer bootstrap to simplify and improve code is
left to be done in separate CLs.
For #69315.
Change-Id: I4bef752b2adb67e969d585d97e680d26afefc6f4
Reviewed-on: https://go-review.googlesource.com/c/go/+/694535
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Joe Tsai [Thu, 31 Jul 2025 23:21:41 +0000 (16:21 -0700)]
encoding/json: fix Indent trailing whitespace regression in goexperiment.jsonv2
The Indent function preserves trailing whitespace,
while the v1 emulation under v2 implementation accidentally dropped it.
There was prior logic that attempted to preserve it,
but it did not work correctly since it ran in a defer and
accidentally mutated the dst input argument rather than the output argument.
Move the logic to the end and avoid a defer.
Also, add a test to both v1 and v1in2 to codify this behavior.
This only modifies code that is compiled in under goexperiment.jsonv2.
Updates #13520
Fixes #74806
Change-Id: I22b1a8da5185eb969e2a8a111b625d3752cfcbe8
Reviewed-on: https://go-review.googlesource.com/c/go/+/692195 Reviewed-by: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Sean Liao <sean@liao.dev>
Bracken Dawson [Thu, 12 Jun 2025 08:30:28 +0000 (10:30 +0200)]
net/http: add example for CrossOriginProtection
It's not immediately appaerent that a method must
be used to wrap the handler, so add a basic
example to guide users to the right API.
Fixes #74121
Change-Id: I23fc3dff6fff9bf4eb29c099bc77da8c99620671
Reviewed-on: https://go-review.googlesource.com/c/go/+/681256
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Sean Liao <sean@liao.dev>
Auto-Submit: Sean Liao <sean@liao.dev> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Joe Tsai [Thu, 31 Jul 2025 22:01:47 +0000 (15:01 -0700)]
encoding/json/v2: fix UnmarshalDecode regression with EOF
When EOF is encountered within jsontext.Decoder stream without
starting to parse any token, UnmarshalDecode should report EOF,
rather than converting it into ErrUnexpectedEOF.
This fixes a regression introduced by https://go.dev/cl/689919.
This change only affects code compiled under goexperiment.jsonv2.
Fixes #74835
Change-Id: I7e8e57ab11b462c422c538503ed8c6b91ead53bd
Reviewed-on: https://go-review.googlesource.com/c/go/+/692175
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Sean Liao <sean@liao.dev> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Jake Bailey <jacob.b.bailey@gmail.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Joseph Tsai <joetsai@digital-static.net>
thepudds [Sat, 9 Aug 2025 21:25:14 +0000 (17:25 -0400)]
internal/sync: warn about incorrect unsafe usage in HashTrieMap
When the HashTrieMap expand method runs out of bits, it can be because
the user mutated a key after insertion using unsafe or similar
in violation of the HashTrieMap invariants.
Adjust the panic message to help triage and debugging by
more directly suggesting unsafe code might be at fault.
CL 694635 is a follow-up change that attempts to detect and
report illegally mutated keys sooner and more precisely.
Updates #74948
Updates #73427
Change-Id: Ib2bca067f0e212b8765c61183f59ac229513a823
Reviewed-on: https://go-review.googlesource.com/c/go/+/694376 Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Michael Munday [Wed, 6 Aug 2025 21:43:05 +0000 (22:43 +0100)]
cmd/compile: allow InlMark operations to be speculatively executed
Although InlMark takes a memory argument it ultimately becomes a
NOP and therefore is safe to speculatively execute.
Fixes #74915
Change-Id: I64317dd433e300ac28de2bcf201845083ec2ac82
Reviewed-on: https://go-review.googlesource.com/c/go/+/693795
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Ian Lance Taylor [Fri, 8 Aug 2025 21:22:11 +0000 (14:22 -0700)]
internal/sync: rename Store parameter from old to new
It's not an old value, it's a new value.
Change-Id: I135ecd8815fac9c3d34ca35afa2b62e74fa76cb6
Reviewed-on: https://go-review.googlesource.com/c/go/+/694436
Auto-Submit: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
Cuong Manh Le [Thu, 7 Aug 2025 15:57:58 +0000 (22:57 +0700)]
cmd/compile/internal/staticinit: remove deadcode
The staticAssignInlinedCall function contains code for handling
non-Unified IR. As Unified IR is now the sole format for the frontend,
this code is obsolete and can be removed.
Change-Id: Iac93a9b59ec6d639851e1b17ba1f75563d8bcda5
Reviewed-on: https://go-review.googlesource.com/c/go/+/694075
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Keith Randall <khr@google.com>
Roland Shoemaker [Tue, 29 Jul 2025 16:19:51 +0000 (09:19 -0700)]
cmd/go: fix fips doc link
Change-Id: I8f06ebd65ba9961e19274c1e5fec251b18395d1c
Reviewed-on: https://go-review.googlesource.com/c/go/+/691435 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Sean Liao <sean@liao.dev>
Auto-Submit: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
wagner riffel [Sat, 7 Jun 2025 19:28:20 +0000 (16:28 -0300)]
cmd/go: fix get -tool when multiple packages are provided
Fixes #74035
Change-Id: I51865f4f753aade9a8be62ed6f9bc2d298742bf1
Reviewed-on: https://go-review.googlesource.com/c/go/+/679975 Reviewed-by: Ian Alexander <jitsu@google.com> Reviewed-by: Michael Matloob <matloob@google.com> Reviewed-by: Michael Matloob <matloob@golang.org>
Auto-Submit: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Sean Liao <sean@liao.dev>
Audi P. R. Putra [Fri, 15 Sep 2023 18:23:51 +0000 (01:23 +0700)]
crypto/tls: check if quic conn can send session ticket
On SendSessionTicket, returns nil if SessionTicketsDisabled is disabled in config.
Fixes #62032
Change-Id: Id0c89e2e6fb0805bbf108bb0cafdabdfbaf3897f
Reviewed-on: https://go-review.googlesource.com/c/go/+/528755 Reviewed-by: Roland Shoemaker <roland@golang.org> Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Mark Freeman <markfreeman@google.com>
Keith Randall [Thu, 7 Aug 2025 22:30:54 +0000 (15:30 -0700)]
reflect: handle zero-sized fields of directly-stored structures correctly
type W struct {
E struct{}
X *byte
}
type W is a "direct" type. That is, it is a pointer-ish type that can
be stored directly as the second word of an interface.
But if we ask reflect for W's first field, that value must *not* be
direct, as zero-sized things cannot be stored directly.
This was a problem introduced in CL 681937. Before that, types like W
were not eligible for directness.
Fixes #74935
Change-Id: Idefb55c23eaa59153009f863bad611593981e5cb
Reviewed-on: https://go-review.googlesource.com/c/go/+/694195
Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Joel Sing [Wed, 12 Feb 2025 12:41:35 +0000 (23:41 +1100)]
internal/bytealg: vector implementation of compare for riscv64
Provide a vector implementation of compare for riscv64, which is used
when compiled with the rva23u64 profile, or when vector is detected
to be available. Inputs that are 8 byte aligned will still be handled
via a the non-vector code if the length is less than or equal to 128
bytes.
Change-Id: Id3012faf8d353eb1be0e1fb01b78ac43fa4c7e8b
Reviewed-on: https://go-review.googlesource.com/c/go/+/646737 Reviewed-by: Mark Ryan <markdryan@rivosinc.com> Reviewed-by: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
limeidan [Wed, 6 Aug 2025 06:57:39 +0000 (14:57 +0800)]
cmd/internal/obj/loong64: change the immediate range of ALSL{W/WU/V}
When executing the alsl.w/wu/d family of instructions, the actual shift amount is the immediate value
in the instruction encoding plus one. Therefore, this change is made to align the immediate value
in the assembly code with the programmer's intended shift amount, and to include the result of
the immediate value minus one in the final encoding.
Change-Id: Ic82249251878eabde8372e183d841a03f963f9f9
Reviewed-on: https://go-review.googlesource.com/c/go/+/693475 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: abner chenc <chenguoqi@loongson.cn> Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn>
Richard Miller [Thu, 7 Aug 2025 10:58:20 +0000 (11:58 +0100)]
time: skip TestLongAdjustTimers on plan9 (too slow)
The TestLongAdjustTimers test has been consistently timing out
after 60 seconds on plan9-arm. Skip the test for plan9, as it
is already skipped for being too slow on android and ios.
Fixes #74921
Change-Id: Icc32e902cecd2e98971a898373fe8346b179437d
Reviewed-on: https://go-review.googlesource.com/c/go/+/693955 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Mark Freeman <markfreeman@google.com>
Cherry Mui [Tue, 25 Mar 2025 19:21:04 +0000 (15:21 -0400)]
runtime/race: update darwin race syso
On macOS, the script in LLVM TSAN building the race syso files
produces the Mach-O object with a malformed dynamic symbol table,
which new Apple linker doesn't like and emits an annoying warning
(https://github.com/golang/go/issues/61229#issuecomment-1988965927).
The dynamic symbol table isn't really needed, as it is a static
object. Perhaps it should be fixed in TSAN or the C toolchain, but
we can do a simple workaround: pass it through "ld -r", which
produces an equivalent object file with LC_DYSYMTAB removed.
CL 692975 changes racebuild to do this, which produces new syso's
in this CL.
While here, build the syso with a newer version of LLVM TSAN.
Updates #61229.
Change-Id: Ide4b7831eb2cb6877c8ace7b3ec8ff565a9eaf54
Reviewed-on: https://go-review.googlesource.com/c/go/+/692996 Reviewed-by: David Chase <drchase@google.com>
TryBot-Bypass: Cherry Mui <cherryyz@google.com>
Keith Randall [Wed, 6 Aug 2025 16:59:12 +0000 (09:59 -0700)]
cmd/compile: make panicBounds stack frame smaller on ppc64
We're running into nosplit limits when compiled with all=-N -l.
Fixes #74910
Change-Id: I156263ae9b54ded240000001719512af86af70ee
Reviewed-on: https://go-review.googlesource.com/c/go/+/693557 Reviewed-by: Paul Murphy <paumurph@redhat.com>
Auto-Submit: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Keith Randall <khr@google.com>
Cherry Mui [Mon, 4 Aug 2025 14:30:26 +0000 (10:30 -0400)]
debug/macho: support reading imported symbols without LC_DYSYMTAB
Currently, the ImportedSymbols method requires an LC_DYSYMTAB load
command to exist. However, a Mach-O object file may not have an
LC_DYSYMTAB load command, e.g. the one produced by "ld -r".
Support this case by just reading the symbol table and gathers
undefined symbols.
Updates #61229.
Change-Id: I8b4761ac7d99e1f1f378e883e9be75ee4049ffbb
Reviewed-on: https://go-review.googlesource.com/c/go/+/692995
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com>
Cherry Mui [Sat, 2 Aug 2025 22:08:26 +0000 (18:08 -0400)]
cmd/internal/testdir: pass -buildid to link command
The new dynamic loader in macOS 26 beta doesn't like binaries
without LC_UUID. Binaries built by "go build" have LC_UUID by
default. When invoking the linker manually, it has an LC_UUID by
default if a Go buildid is specified. This CL makes it pass
-buildid to link command for the test directory, so the binaries
will have LC_UUID.
Change-Id: I9369aeb7323d211eda80e4f22f459c220085f61d
Reviewed-on: https://go-review.googlesource.com/c/go/+/692876 Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Damien Neil [Wed, 23 Jul 2025 21:26:54 +0000 (14:26 -0700)]
database/sql: avoid closing Rows while scan is in progress
A database/sql/driver.Rows can return database-owned data
from Rows.Next. The driver.Rows documentation doesn't explicitly
document the lifetime guarantees for this data, but a reasonable
expectation is that the caller of Next should only access it
until the next call to Rows.Close or Rows.Next.
Avoid violating that constraint when a query is cancelled while
a call to database/sql.Rows.Scan (note the difference between
the two different Rows types!) is in progress. We previously
took care to avoid closing a driver.Rows while the user has
access to driver-owned memory via a RawData, but we could still
close a driver.Rows while a Scan call was in the process of
reading previously-returned driver-owned data.
Update the fake DB used in database/sql tests to invalidate
returned data to help catch other places we might be
incorrectly retaining it.
Fixes #74831.
Change-Id: Ice45b5fad51b679c38e3e1d21ef39156b56d6037
Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/2540 Reviewed-by: Roland Shoemaker <bracewell@google.com> Reviewed-by: Neal Patel <nealpatel@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/693735
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Overall, we do not see a statistically significant perforance impact. Flate
actually reports a speedup, but with a p-value of 0.043, it's quite close
to the significance threshold (which is fairly lenient). In my opinion,
this is likely due to chance.
Fixes #51603
Change-Id: I7f439730be45e02c7f799df768590ef78e321952
Reviewed-on: https://go-review.googlesource.com/c/go/+/676816 Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Keith Randall [Wed, 6 Aug 2025 16:21:41 +0000 (09:21 -0700)]
cmd/compile: allow more args in StructMake folding rule
imakeOfStructMake does the right thing, but we never call it
when the StructMake has more than one argument.
Fixes #74908
Change-Id: Ib4b1a025bfb1fa69a325207e47b74bd6217092bf
Reviewed-on: https://go-review.googlesource.com/c/go/+/693615
Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Joel Sing [Fri, 7 Feb 2025 14:03:23 +0000 (01:03 +1100)]
internal/bytealg: vector implementation of indexbyte for riscv64
Provide a vector implementation of indexbyte for riscv64, which is used
when compiled with the rva23u64 profile, or when vector is detected
to be available. Inputs that are smaller than 24 bytes will continue
to use the non-vector path.
Change-Id: If7b0dbef38d76fa7a2021e4ecaed668a1d4b9783
Reviewed-on: https://go-review.googlesource.com/c/go/+/648856
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com> Reviewed-by: Mark Freeman <markfreeman@google.com> Reviewed-by: Mark Ryan <markdryan@rivosinc.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Joel Sing [Wed, 12 Feb 2025 12:41:22 +0000 (23:41 +1100)]
internal/bytealg: vector implementation of equal for riscv64
Provide a vector implementation of equal for riscv64, which is used
when compiled with the rva23u64 profile, or when vector is detected
to be available. Inputs that are 8 byte aligned will still be handled
via a the non-vector code if the length is less than or equal to 64
bytes.
Change-Id: I9c5270bcc6997d020a96d1e97c7e7cfc7ca7fd34
Reviewed-on: https://go-review.googlesource.com/c/go/+/646736 Reviewed-by: Mark Ryan <markdryan@rivosinc.com> Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Mark Freeman <markfreeman@google.com>
runtime: save scalar registers off stack in amd64 async preemption
Asynchronous preemption must save all registers that could be in use
by Go code. Currently, it saves all of these to the goroutine stack.
As a result, the stack frame requirements of asynchronous preemption
can be rather high. On amd64, this requires 368 bytes of stack space,
most of which is the XMM registers. Several RISC architectures are
around 0.5 KiB.
As we add support for SIMD instructions, this is going to become a
problem. The AVX-512 register state is 2.5 KiB. This well exceeds the
nosplit limit, and even if it didn't, could constrain when we can
asynchronously preempt goroutines on small stacks.
This CL fixes this by moving pure scalar state stored in non-GP
registers off the stack and into an allocated "extended register
state" object. To reduce space overhead, we only allocate these
objects as needed. While in the theoretical limit, every G could need
this register state, in practice very few do at a time.
However, we can't allocate when we're in the middle of saving the
register state during an asynchronous preemption, so we reserve
scratch space on every P to temporarily store the register state,
which can then be copied out to an allocated state object later by Go
code.
This commit only implements this for amd64, since that's where we're
about to add much more vector state, but it lays the groundwork for
doing this on any architecture that could benefit.
This is a cherry-pick of CL 680898 plus bug fix CL 684836 from the
dev.simd branch.
Change-Id: I123a95e21c11d5c10942d70e27f84d2d99bbf735
Reviewed-on: https://go-review.googlesource.com/c/go/+/669195
Auto-Submit: Austin Clements <austin@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
Austin Clements [Thu, 12 Jun 2025 19:24:22 +0000 (15:24 -0400)]
internal/cpu: add AVX-512-CD and DQ, and derived "basic AVX-512"
This adds detection for the CD and DQ sub-features of x86 AVX-512.
Building on these, we also add a "derived" AVX-512 feature that
bundles together the basic usable subset of subfeatures. Despite the F
in AVX-512-F standing for "foundation", AVX-512-F+BW+DQ+VL together
really form the basic usable subset of AVX-512 functionality. These
have also all been supported together by almost every CPU, and are
guaranteed by GOAMD64=v4, so there's little point in separating them
out.
This is a cherry-pick of CL 680899 from the dev.simd branch.
Change-Id: I34356502bd1853ba2372e48db0b10d55cffe07a1
Reviewed-on: https://go-review.googlesource.com/c/go/+/693396 Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Austin Clements <austin@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Mateusz Poliwczak [Tue, 5 Aug 2025 16:51:09 +0000 (18:51 +0200)]
go/parser: correct comment in expectedErrors
If `here` were already the start of the comment, then
the `pos = here` assignment would be redundant. Since pos
is already the start of the comment.
Change-Id: I793334988951ae5441327cb62d7524b423155b74
Reviewed-on: https://go-review.googlesource.com/c/go/+/693295 Reviewed-by: Alan Donovan <adonovan@google.com>
Commit-Queue: Alan Donovan <adonovan@google.com> Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Change-Id: Icc67b3d4e342f329584433bd1250c56ae8f5a73d
Reviewed-on: https://go-review.googlesource.com/c/go/+/690635 Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Commit-Queue: Alan Donovan <adonovan@google.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Keith Randall [Wed, 18 Jun 2025 23:10:58 +0000 (16:10 -0700)]
cmd/compile: move ppc64 over to new bounds check strategy
Change-Id: I25a9bbc247b2490e7e37ed843386f53a71822146
Reviewed-on: https://go-review.googlesource.com/c/go/+/682498 Reviewed-by: Paul Murphy <paumurph@redhat.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Keith Randall <khr@google.com>
Daniel Morsing [Wed, 4 Jun 2025 08:22:21 +0000 (09:22 +0100)]
cmd/compile/internal/ssa: Use transitive properties for len/cap
Remove the special casing for len/cap and rely on the posets.
After removing the special logic, I ran `go build -gcflags='-d
ssa/prove/debug=2' all` to verify my results. During this, I found 2
common cases where the old implicit unsigned->signed domain conversion
made proving a branch possible that shouldn't be strictly possible and
added these.
The 2 cases are shifting a non-negative signed integer and unsigned
comparisons that happen with arguments that fits entirely inside the
unsigned argument
Change-Id: Ic88049ff69efc5602fc15f5dad02028e704f5483
Reviewed-on: https://go-review.googlesource.com/c/go/+/679155 Reviewed-by: Mark Freeman <mark@golang.org> Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@golang.org>
Derek Parker [Mon, 4 Aug 2025 18:33:05 +0000 (11:33 -0700)]
doc: fix typo in go memory model doc
Fixes a typo where originally "may by" was written where the intent was
"may be".
Change-Id: Ia5ba51a966506395c41b17ca28d59f63bd487f3e
Reviewed-on: https://go-review.googlesource.com/c/go/+/693075 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Bypass: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>