]> Cypherpunks repositories - gostls13.git/log
gostls13.git
15 months agoruntime: avoid new linkname for goroutine profiles
Michael Pratt [Tue, 30 Jan 2024 16:01:05 +0000 (11:01 -0500)]
runtime: avoid new linkname for goroutine profiles

CL 464349 added a new linkname to provide gcount to runtime/pprof to
avoid a STW when estimating the goroutine profile allocation size.

However, adding a linkname here isn't necessary for a few reasons:

1. We already export gcount via NumGoroutines. I completely forgot about
   this during review.
2. aktau suggested that goroutineProfileWithLabelsConcurrent return
   gcount as a fast path estimate when the input is empty.

The second point keeps the code cleaner overall, so I've done that.

For #54014.

Change-Id: I6cb0811a769c805e269b55774cdd43509854078e
Reviewed-on: https://go-review.googlesource.com/c/go/+/559515
Auto-Submit: Michael Pratt <mpratt@google.com>
Auto-Submit: Nicolas Hillegeer <aktau@google.com>
Reviewed-by: Nicolas Hillegeer <aktau@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

15 months agocmd/link: add DW_AT_go_runtime_type to unsafe.Pointer and fix it for
Alessandro Arzilli [Wed, 24 Jan 2024 17:10:47 +0000 (18:10 +0100)]
cmd/link: add DW_AT_go_runtime_type to unsafe.Pointer and fix it for
uintptr

Adds the DW_AT_go_runtime_type attribute to the debug_info entry for
unsafe.Pointer (which is special) and fixes the debug_info entry of
uintptr so that its DW_AT_go_runtime_type attribute has the proper
class (it was accidentally using DW_CLS_ADDRESS instead of
DW_CLS_GO_TYPEREF)

Change-Id: I52e18593935fbda9bc425e849f4c7f50e9144ad4
Reviewed-on: https://go-review.googlesource.com/c/go/+/558275
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
15 months agointernal/zstd: avoid panic when windowSize is negative
aimuz [Sat, 18 Nov 2023 04:16:04 +0000 (04:16 +0000)]
internal/zstd: avoid panic when windowSize is negative

This change fixes an edge case in the zstd decompressor where
an int conversion could result in a negative window size.

Fixes #63979
For #62513

Change-Id: Ie714bf8fb51fa509b310deb8bd2c96bd87b52852
GitHub-Last-Rev: ab0be6578247da896f16d85e102b81994b8ee5c4
GitHub-Pull-Request: golang/go#63980
Reviewed-on: https://go-review.googlesource.com/c/go/+/540415
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: M Zhuo <mengzhuo1203@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: M Zhuo <mengzhuo1203@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

15 months agoRevert "runtime: disable use of runnext on wasm"
Michael Pratt [Mon, 29 Jan 2024 23:57:14 +0000 (23:57 +0000)]
Revert "runtime: disable use of runnext on wasm"

This reverts CL 557437.

Reason for revert: Appears to have broken wasip1 builders.

For #65178.

Change-Id: I59c1a310eb56589c768536fe444c1efaf862f8b0
Reviewed-on: https://go-review.googlesource.com/c/go/+/559237
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
15 months agoruntime: reduce one STW when obtaining goroutine configuration file
Jun10ng [Sat, 27 Jan 2024 11:53:43 +0000 (11:53 +0000)]
runtime: reduce one STW when obtaining goroutine configuration file

Fixes #54014

Change-Id: If4ee2752008729e1ed4b767cfda52effdcec4959
GitHub-Last-Rev: 5ce300bf5128f842604d85d5f8749027c8e091c2
GitHub-Pull-Request: golang/go#58239
Reviewed-on: https://go-review.googlesource.com/c/go/+/464349
Reviewed-by: qiulaidongfeng <2645477756@qq.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: qiulaidongfeng <2645477756@qq.com>
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>
15 months agoruntime: disable use of runnext on wasm
Michael Pratt [Mon, 22 Jan 2024 22:50:44 +0000 (17:50 -0500)]
runtime: disable use of runnext on wasm

When readying a goroutine, the scheduler typically places the readied
goroutine in pp.runnext, which will typically be the next goroutine to
run in the schedule.

In order to prevent a set of ping-pong goroutines from simply switching
back and forth via runnext and starving the rest of the run queue, a
goroutine scheduled via runnext shares a time slice (pp.schedtick) with
the previous goroutine.

sysmon detects "long-running goroutines", which really means Ps using
the same pp.schedtick for too long, and preempts them to allow the rest
of the run queue to run. Thus this avoids starvation via runnext.

However, wasm has no threads, and thus no sysmon. Without sysmon to
preempt, the possibility for starvation returns. Avoid this by disabling
runnext entirely on wasm. This means that readied goroutines always go
on the end of the run queue and thus cannot starve via runnext.

Note that this CL doesn't do anything about single long-running
goroutines. Without sysmon to preempt them, a single goroutine that
fails to yield will starve the run queue indefinitely.

For #65178.

Cq-Include-Trybots: luci.golang.try:gotip-js-wasm,gotip-wasip1-wasm_wasmtime,gotip-wasip1-wasm_wazero
Change-Id: I7dffe1e72c6586474186b72f8068cff77b661eae
Reviewed-on: https://go-review.googlesource.com/c/go/+/557437
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
15 months agonet/http: allow nothingWrittenError in TestTransportPersistConnReadLoopEOF
Michael Pratt [Thu, 25 Jan 2024 20:39:09 +0000 (15:39 -0500)]
net/http: allow nothingWrittenError in TestTransportPersistConnReadLoopEOF

Flakes in #64317 are a result of a race where the server shutdown
schedules ahead of the client read loop. Normal network latency usually
hides this, but wasm's net_fake.go has very low latency.

Explicitly allow the results of this race in the test.

For #64317.

Change-Id: I9c2572fb44643762fe3f3d7cb133d7e7a8a47881
Reviewed-on: https://go-review.googlesource.com/c/go/+/558595
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>

15 months agonet: in the fake implementation, allow writes to buffer on closed connections
Bryan C. Mills [Fri, 26 Jan 2024 17:23:01 +0000 (12:23 -0500)]
net: in the fake implementation, allow writes to buffer on closed connections

This mimics the apparent behavior of writes on linux/amd64, in which a
write on an already-closed connection silently succeeds — even if the
connection has already been closed by the remote end — provided that
the packet fits in the kernel's send buffer.

I tested this by patching in CL 557437 and running the test on js/wasm
and wasip1/wasm locally.

Fixes #64317.

Change-Id: I43f6a89e5059115cb61e4ffc33a8371057cb67a1
Reviewed-on: https://go-review.googlesource.com/c/go/+/558915
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

15 months agocmd/go/internal/generate: call modload.InitWorkFile
Michael Matloob [Mon, 29 Jan 2024 16:14:05 +0000 (11:14 -0500)]
cmd/go/internal/generate: call modload.InitWorkFile

This is necessary for go generate to enter workspace mode for
recognizing package paths in the workspace.

Fixes #56098

Change-Id: I25f68de24f4189259353f63194823516e9d3d505
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/559195
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
15 months agocmd/go/internal/list: make a copy of the package before zeroing fields
Michael Matloob [Wed, 3 Jan 2024 19:23:49 +0000 (14:23 -0500)]
cmd/go/internal/list: make a copy of the package before zeroing fields

go list -json=<fields> zeroes out the fields in the package struct
that aren't specified. The problem with this is that some of the fields
have references into other fields: specifically, the NoGoError's
Error() function accesses the package struct's Dir field, so if we
clear it out the error will just print out "no Go files in" without a
directory. Instead, make a copy of the package struct before we zero
out the fields so the original values are still there.

For #64946

Change-Id: I95103e91fa0782bb23a86a965d5eb87cb12654c6
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/553795
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
15 months agocmd/go: allow test caching for the -fullpath flag
Raghvender [Mon, 11 Dec 2023 21:41:45 +0000 (15:41 -0600)]
cmd/go: allow test caching for the -fullpath flag

Change-Id: I5662b8ff617772ca2afec8bf419c468a3e69c392
Reviewed-on: https://go-review.googlesource.com/c/go/+/548996
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

15 months agocmd/go/internal/toolchain: apply the -modcacherw flag when downloading a module to...
Bryan C. Mills [Thu, 11 Jan 2024 20:00:17 +0000 (15:00 -0500)]
cmd/go/internal/toolchain: apply the -modcacherw flag when downloading a module to determine what toolchain it needs

Fixes #64282.

Change-Id: I3f211c599ee70cb58254d0bc07eeb3c135124e58
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/555436
Auto-Submit: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Russ Cox <rsc@golang.org>
15 months agocmd/go/internal/load: improve comments
sivchari [Tue, 1 Aug 2023 05:00:52 +0000 (05:00 +0000)]
cmd/go/internal/load: improve comments

isTestFunc checked whether the parameter type is B, M or T before the version of Go1.17.
But, after Go1.18, isTestFunc checks F, too.

Change-Id: I30bc97c2b8f2974bc9ae4df2f32dc8dce760d7d6
GitHub-Last-Rev: 507d5b1f74b2f2d0a75d61fe169cc0cc40d132c0
GitHub-Pull-Request: golang/go#56127
Reviewed-on: https://go-review.googlesource.com/c/go/+/441835
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: 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>

15 months agoruntime: crash stack support for loong64
Mauri de Souza Meneguzzo [Thu, 25 Jan 2024 23:11:02 +0000 (23:11 +0000)]
runtime: crash stack support for loong64

Change-Id: Icc2641b888440cc27444b5dfb2b8ff286e6a595d
GitHub-Last-Rev: f5772e32e9190ab1eed94fcf2c9e58d6bc0d74d6
GitHub-Pull-Request: golang/go#63923
Reviewed-on: https://go-review.googlesource.com/c/go/+/539536
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Run-TryBot: Joel Sing <joel@sing.id.au>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

15 months agocmd/internal/moddeps: fix test fail when the last element of GOROOT start with a...
qiulaidongfeng [Sat, 27 Jan 2024 03:27:17 +0000 (03:27 +0000)]
cmd/internal/moddeps: fix test fail when the last element of GOROOT start with a dot or underscore

Fixes #54221

Change-Id: Id16f553251daf0b7c51f45232a4133f7dfb1ebb9
GitHub-Last-Rev: 675c2bfcbb4fd31da0442dd0e612874934cc0d87
GitHub-Pull-Request: golang/go#65298
Reviewed-on: https://go-review.googlesource.com/c/go/+/558696
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
15 months agoRevert "crypto/internal/boring: upgrade module to fips-20220613" +1
Filippo Valsorda [Fri, 26 Jan 2024 22:22:45 +0000 (23:22 +0100)]
Revert "crypto/internal/boring: upgrade module to fips-20220613" +1

This reverts commit 7383b2a4db5dc93c9b875b42d5add73d27cc4b9f
("crypto/internal/boring: upgrade module to fips-20220613") and commit
4106de901a8efe914cda6f6c4e8d45ff8c115da4 ("crypto/tls: align FIPS-only
mode with BoringSSL policy").

Fixes #65321
Updates #64717
Updates #62372

Change-Id: I0938b97e5b4904e6532448b8ae76e920d03d0508
Reviewed-on: https://go-review.googlesource.com/c/go/+/558796
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

15 months agocmd/api: include type arguments in API
Matthew Dempsky [Fri, 26 Jan 2024 04:29:32 +0000 (20:29 -0800)]
cmd/api: include type arguments in API

T[A] and T[B] are different types, but we were writing them both as
just "T". Reported by Russ.

Change-Id: I27db35946b6d3a1fad6c56c785fa6d850ad71d00
Reviewed-on: https://go-review.googlesource.com/c/go/+/558716
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

15 months agocmd/link: print failed external command invocation
Cherry Mui [Fri, 26 Jan 2024 17:08:00 +0000 (12:08 -0500)]
cmd/link: print failed external command invocation

When the invocation of the external linker, dsymutil or strip
command fails, print the command we invoked.

For #65292.

Change-Id: Icdb5f9ee942ebda4276f6373c3fbbf5222088d0b
Reviewed-on: https://go-review.googlesource.com/c/go/+/558856
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
15 months agonet/mail: remove obsolete comment
Roland Shoemaker [Fri, 26 Jan 2024 00:11:15 +0000 (16:11 -0800)]
net/mail: remove obsolete comment

Forgot to remove this in CL 555596.

Change-Id: I903a6d1c02ee38b676e3e5860376d8d9509f0e03
Reviewed-on: https://go-review.googlesource.com/c/go/+/558675
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Roland Shoemaker <roland@golang.org>

15 months agoRevert "net/http: wrap client errors"
Cherry Mui [Fri, 26 Jan 2024 17:28:45 +0000 (17:28 +0000)]
Revert "net/http: wrap client errors"

This reverts CL 533119.

Reason for revert: the test fails frequently, see #65287.

Fixes #65287.

Change-Id: I5bf2ee2b7ce435608ff76b892da261c0a4a189bf
Reviewed-on: https://go-review.googlesource.com/c/go/+/558916
Reviewed-by: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Cherry Mui <cherryyz@google.com>

15 months agocmd/go: ensure the correct line number is displayed when using TB.Helper
Quan Tong [Mon, 6 Nov 2023 02:17:02 +0000 (09:17 +0700)]
cmd/go: ensure the correct line number is displayed when using TB.Helper

Fixes #26995

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest-race,gotip-linux-386-longtest,gotip-windows-amd64-longtest
Change-Id: If3b68002d205fe985a692b69f5d7e0d2f20a7bd6
Reviewed-on: https://go-review.googlesource.com/c/go/+/540016
TryBot-Bypass: Bryan Mills <bcmills@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
15 months agocmd/link: use MapMaxKeyBytes,MapMaxElemBytes,MapBucketCount of internal/abi
qiulaidongfeng [Sun, 17 Dec 2023 09:47:10 +0000 (09:47 +0000)]
cmd/link: use MapMaxKeyBytes,MapMaxElemBytes,MapBucketCount of internal/abi

For #59670

Change-Id: I248bad2d2f9d05903b80022e52a795ff7a4fae93
GitHub-Last-Rev: df6a7bf29a2012eb681ce391dc9cf295370b5b2e
GitHub-Pull-Request: golang/go#64775
Reviewed-on: https://go-review.googlesource.com/c/go/+/550596
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
15 months agoreflect: use MapMaxKeyBytes,MapMaxElemBytes,MapBucketCount of internal/abi
qiulaidongfeng [Sun, 17 Dec 2023 09:46:48 +0000 (09:46 +0000)]
reflect: use MapMaxKeyBytes,MapMaxElemBytes,MapBucketCount of internal/abi

For #59670

Change-Id: I63a6e2cfaf9eec03866ea61064164a059fc42bb2
GitHub-Last-Rev: a3aa46a36444b08382ddac79c10a064b314bd971
GitHub-Pull-Request: golang/go#64773
Reviewed-on: https://go-review.googlesource.com/c/go/+/550595
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
15 months agoruntime: use channels in gcBgMarkStartWorkers
Michael Pratt [Tue, 23 Jan 2024 18:29:23 +0000 (13:29 -0500)]
runtime: use channels in gcBgMarkStartWorkers

gcBgMarkStartWorkers currently starts workers one at a time, using a
note to communicate readiness back from the worker.

However, this is a pretty standard goroutine, so we can just use a
channel to communicate between the goroutines.

In addition to being conceptually simpler, using channels has the
additional advantage of coordinating with the scheduler. Notes use OS
locks and sleep the entire thread, requiring other threads to run the
other goroutines. Waiting on a channel allows the scheduler to directly
run another goroutine. When the worker sends to the channel, the
scheduler can use runnext to run gcBgMarkStartWorker immediately,
reducing latency.

We could additionally batch start all workers and then wait only once,
however this would defeate runnext switching between the workers and
gcBgMarkStartWorkers, so in a heavily loaded system, we expect the
direct switches to reduce latency.

Change-Id: Iedf0d2ad8ad796b43fd8d32ccb1e815cfe010cb4
Reviewed-on: https://go-review.googlesource.com/c/go/+/558535
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
15 months agogo/types, types2: use existing case-insensitive lookup (remove TODO)
Robert Griesemer [Wed, 24 Jan 2024 20:42:11 +0000 (12:42 -0800)]
go/types, types2: use existing case-insensitive lookup (remove TODO)

Rather than implementing a new, less complete mechanism to check
if a selector exists with different capitalization, use the
existing mechanism in lookupFieldOrMethodImpl by making it
available for internal use.

Pass foldCase parameter all the way trough to Object.sameId and
thus make it consistently available where Object.sameId is used.

From sameId, factor out samePkg functionality into stand-alone
predicate.

Do better case distinction when reporting an error for an undefined
selector expression.

Cleanup.

Change-Id: I7be3cecb4976a4dce3264c7e0c49a320c87101e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/558315
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

15 months agoall: enable range-over-func in Go 1.23
Russ Cox [Tue, 23 Jan 2024 17:02:50 +0000 (12:02 -0500)]
all: enable range-over-func in Go 1.23

GOEXPERIMENT=rangefunc still enables it for all Go modules.
Otherwise only enable in Go 1.23 source files.
More work remains but it will be done in follow-up issues.

Fixes #61405.

Change-Id: Icad64942deb152ee65444e4d7be289814a8a0b6b
Reviewed-on: https://go-review.googlesource.com/c/go/+/557835
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
15 months agomaps: correct use of linkname
Russ Cox [Tue, 23 Jan 2024 19:42:42 +0000 (14:42 -0500)]
maps: correct use of linkname

Linkname should have uses at both ends,
and then no fake assembly file is needed.

Change-Id: Ia2066be7b1e08d71a6db622d2a167f1b09cb7d9f
Reviewed-on: https://go-review.googlesource.com/c/go/+/558297
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
15 months agocmd/compile: implement float min/max in hardware for riscv64
Meng Zhuo [Tue, 1 Aug 2023 14:17:02 +0000 (22:17 +0800)]
cmd/compile: implement float min/max in hardware for riscv64

CL 514596 adds float min/max for amd64, this CL adds it for riscv64.

The behavior of the RISC-V FMIN/FMAX instructions almost match Go's
requirements.

However according to RISCV spec 8.3 "NaN Generation and Propagation"
>> if at least one input is a signaling NaN, or if both inputs are quiet
>> NaNs, the result is the canonical NaN. If one operand is a quiet NaN
>> and the other is not a NaN, the result is the non-NaN operand.

Go using quiet NaN as NaN and according to Go spec
>> if any argument is a NaN, the result is a NaN

This requires the float min/max implementation to check whether one
of operand is qNaN before float mix/max actually execute.

This CL also fix a typo in minmax test.

Benchmark on Visionfive2
goos: linux
goarch: riscv64
pkg: runtime
         │ float_minmax.old.bench │       float_minmax.new.bench        │
         │         sec/op         │   sec/op     vs base                │
MinFloat             158.20n ± 0%   28.13n ± 0%  -82.22% (p=0.000 n=10)
MaxFloat             158.10n ± 0%   28.12n ± 0%  -82.21% (p=0.000 n=10)
geomean               158.1n        28.12n       -82.22%

Update #59488

Change-Id: Iab48be6d32b8882044fb8c821438ca8840e5493d
Reviewed-on: https://go-review.googlesource.com/c/go/+/514775
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
Run-TryBot: M Zhuo <mengzhuo1203@gmail.com>
Reviewed-by: Joel Sing <joel@sing.id.au>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
15 months agogo/types, types2: in struct processing, set name position in types2
Robert Griesemer [Wed, 24 Jan 2024 21:09:55 +0000 (13:09 -0800)]
go/types, types2: in struct processing, set name position in types2

As a consequence, the positions needed by the Checker.structType
internal helper functions add and addInvalid are always the positions
of the provided identifiers, and we can leave away the extra position
arguments.

Change-Id: Iddc275c83d3781261476b8e1903050e0a049957c
Reviewed-on: https://go-review.googlesource.com/c/go/+/558316
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
15 months agointernal/testenv: support the LUCI mobile builders in tests
Michael Anthony Knyszek [Thu, 25 Jan 2024 17:23:15 +0000 (17:23 +0000)]
internal/testenv: support the LUCI mobile builders in tests

This change updates the testenv tests to correctly match on future LUCI
builder names for mobile builders. This isn't a problem today because
those haven't been set up yet, but the builder names are structured and
it's clear where the modifiers will appear. Might as well set them up
now.

Change-Id: I244b88a62a90312c0f3ff2360527d58531070362
Reviewed-on: https://go-review.googlesource.com/c/go/+/558597
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

15 months agointernal/testenv: allow "-noopt" anywhere in builder name in test
Michael Anthony Knyszek [Thu, 25 Jan 2024 17:13:11 +0000 (17:13 +0000)]
internal/testenv: allow "-noopt" anywhere in builder name in test

testenv's TestHasGoBuild test is supposed to allow noopt builders to not
have go build, but the pattern match is failing on the LUCI builders
where a test shard might have an additional "-test_only" suffix in the
builder name. Furthermore, in the LUCI world, "run mods" (the builder
type suffixes) are supposed to be well-defined and composable, so it
doesn't make sense to restrict "-noopt" to the builder suffix anyway.

This change modifies the test to allow "-noopt" to appear anywhere in
the builder name when checking if it's running on a noopt builder.

Change-Id: I393818e3e8e452c7b0927cbc65726d552aa8ff8e
Reviewed-on: https://go-review.googlesource.com/c/go/+/558596
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>
Reviewed-by: Bryan Mills <bcmills@google.com>
15 months agoruntime/pprof: fix retry logic introduced by #858cd8d
Cosmos Nicolaou [Thu, 25 Jan 2024 19:55:38 +0000 (11:55 -0800)]
runtime/pprof: fix retry logic introduced by #858cd8d

The previous attempt to fix this flake was incorrect in that it
examined the vmmap output rather than the detailed error
output for the 'resource shortage' message that triggers the
retry, and hence failed to retry. This PR looks at the
detailed error output.

Fixes #62352

Change-Id: I4218b187528a95842556dc1ea27947ffcbfbc497
Reviewed-on: https://go-review.googlesource.com/c/go/+/558575
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>
Reviewed-by: Michael Pratt <mpratt@google.com>
15 months agodebug/gosym: add detailed doc for text argument in NewLineTable
Zxilly [Wed, 24 Jan 2024 21:27:41 +0000 (21:27 +0000)]
debug/gosym: add detailed doc for text argument in NewLineTable

Fixes #65232

Change-Id: I9ef76355cec4bea2d77811a69c61c1806c486be8
GitHub-Last-Rev: 9c617b65be9b01e9708e05a540316f98c8a0d165
GitHub-Pull-Request: golang/go#65263
Reviewed-on: https://go-review.googlesource.com/c/go/+/557957
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
15 months agomath/big,crypto/internal/bigmod: unroll loop in addMulVVW for ppc64x
Lynn Boger [Tue, 23 Jan 2024 18:46:05 +0000 (12:46 -0600)]
math/big,crypto/internal/bigmod: unroll loop in addMulVVW for ppc64x

This updates the assembly implementation of AddMulVVW to
unroll the main loop to do 64 bytes at a time.

The code for addMulVVWx is based on the same code and has
also been updated to improve performance.

goos: linux
goarch: ppc64le
pkg: crypto/internal/bigmod
cpu: POWER10
               │ bg.orig.out │               bg.out               │
               │   sec/op    │   sec/op     vs base               │
ModAdd           116.3n ± 0%   116.9n ± 0%   +0.52% (p=0.002 n=6)
ModSub           111.5n ± 0%   111.5n ± 0%    0.00% (p=0.273 n=6)
MontgomeryRepr   2.195µ ± 0%   1.944µ ± 0%  -11.44% (p=0.002 n=6)
MontgomeryMul    2.195µ ± 0%   1.943µ ± 0%  -11.48% (p=0.002 n=6)
ModMul           4.418µ ± 0%   3.900µ ± 0%  -11.72% (p=0.002 n=6)
ExpBig           5.736m ± 0%   5.117m ± 0%  -10.78% (p=0.002 n=6)
Exp              5.891m ± 0%   5.237m ± 0%  -11.11% (p=0.002 n=6)
geomean          9.901µ        9.094µ        -8.15%

goos: linux
goarch: ppc64le
pkg: math/big
cpu: POWER10
                 │ am.orig.out  │               am.out               │
                 │    sec/op    │   sec/op     vs base               │
AddMulVVW/1         4.456n ± 1%   3.565n ± 0%  -20.00% (p=0.002 n=6)
AddMulVVW/2         4.875n ± 1%   5.938n ± 1%  +21.79% (p=0.002 n=6)
AddMulVVW/3         5.484n ± 0%   5.693n ± 0%   +3.80% (p=0.002 n=6)
AddMulVVW/4         6.370n ± 0%   6.065n ± 0%   -4.79% (p=0.002 n=6)
AddMulVVW/5         7.321n ± 0%   7.188n ± 0%   -1.82% (p=0.002 n=6)
AddMulVVW/10        12.26n ± 8%   11.41n ± 0%   -6.97% (p=0.002 n=6)
AddMulVVW/100      100.70n ± 0%   93.58n ± 0%   -7.08% (p=0.002 n=6)
AddMulVVW/1000      938.6n ± 0%   845.5n ± 0%   -9.92% (p=0.002 n=6)
AddMulVVW/10000     9.459µ ± 0%   8.415µ ± 0%  -11.04% (p=0.002 n=6)
AddMulVVW/100000    94.57µ ± 0%   84.01µ ± 0%  -11.16% (p=0.002 n=6)
geomean             75.17n        71.21n        -5.27%

Change-Id: Idd79f5f02387564f4c2cc28d50b1c12bcd9a400f
Reviewed-on: https://go-review.googlesource.com/c/go/+/557915
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Paul Murphy <murp@ibm.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
15 months agonet/http: wrap client errors
kayos@tcp.direct [Mon, 8 Jan 2024 07:42:00 +0000 (07:42 +0000)]
net/http: wrap client errors

Fixes #50856

Change-Id: I7fe89fcce223e1571debb73436f8aeb3bfbe4b9f
GitHub-Last-Rev: be570e7883be06adbd227a1dfe63a80e384d96f6
GitHub-Pull-Request: golang/go#63448
Reviewed-on: https://go-review.googlesource.com/c/go/+/533119
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: qiulaidongfeng <2645477756@qq.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
15 months agocmd/dist,internal/platform,runtime: add cgo support for openbsd/riscv64 port
Joel Sing [Sat, 17 Sep 2022 16:37:36 +0000 (02:37 +1000)]
cmd/dist,internal/platform,runtime: add cgo support for openbsd/riscv64 port

Updates #55999

Change-Id: Ie9a030130713f3eaf789b91d9033be3335eb9d75
Reviewed-on: https://go-review.googlesource.com/c/go/+/518630
Reviewed-by: Carlos Amedee <carlos@golang.org>
Run-TryBot: Joel Sing <joel@sing.id.au>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
15 months agocmd/dist,internal/platform: enable openbsd/riscv64 port
Joel Sing [Fri, 4 Aug 2023 10:40:23 +0000 (20:40 +1000)]
cmd/dist,internal/platform: enable openbsd/riscv64 port

Fixes #55999

Change-Id: If76b61b660db3fefe5f9ca97500782f2a650db25
Reviewed-on: https://go-review.googlesource.com/c/go/+/518629
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Joel Sing <joel@sing.id.au>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
15 months agoruntime: add crash stack support for s390x
Mauri de Souza Meneguzzo [Sat, 2 Dec 2023 15:04:52 +0000 (15:04 +0000)]
runtime: add crash stack support for s390x

Change-Id: Ie923f7bbe5ef22e381ae4f421387fbd570622a28
GitHub-Last-Rev: f8f21635025eb6e26c6994679995ade501e870cf
GitHub-Pull-Request: golang/go#63908
Reviewed-on: https://go-review.googlesource.com/c/go/+/539296
Run-TryBot: Joel Sing <joel@sing.id.au>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Run-TryBot: Mauri de Souza Meneguzzo <mauri870@gmail.com>
Reviewed-by: Joel Sing <joel@sing.id.au>
15 months agonet/netip: use Addr.appendTo4In6 in Addr.AppendTo
Tobias Klauser [Wed, 24 Jan 2024 21:15:19 +0000 (22:15 +0100)]
net/netip: use Addr.appendTo4In6 in Addr.AppendTo

Change-Id: Ieb1931c40b37b87fc7d0011461d9f583e73aaff9
Reviewed-on: https://go-review.googlesource.com/c/go/+/557778
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
15 months agonet/netip: optimize Addr.String for 4in6 addresses
Tobias Klauser [Wed, 24 Jan 2024 21:15:15 +0000 (22:15 +0100)]
net/netip: optimize Addr.String for 4in6 addresses

name                      old time/op    new time/op    delta
AddrString/v4-8             20.0ns ± 0%    19.7ns ± 1%   -1.42%  (p=0.000 n=9+10)
AddrString/v6-8             58.9ns ± 6%    57.1ns ± 0%   -3.08%  (p=0.000 n=10+9)
AddrString/v6_ellipsis-8    59.9ns ± 1%    59.5ns ± 0%   -0.53%  (p=0.027 n=8+10)
AddrString/v6_v4-8          33.7ns ± 1%    24.3ns ± 0%  -27.82%  (p=0.000 n=9+10)
AddrString/v6_zone-8        61.4ns ± 1%    61.6ns ± 0%     ~     (p=0.190 n=9+9)

name                      old alloc/op   new alloc/op   delta
AddrString/v4-8              16.0B ± 0%     16.0B ± 0%     ~     (all equal)
AddrString/v6-8              48.0B ± 0%     48.0B ± 0%     ~     (all equal)
AddrString/v6_ellipsis-8     24.0B ± 0%     24.0B ± 0%     ~     (all equal)
AddrString/v6_v4-8           24.0B ± 0%     24.0B ± 0%     ~     (all equal)
AddrString/v6_zone-8         24.0B ± 0%     24.0B ± 0%     ~     (all equal)

name                      old allocs/op  new allocs/op  delta
AddrString/v4-8               1.00 ± 0%      1.00 ± 0%     ~     (all equal)
AddrString/v6-8               1.00 ± 0%      1.00 ± 0%     ~     (all equal)
AddrString/v6_ellipsis-8      1.00 ± 0%      1.00 ± 0%     ~     (all equal)
AddrString/v6_v4-8            1.00 ± 0%      1.00 ± 0%     ~     (all equal)
AddrString/v6_zone-8          1.00 ± 0%      1.00 ± 0%     ~     (all equal)

Change-Id: Ie611ee8629a2ff457dcff83b08d0c94c93af3182
Reviewed-on: https://go-review.googlesource.com/c/go/+/557777
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
15 months agonet/netip: optimize Addr.MarshalText allocation for 4in6 addresses
Tobias Klauser [Wed, 24 Jan 2024 21:14:49 +0000 (22:14 +0100)]
net/netip: optimize Addr.MarshalText allocation for 4in6 addresses

name                           old time/op    new time/op    delta
AddrMarshalText/v4-8             18.5ns ± 1%    18.8ns ± 1%   +1.40%  (p=0.000 n=9+10)
AddrMarshalText/v6-8             58.0ns ± 0%    57.5ns ± 0%   -0.93%  (p=0.000 n=9+10)
AddrMarshalText/v6_ellipsis-8    61.4ns ± 0%    60.4ns ± 0%   -1.65%  (p=0.000 n=10+9)
AddrMarshalText/v6_v4-8          25.7ns ± 0%    26.2ns ± 1%   +1.86%  (p=0.000 n=10+10)
AddrMarshalText/v6_zone-8        61.8ns ± 0%    60.8ns ± 0%   -1.63%  (p=0.000 n=10+9)

name                           old alloc/op   new alloc/op   delta
AddrMarshalText/v4-8              16.0B ± 0%     16.0B ± 0%     ~     (all equal)
AddrMarshalText/v6-8              48.0B ± 0%     48.0B ± 0%     ~     (all equal)
AddrMarshalText/v6_ellipsis-8     48.0B ± 0%     48.0B ± 0%     ~     (all equal)
AddrMarshalText/v6_v4-8           48.0B ± 0%     32.0B ± 0%  -33.33%  (p=0.000 n=10+10)
AddrMarshalText/v6_zone-8         48.0B ± 0%     48.0B ± 0%     ~     (all equal)

name                           old allocs/op  new allocs/op  delta
AddrMarshalText/v4-8               1.00 ± 0%      1.00 ± 0%     ~     (all equal)
AddrMarshalText/v6-8               1.00 ± 0%      1.00 ± 0%     ~     (all equal)
AddrMarshalText/v6_ellipsis-8      1.00 ± 0%      1.00 ± 0%     ~     (all equal)
AddrMarshalText/v6_v4-8            1.00 ± 0%      1.00 ± 0%     ~     (all equal)
AddrMarshalText/v6_zone-8          1.00 ± 0%      1.00 ± 0%     ~     (all equal)

Change-Id: Ib298a0fb9ec6b55e37d0559dad387242dc82aab9
Reviewed-on: https://go-review.googlesource.com/c/go/+/557776
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
15 months agonet/netip: further optimize AddrPort.String
Tobias Klauser [Wed, 24 Jan 2024 21:13:17 +0000 (22:13 +0100)]
net/netip: further optimize AddrPort.String

name                          old time/op    new time/op    delta
AddrPortString/v4-8             29.0ns ± 0%    28.2ns ± 1%   -2.74%  (p=0.000 n=8+9)
AddrPortString/v6-8             96.0ns ± 0%    65.1ns ± 0%  -32.22%  (p=0.000 n=10+10)
AddrPortString/v6_ellipsis-8    98.5ns ± 0%    68.0ns ± 1%  -30.95%  (p=0.000 n=10+10)
AddrPortString/v6_v4-8          71.8ns ± 1%    33.9ns ± 0%  -52.88%  (p=0.000 n=10+10)
AddrPortString/v6_zone-8        98.5ns ± 0%    68.6ns ± 0%  -30.35%  (p=0.000 n=8+9)

name                          old alloc/op   new alloc/op   delta
AddrPortString/v4-8              24.0B ± 0%     24.0B ± 0%     ~     (all equal)
AddrPortString/v6-8              96.0B ± 0%     48.0B ± 0%  -50.00%  (p=0.000 n=10+10)
AddrPortString/v6_ellipsis-8     56.0B ± 0%     32.0B ± 0%  -42.86%  (p=0.000 n=10+10)
AddrPortString/v6_v4-8           56.0B ± 0%     32.0B ± 0%  -42.86%  (p=0.000 n=10+10)
AddrPortString/v6_zone-8         56.0B ± 0%     32.0B ± 0%  -42.86%  (p=0.000 n=10+10)

name                          old allocs/op  new allocs/op  delta
AddrPortString/v4-8               1.00 ± 0%      1.00 ± 0%     ~     (all equal)
AddrPortString/v6-8               2.00 ± 0%      1.00 ± 0%  -50.00%  (p=0.000 n=10+10)
AddrPortString/v6_ellipsis-8      2.00 ± 0%      1.00 ± 0%  -50.00%  (p=0.000 n=10+10)
AddrPortString/v6_v4-8            2.00 ± 0%      1.00 ± 0%  -50.00%  (p=0.000 n=10+10)
AddrPortString/v6_zone-8          2.00 ± 0%      1.00 ± 0%  -50.00%  (p=0.000 n=10+10)

Change-Id: Iae077c5c80db3d236d7ec9a02d20a96b0e3a96e3
Reviewed-on: https://go-review.googlesource.com/c/go/+/557775
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
15 months agonet: verify if internal/poll.Splice has been called during io.Copy
Andy Pan [Fri, 22 Dec 2023 13:49:46 +0000 (21:49 +0800)]
net: verify if internal/poll.Splice has been called during io.Copy

Change-Id: I29ef35b034cd4ec401ac502bf95dbd8c3ef2a2d4
Reviewed-on: https://go-review.googlesource.com/c/go/+/552535
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
15 months agogo/types, types2: better error msg when type inference fails in a call
Robert Griesemer [Tue, 23 Jan 2024 21:21:19 +0000 (13:21 -0800)]
go/types, types2: better error msg when type inference fails in a call

In Checker.infer, report an error through an (incoming) *error_
so that the error can be reported as desired where infer is called.
Checker.infer is now a pure function.

Fixes #60543.

At call sites of Checker.infer, pass in an *error_ and use it to
report inference errors, together with additional information as
desired.

Fixes #60542.

In go/types, in error_.errorf, pass in a positioner rather than
a token.Pos. Also, introduce noposn, the positioner equivalent
for nopos. Adjust call sites as needed.

Change-Id: I462a7899a77a8bee2a21ba88299df237d74e0672
Reviewed-on: https://go-review.googlesource.com/c/go/+/558035
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
15 months agodoc/go1.22: remove archive/tar.FileInfoNames
Cherry Mui [Wed, 24 Jan 2024 20:24:50 +0000 (15:24 -0500)]
doc/go1.22: remove archive/tar.FileInfoNames

CL 514235 is reverted.

Updates #65245.
Updates #61422.

Change-Id: Ib5d2e16c982ab25c8a87af2bdaee8568446cf599
Reviewed-on: https://go-review.googlesource.com/c/go/+/557840
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>
15 months agoRevert "archive/tar: add FileInfoNames interface"
Cherry Mui [Wed, 24 Jan 2024 20:00:47 +0000 (15:00 -0500)]
Revert "archive/tar: add FileInfoNames interface"

This reverts CL 514235. Also reverts CL 518056 which is a followup
fix.

Reason for revert: Proposal #50102 defined an interface that is
too specific to UNIX-y systems and also didn't make much sense.
The proposal is un-accepted, and we'll revisit in Go 1.23.

Fixes (via backport) #65245.
Updates #50102.

Change-Id: I41ba0ee286c1d893e6564a337e5d76418d19435d
Reviewed-on: https://go-review.googlesource.com/c/go/+/558295
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>
15 months agonet: ignore Dial errors in TestAcceptTimeout
Bryan C. Mills [Tue, 23 Jan 2024 22:08:50 +0000 (17:08 -0500)]
net: ignore Dial errors in TestAcceptTimeout

Also use DialContext instead of just Dial so that we can ensure
the call returns before we close the listener.

The Dial in this test is intended to complete before the call to
Accept, but there is no synchronization to ensure that and sometimes
it doesn't happen. That's ok and mostly immaterial to the test, but it
does mean we need to ignore Dial errors (which can happen when the
listener is closed), and we need to be a little more careful about not
dialing a port that may have already been reused by some other test.

Fixes #65240.
Updates #17948.

Change-Id: Ife1b5c3062939441b58f4c096461bf5d7841889b
Reviewed-on: https://go-review.googlesource.com/c/go/+/558175
Reviewed-by: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
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>

15 months agoreflect: fix isRegularMemory at case Array
Jes Cok [Wed, 24 Jan 2024 12:33:30 +0000 (12:33 +0000)]
reflect: fix isRegularMemory at case Array

To match cmd/compile/internal/compare.IsRegularMemory,
this CL adds code for empty arrays of comparable element type.

Change-Id: I205fb9bfda60be6c9aac2d9098ed3f0eb51cd0fa
GitHub-Last-Rev: 40db7ed510883633374895271145678a51418426
GitHub-Pull-Request: golang/go#65252
Reviewed-on: https://go-review.googlesource.com/c/go/+/558155
Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: qiulaidongfeng <2645477756@qq.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: qiulaidongfeng <2645477756@qq.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

15 months agodoc/next: initial contents
Jonathan Amsterdam [Mon, 22 Jan 2024 18:20:07 +0000 (13:20 -0500)]
doc/next: initial contents

Initialize the doc/next directory for the next release by copying the
contents of doc/initial into it.

Also, rewrite doc/README.md to add release instructions and to separate
information for developers from information for the release team.

Change-Id: Ie1e5c2ddae7a8d301e9b2f8a68925519648aa84d
Reviewed-on: https://go-review.googlesource.com/c/go/+/557535
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>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
15 months agoruntime: short path for equal pointers in arm64 memequal
Mauri de Souza Meneguzzo [Tue, 28 Nov 2023 18:42:43 +0000 (18:42 +0000)]
runtime: short path for equal pointers in arm64 memequal

If memequal is invoked with the same pointers as arguments it ends up
comparing the whole memory contents, instead of just comparing the pointers.

This effectively makes an operation that could be O(1) into O(n). All the
other architectures already have this optimization in place. For
instance, arm64 also have it, in memequal_varlen.

Such optimization is very specific, one case that it will probably benefit is
programs that rely heavily on interning of strings.

goos: darwin
goarch: arm64
pkg: bytes
                 │      old.txt       │               new.txt                │
                 │       sec/op       │    sec/op     vs base                │
Equal/same/1-8           2.678n ± ∞ ¹   2.400n ± ∞ ¹   -10.38% (p=0.008 n=5)
Equal/same/6-8           3.267n ± ∞ ¹   2.431n ± ∞ ¹   -25.59% (p=0.008 n=5)
Equal/same/9-8           2.981n ± ∞ ¹   2.385n ± ∞ ¹   -19.99% (p=0.008 n=5)
Equal/same/15-8          2.974n ± ∞ ¹   2.390n ± ∞ ¹   -19.64% (p=0.008 n=5)
Equal/same/16-8          2.983n ± ∞ ¹   2.380n ± ∞ ¹   -20.21% (p=0.008 n=5)
Equal/same/20-8          3.567n ± ∞ ¹   2.384n ± ∞ ¹   -33.17% (p=0.008 n=5)
Equal/same/32-8          3.568n ± ∞ ¹   2.385n ± ∞ ¹   -33.16% (p=0.008 n=5)
Equal/same/4K-8         78.040n ± ∞ ¹   2.378n ± ∞ ¹   -96.95% (p=0.008 n=5)
Equal/same/4M-8      78713.000n ± ∞ ¹   2.385n ± ∞ ¹  -100.00% (p=0.008 n=5)
Equal/same/64M-8   1348095.000n ± ∞ ¹   2.381n ± ∞ ¹  -100.00% (p=0.008 n=5)
geomean                  43.52n         2.390n         -94.51%
¹ need >= 6 samples for confidence interval at level 0.95

                 │    old.txt    │                     new.txt                      │
                 │      B/s      │         B/s          vs base                     │
Equal/same/1-8     356.1Mi ± ∞ ¹         397.3Mi ± ∞ ¹        +11.57% (p=0.008 n=5)
Equal/same/6-8     1.711Gi ± ∞ ¹         2.298Gi ± ∞ ¹        +34.35% (p=0.008 n=5)
Equal/same/9-8     2.812Gi ± ∞ ¹         3.515Gi ± ∞ ¹        +24.99% (p=0.008 n=5)
Equal/same/15-8    4.698Gi ± ∞ ¹         5.844Gi ± ∞ ¹        +24.41% (p=0.008 n=5)
Equal/same/16-8    4.995Gi ± ∞ ¹         6.260Gi ± ∞ ¹        +25.34% (p=0.008 n=5)
Equal/same/20-8    5.222Gi ± ∞ ¹         7.814Gi ± ∞ ¹        +49.63% (p=0.008 n=5)
Equal/same/32-8    8.353Gi ± ∞ ¹        12.496Gi ± ∞ ¹        +49.59% (p=0.008 n=5)
Equal/same/4K-8    48.88Gi ± ∞ ¹       1603.96Gi ± ∞ ¹      +3181.17% (p=0.008 n=5)
Equal/same/4M-8    49.63Gi ± ∞ ¹    1637911.85Gi ± ∞ ¹   +3300381.91% (p=0.008 n=5)
Equal/same/64M-8   46.36Gi ± ∞ ¹   26253069.97Gi ± ∞ ¹  +56626517.99% (p=0.008 n=5)
geomean            6.737Gi               122.7Gi            +1721.01%
¹ need >= 6 samples for confidence interval at level 0.95

Fixes #64381

Change-Id: I7d423930a688edd88c4ba60d45e097296d9be852
GitHub-Last-Rev: ae8189fafb1cba87b5394f09f971746ae9299273
GitHub-Pull-Request: golang/go#64419
Reviewed-on: https://go-review.googlesource.com/c/go/+/545416
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>

15 months agosrc/cmd/relnote, doc/next: add release note check
Jonathan Amsterdam [Wed, 15 Nov 2023 14:50:01 +0000 (09:50 -0500)]
src/cmd/relnote, doc/next: add release note check

Add a test that every file in api/next has corresponding
release note fragments.

Vendor in golang.org/x/build/relnote, which brings along some other
things.

Modify dist/test.go to configure the test to run on some trybots.

For #64169.

Change-Id: If87d11350ea6b2605bc3ab31c491fa28f1d6ee7d
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/556995
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>
15 months agocmd/go: add GORISCV64 environment variable
Mark Ryan [Tue, 7 Nov 2023 09:09:49 +0000 (10:09 +0100)]
cmd/go: add GORISCV64 environment variable

The variable represents the RISC-V user-mode application profile for
which to compile.  Valid values are rva20u64 (the default) and
rva22u64.

Setting GORISCV64=rva20u64 defines the riscv64.rva20u64 build tag,
sets the internal variable buildcfg.GORISCV64 to 20 and defines the
macro GORISCV64_rva20u64 for use in assembly language code.

Setting GORISCV64=rva22u64 defines the riscv64.rva20u64 and
riscv64.rva22u64 build tags, sets the internal variable
buildcfg.GORISCV64 to 22 and defines the macro GORISCV64_rva22u64
for use in assembly language code.

This patch only provides a mechanism for the compiler and hand-coded
assembly language functions to take advantage of the RISC-V
extensions mandated by the application profiles.  Further patches
will be required to get the compiler/assembler and assembly language
functions to actually generate and use these extensions.

Fixes #61476

Change-Id: I9195ae6ee71703cd2112160e89157ab63b8391af
Reviewed-on: https://go-review.googlesource.com/c/go/+/541135
Reviewed-by: M Zhuo <mengzhuo1203@gmail.com>
Reviewed-by: Joel Sing <joel@sing.id.au>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Wang Yaduo <wangyaduo@linux.alibaba.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: M Zhuo <mengzhuo1203@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

15 months agocmd/go/internal/str,cmd/go/internal/work: remove redundant Contains
apocelipes [Tue, 23 Jan 2024 16:33:12 +0000 (16:33 +0000)]
cmd/go/internal/str,cmd/go/internal/work: remove redundant Contains

"cmd/go/internal/str.Contains" does the same thing as the "slices.Contains".

The name "str.Contains" is also easily confused with "strings.Contains".

Given that the slices package is already used in the package,
replace "str.Contains" with "slices.Contains".

"str.Contains" is no longer used so just remove it.

Change-Id: I80572464bd17d4a60e7ff41db3a77c4d0bd03fa3
GitHub-Last-Rev: e74d333f0fd4b9558382e9dba0f77717089f45a9
GitHub-Pull-Request: golang/go#64136
Reviewed-on: https://go-review.googlesource.com/c/go/+/542416
Auto-Submit: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
15 months agonet,internal/poll: load ws2_32.dll only when net is imported
qmuntal [Fri, 19 Jan 2024 15:27:22 +0000 (16:27 +0100)]
net,internal/poll: load ws2_32.dll only when net is imported

On Windows, ws2_32.dll is loaded and WSA initialized even if websockets
are not used.

This CL delays loading of ws2_32.dll and starting WSA until net is
initialized.

Change-Id: I07ea8241d79709cd4e80d29ba0d792c7444bbfe9
Reviewed-on: https://go-review.googlesource.com/c/go/+/557015
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

15 months agonet: move cgo-using darwin test to separate package
Russ Cox [Tue, 12 Dec 2023 17:53:32 +0000 (12:53 -0500)]
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>

15 months agocmd/go: add test case for issue 64738
Russ Cox [Tue, 19 Dec 2023 14:42:00 +0000 (09:42 -0500)]
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>
15 months agonet: unskip and attempt to deflake TestAcceptTimeout
Bryan C. Mills [Mon, 11 Dec 2023 21:45:04 +0000 (16:45 -0500)]
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>

15 months agointernal/reflectlite: delete TODO pass safe to packEface don't need to copy if safe...
qiulaidongfeng [Sat, 9 Dec 2023 05:50:59 +0000 (05:50 +0000)]
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: cfc39509085477e9cba8e8ba1698653837a12301
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>
15 months agoreflect: delete TODO pass safe to packEface don't need to copy if safe==true
qiulaidongfeng [Tue, 23 Jan 2024 00:42:58 +0000 (00:42 +0000)]
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: 4a6386709817f3ea6055711dd39d2694d58b3043
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>

15 months agonet: report timeouts more aggressively in Accept in the fake implementation
Bryan C. Mills [Mon, 22 Jan 2024 23:02:38 +0000 (18:02 -0500)]
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>
15 months agoruntime,internal/poll: move websocket handling out of the runtime on Windows
qmuntal [Fri, 19 Jan 2024 13:14:17 +0000 (14:14 +0100)]
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>
15 months agofmt: don't pad strings with zeros
Rob Pike [Sun, 14 Jan 2024 04:34:49 +0000 (15:34 +1100)]
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>
15 months agocmd/cgo/internal/test: skip TestCallbackCallersSEH when internal linking
qmuntal [Thu, 18 Jan 2024 06:53:50 +0000 (07:53 +0100)]
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>

15 months agocmd/compile/internal/ssagen,runtime: merge trace consts into internal/abi
qiulaidongfeng [Tue, 9 Jan 2024 11:20:29 +0000 (11:20 +0000)]
cmd/compile/internal/ssagen,runtime: merge trace consts into internal/abi

For #59670

Change-Id: Iec85ee7312bb566b3f1224424f7d27bf4e408b13
GitHub-Last-Rev: c620abf9673e166505821d75717e820776abc302
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>

15 months agoreflect: StructOf set abi.TFlagRegularMemory
qiulaidongfeng [Sat, 6 Jan 2024 07:25:05 +0000 (07:25 +0000)]
reflect: StructOf set abi.TFlagRegularMemory

Complete a TODO.

Change-Id: I791d27266ccee69c371524e298120765f5736cf8
GitHub-Last-Rev: 8878003efa2f9f3d8609b88073c982d21ece774b
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>
15 months agocmd/compile: use MapMaxKeyBytes,MapMaxElemBytes,MapBucketCount of internal/abi
qiulaidongfeng [Sun, 17 Dec 2023 13:04:20 +0000 (13:04 +0000)]
cmd/compile: use MapMaxKeyBytes,MapMaxElemBytes,MapBucketCount of internal/abi

For #59670

Change-Id: I651e211650e69989c598ab16202105bc6e68d67e
GitHub-Last-Rev: fba087a35fa563cba0dc5f70e8c9d9108dc1f1d4
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>

15 months agohash/crc32: fix codegen to align with manual changes
Olivier Mengué [Mon, 15 Jan 2024 23:32:40 +0000 (00:32 +0100)]
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>

15 months agocmd/compile: improve integer comparisons with numeric bounds
Jorropo [Wed, 10 Jan 2024 06:31:57 +0000 (07:31 +0100)]
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>

15 months agocrypto/sha512: provide optimised assembly for riscv64
Joel Sing [Sat, 12 Aug 2023 14:14:58 +0000 (00:14 +1000)]
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>
15 months agoRevert "cmd/preprofile: Add preprocess tool to pre-parse the profile file."
Michael Pratt [Mon, 22 Jan 2024 22:35:04 +0000 (22:35 +0000)]
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>

15 months agoruntime: use the correct M ID for syscalling goroutines in traces
Michael Anthony Knyszek [Mon, 22 Jan 2024 16:34:41 +0000 (16:34 +0000)]
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>

15 months agocmd/preprofile: Add preprocess tool to pre-parse the profile file.
Jin Lin [Wed, 20 Sep 2023 19:22:26 +0000 (12:22 -0700)]
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>
15 months agonet: delete TestListenCloseListen
Bryan C. Mills [Mon, 22 Jan 2024 18:54:56 +0000 (13:54 -0500)]
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>
15 months agonet/mail: properly handle special characters in phrase and obs-phrase
Roland Shoemaker [Wed, 10 Jan 2024 19:02:14 +0000 (11:02 -0800)]
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>

15 months agoruntime: simplify freedefer logic
Austin Clements [Wed, 3 Jan 2024 15:41:09 +0000 (10:41 -0500)]
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>
15 months agoall: update vendored dependencies
Cherry Mui [Mon, 22 Jan 2024 16:47:50 +0000 (11:47 -0500)]
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>

15 months agodoc/initial: initial contents of release notes
Jonathan Amsterdam [Fri, 19 Jan 2024 00:34:48 +0000 (19:34 -0500)]
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>
15 months agocmd/compile: fix typo in comment
Rulin Tang [Tue, 9 Jan 2024 02:39:36 +0000 (02:39 +0000)]
cmd/compile: fix typo in comment

Change-Id: Ie3f1f194489dd4cfd995bfaf292e1c311b37597b
GitHub-Last-Rev: 6a363297785187188923a76456b468ef1bc1a656
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>

15 months agodoc/README.md: explain new release note system
Jonathan Amsterdam [Wed, 15 Nov 2023 13:23:23 +0000 (08:23 -0500)]
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>
15 months agoruntime: avoid loading winmm.dll on newer Windows versions
qmuntal [Fri, 19 Jan 2024 09:59:39 +0000 (10:59 +0100)]
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>
15 months agocmd/compile/internal/ssa: fix typo in sccp
Wingrez [Sun, 21 Jan 2024 09:26:40 +0000 (09:26 +0000)]
cmd/compile/internal/ssa: fix typo in sccp

Change-Id: I7f522a4e1b0c50a469ce948249342d6e7cf7777c
GitHub-Last-Rev: f89d7ee576814c6ebde823b68a0b64bba8c2ad8f
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>

15 months agodoc/go1.22: fix method name in net/netip changes
Tobias Klauser [Wed, 17 Jan 2024 23:29:48 +0000 (00:29 +0100)]
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>

15 months agodoc: remove last TODO item
Carlos Amedee [Mon, 22 Jan 2024 16:30:51 +0000 (11:30 -0500)]
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>

15 months agonet: attempt to deflake TestListenCloseListen
Bryan C. Mills [Sat, 20 Jan 2024 00:05:53 +0000 (19:05 -0500)]
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>

15 months agocmd/link,runtime: merge minfunc const info internal/abi
qiulaidongfeng [Sat, 6 Jan 2024 07:12:43 +0000 (07:12 +0000)]
cmd/link,runtime: merge minfunc const info internal/abi

For #59670

Change-Id: If2b05b1ba30b607b518577b0e11ba5a0b07999c5
GitHub-Last-Rev: a664aa18b5ef674dc2d05c1f7533e1974d265894
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>

15 months agonet/http/pprof: configure WriteDeadline
Alexander Yastrebov [Thu, 23 Nov 2023 12:08:33 +0000 (12:08 +0000)]
net/http/pprof: configure WriteDeadline

Configure write deadline according to requested profiling duration.

Fixes #62358

Change-Id: I2350110ff20a637c7e90bdda57026b0b0d9c87ba
GitHub-Last-Rev: b79ae38defc4d9b58b23a9d13ff86fa863f18b00
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>

15 months agogo/types, types2: typeparams.IndexExpr must not be an ast.Expr
Rob Findley [Sat, 6 Jan 2024 00:19:14 +0000 (19:19 -0500)]
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>

15 months agotime: add a regression test for time.AfterFunc goroutine starvation
Bryan C. Mills [Fri, 19 Jan 2024 22:10:21 +0000 (17:10 -0500)]
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>
15 months agonet: remove an unused sync.Map in the fake net implementation
Bryan C. Mills [Sat, 20 Jan 2024 00:01:54 +0000 (19:01 -0500)]
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>

15 months agonet: work around runtime scheduler starvation on js and wasip1
Bryan C. Mills [Fri, 19 Jan 2024 21:51:24 +0000 (16:51 -0500)]
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>
15 months agoruntime: make a much better effort to emit CPU profile in a trace
Michael Anthony Knyszek [Thu, 11 Jan 2024 21:55:04 +0000 (21:55 +0000)]
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>
15 months agocmd/trace/v2: emit user log annotations in all views
Michael Anthony Knyszek [Fri, 19 Jan 2024 19:25:04 +0000 (19:25 +0000)]
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>
15 months agointernal/goversion: update Version to 1.23
Carlos Amedee [Fri, 19 Jan 2024 18:51:50 +0000 (13:51 -0500)]
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>

15 months agocmd/go/internal/modfetch: set protocol.version=2 for shallow git fetches
Bryan C. Mills [Wed, 17 Jan 2024 20:00:40 +0000 (15:00 -0500)]
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>
15 months agogo/types, types2: fix range clause checks for constant range expressions
Robert Griesemer [Wed, 17 Jan 2024 19:04:11 +0000 (11:04 -0800)]
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>
15 months agodoc/go1.22: document net/netip changes
Damien Neil [Wed, 17 Jan 2024 19:59:10 +0000 (11:59 -0800)]
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>
15 months agodoc/go1.22: document net/http/cgi changes
Damien Neil [Wed, 17 Jan 2024 19:03:15 +0000 (11:03 -0800)]
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>
15 months agoruntime: document GODEBUG panicnil values
Cuong Manh Le [Mon, 23 Oct 2023 03:56:57 +0000 (10:56 +0700)]
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>

15 months agoruntime: skip test if strace crashes
Austin Clements [Wed, 17 Jan 2024 19:24:06 +0000 (14:24 -0500)]
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>

15 months agoruntime: mark TestGdbCoreCrashThreadBacktrace as flaky
Michael Pratt [Wed, 17 Jan 2024 18:44:44 +0000 (13:44 -0500)]
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>