1
0
mirror of https://github.com/golang/go synced 2024-11-26 04:17:59 -07:00
Commit Graph

59228 Commits

Author SHA1 Message Date
Michael Pratt
09c62a86a9 internal/trace: fix race condition in gc-stress
Multiple goroutines all writing to the same sink triggers the race detector,
rightfully so.

Change-Id: Ia64836d0d88c0f587a6cb96ed747f656a3c1804a
Reviewed-on: https://go-review.googlesource.com/c/go/+/562997
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2024-02-09 20:10:45 +00:00
Michael Pratt
9fa153b729 runtime: don't call traceReadCPU on the system stack
traceReadCPU calls profBuf.read, which does a raceacquire. g0 does not
have a race context, so this crashes when running on the system stack.

We could borrow a race context, but it is simpler to just move
traceReadCPU off of the system stack.

Fixes #65607.

Change-Id: I335155b96d683aebb92b2f4e1eea063dd139f2d5
Reviewed-on: https://go-review.googlesource.com/c/go/+/562996
Auto-Submit: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2024-02-09 20:07:38 +00:00
Michael Pratt
532c6f1c8d cmd/compile: fail noder.LookupFunc gracefully if function generic
PGO uses noder.LookupFunc to look for devirtualization targets in
export data.  LookupFunc does not support type-parameterized
functions, and will currently fail the build when attempting to lookup
a type-parameterized function because objIdx is passed the wrong
number of type arguments.

This doesn't usually come up, as a PGO profile will report a generic
function with a symbol name like Func[.go.shape.foo]. In export data,
this is just Func, so when we do LookupFunc("Func[.go.shape.foo]")
lookup simply fails because the name doesn't exist.

However, if Func is not generic when the profile is collected, but the
source has since changed to make Func generic, then LookupFunc("Func")
will find the object successfully, only to fail the build because we
failed to provide type arguments.

Handle this with a objIdxMayFail, which allows graceful failure if the
object requires type arguments.

Bumping the language version to 1.21 in pgo_devirtualize_test.go is
required for type inference of the uses of mult.MultFn in
cmd/compile/internal/test/testdata/pgo/devirtualize/devirt_test.go.

Fixes #65615.

Change-Id: I84d9344840b851182f5321b8f7a29a591221b29f
Reviewed-on: https://go-review.googlesource.com/c/go/+/562737
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-02-09 20:03:18 +00:00
Michael Anthony Knyszek
d94ab597af cmd/cgo/internal/testsanitizers: disable location checking for clang
Pending a resolution to #65606, this CL marks clang's ASAN runtime as
unable to symbolize stack traces to unblock the LUCI clang builder.

For #65606.
Fixes #65469.

Change-Id: I649773085aff30e5703e7f7ac2c72a0430a015c2
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-clang15
Reviewed-on: https://go-review.googlesource.com/c/go/+/562675
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-02-09 20:00:56 +00:00
Matthew Dempsky
b158ca9ae3 cmd/compile: separate inline cost analysis from applying inlining
This CL separates the pass that computes inlinability from the pass
that performs inlinability. In particular, the latter can now happen
in any flat order, rather than bottom-up order. This also allows
inlining of calls exposed by devirtualization.

Change-Id: I389c0665fdc8288a6e25129a6744bfb1ace1eff7
Reviewed-on: https://go-review.googlesource.com/c/go/+/562319
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2024-02-09 17:21:38 +00:00
Nick Ripley
a51713103b cmd/trace/v2,internal/trace: use correct frame for identifying goroutines
To determine the identity of a goroutine for displaying in the trace UI,
we should use the root frame from a call stack. This will be the
starting function for the goroutine and is the same for each call stack
from a given goroutine. The new tracer no longer includes starting PCs
for goroutines which existed at the start of tracing, so we can't use a
PC for grouping together goroutines any more. Instead, we just use the
name of the entry function for grouping.

Fixes #65574

Change-Id: I5324653316f1acf0ab90c30680f181060ea45dd7
Reviewed-on: https://go-review.googlesource.com/c/go/+/562455
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>
2024-02-09 16:30:09 +00:00
Joe Tsai
2057ad02bd context: improve valueCtx.String
Check for stringer on the key itself.
This is useful for locally defined context key types,
where there may be multiple instances of that type.
For example, see http.contextKey,
which can now be called after this change.

For the value itself, print the type at least
instead of just resorting to "<not stringer>".

Change-Id: I588ef1df34e90fb9ebd83cb180fea495e1fedaa8
Reviewed-on: https://go-review.googlesource.com/c/go/+/555697
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Joseph Tsai <joetsai@digital-static.net>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Joseph Tsai <joetsai@digital-static.net>
TryBot-Result: Gopher Robot <gobot@golang.org>
2024-02-09 00:58:17 +00:00
Jorropo
dba518999d time: fix FuzzFormatRFC3339 nano comparison
Change-Id: I13ed84b99459d5844abb6e932cc4b8e0bd3ae9f5
Reviewed-on: https://go-review.googlesource.com/c/go/+/561215
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: David Chase <drchase@google.com>
2024-02-08 23:28:17 +00:00
Tobias Klauser
7c4ee1b165 sort: use math/rand/v2 in tests and benchmarks
This allows to drop the use of deprecated rand.Seed in benchmarks.

Fixes #61142

Change-Id: I628848c0d4a500dc9a361930c393e47c3361a95c
Reviewed-on: https://go-review.googlesource.com/c/go/+/551155
Reviewed-by: Eli Bendersky <eliben@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-02-08 22:59:40 +00:00
Alan Donovan
643d816c8b runtime: traceback: include pc=0x%x for inline frames
Crash monitoring tools may parse the PC values and feed them
to CallersFrames, which does not run the inline unwinder, since
Callers already did so. So, the GOTRACEBACK=system output
must also include PC values even for inlined frames.
(The actual values are just marker NOP instructions,
but that isn't important.)

This CL also includes a test that the PC values can be
parsed out of the crash report and fed to CallersFrames
to yield a sensible result. (The logic is a distillation
of the x/telemetry crashmonitor.)

The previously printed PCs were in fact slightly wrong
for frames containing inlined calls: instead of the
virtual CALL instruction (a NOP) to the first
inlined call, it would display the PC of the
CALL in the innermost inlined function.

Change-Id: I64a06771fc191ba16c1383b8139b714f4f299703
Reviewed-on: https://go-review.googlesource.com/c/go/+/561635
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-02-08 21:44:52 +00:00
Matthew Dempsky
08370dcd9a cmd/compile: accept -lang=go1 as -lang=go1.0
Fixes #65528.

Change-Id: I55fef8cf7be4654c7242462d45f12999e0c91c02
Reviewed-on: https://go-review.googlesource.com/c/go/+/562322
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
2024-02-08 21:36:02 +00:00
Michael Matloob
58fea5dfaf cmd/go: add telemetry counters for flag names and subcommand
For #58894,#65586

This is a revert of CL 560655 which was a revert of CL 559519.
CL 559519 was reverted because it was broken on windows/386. But now
CL 562715 pulls in x/telemetry CL 560462 which disables telemetry on
windows/386, fixing that issue.

Change-Id: I094e90c28bca02f2303807d3b008f2ef9d59433c
Reviewed-on: https://go-review.googlesource.com/c/go/+/562735
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-02-08 20:48:23 +00:00
Michael Matloob
c2de2912cb cmd: update golang.org/x/telemetry and its dependencies
This change was produced with
	go get golang.org/x/telemetry@latest
	go mod tidy
	go mod vendor

For golang/go#65586,golang/go#58894

Change-Id: I631a424ebb726fb0999d4b5d1e6e7a288b475344
Cq-Include-Trybots: luci.golang.try:gotip-windows-386,gotip-windows-amd64-longtest,gotip-solaris-amd64,gotip-openbsd-amd64,gotip-wasip1-wasm_wazero,gotip-js-wasm
Reviewed-on: https://go-review.googlesource.com/c/go/+/562715
TryBot-Bypass: Michael Matloob <matloob@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Michael Matloob <matloob@golang.org>
Commit-Queue: Michael Matloob <matloob@golang.org>
2024-02-08 20:43:36 +00:00
Michael Matloob
3707d60606 all: update golang.org/x/sys and vendor it
Commands run (in both src and src/cmd):
	go get golang.org/x/sys@latest
	go mod tidy
	go mod vendor

Change-Id: Ia041258c71ffb93428257b547411d359c62d9b70
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/562736
Reviewed-by: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-02-08 20:35:26 +00:00
Jes Cok
414161ebfa encoding/xml: rewrite func procInst
This CL tries to make function procInst more exact,
also adds test cases, however, including tricky ones.

Change-Id: If421299fc84d136e56a25dba7a4919c4424702c8
GitHub-Last-Rev: b9a3192718
GitHub-Pull-Request: golang/go#64336
Reviewed-on: https://go-review.googlesource.com/c/go/+/544475
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-02-08 20:33:51 +00:00
Robert Griesemer
a56834922f go/types, types2: factor out hasDots to check for ... arguments in calls (cleanup)
This further reduces the differences between go/types and types2.

Change-Id: Ie651c13dd12ecf043b8be92655d48d1ce32d4c5d
Reviewed-on: https://go-review.googlesource.com/c/go/+/562777
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
2024-02-08 19:31:44 +00:00
Robert Griesemer
7731fd9cd3 go/types, types2: consistently use ast/syntax.Unparen (cleanup)
This further reduces the differences between go/types and types2.

Change-Id: I5ed0f621e1d64cd65b6a3e8eaca9926a1ccb5794
Reviewed-on: https://go-review.googlesource.com/c/go/+/562776
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
2024-02-08 19:30:23 +00:00
Michael Matloob
4e91c5697a internal/goroot: in IsStandardPackage check for go source files
Be more strict in IsStandardPackage: before this change we'd just
check for the existence of the directory, but now we check to see that
there's at least one .go file in the directory.

Also update some comments in the modindex package to reflect the fact
that an IndexPackage might represent a directory that does not contain
any source files.

Fixes #65406
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest

Change-Id: I82f0c0e7bfcd5bb4df0195c4c8c7fc7c67fae53e
Reviewed-on: https://go-review.googlesource.com/c/go/+/561338
Reviewed-by: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-02-08 18:16:28 +00:00
qiulaidongfeng
151362cf7c internal/pprof: remove unused code
Change-Id: I47e98122668960321124e426b345d36f6916b738
GitHub-Last-Rev: b72c9ab33e
GitHub-Pull-Request: golang/go#65594
Reviewed-on: https://go-review.googlesource.com/c/go/+/562324
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-02-08 17:57:40 +00:00
Sam Thanawalla
4aaa550ff5 cmd: vendor version error message changes from x/mod
For golang/go#61888

Change-Id: I254fe559f25ac643e842a935954d18744ae87b0b
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/560855
Reviewed-by: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2024-02-08 17:50:49 +00:00
Robert Griesemer
210f051d6b go/types, types2: document deterministic method index order and add test
Fixes #61298.

Change-Id: Ie2f930752867710884ace3990447866e785ebf1c
Reviewed-on: https://go-review.googlesource.com/c/go/+/562347
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
2024-02-08 17:31:55 +00:00
Meng Zhuo
1400b26852 test/codegen: add float max/min codegen test
As CL 514596 and CL 514775 adds hardware implement of float
max/min, we should add codegen test for these two CL.

Change-Id: I347331032fe9f67a2e6fdb5d3cfe20203296b81c
Reviewed-on: https://go-review.googlesource.com/c/go/+/561295
Reviewed-by: Joel Sing <joel@sing.id.au>
TryBot-Result: Gopher Robot <gobot@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: M Zhuo <mengzhuo1203@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
2024-02-08 03:02:00 +00:00
Keith Randall
109c7bbf8f cmd/link: use symbolic offset for ITab.Type
Change-Id: If04c24d5209cd241e300ce714efdd0e0dde61af2
Reviewed-on: https://go-review.googlesource.com/c/go/+/549456
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-02-08 03:01:24 +00:00
Keith Randall
977803e796 cmd/compile: generate itabs using rttype mechanism
Change-Id: I9a85704c57e978c8c6303b21da3e4627d3446f3e
Reviewed-on: https://go-review.googlesource.com/c/go/+/549455
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
2024-02-08 03:01:15 +00:00
Keith Randall
e0ee5b1afa cmd/compile: move runtime.itab to internal/abi.ITab
Change-Id: I44293452764dc4bc4de8d386153c6402a9cbe409
Reviewed-on: https://go-review.googlesource.com/c/go/+/549435
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2024-02-08 01:38:11 +00:00
Ian Lance Taylor
cde38c966d slices: document that BinarySearch[Func] return earliest position
Fixes #65446

Change-Id: I08dc512fb1f0101eb8aac8767cdf582360699559
Reviewed-on: https://go-review.googlesource.com/c/go/+/562345
Reviewed-by: Eli Bendersky <eliben@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-02-07 23:54:41 +00:00
Ian Lance Taylor
23ac1599ab net: don't return errno from _C_res_nsearch
We ignore the value anyhow.

Change-Id: I1b1db7831c42bf852652236212812fd5cf258530
Reviewed-on: https://go-review.googlesource.com/c/go/+/457439
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-02-07 23:50:56 +00:00
Dominik Honnef
d3d390984b internal/trace/v2: store stacks as PCs, not frames
Most stacks share some frames, especially prefixes, and deduplicating
them can save significant amounts of memory.

This will be especially true when we convert traces from the old to the
new format. Here, all stacks exist in a single generation and will be
live together.

For busy traces, such as one of running Staticcheck on std, with CPU
profiling enabled, this change saves ~400 MiB of memory.

Change-Id: Ie676f628dd2715e1c6077747dd4e08acf3331e5e
Reviewed-on: https://go-review.googlesource.com/c/go/+/557355
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-02-07 23:35:44 +00:00
Paul E. Murphy
adbf71eb98 cmd/internal/obj/ppc64: combine C_SBRA and C_LBRA optab classes
The assembler treats C_SBRA and C_LBRA optab classes identically,
combine them into one class to reduce the number of optab classes.

Likewise, C_LBRAPIC is renamed to C_BRAPIC for consistency with
the above change.

Change-Id: I47000e7273cb8f89a4d0621d71433ccbfb7afb70
Reviewed-on: https://go-review.googlesource.com/c/go/+/557916
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: David Chase <drchase@google.com>
2024-02-07 21:50:42 +00:00
Nasfame
1ffc110469 doc/next: add release note for sync/Map.Clear
Fix https://go-review.git.corp.google.com/c/go/+/561456

For #61696

Change-Id: I573bd14cf0e5c41adcc8c2b9481e85c5792c2a82
GitHub-Last-Rev: c6fce6d25f
GitHub-Pull-Request: golang/go#65534
Reviewed-on: https://go-review.googlesource.com/c/go/+/561755
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2024-02-07 21:04:18 +00:00
qmuntal
c098400548 runtime,internal/syscall/windows: remove long path support check
The runtime currently enables long path support process-wide by updating
the process environment block (PEB). It then tries to create a file
using a long path to check if the PEB update made any difference.

There hasn't been any report that the PEB update was not effective,
and the check itself is quite tricky, so it's time to remove it.

While here, linkname `runtime.canUseLongPaths` to a variable in
internal/syscall/windows instead of the os package so it is easier to
consume from other packages.

Change-Id: I549380b7f2c242dc4db20d5be603840282de69b9
Reviewed-on: https://go-review.googlesource.com/c/go/+/536495
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: David Chase <drchase@google.com>
2024-02-07 20:54:38 +00:00
qmuntal
28b8851671 os: support Stat and LStat for CON device on Windows
\\.\con and CON need to be opened with GENERIC_READ access, else
CreateFile will fail with ERROR_INVALID_PARAMETER.

Special-case ERROR_INVALID_PARAMETER in os.[L]Stat so it retries with
GENERIC_READ access.

Fixes #34900.

Change-Id: I5010e736d0189c8ada4fc0eca98d71a438c41426
Reviewed-on: https://go-review.googlesource.com/c/go/+/560755
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: David Chase <drchase@google.com>
2024-02-07 20:53:05 +00:00
Andy Pan
e55bf08d98 net: support benchmark testing for sendfile on various platforms
When I introduced the benchmark test code for sendfile(2) in CL 425878,
I only did it on Linux while the sendfile system call is also available
on other Unix-like and Windows platforms, this CL will pick up where I left out.

goos: darwin
goarch: arm64
pkg: net
BenchmarkSendFile/file-to-tcp/1024-10    	 2240488	       749.5 ns/op	1366.30 MB/s	       0 B/op	       0 allocs/op
BenchmarkSendFile/file-to-tcp/2048-10    	 1956669	       850.4 ns/op	2408.38 MB/s	       0 B/op	       0 allocs/op
BenchmarkSendFile/file-to-tcp/4096-10    	  840103	      1593 ns/op	2571.30 MB/s	       0 B/op	       0 allocs/op
BenchmarkSendFile/file-to-tcp/8192-10    	  449536	      2881 ns/op	2843.35 MB/s	       0 B/op	       0 allocs/op
BenchmarkSendFile/file-to-tcp/16384-10   	  269974	      6307 ns/op	2597.86 MB/s	       0 B/op	       0 allocs/op
BenchmarkSendFile/file-to-tcp/32768-10   	  137210	     12646 ns/op	2591.09 MB/s	       0 B/op	       0 allocs/op
BenchmarkSendFile/file-to-tcp/65536-10   	   66642	     24557 ns/op	2668.74 MB/s	       0 B/op	       0 allocs/op
BenchmarkSendFile/file-to-tcp/131072-10  	   37852	     59550 ns/op	2201.03 MB/s	       0 B/op	       0 allocs/op
BenchmarkSendFile/file-to-tcp/262144-10  	   16288	    107859 ns/op	2430.44 MB/s	       2 B/op	       0 allocs/op
BenchmarkSendFile/file-to-tcp/524288-10  	   10540	    249957 ns/op	2097.52 MB/s	       3 B/op	       0 allocs/op
BenchmarkSendFile/file-to-tcp/1048576-10 	    4982	    419750 ns/op	2498.09 MB/s	       6 B/op	       0 allocs/op
BenchmarkSendFile/file-to-unix/1024-10   	 1180185	      1187 ns/op	 862.66 MB/s	       0 B/op	       0 allocs/op
BenchmarkSendFile/file-to-unix/2048-10   	  523159	      2294 ns/op	 892.78 MB/s	       0 B/op	       0 allocs/op
BenchmarkSendFile/file-to-unix/4096-10   	  238792	      5223 ns/op	 784.29 MB/s	       0 B/op	       0 allocs/op
BenchmarkSendFile/file-to-unix/8192-10   	  116611	     10929 ns/op	 749.58 MB/s	       0 B/op	       0 allocs/op
BenchmarkSendFile/file-to-unix/16384-10  	   57568	     19870 ns/op	 824.57 MB/s	       0 B/op	       0 allocs/op
BenchmarkSendFile/file-to-unix/32768-10  	   32280	     33696 ns/op	 972.47 MB/s	       1 B/op	       0 allocs/op
BenchmarkSendFile/file-to-unix/65536-10  	   17242	     72122 ns/op	 908.69 MB/s	       1 B/op	       0 allocs/op
BenchmarkSendFile/file-to-unix/131072-10 	    8350	    159131 ns/op	 823.67 MB/s	       3 B/op	       0 allocs/op
BenchmarkSendFile/file-to-unix/262144-10 	    3872	    318000 ns/op	 824.35 MB/s	       8 B/op	       0 allocs/op
BenchmarkSendFile/file-to-unix/524288-10 	    1766	    600785 ns/op	 872.67 MB/s	      18 B/op	       0 allocs/op
BenchmarkSendFile/file-to-unix/1048576-10            993	   1138624 ns/op	 920.92 MB/s	      33 B/op	       0 allocs/op

goos: linux
goarch: amd64
pkg: net
cpu: DO-Premium-AMD
BenchmarkSendFile/file-to-tcp/1024-8             1796002               716.3 ns/op      1429.59 MB/s           0 B/op          0 allocs/op
BenchmarkSendFile/file-to-tcp/2048-8             1196700               896.6 ns/op      2284.23 MB/s           0 B/op          0 allocs/op
BenchmarkSendFile/file-to-tcp/4096-8              923604              2385 ns/op        1717.48 MB/s           0 B/op          0 allocs/op
BenchmarkSendFile/file-to-tcp/8192-8              638967              9722 ns/op         842.60 MB/s           0 B/op          0 allocs/op
BenchmarkSendFile/file-to-tcp/16384-8             357740             18710 ns/op         875.67 MB/s           0 B/op          0 allocs/op
BenchmarkSendFile/file-to-tcp/32768-8             147417             17489 ns/op        1873.66 MB/s           0 B/op          0 allocs/op
BenchmarkSendFile/file-to-tcp/65536-8             113054             58818 ns/op        1114.21 MB/s           0 B/op          0 allocs/op
BenchmarkSendFile/file-to-tcp/131072-8             57981            113202 ns/op        1157.86 MB/s           0 B/op          0 allocs/op
BenchmarkSendFile/file-to-tcp/262144-8             26362            253376 ns/op        1034.61 MB/s           0 B/op          0 allocs/op
BenchmarkSendFile/file-to-tcp/524288-8             13767            442053 ns/op        1186.03 MB/s           0 B/op          0 allocs/op
BenchmarkSendFile/file-to-tcp/1048576-8             4906            829984 ns/op        1263.37 MB/s           0 B/op          0 allocs/op
BenchmarkSendFile/file-to-unix/1024-8            2031691               628.9 ns/op      1628.36 MB/s           0 B/op          0 allocs/op
BenchmarkSendFile/file-to-unix/2048-8            1294472               965.0 ns/op      2122.30 MB/s           0 B/op          0 allocs/op
BenchmarkSendFile/file-to-unix/4096-8            1005753              1203 ns/op        3404.27 MB/s           0 B/op          0 allocs/op
BenchmarkSendFile/file-to-unix/8192-8             865448              6412 ns/op        1277.65 MB/s           0 B/op          0 allocs/op
BenchmarkSendFile/file-to-unix/16384-8            268946             12801 ns/op        1279.89 MB/s           0 B/op          0 allocs/op
BenchmarkSendFile/file-to-unix/32768-8            153398              6691 ns/op        4897.23 MB/s           0 B/op          0 allocs/op
BenchmarkSendFile/file-to-unix/65536-8             88911             11969 ns/op        5475.36 MB/s           0 B/op          0 allocs/op
BenchmarkSendFile/file-to-unix/131072-8            48639            107538 ns/op        1218.84 MB/s           0 B/op          0 allocs/op
BenchmarkSendFile/file-to-unix/262144-8            22720            203199 ns/op        1290.09 MB/s           0 B/op          0 allocs/op
BenchmarkSendFile/file-to-unix/524288-8            12034             97126 ns/op        5398.03 MB/s           0 B/op          0 allocs/op
BenchmarkSendFile/file-to-unix/1048576-8            5374            202308 ns/op        5183.06 MB/s           0 B/op          0 allocs/op

Change-Id: Ib9507bd9837ecb38b1702afa89502da18806929c
Reviewed-on: https://go-review.googlesource.com/c/go/+/543276
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-02-07 20:33:40 +00:00
Quim Muntal
6abeffb18e Revert "runtime: make netpollBreak entries identifiable on Windows"
This reverts commit 29746b4814.

Reason for revert: Windows builders are flaky since this CL. Needs investigation. See https://build.golang.org/log/70d5d039b57b505870c9cc4e61de320df06a6f3a.

Change-Id: I8a5874bb057785497d03b9450819578de7faeb47
Reviewed-on: https://go-review.googlesource.com/c/go/+/561276
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-02-07 20:08:01 +00:00
David Chase
6d498ce844 doc: move Go 1.22 release notes to x/website
Now that the development of the Go 1.22 release is almost done, its
release notes are moved to their eventual long-term home in x/website
in CL 562195. Delete the initial development copy here.

Change-Id: Ic8e44ee5d95ff121f96a53f6093fd8764abea004
Reviewed-on: https://go-review.googlesource.com/c/go/+/562155
Auto-Submit: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-02-07 17:50:49 +00:00
Robert Griesemer
77c9188471 spec: fix typo in year (it's 2024 now)
While at it, set the date to the Go 1.22 release date.

Change-Id: I03872626e500433eb63786d24c67810c8c6289f4
Reviewed-on: https://go-review.googlesource.com/c/go/+/562337
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Bypass: Robert Griesemer <gri@google.com>
2024-02-07 17:18:54 +00:00
Robert Griesemer
7020beeffd go/types, types2: optimize Named type method lookup
Because methods associated with named types are in the
same package as the type, when looking up a method we
don't need to check the package repeatedly.

Rename the global lookupMethod function to methodIndex,
to match the corresponding fieldIndex function (cleanup).

Implement Named.methodIndex, optimized for method lookup
on named types (optimization).

Adjust call sites.

Change-Id: Ifa05306126773262b1af3ce73365b5742b470eb6
Reviewed-on: https://go-review.googlesource.com/c/go/+/562297
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
2024-02-07 17:03:59 +00:00
Robert Griesemer
f81e498673 go/types, types2: better errors for non-existing fields or methods
This CL improves the error messages reported when a field or method
name is used that doesn't exist. It brings the error messges on par
(or better) with the respective errors reported before Go 1.18 (i.e.
before switching to the new type checker):

Make case distinctions based on whether a field/method is exported
and how it is spelled. Factor out that logic into a new function
(lookupError) in a new file (errsupport.go), which is generated for
go/types. Use lookupError when reporting selector lookup errors
and missing struct field keys.

Add a comprehensive set of tests (lookup2.go) and spot tests for
the two cases brought up by the issue at hand.

Adjusted existing tests as needed.

Fixes #49736.

Change-Id: I2f439948dcd12f9bd1a258367862d8ff96e32305
Reviewed-on: https://go-review.googlesource.com/c/go/+/560055
Run-TryBot: 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-02-07 16:41:56 +00:00
Bryan C. Mills
39ec246e73 cmd/go: avoid copying a binary to be exec'd in TestScript/gotoolchain_path
Runinng 'go build' writes the binary in a separate process, so avoids
the race described in #22315. However, the script engine's 'cp'
command currently executes in-process, so it does not avoid that bug
and may retain stale file descriptors when running tests in parallel.

Avoid the race in this particular test by giving the final binary
location in the '-o' argument instead of copying it there after the
fact.

Fixes #64019.

Change-Id: I96d276f33c09e39f465e9877356f1d8f2ae55062
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/560415
Auto-Submit: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2024-02-06 22:21:42 +00:00
Michael Pratt
c18ddc84e1 cmd/compile: add missing colon in debug log
Change-Id: Id76f4688a2ac45c1616d5c03274eec5d2108e555
Reviewed-on: https://go-review.googlesource.com/c/go/+/562156
Auto-Submit: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-02-06 21:03:43 +00:00
Than McIntosh
4b0e086348 dog/go1.22: tweak coverage testing notes
Clarify the section in the "go" command notes that deals with the
changes to "go test -cover" for packages without tests, adding a note
that if a package has not tests and no executable code, you still get
a "package has no test files" diagnostic.

Fixes #65262.

Change-Id: Ie960871f9d5c1a1965090738644eace28fc3e156
Reviewed-on: https://go-review.googlesource.com/c/go/+/561337
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>
Reviewed-by: Chris Hines <chris.cs.guy@gmail.com>
2024-02-06 15:59:53 +00:00
Jonathan Amsterdam
6f44cc88f5 archive/zip: reduce memory held by Writer.Copy
Make a copy of the argument File's FileHeader, and pass a pointer
to the copy to CreateRaw.

Passing the pointer directly causes the entire `File` to be referenced
by the receiver. The `File` includes a reference to the `ReaderAt`
underlying the `Reader`, so all its memory, which may be the entire
contents of the archive, is prevented from being garbage-collected.

Also, explain the issue in the doc comment for CreateRaw. We
cannot change its behavior because someone may depend on the
preserving the identity of its argument pointer.

For #65499.

Change-Id: Ieb4963a0ea30539d597547d3511accbd8c6b5c5a
Reviewed-on: https://go-review.googlesource.com/c/go/+/560238
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-02-06 12:43:52 +00:00
Jun10ng
6076edc55c cmd/compile: delete unused code and fix typo in comment
Change-Id: Ia1f1c7d5563a74950c47cf3ebdcb600b34c83e85
GitHub-Last-Rev: bd58214e5e
GitHub-Pull-Request: golang/go#65527
Reviewed-on: https://go-review.googlesource.com/c/go/+/561355
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2024-02-05 20:59:15 +00:00
Jonathan Amsterdam
b39ec942d8 doc/next: add release note file for api/next file
Change-Id: I3003968d9d7e543c25d4b0ab1d1cd924a1efd3ec
Reviewed-on: https://go-review.googlesource.com/c/go/+/561456
Auto-Submit: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-02-05 19:05:03 +00:00
Robert Griesemer
2c6f24c825 go/types, types2: bail early if we want a type but don't have one
If we do know whether we need a type or not, make use of the
information when we know that we don't have a type and bail out.

Fixes the issue at hand and also improves some other error messages
which now report that we don't have a type instead of reporting a cycle.

For #65344.

Change-Id: I11182efd452c485d89e6c09ead8a647ea05d7318
Reviewed-on: https://go-review.googlesource.com/c/go/+/559335
Run-TryBot: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Bypass: Robert Griesemer <gri@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2024-02-05 18:13:11 +00:00
Rob Findley
10a65649a3 go/types, types2: ensure that Alias.actual is set in NewAlias
Types returned by the go/types API must be immutable (or at least
concurrency safe), but NewAlias returned an alias without actual set.

Ensure that actual is set by unaliasing. Also make some superficial
simplifications to unalias, and avoid indirection where unnecessary.

Fixes golang/go#65455

Change-Id: Ic9a020da5accf9032056a924b65c9e9e08cb2e0a
Reviewed-on: https://go-review.googlesource.com/c/go/+/560915
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: Robert Griesemer <gri@google.com>
2024-02-05 17:28:36 +00:00
Michael Pratt
468f56b10a cmd/compile: consistently use s.pp in genssa
In genssa, s.pp == pp, so using either is equivalent, but use is
inconsistent. About half of the uses use s.pp and the other half use pp.

This gets confusing, especially when two different uses are right next
to each other, because it implies that these might be different.

Pick one and use it consistently.

Change-Id: Ifb1bb9332138d8cb62a45c212fcd7139f8511901
Reviewed-on: https://go-review.googlesource.com/c/go/+/560780
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-02-05 16:43:45 +00:00
Jonathan Amsterdam
d3fd7ee580 cmd/relnote: fix API relnote check
Fix the check for release note files that correspond to API files
to look in the right directory, doc/next/*stdlib/*minor. Previously
the test looked in doc/next.

Improve the error messages when the test fails to explain the problem
better and refer to further documentation.

(These changes are actually in the x/build repo; this CL vendors
the latest version.)

Lastly, re-enable the check.

For #64169.

Change-Id: I8bba845e9bd12afbe269ce42d6d4b17b1e3c0252
Reviewed-on: https://go-review.googlesource.com/c/go/+/560516
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-02-05 16:31:53 +00:00
Mauri de Souza Meneguzzo
76ff0caa59 runtime/internal/atomic: add loong64 operators for And/Or
These primitives will be used by the new And/Or sync/atomic apis.

For #61395

Change-Id: I64b2e599e4f91412e0342aa01f5fd53271e9a333
GitHub-Last-Rev: 9755db5406
GitHub-Pull-Request: golang/go#63314
Reviewed-on: https://go-review.googlesource.com/c/go/+/531895
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Mauri de Souza Meneguzzo <mauri870@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2024-02-05 15:30:09 +00:00
Bryan C. Mills
e8d87728bd cmd/go: fix tests that fail when running a cross-compiled GOARCH
In CL 356611 I changed cmd/go to run most of its tests (instead of
skipping them all) when cross-compiled, such as with GOARCH=386 on an
amd64 host. Unfortunately, since we don't have a CI builder that runs
long tests in a cross-compiled configuration, some of the tests have
rotted since then.

This fixes 'GOARCH=386 go test cmd/go' on my workstation.

For #64963.
Updates #53936.

Change-Id: If7f4bc8e8d1ace7d36010d7a1b652fc7b2ceb276
Cq-Include-Trybots: luci.golang.try:gotip-linux-386-longtest,gotip-windows-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/560782
Auto-Submit: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2024-02-05 14:52:04 +00:00