1
0
mirror of https://github.com/golang/go synced 2024-11-17 13:25:15 -07:00
Commit Graph

59083 Commits

Author SHA1 Message Date
Russ Cox
4085a4893c net: move cgo-using darwin test to separate package
It is a goal / requirement that nothing in the standard library
on darwin require cgo, and this test-only file makes net use
cgo on darwin. Move it elsewhere.

Change-Id: I6c11a8391d3913f73ce0098ba63b29adf5864f93
Reviewed-on: https://go-review.googlesource.com/c/go/+/549255
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Russ Cox <rsc@golang.org>
2024-01-23 18:09:52 +00:00
Russ Cox
76b8bec6db cmd/go: add test case for issue 64738
The straight revert in CL 551215 fixed this issue.
Add a test case to make sure we don't reintroduce it.

Test case copied from CL 550237 (by bcmills).

Fixes #64738.

Change-Id: I9654a1fd46fe1a1cc63ee6645a552ec21d720ad0
Reviewed-on: https://go-review.googlesource.com/c/go/+/551255
Reviewed-by: Michael Matloob <matloob@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Bryan Mills <bcmills@google.com>
2024-01-23 18:08:32 +00:00
Bryan C. Mills
1a07550962 net: unskip and attempt to deflake TestAcceptTimeout
This test has been unconditionally skipped for over five years.
It may be that whatever was causing it to flake has been fixed.
And if it hasn't been fixed, it isn't providing any value.
Let's unskip it for the Go 1.23 development cycle and see what happens.

Let's also use a separate listener for each test case, so that a
leaked Dial goroutine from one case won't interfere with the other.

Fixes #17948 (maybe).

Change-Id: I239f22ca5d5a44388b9aa0ed4d81e451c6342617
Reviewed-on: https://go-review.googlesource.com/c/go/+/548940
Commit-Queue: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-01-23 17:46:06 +00:00
qiulaidongfeng
ed18d85ad7 internal/reflectlite: delete TODO pass safe to packEface don't need to copy if safe==true
reflect on the https://go-review.googlesource.com/c/go/+/548436
delete TODO the same.

Change-Id: I5b278cbfcb4108e5ffb332ba82dafb1eaa2bd6b2
GitHub-Last-Rev: cfc3950908
GitHub-Pull-Request: golang/go#64628
Reviewed-on: https://go-review.googlesource.com/c/go/+/548615
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2024-01-23 17:20:01 +00:00
qiulaidongfeng
8c45dddd5d reflect: delete TODO pass safe to packEface don't need to copy if safe==true
valueInterface not copy result in the follow incorrect behavior
w1.  x := ValueOf(&v).Elem()
r1.  iface := Value.Interface()
w2.  x.Set() or x.SetT()

The write operation of W2 will be observed by the read operation of r1,
but the existing behavior is not.

The valueInterface in deepValueEqual can, in theory, pass safe==true to not copy the object,
but there is no benchmark to indicate that the memory allocation has changed,
maybe we don't actually need safe==true here.

Change-Id: I55c423fd50adac8822a7fdbfe67af89ee223eace
GitHub-Last-Rev: 4a63867098
GitHub-Pull-Request: golang/go#64618
Reviewed-on: https://go-review.googlesource.com/c/go/+/548436
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
2024-01-23 17:19:58 +00:00
Bryan C. Mills
f75e1c1460 net: report timeouts more aggressively in Accept in the fake implementation
This ensures that if the listener has already timed out when Accept
is called, Accept always returns an error instead of instantaneously
accepting a connection that was already pending.

For #17948.

Change-Id: Iabef7121590df3dcc2fe428429d7c2bc2bcb6cd5
Reviewed-on: https://go-review.googlesource.com/c/go/+/557438
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-01-23 17:05:09 +00:00
qmuntal
d0dc93c8e1 runtime,internal/poll: move websocket handling out of the runtime on Windows
On Windows, the netpoll is currently coupled with the websocket usage
in the internal/poll package.

This CL moves the websocket handling out of the runtime and puts it into
the internal/poll package, which already contains most of the async I/O
logic for websockets.

This is a good refactor per se, as the Go runtime shouldn't know about
websockets. In addition, it will make it easier (in a future CL) to only
load ws2_32.dll when the Go program actually uses websockets.

Change-Id: Ic820872cf9bdbbf092505ed7f7504edb6687735e
Reviewed-on: https://go-review.googlesource.com/c/go/+/556936
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-01-23 15:36:19 +00:00
Rob Pike
704401ffa0 fmt: don't pad strings with zeros
It's what the documentation says, and oddly it already behaves correctly
for right padding, not left. (We never pad with zeros on the right.)

Just don't do it.

Fixes #56486

Change-Id: I2465edea93c69084e33bee0d945d5a1b85e6cd14
Reviewed-on: https://go-review.googlesource.com/c/go/+/555776
Reviewed-by: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Rob Pike <r@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-01-23 08:29:53 +00:00
qmuntal
adead1a93f cmd/cgo/internal/test: skip TestCallbackCallersSEH when internal linking
TestCallbackCallersSEH is flaky when using the internal linker. Skip
it for now until the flakiness is resolved.

Updates #65116

Change-Id: I7628b07eaff8be00757d5604722f30aede25fce5
Reviewed-on: https://go-review.googlesource.com/c/go/+/556635
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-01-23 06:52:00 +00:00
qiulaidongfeng
7611d2e610 cmd/compile/internal/ssagen,runtime: merge trace consts into internal/abi
For #59670

Change-Id: Iec85ee7312bb566b3f1224424f7d27bf4e408b13
GitHub-Last-Rev: c620abf967
GitHub-Pull-Request: golang/go#64905
Reviewed-on: https://go-review.googlesource.com/c/go/+/553295
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2024-01-23 02:16:01 +00:00
qiulaidongfeng
99e12bee44 reflect: StructOf set abi.TFlagRegularMemory
Complete a TODO.

Change-Id: I791d27266ccee69c371524e298120765f5736cf8
GitHub-Last-Rev: 8878003efa
GitHub-Pull-Request: golang/go#64617
Reviewed-on: https://go-review.googlesource.com/c/go/+/548435
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2024-01-23 00:36:00 +00:00
qiulaidongfeng
4605ce2d34 cmd/compile: use MapMaxKeyBytes,MapMaxElemBytes,MapBucketCount of internal/abi
For #59670

Change-Id: I651e211650e69989c598ab16202105bc6e68d67e
GitHub-Last-Rev: fba087a35f
GitHub-Pull-Request: golang/go#64776
Reviewed-on: https://go-review.googlesource.com/c/go/+/550615
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-01-23 00:14:28 +00:00
Olivier Mengué
9c663e8bf7 hash/crc32: fix codegen to align with manual changes
Update gen_const_ppc64le.go to match the manual changes applied in
CL 478976.

Change-Id: I79a0d014a2a151750f898517b2771b312f3437bc
Reviewed-on: https://go-review.googlesource.com/c/go/+/555996
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
2024-01-23 00:03:20 +00:00
Jorropo
bbd0bc22ea cmd/compile: improve integer comparisons with numeric bounds
This do:
- Fold always false or always true comparisons for ints and uint.
- Reduce < and <= where the true set is only one value to == with such value.

Change-Id: Ie9e3f70efd1845bef62db56543f051a50ad2532e
Reviewed-on: https://go-review.googlesource.com/c/go/+/555135
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-01-23 00:02:36 +00:00
Joel Sing
370f1a88ed crypto/sha512: provide optimised assembly for riscv64
Provide an optimised assembly implementation of sha512 for riscv64.
This results in significant performance gains.

On a StarFive VisionFive 2:

                    │   sha512a   │               sha512b               │
                    │   sec/op    │   sec/op     vs base                │
Hash8Bytes/New-4      7.998µ ± 0%   6.962µ ± 0%  -12.96% (p=0.000 n=10)
Hash8Bytes/Sum384-4   8.113µ ± 0%   6.651µ ± 0%  -18.02% (p=0.000 n=10)
Hash8Bytes/Sum512-4   8.269µ ± 0%   6.748µ ± 0%  -18.39% (p=0.000 n=10)
Hash1K/New-4          57.38µ ± 0%   36.92µ ± 0%  -35.66% (p=0.000 n=10)
Hash1K/Sum384-4       57.47µ ± 0%   36.57µ ± 0%  -36.37% (p=0.000 n=10)
Hash1K/Sum512-4       57.61µ ± 0%   36.75µ ± 0%  -36.21% (p=0.000 n=10)
Hash8K/New-4          402.5µ ± 0%   245.4µ ± 0%  -39.02% (p=0.000 n=10)
Hash8K/Sum384-4       402.5µ ± 0%   245.1µ ± 0%  -39.12% (p=0.000 n=10)
Hash8K/Sum512-4       402.7µ ± 0%   245.3µ ± 0%  -39.09% (p=0.000 n=10)

                    │   sha512a    │                sha512b                │
                    │     B/s      │      B/s       vs base                │
Hash8Bytes/New-4      976.6Ki ± 0%   1123.0Ki ± 0%  +15.00% (p=0.000 n=10)
Hash8Bytes/Sum384-4   966.8Ki ± 0%   1171.9Ki ± 0%  +21.21% (p=0.000 n=10)
Hash8Bytes/Sum512-4   947.3Ki ± 0%   1162.1Ki ± 1%  +22.68% (p=0.000 n=10)
Hash1K/New-4          17.01Mi ± 0%    26.45Mi ± 0%  +55.47% (p=0.000 n=10)
Hash1K/Sum384-4       16.99Mi ± 0%    26.70Mi ± 0%  +57.13% (p=0.000 n=10)
Hash1K/Sum512-4       16.95Mi ± 0%    26.57Mi ± 0%  +56.74% (p=0.000 n=10)
Hash8K/New-4          19.41Mi ± 0%    31.83Mi ± 0%  +63.99% (p=0.000 n=10)
Hash8K/Sum384-4       19.41Mi ± 0%    31.88Mi ± 0%  +64.28% (p=0.000 n=10)
Hash8K/Sum512-4       19.40Mi ± 0%    31.85Mi ± 0%  +64.21% (p=0.000 n=10)

Change-Id: I92629a106b75b0526e9f2a8fe3cc4a6f7fc63c8c
Reviewed-on: https://go-review.googlesource.com/c/go/+/518631
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Joel Sing <joel@sing.id.au>
Reviewed-by: M Zhuo <mzh@golangcn.org>
Reviewed-by: Wang Yaduo <wangyaduo@linux.alibaba.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Mark Ryan <markdryan@rivosinc.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-01-22 23:53:04 +00:00
Michael Pratt
a807295d43 Revert "cmd/preprofile: Add preprocess tool to pre-parse the profile file."
This reverts CL 529738.

Reason for revert: Breaking longtest builders

For #58102.
Fixes #65220.

Change-Id: Id295e3249da9d82f6a9e4fc571760302a1362def
Reviewed-on: https://go-review.googlesource.com/c/go/+/557460
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-01-22 23:07:48 +00:00
Michael Anthony Knyszek
c46966653f runtime: use the correct M ID for syscalling goroutines in traces
Earlier in the development of the new tracer, m.id was used as a the
canonical ID for threads. Later, we switched to m.procid because it
matches the underlying OS resource. However, in that switch, we missed a
spot.

The tracer catches and emits statuses for goroutines that have remained
in either waiting or syscall across a whole generation, and emits a
thread ID for the latter set. The ID being used here, however, was m.id
instead of m.procid, like the rest of the tracer.

This CL also adds a regression test. In order to make the regression
test actually catch the failure, we also have to make the parser a
little less lenient about GoStatus events with GoSyscall: if this isn't
the first generation, then we should've seen the goroutine bound to an
M already when its status is getting emitted for its context. If we emit
the wrong ID, then we'll catch the issue when we emit the right ID when
the goroutine exits the syscall.

Fixes #65196.

Change-Id: I78b64fbea65308de5e1291c478a082a732a8bf9f
Reviewed-on: https://go-review.googlesource.com/c/go/+/557456
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-01-22 21:47:43 +00:00
Jin Lin
b7ae16e04b cmd/preprofile: Add preprocess tool to pre-parse the profile file.
The pgo compilation time is very long if the profile file is large.
We added a preprocess tool to pre-parse profile file in order to
expedite the compile time.

Change-Id: I6f50bbd01f242448e2463607a9b63483c6ca9a12
Reviewed-on: https://go-review.googlesource.com/c/go/+/529738
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-01-22 21:47:07 +00:00
Bryan C. Mills
6e7aee5f6b net: delete TestListenCloseListen
In CL 557177, I attempted to fix a logical race in this test (#65175).
However, I introduced a data race in the process (#65209).

The race was reported on the windows-amd64-race builder. When I tried
to reproduce it on linux/amd64, I added a time.Sleep in the Accept
loop. However, that Sleep causes the test to fail outright with
EADDRINUSE, which suggests that my earlier guess about the open Conn
preventing reuse of the port was, in fact, incorrect.

On some platforms we could instead use SO_REUSEPORT and avoid closing
the first Listener entirely, but that wouldn't be even remotely in the
spirit of the original test.

Since I don't see a way to preserve the test in a way that is not
inherently flaky / racy, I suggest that we just delete it. It was
originally added as a regression test for a bug in the nacl port,
which no longer exists anyway. (Some of that code may live on in the
wasm port, but it doesn't seem worth maintaining a flaky
port-independent test to maintain a regression test for a bug specific
to secondary platforms.)

Fixes #65209.
Updates #65175.

Change-Id: I32f9da779d24f2e133571f0971ec460cebe7820a
Cq-Include-Trybots: luci.golang.try:gotip-windows-amd64-race
Reviewed-on: https://go-review.googlesource.com/c/go/+/557536
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2024-01-22 21:04:44 +00:00
Roland Shoemaker
e5eeadb2d8 net/mail: properly handle special characters in phrase and obs-phrase
Fixes a couple of misalignments with RFC 5322 which introduce
significant diffs between (mostly) conformant parsers.

This change reverts the changes made in CL50911, which allowed certain
special RFC 5322 characters to appear unquoted in the "phrase" syntax.
It is unclear why this change was made in the first place, and created
a divergence from comformant parsers. In particular this resulted in
treating comments in display names incorrectly.

Additionally properly handle trailing malformed comments in the group
syntax.

Fixes #65083

Change-Id: I00dddc044c6ae3381154e43236632604c390f672
Reviewed-on: https://go-review.googlesource.com/c/go/+/555596
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-01-22 20:28:44 +00:00
Austin Clements
5a61d8d36b runtime: simplify freedefer logic
Currently, freedefer's API forces a subtle and fragile situation. It
requires that the caller unlink the _defer from the G list, but
freedefer itself is responsible for zeroing some _defer fields. In the
window between these two steps, we have to prevent stack growth
because stack growth walks the defer list (which no longer contains
the unlinked defer) to adjust pointers, and would thus leave an
unadjusted and potentially invalid pointer behind in the _defer before
freedefer zeroes it.

This setup puts part of this subtle responsibility on the caller and
also means freedefer must be nosplit, which forces other shenanigans
to avoid nosplit overflows.

We can simplify all of this by replacing freedefer with a new popDefer
function that's responsible for both unlinking and zeroing the _defer,
in addition to freeing it.

Some history: prior to regabi, defer records contained their argument
frame, which deferreturn copied to the stack before freeing the defer
record (and subsequently running the defer). Since that argument frame
didn't have a valid stack map until we ran the deferred function, the
non-preemptible window was much larger and more difficult to isolate.
Now we use normal closure calls to capture defer state and call the
defer, so the non-preemptible window is narrowed to just the unlinking
step.

Change-Id: I7cf95ba18e1e2e7d73f616b9ed9fb38f5e725d72
Reviewed-on: https://go-review.googlesource.com/c/go/+/553696
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Austin Clements <austin@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2024-01-22 19:45:52 +00:00
Cherry Mui
3e54329cbe all: update vendored dependencies
The Go 1.23 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.

Generated with:

go install golang.org/x/build/cmd/updatestd@latest
go install golang.org/x/tools/cmd/bundle@latest
updatestd -goroot=$(pwd) -branch=master

For #36905.

Change-Id: I46a68f27a54f1e3f9e1aa5af4de6ee0b26388f3f
Reviewed-on: https://go-review.googlesource.com/c/go/+/557457
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-01-22 19:00:13 +00:00
Jonathan Amsterdam
d29980cdc4 doc/initial: initial contents of release notes
Add files to doc/initial that set up the overall structure
of the release notes document.

For #64169.

Change-Id: Ifbf330e554e1fa20d47c72cc309d5cd26048a323
Reviewed-on: https://go-review.googlesource.com/c/go/+/556817
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2024-01-22 18:07:49 +00:00
Rulin Tang
b16a1e3a03 cmd/compile: fix typo in comment
Change-Id: Ie3f1f194489dd4cfd995bfaf292e1c311b37597b
GitHub-Last-Rev: 6a36329778
GitHub-Pull-Request: golang/go#65008
Reviewed-on: https://go-review.googlesource.com/c/go/+/554136
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Peter Weinberger <pjw@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Bypass: Robert Griesemer <gri@google.com>
2024-01-22 17:32:38 +00:00
Jonathan Amsterdam
b3cfb24f8d doc/README.md: explain new release note system
This is the first CL in a sequence that adds support
for generating release notes from fragments.

The actual generator will live elsewhere, in x/build.
This repo will hold the content and some validity
checks.

For #64169.

Change-Id: Iaa8d9ad96393ab9433170b3cfa47334837f3f691
Reviewed-on: https://go-review.googlesource.com/c/go/+/542515
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-01-22 17:28:52 +00:00
qmuntal
558919b454 runtime: avoid loading winmm.dll on newer Windows versions
winmm.dll is only used for timeBeginPeriod and timeEndPeriod, which are
not needed on Windows versions supporting high resolution timers, that
is Windows 10 version 1803, and later.

Updates #56745.

Change-Id: Ie9576638fb8d2b4e648283bec3170aefa76f9f82
Reviewed-on: https://go-review.googlesource.com/c/go/+/556935
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2024-01-22 17:00:04 +00:00
Wingrez
29cea6583e cmd/compile/internal/ssa: fix typo in sccp
Change-Id: I7f522a4e1b0c50a469ce948249342d6e7cf7777c
GitHub-Last-Rev: f89d7ee576
GitHub-Pull-Request: golang/go#65188
Reviewed-on: https://go-review.googlesource.com/c/go/+/557255
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-01-22 16:54:50 +00:00
Tobias Klauser
4ca1caf407 doc/go1.22: fix method name in net/netip changes
Change-Id: Icbeb911aad8bd23399b5afb66b3babed018368e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/556595
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
2024-01-22 16:54:48 +00:00
Carlos Amedee
846bb47520 doc: remove last TODO item
For #61422

Change-Id: I50e427b78a533c3196aeb5291a34c05528ee0bed
Reviewed-on: https://go-review.googlesource.com/c/go/+/557455
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-01-22 16:50:46 +00:00
Bryan C. Mills
41c05ea4b9 net: attempt to deflake TestListenCloseListen
Also make it flakier in longtest mode by burning through more
ephemeral ports. (Burning through the ports raised the failure rate
for me locally enough to reliably reproduce the failure in #65175 with
-count=10.)

Fixes #65175 (I hope).

Change-Id: I5f5b68b6bf6a6aa92e66f0288078817041656a3e
Reviewed-on: https://go-review.googlesource.com/c/go/+/557177
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-01-22 16:30:46 +00:00
qiulaidongfeng
40fab294de cmd/link,runtime: merge minfunc const info internal/abi
For #59670

Change-Id: If2b05b1ba30b607b518577b0e11ba5a0b07999c5
GitHub-Last-Rev: a664aa18b5
GitHub-Pull-Request: golang/go#64906
Reviewed-on: https://go-review.googlesource.com/c/go/+/553276
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2024-01-22 16:17:48 +00:00
Alexander Yastrebov
a557f9dcd7 net/http/pprof: configure WriteDeadline
Configure write deadline according to requested profiling duration.

Fixes #62358

Change-Id: I2350110ff20a637c7e90bdda57026b0b0d9c87ba
GitHub-Last-Rev: b79ae38def
GitHub-Pull-Request: golang/go#64360
Reviewed-on: https://go-review.googlesource.com/c/go/+/544756
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-01-22 16:17:44 +00:00
Rob Findley
8435659a43 go/types, types2: typeparams.IndexExpr must not be an ast.Expr
The typeparams.IndexExpr wrapper type was added as a compatibility layer
to make the go/types code symmetric with types2. However, this type
incidentally implemented the ast.Expr interface, leading to the
accidental misuse that led to golang/go#63933.

Fix this minimally for now, though leave a TODO that this old
compatibility shim really needs to be eliminated.

Also fix a case in types2 where operand.expr was set to a typed nil.

Fixes golang/go#63933

Change-Id: I180d411e52f795a8322ecce6ed8649e88af1c63b
Reviewed-on: https://go-review.googlesource.com/c/go/+/554395
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-01-22 16:17:05 +00:00
Bryan C. Mills
d3f713bbd1 time: add a regression test for time.AfterFunc goroutine starvation
The test is skipped on wasm platforms for now, because it
successfully detects a starvation bug on those platforms.

For #65178.

Change-Id: I05d28f1c7be99fcab67ec4dfaa38f412e11fd3cb
Reviewed-on: https://go-review.googlesource.com/c/go/+/557038
Auto-Submit: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-01-22 16:16:08 +00:00
Bryan C. Mills
b17bf6dde5 net: remove an unused sync.Map in the fake net implementation
I added this map in CL 526117, but it is apparently unused.
I assume that I removed all uses of it while revising that change.

Updates #59718.
Updates #50216.

Change-Id: I8cdac39f4764d1fcc31566408304c850cf0f9374
Reviewed-on: https://go-review.googlesource.com/c/go/+/557176
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-01-22 16:09:18 +00:00
Bryan C. Mills
f19f31f2e7 net: work around runtime scheduler starvation on js and wasip1
Fixes #65177.
Updates #65178.
Updates #64321.

Change-Id: I698fd3b688c7dfbde692eb7c29cbdafc89e7ca32
Cq-Include-Trybots: luci.golang.try:gotip-js-wasm,gotip-wasip1-wasm_wasmtime,gotip-wasip1-wasm_wazero
Reviewed-on: https://go-review.googlesource.com/c/go/+/557037
Auto-Submit: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-01-19 22:38:49 +00:00
Michael Anthony Knyszek
f5e475edaf runtime: make a much better effort to emit CPU profile in a trace
Currently the new execution tracer's handling of CPU profile samples is
very best-effort. The same CPU profile buffer is used across
generations, leading to a high probability that CPU samples will bleed
across generations. Also, because the CPU profile buffer (not the trace
buffer the samples get written into) isn't guaranteed to be flushed when
we close out a generation, nor when tracing stops. This has led to test
failures, but can more generally just lead to lost samples.

In general, lost samples are considered OK. The CPU profile buffer is
only read from every 100 ms, so if it fills up too much before then, old
samples will get overwritten. The tests already account for this, and in
that sense the CPU profile samples are already best-effort. But with
actual CPU profiles, this is really the only condition under which
samples are dropped.

This CL aims to align CPU profiles better with traces by eliminating
all best-effort parts of the implementation aside from the possibility
of dropped samples from a full buffer.

To achieve this, this CL adds a second CPU profile buffer and has the
SIGPROF handler pick which CPU profile buffer to use based on the
generation, much like every other part of the tracer. The SIGPROF
handler then reads the trace generation, but not before ensuring it
can't change: it grabs its own thread's trace seqlock. It's possible
that a SIGPROF signal lands while this seqlock is already held by the
thread. Luckily this is detectable and the SIGPROF handler can simply
elide the locking if this happens (the tracer will already wait until
all threads exit their seqlock critical section).

Now that there are two CPU profile buffers written to, the read side
needs to change. Instead of calling traceAcquire/traceRelease for every
single CPU sample event, the trace CPU profile reader goroutine holds
this conceptual lock over the entirety of flushing a buffer. This means
it can pick the CPU profile buffer for the current generation to flush.

With all this machinery in place, we're now at a point where all CPU
profile samples get divided into either the previous generation or the
current generation. This is good, since it means that we're able to
emit profile samples into the correct generation, avoiding surprises in
the final trace. All that's missing is to flush the CPU profile buffer
from the previous generation, once the runtime has moved on from that
generation. That is, when the generation counter updates, there may yet
be CPU profile samples sitting in the last generation's buffer. So,
traceCPUFlush now first flushes the CPU profile buffer, followed by any
trace buffers containing CPU profile samples.

The end result of all this is that no sample gets left behind unless it
gets overwritten in the CPU profile buffer in the first place. CPU
profile samples in the trace will now also get attributed to the right
generation, since the SIGPROF handler now participates in the tracer's
synchronization across trace generations.

Fixes #55317.

Change-Id: I47719fad164c544eef0bb12f99c8f3c15358e344
Reviewed-on: https://go-review.googlesource.com/c/go/+/555495
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2024-01-19 22:19:18 +00:00
Michael Anthony Knyszek
7cb98c1da1 cmd/trace/v2: emit user log annotations in all views
This was an oversight in porting over cmd/trace to the new trace format
and API.

Fixes #65153.

Change-Id: I883d302f95956fcc9abb60aa53165acb6d099d67
Reviewed-on: https://go-review.googlesource.com/c/go/+/557175
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2024-01-19 21:39:18 +00:00
Carlos Amedee
1653833811 internal/goversion: update Version to 1.23
(The corresponding update for the last release cycle was CL 510735.)

For #40705
For #64340

Change-Id: I123ce68131a6c7b0344cab54cd29402cabb57225
Reviewed-on: https://go-review.googlesource.com/c/go/+/557155
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-01-19 19:23:40 +00:00
Bryan C. Mills
66d34c7d08 cmd/go/internal/modfetch: set protocol.version=2 for shallow git fetches
This works around an apparent bug in the Git HTTP backend, introduced
in Git 2.21, that causes responses for the version 1 protocol to
provide incomplete tags.

For Git commands older than 2.18, this configuration flag is ignored.
(Note that Git 2.29 and above already use protocol version 2 by
default.)

Fixes #56881.

Change-Id: I9b241cfb604e5f633ca6a5d799df6706246684a7
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/556358
Run-TryBot: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
2024-01-18 19:08:14 +00:00
Robert Griesemer
5f949c4f2f go/types, types2: fix range clause checks for constant range expressions
Add missing checks for the case where the range expression is
a (possibly untyped) constant integer expression.

Add context parameter to assignVar for better error message
where the expression is part of a range clause.

Also, rename s/expr/Expr/ where it denotes an AST expression,
for clarity.

Fixes #65133.
For #65137.

Change-Id: I72962d76741abe79f613e251f7b060e99261d3ae
Reviewed-on: https://go-review.googlesource.com/c/go/+/556398
Run-TryBot: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
2024-01-18 17:25:18 +00:00
Damien Neil
97daa6e942 doc/go1.22: document net/netip changes
For #61422

Change-Id: Ide818366b035eada4ba04b70b4741fb1891585d6
Reviewed-on: https://go-review.googlesource.com/c/go/+/556396
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-01-17 23:14:20 +00:00
Damien Neil
8d04110ce1 doc/go1.22: document net/http/cgi changes
For #61422

Change-Id: If9c3d3ccbfb2061f42ffc26461209c96d38020e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/556395
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
2024-01-17 20:26:04 +00:00
Cuong Manh Le
73eff89d07 runtime: document GODEBUG panicnil values
Updates #25448

Change-Id: Ia1b7a376f5175f67e14ad4bd065d6e8ad5250d38
Reviewed-on: https://go-review.googlesource.com/c/go/+/536955
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Keith Randall <khr@golang.org>
2024-01-17 20:18:41 +00:00
Austin Clements
92d7169a36 runtime: skip test if strace crashes
Very occasionally, at least on linux/386, strace itself will crash in
TestUsingVDSO. Detect these crashes and just skip the test.

Fixes #63734.

Change-Id: I050494459d47dd96c0b8dc0b16353cb532fba93e
Reviewed-on: https://go-review.googlesource.com/c/go/+/556357
Auto-Submit: Austin Clements <austin@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-01-17 19:47:47 +00:00
Michael Pratt
3c1155ee2d runtime: mark TestGdbCoreCrashThreadBacktrace as flaky
This test exercises the SIGQUIT crash loop and managed to trigger the
race from #65138 at least once.

For #65138.
Fixes #64752.

Change-Id: I11091510aa7ae4f58b1d748e53df2e3e3dbfb323
Reviewed-on: https://go-review.googlesource.com/c/go/+/556356
Auto-Submit: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-01-17 19:05:30 +00:00
lxl-renren
f2794207ad cmp: add test case for uinitptr
Change-Id: Iebe79be01eb5208e9b9dea9297c464fe2b2dd3dd
GitHub-Last-Rev: 875ab08627
GitHub-Pull-Request: golang/go#65017
Reviewed-on: https://go-review.googlesource.com/c/go/+/554595
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-01-17 17:58:34 +00:00
Robert Griesemer
8e658eee9c cmd/compile: call types2.Unalias to be ready for GODEBUG=gotypesalias=1
types2.Unalias is not needed if we know we have a core or underlying
type. Also, types of declared functions (signatures) cannot be aliases
(this includes tuples).

Fixes #65125.

Change-Id: I1faa26b66f6c646719e830dd661136fae86f3775
Reviewed-on: https://go-review.googlesource.com/c/go/+/556036
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2024-01-17 03:56:30 +00:00
Dan Peterson
7e7b16c972 doc: fill out net/http.Request.PathValue,SetPathValue section
And add a missing code tag wrap elsewhere.

Updates #61410
Updates #61422

Change-Id: I70a9c4ecaf4056af2e88d777b8db892a45dfcb9f
Reviewed-on: https://go-review.googlesource.com/c/go/+/552195
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Dan Peterson <danp@danp.net>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2024-01-16 22:34:54 +00:00
Olivier Mengué
b44f637823 io/fs: godoc links to testing/fstest
Add godoc links from io/fs to testing/fstest for discoverability.

Change-Id: I6550b4b703d2214faa732987ec8630ac903705b5
Reviewed-on: https://go-review.googlesource.com/c/go/+/534095
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
2024-01-15 21:21:41 +00:00