]> Cypherpunks.ru repositories - gostls13.git/log
gostls13.git
5 months agodoc: changes for loong64 linux port
David Chase [Tue, 5 Dec 2023 21:11:20 +0000 (16:11 -0500)]
doc: changes for loong64 linux port

register abi, memory sanitizer, new relocations, buildmode=plugin

Change-Id: Ib7f023f61be26fc1369a3db454f6d8828e5b5b33
Reviewed-on: https://go-review.googlesource.com/c/go/+/547638
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

5 months agoruntime/pprof: add section headers to Profile doc
Michael Pratt [Wed, 6 Dec 2023 17:34:02 +0000 (12:34 -0500)]
runtime/pprof: add section headers to Profile doc

Adding explicit section headers makes it cleaner to split the profile
descriptions into multiple paragraphs, as there is now an explicit
transition from discussion of one profile type to the next.

For #14689.

Change-Id: Ifcff918367e91a165ee5f74423be3935b421972b
Reviewed-on: https://go-review.googlesource.com/c/go/+/547955
Reviewed-by: Rhys Hiltner <rhys@justin.tv>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Pratt <mpratt@google.com>

5 months agodoc: add STW metrics to release notes
Michael Pratt [Mon, 4 Dec 2023 22:31:58 +0000 (17:31 -0500)]
doc: add STW metrics to release notes

For #63340.
For #61422.

Change-Id: Ib74bb54b0450e96b7f4b7eb7ba2ae7ac2d40171a
Reviewed-on: https://go-review.googlesource.com/c/go/+/547095
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
5 months agodoc: add release notes for runtime-internal contention
Michael Pratt [Mon, 4 Dec 2023 21:45:33 +0000 (16:45 -0500)]
doc: add release notes for runtime-internal contention

For #57071.
For #61422.

Change-Id: I5d546d8828be897cb087e85a1251213c582b3894
Reviewed-on: https://go-review.googlesource.com/c/go/+/547059
Reviewed-by: Rhys Hiltner <rhys@justin.tv>
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>
5 months agodoc: document runtimecontentionstacks
Michael Pratt [Mon, 4 Dec 2023 20:43:41 +0000 (15:43 -0500)]
doc: document runtimecontentionstacks

For #57071.

Change-Id: Ic1645af57aa589917c67154a5e4ad0b4edd7ba90
Reviewed-on: https://go-review.googlesource.com/c/go/+/547058
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Rhys Hiltner <rhys@justin.tv>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Pratt <mpratt@google.com>

5 months agoruntime/pprof: document block and mutex profiles
Michael Pratt [Mon, 4 Dec 2023 20:13:13 +0000 (15:13 -0500)]
runtime/pprof: document block and mutex profiles

Amazingly, we seem to have nearly no in-tree documentation on the
semantics of block and mutex profiles. Add brief summaries, including
the new behavior from CL 506415 and CL 544195.

For #14689.
For #44920.
For #57071.
For #61015.

Change-Id: I1a6edce7c434fcb43f17c83eb362b1f9d1a32df1
Reviewed-on: https://go-review.googlesource.com/c/go/+/547057
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Rhys Hiltner <rhys@justin.tv>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
5 months agogover: support Semantic Versioning major versions beyond 1
lotusirous [Mon, 13 Nov 2023 15:03:09 +0000 (22:03 +0700)]
gover: support Semantic Versioning major versions beyond 1

For #64033

Change-Id: Iab132f86c66aa6115a349d8032e9766a14dad02e
Reviewed-on: https://go-review.googlesource.com/c/go/+/541915
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>

5 months agoiter, runtime: add coroutine support
Russ Cox [Mon, 20 Nov 2023 00:22:48 +0000 (11:22 +1100)]
iter, runtime: add coroutine support

The exported API is only available with GOEXPERIMENT=rangefunc.
This will let Go 1.22 users who want to experiment with rangefuncs
access an efficient implementation of iter.Pull and iter.Pull2.

For #61897.

Change-Id: I6ef5fa8f117567efe4029b7b8b0f4d9b85697fb7
Reviewed-on: https://go-review.googlesource.com/c/go/+/543319
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

5 months agodoc/go1.22: mention new #vet analyzer
cui fliter [Sat, 7 Oct 2023 08:13:04 +0000 (16:13 +0800)]
doc/go1.22: mention new #vet analyzer

Change-Id: Ib135101bc8adbdb158c5e98bcca14e13d7ac963b
Reviewed-on: https://go-review.googlesource.com/c/go/+/533555
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Run-TryBot: Tim King <taking@google.com>
Reviewed-by: Tim King <taking@google.com>
5 months agocmd/go/internal/modfetch/codehost: add new git tags before statLocal instead of after
Bryan C. Mills [Mon, 4 Dec 2023 23:29:35 +0000 (18:29 -0500)]
cmd/go/internal/modfetch/codehost: add new git tags before statLocal instead of after

gitRepo.statLocal reports tag and version information.
If we are statting a hash that corresponds to a tag, we need to add that tag
before calling statLocal so that it can be included in that information.

Fixes #53955.
Updates #56881.

Change-Id: I69a71428e6ed9096d4cb8ed1bb79531415ff06c1
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/547155
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>
5 months agoruntime/metrics: document runtime-internal locks in /sync/mutex/wait/total:seconds
Michael Pratt [Mon, 4 Dec 2023 20:12:25 +0000 (15:12 -0500)]
runtime/metrics: document runtime-internal locks in /sync/mutex/wait/total:seconds

For #57071.

Change-Id: I7ce6c35bed95a6ea3cdc17007f861c5dd82404d2
Reviewed-on: https://go-review.googlesource.com/c/go/+/547056
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Rhys Hiltner <rhys@justin.tv>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

5 months agoruntime: rename GODEBUG=profileruntimelocks to runtimecontentionstacks
Michael Pratt [Mon, 4 Dec 2023 19:28:30 +0000 (14:28 -0500)]
runtime: rename GODEBUG=profileruntimelocks to runtimecontentionstacks

profileruntimelocks is new in CL 544195, but the name is deceptive. Even
with profileruntimelocks=0, runtime-internal locks are still profiled.
The actual difference is that call stacks are not collected. Instead all
contention is reported at runtime._LostContendedLock.

Rename this setting to runtimecontentionstacks to make its name more
aligned with its behavior.

In addition, for this release the default is profileruntimelocks=0,
meaning that users are fairly likely to encounter
runtime._LostContendedLock. Rename it to
runtime._LostContendedRuntimeLock in an attempt to make it more
intuitive that these are runtime locks, not locks in application code.

For #57071.

Change-Id: I38aac28b2c0852db643d53b1eab3f3bc42a43393
Reviewed-on: https://go-review.googlesource.com/c/go/+/547055
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Rhys Hiltner <rhys@justin.tv>
5 months agocmd/go: use local go cache for cover_statements script test
Than McIntosh [Mon, 27 Nov 2023 17:24:59 +0000 (12:24 -0500)]
cmd/go: use local go cache for cover_statements script test

Use a test-local directory for GOCACHE in "cover_statements" script
test, as a workaround for issue 64014.

For the portion of this test that verifies that caching works
correctly, the cache should theoretically always behave
reliably/deterministically, however if other tests are concurrently
accessing the cache while this test is running, it can lead to cache
lookup failures, which manifest as a flaky failure. To avoid such
flakes, use a separate isolated GOCACHE for this test.

For #64014.

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest
Change-Id: Ia66798215a75b7c41188ed15920c17b73f40152a
Reviewed-on: https://go-review.googlesource.com/c/go/+/545235
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
5 months agodoc/go1.22: document linker flag changes
Cherry Mui [Tue, 5 Dec 2023 17:36:13 +0000 (12:36 -0500)]
doc/go1.22: document linker flag changes

Updates #41004.
For #61422.

Change-Id: I5ab60d8e9d30986233d7adec400ef059bbe4c1a9
Reviewed-on: https://go-review.googlesource.com/c/go/+/547515
Reviewed-by: Than McIntosh <thanm@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

5 months agocrypto/x509: revert Policies marshaling behavior
Roland Shoemaker [Mon, 4 Dec 2023 18:00:41 +0000 (10:00 -0800)]
crypto/x509: revert Policies marshaling behavior

Don't marshal Policies field.

Updates #64248

Change-Id: I7e6d8b9ff1b3698bb4f585fa82fc4050eff3ae4d
Reviewed-on: https://go-review.googlesource.com/c/go/+/546915
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
5 months agodoc: add release note on coverage testing of no-test packages
Than McIntosh [Tue, 5 Dec 2023 20:15:06 +0000 (15:15 -0500)]
doc: add release note on coverage testing of no-test packages

Add a small release note blurb to describe the changes in CL 495447
relating to "go test -cover" runs on packages with functions but no
tests.

For #61422.

Change-Id: Ib8163ac70b902f0d7f9f470b944e7f70711e3cf3
Reviewed-on: https://go-review.googlesource.com/c/go/+/547635
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Than McIntosh <thanm@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

5 months agodoc: document new cmp.Or function
khr@golang.org [Tue, 5 Dec 2023 22:54:10 +0000 (22:54 +0000)]
doc: document new cmp.Or function

Change-Id: I41ea06018daae2c929edc24a714007cede9296ed
Reviewed-on: https://go-review.googlesource.com/c/go/+/547756
TryBot-Bypass: Keith Randall <khr@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
5 months agodoc: add release notes for changes to encoding packages
Robert Griesemer [Tue, 5 Dec 2023 21:40:45 +0000 (13:40 -0800)]
doc: add release notes for changes to encoding packages

For #53693.

Change-Id: I360f5cb9caf5fa77267a100eebcc282955677abe
Reviewed-on: https://go-review.googlesource.com/c/go/+/547755
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
TryBot-Bypass: Robert Griesemer <gri@google.com>

5 months agodoc: add release note for new go/version package
Robert Griesemer [Tue, 5 Dec 2023 21:01:30 +0000 (13:01 -0800)]
doc: add release note for new go/version package

For #62039.

Change-Id: Id19a4c06489ad24dc44c7caf2405d155d96c6fcb
Reviewed-on: https://go-review.googlesource.com/c/go/+/547695
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Bypass: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>

5 months agodoc: re-arrange release notes for go/types
Robert Griesemer [Mon, 4 Dec 2023 21:31:23 +0000 (13:31 -0800)]
doc: re-arrange release notes for go/types

Better order in description of changes to go/types.
Move go/types section up so it's in alphabetical order again.
No changes to actual content.

Change-Id: If2f085b665b412489e5dfdba79b7f93598ff2785
Reviewed-on: https://go-review.googlesource.com/c/go/+/546359
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
TryBot-Bypass: Robert Griesemer <gri@google.com>

5 months agodoc: add release note for go/types.Alias type and Unalias function
Robert Griesemer [Mon, 4 Dec 2023 21:24:13 +0000 (13:24 -0800)]
doc: add release note for go/types.Alias type and Unalias function

Also, add some missing <code></code> tags.

For #63223.

Change-Id: I570b82be830b3c124420c5715ab1165ca53725f9
Reviewed-on: https://go-review.googlesource.com/c/go/+/546358
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Bypass: Robert Griesemer <gri@google.com>

5 months agodoc: add release note for go/types/PkgNameOf
Robert Griesemer [Mon, 4 Dec 2023 20:35:35 +0000 (12:35 -0800)]
doc: add release note for go/types/PkgNameOf

For #62037.

Change-Id: Id1d02f88205e5ea62662e78c8313731ec9e55b1e
Reviewed-on: https://go-review.googlesource.com/c/go/+/546975
Reviewed-by: Alan Donovan <adonovan@google.com>
TryBot-Bypass: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>

5 months agodoc: add release note for changes to go/types/SizesFor
Robert Griesemer [Mon, 4 Dec 2023 19:38:50 +0000 (11:38 -0800)]
doc: add release note for changes to go/types/SizesFor

For #61035.

Change-Id: I27e2c44f9275b508d9dccc50da80896384a4c8fc
Reviewed-on: https://go-review.googlesource.com/c/go/+/546837
TryBot-Bypass: Robert Griesemer <gri@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>

5 months agodoc: add release note for go/types.Info.FileVersions
Robert Griesemer [Mon, 4 Dec 2023 19:13:32 +0000 (11:13 -0800)]
doc: add release note for go/types.Info.FileVersions

For #62605.

Change-Id: I3c06b835c874c1be5aa5293e3906bdd06c021d87
Reviewed-on: https://go-review.googlesource.com/c/go/+/546836
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Bypass: Robert Griesemer <gri@google.com>

5 months agocmd/compile: fix escape analysis of string min/max
Matthew Dempsky [Tue, 5 Dec 2023 20:56:04 +0000 (12:56 -0800)]
cmd/compile: fix escape analysis of string min/max

When I was plumbing min/max support through the compiler, I was
thinking mostly about numeric argument types. As a result, I forgot
that escape analysis would need to be aware that min/max can operate
on string values, which contain pointers.

Fixes #64565.

Change-Id: I36127ce5a2da942401910fa0f9de922726c9f94d
Reviewed-on: https://go-review.googlesource.com/c/go/+/547715
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

5 months agodoc/go1.22: document ast.Object deprecation
Alan Donovan [Tue, 5 Dec 2023 20:16:18 +0000 (15:16 -0500)]
doc/go1.22: document ast.Object deprecation

The api.txt changes were originally recorded by mistake (sorry)
into go1.21.txt; see CL 504915, which made the actual change
in August.

Change-Id: If46b48d9714f01605888a6e975c1a03ccfce3b3e
Reviewed-on: https://go-review.googlesource.com/c/go/+/547637
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Commit-Queue: Alan Donovan <adonovan@google.com>

5 months agodoc/go_spec.html: rename golang.org to go.dev
Alan Donovan [Tue, 5 Dec 2023 19:22:53 +0000 (14:22 -0500)]
doc/go_spec.html: rename golang.org to go.dev

Fixes #64513

Change-Id: I45d6a4ba2170308260f3b8f7965affc9948f3fcf
Reviewed-on: https://go-review.googlesource.com/c/go/+/547476
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>
Auto-Submit: Alan Donovan <adonovan@google.com>

5 months agomath/rand, math/rand/v2: use ChaCha8 for global rand
Russ Cox [Sun, 6 Aug 2023 03:26:28 +0000 (13:26 +1000)]
math/rand, math/rand/v2: use ChaCha8 for global rand

Move ChaCha8 code into internal/chacha8rand and use it to implement
runtime.rand, which is used for the unseeded global source for
both math/rand and math/rand/v2. This also affects the calculation of
the start point for iteration over very very large maps (when the
32-bit fastrand is not big enough).

The benefit is that misuse of the global random number generators
in math/rand and math/rand/v2 in contexts where non-predictable
randomness is important for security reasons is no longer a
security problem, removing a common mistake among programmers
who are unaware of the different kinds of randomness.

The cost is an extra 304 bytes per thread stored in the m struct
plus 2-3ns more per random uint64 due to the more sophisticated
algorithm. Using PCG looks like it would cost about the same,
although I haven't benchmarked that.

Before this, the math/rand and math/rand/v2 global generator
was wyrand (https://github.com/wangyi-fudan/wyhash).
For math/rand, using wyrand instead of the Mitchell/Reeds/Thompson
ALFG was justifiable, since the latter was not any better.
But for math/rand/v2, the global generator really should be
at least as good as one of the well-studied, specific algorithms
provided directly by the package, and it's not.

(Wyrand is still reasonable for scheduling and cache decisions.)

Good randomness does have a cost: about twice wyrand.

Also rationalize the various runtime rand references.

goos: linux
goarch: amd64
pkg: math/rand/v2
cpu: AMD Ryzen 9 7950X 16-Core Processor
                        │ bbb48afeb7.amd64 │           5cf807d1ea.amd64           │
                        │      sec/op      │    sec/op     vs base                │
ChaCha8-32                     1.862n ± 2%    1.861n ± 2%        ~ (p=0.825 n=20)
PCG_DXSM-32                    1.471n ± 1%    1.460n ± 2%        ~ (p=0.153 n=20)
SourceUint64-32                1.636n ± 2%    1.582n ± 1%   -3.30% (p=0.000 n=20)
GlobalInt64-32                 2.087n ± 1%    3.663n ± 1%  +75.54% (p=0.000 n=20)
GlobalInt64Parallel-32        0.1042n ± 1%   0.2026n ± 1%  +94.48% (p=0.000 n=20)
GlobalUint64-32                2.263n ± 2%    3.724n ± 1%  +64.57% (p=0.000 n=20)
GlobalUint64Parallel-32       0.1019n ± 1%   0.1973n ± 1%  +93.67% (p=0.000 n=20)
Int64-32                       1.771n ± 1%    1.774n ± 1%        ~ (p=0.449 n=20)
Uint64-32                      1.863n ± 2%    1.866n ± 1%        ~ (p=0.364 n=20)
GlobalIntN1000-32              3.134n ± 3%    4.730n ± 2%  +50.95% (p=0.000 n=20)
IntN1000-32                    2.489n ± 1%    2.489n ± 1%        ~ (p=0.683 n=20)
Int64N1000-32                  2.521n ± 1%    2.516n ± 1%        ~ (p=0.394 n=20)
Int64N1e8-32                   2.479n ± 1%    2.478n ± 2%        ~ (p=0.743 n=20)
Int64N1e9-32                   2.530n ± 2%    2.514n ± 2%        ~ (p=0.193 n=20)
Int64N2e9-32                   2.501n ± 1%    2.494n ± 1%        ~ (p=0.616 n=20)
Int64N1e18-32                  3.227n ± 1%    3.205n ± 1%        ~ (p=0.101 n=20)
Int64N2e18-32                  3.647n ± 1%    3.599n ± 1%        ~ (p=0.019 n=20)
Int64N4e18-32                  5.135n ± 1%    5.069n ± 2%        ~ (p=0.034 n=20)
Int32N1000-32                  2.657n ± 1%    2.637n ± 1%        ~ (p=0.180 n=20)
Int32N1e8-32                   2.636n ± 1%    2.636n ± 1%        ~ (p=0.763 n=20)
Int32N1e9-32                   2.660n ± 2%    2.638n ± 1%        ~ (p=0.358 n=20)
Int32N2e9-32                   2.662n ± 2%    2.618n ± 2%        ~ (p=0.064 n=20)
Float32-32                     2.272n ± 2%    2.239n ± 2%        ~ (p=0.194 n=20)
Float64-32                     2.272n ± 1%    2.286n ± 2%        ~ (p=0.763 n=20)
ExpFloat64-32                  3.762n ± 1%    3.744n ± 1%        ~ (p=0.171 n=20)
NormFloat64-32                 3.706n ± 1%    3.655n ± 2%        ~ (p=0.066 n=20)
Perm3-32                       32.93n ± 3%    34.62n ± 1%   +5.13% (p=0.000 n=20)
Perm30-32                      202.9n ± 1%    204.0n ± 1%        ~ (p=0.482 n=20)
Perm30ViaShuffle-32            115.0n ± 1%    114.9n ± 1%        ~ (p=0.358 n=20)
ShuffleOverhead-32             112.8n ± 1%    112.7n ± 1%        ~ (p=0.692 n=20)
Concurrent-32                  2.107n ± 0%    3.725n ± 1%  +76.75% (p=0.000 n=20)

goos: darwin
goarch: arm64
pkg: math/rand/v2
                       │ bbb48afeb7.arm64 │           5cf807d1ea.arm64            │
                       │      sec/op      │    sec/op     vs base                 │
ChaCha8-8                     2.480n ± 0%    2.429n ± 0%    -2.04% (p=0.000 n=20)
PCG_DXSM-8                    2.531n ± 0%    2.530n ± 0%         ~ (p=0.877 n=20)
SourceUint64-8                2.534n ± 0%    2.533n ± 0%         ~ (p=0.732 n=20)
GlobalInt64-8                 2.172n ± 1%    4.794n ± 0%  +120.67% (p=0.000 n=20)
GlobalInt64Parallel-8        0.4320n ± 0%   0.9605n ± 0%  +122.32% (p=0.000 n=20)
GlobalUint64-8                2.182n ± 0%    4.770n ± 0%  +118.58% (p=0.000 n=20)
GlobalUint64Parallel-8       0.4307n ± 0%   0.9583n ± 0%  +122.51% (p=0.000 n=20)
Int64-8                       4.107n ± 0%    4.104n ± 0%         ~ (p=0.416 n=20)
Uint64-8                      4.080n ± 0%    4.080n ± 0%         ~ (p=0.052 n=20)
GlobalIntN1000-8              2.814n ± 2%    5.643n ± 0%  +100.50% (p=0.000 n=20)
IntN1000-8                    4.141n ± 0%    4.139n ± 0%         ~ (p=0.140 n=20)
Int64N1000-8                  4.140n ± 0%    4.140n ± 0%         ~ (p=0.313 n=20)
Int64N1e8-8                   4.140n ± 0%    4.139n ± 0%         ~ (p=0.103 n=20)
Int64N1e9-8                   4.139n ± 0%    4.140n ± 0%         ~ (p=0.761 n=20)
Int64N2e9-8                   4.140n ± 0%    4.140n ± 0%         ~ (p=0.636 n=20)
Int64N1e18-8                  5.266n ± 0%    5.326n ± 1%    +1.14% (p=0.001 n=20)
Int64N2e18-8                  6.052n ± 0%    6.167n ± 0%    +1.90% (p=0.000 n=20)
Int64N4e18-8                  8.826n ± 0%    9.051n ± 0%    +2.55% (p=0.000 n=20)
Int32N1000-8                  4.127n ± 0%    4.132n ± 0%    +0.12% (p=0.000 n=20)
Int32N1e8-8                   4.126n ± 0%    4.131n ± 0%    +0.12% (p=0.000 n=20)
Int32N1e9-8                   4.127n ± 0%    4.132n ± 0%    +0.12% (p=0.000 n=20)
Int32N2e9-8                   4.132n ± 0%    4.131n ± 0%         ~ (p=0.017 n=20)
Float32-8                     4.109n ± 0%    4.105n ± 0%         ~ (p=0.379 n=20)
Float64-8                     4.107n ± 0%    4.106n ± 0%         ~ (p=0.867 n=20)
ExpFloat64-8                  5.339n ± 0%    5.383n ± 0%    +0.82% (p=0.000 n=20)
NormFloat64-8                 5.735n ± 0%    5.737n ± 1%         ~ (p=0.856 n=20)
Perm3-8                       26.65n ± 0%    26.80n ± 1%    +0.58% (p=0.000 n=20)
Perm30-8                      194.8n ± 1%    197.0n ± 0%    +1.18% (p=0.000 n=20)
Perm30ViaShuffle-8            156.6n ± 0%    157.6n ± 1%    +0.61% (p=0.000 n=20)
ShuffleOverhead-8             124.9n ± 0%    125.5n ± 0%    +0.52% (p=0.000 n=20)
Concurrent-8                  2.434n ± 3%    5.066n ± 0%  +108.09% (p=0.000 n=20)

goos: linux
goarch: 386
pkg: math/rand/v2
cpu: AMD Ryzen 9 7950X 16-Core Processor
                        │ bbb48afeb7.386 │            5cf807d1ea.386             │
                        │     sec/op     │    sec/op     vs base                 │
ChaCha8-32                  11.295n ± 1%    4.748n ± 2%   -57.96% (p=0.000 n=20)
PCG_DXSM-32                  7.693n ± 1%    7.738n ± 2%         ~ (p=0.542 n=20)
SourceUint64-32              7.658n ± 2%    7.622n ± 2%         ~ (p=0.344 n=20)
GlobalInt64-32               3.473n ± 2%    7.526n ± 2%  +116.73% (p=0.000 n=20)
GlobalInt64Parallel-32      0.3198n ± 0%   0.5444n ± 0%   +70.22% (p=0.000 n=20)
GlobalUint64-32              3.612n ± 0%    7.575n ± 1%  +109.69% (p=0.000 n=20)
GlobalUint64Parallel-32     0.3168n ± 0%   0.5403n ± 0%   +70.51% (p=0.000 n=20)
Int64-32                     7.673n ± 2%    7.789n ± 1%         ~ (p=0.122 n=20)
Uint64-32                    7.773n ± 1%    7.827n ± 2%         ~ (p=0.920 n=20)
GlobalIntN1000-32            6.268n ± 1%    9.581n ± 1%   +52.87% (p=0.000 n=20)
IntN1000-32                  10.33n ± 2%    10.45n ± 1%         ~ (p=0.233 n=20)
Int64N1000-32                10.98n ± 2%    11.01n ± 1%         ~ (p=0.401 n=20)
Int64N1e8-32                 11.19n ± 2%    10.97n ± 1%         ~ (p=0.033 n=20)
Int64N1e9-32                 11.06n ± 1%    11.08n ± 1%         ~ (p=0.498 n=20)
Int64N2e9-32                 11.10n ± 1%    11.01n ± 2%         ~ (p=0.995 n=20)
Int64N1e18-32                15.23n ± 2%    15.04n ± 1%         ~ (p=0.973 n=20)
Int64N2e18-32                15.89n ± 1%    15.85n ± 1%         ~ (p=0.409 n=20)
Int64N4e18-32                18.96n ± 2%    19.34n ± 2%         ~ (p=0.048 n=20)
Int32N1000-32                10.46n ± 2%    10.44n ± 2%         ~ (p=0.480 n=20)
Int32N1e8-32                 10.46n ± 2%    10.49n ± 2%         ~ (p=0.951 n=20)
Int32N1e9-32                 10.28n ± 2%    10.26n ± 1%         ~ (p=0.431 n=20)
Int32N2e9-32                 10.50n ± 2%    10.44n ± 2%         ~ (p=0.249 n=20)
Float32-32                   13.80n ± 2%    13.80n ± 2%         ~ (p=0.751 n=20)
Float64-32                   23.55n ± 2%    23.87n ± 0%         ~ (p=0.408 n=20)
ExpFloat64-32                15.36n ± 1%    15.29n ± 2%         ~ (p=0.316 n=20)
NormFloat64-32               13.57n ± 1%    13.79n ± 1%    +1.66% (p=0.005 n=20)
Perm3-32                     45.70n ± 2%    46.99n ± 2%    +2.81% (p=0.001 n=20)
Perm30-32                    399.0n ± 1%    403.8n ± 1%    +1.19% (p=0.006 n=20)
Perm30ViaShuffle-32          349.0n ± 1%    350.4n ± 1%         ~ (p=0.909 n=20)
ShuffleOverhead-32           322.3n ± 1%    323.8n ± 1%         ~ (p=0.410 n=20)
Concurrent-32                3.331n ± 1%    7.312n ± 1%  +119.50% (p=0.000 n=20)

For #61716.

Change-Id: Ibdddeed85c34d9ae397289dc899e04d4845f9ed2
Reviewed-on: https://go-review.googlesource.com/c/go/+/516860
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

5 months agomath/rand/v2: add ChaCha8
Russ Cox [Thu, 30 Nov 2023 17:25:43 +0000 (12:25 -0500)]
math/rand/v2: add ChaCha8

This is a replay of CL 516859, after its rollback in CL 543895,
with big-endian systems fixed and the tests disabled on RISC-V
since the compiler is broken there (#64285).

ChaCha8 provides a cryptographically strong generator
alongside PCG, so that people who want stronger randomness
have access to that. On systems with 128-bit vector math
assembly (amd64 and arm64), ChaCha8 runs at about the same
speed as PCG (25% slower on amd64, 2% faster on arm64).

Fixes #64284.

Change-Id: I6290bb8ace28e1aff9a61f805dbe380ccdf25b94
Reviewed-on: https://go-review.googlesource.com/c/go/+/546020
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

5 months agointernal/trace/v2: handle thread ID reuse correctly
Michael Anthony Knyszek [Wed, 29 Nov 2023 22:18:32 +0000 (22:18 +0000)]
internal/trace/v2: handle thread ID reuse correctly

To begin with, CL 545515 made the trace parser tolerant of
GoCreateSyscall having a P, but that was wrong. Because dropm trashes
the M's syscalltick, that case should never be possible. So the first
thing this change does is it rewrites the test that CL introduced to
expect a failure instead of a success.

What I'd misinterpreted as a case that should be allowed was actually
the same as the other issues causing #64060, which is that the parser
doesn't correctly implement what happens to Ps when a thread calls back
into Go on non-pthread platforms, and what happens when a thread dies
on pthread platorms (or more succinctly, what the runtime does when it
calls dropm).

Specifically, the GoDestroySyscall event implies that if any P is still
running on that M when it's called, that the P stops running. This is
what is intended by the runtime trashing the M's syscalltick; when it
calls back into Go, the tracer models that thread as obtaining a new P
from scratch.

Handling this incorrectly manifests in one of two ways.

On pthread platforms, GoDestroySyscall is only emitted when a C thread
that previously called into Go is destroyed. However, that thread ID can
be reused. Because we have no thread events, whether it's the same
thread or not is totally ambiguous to the tracer. Therefore, the tracer
may observe a thread that previously died try to start running with a
new P under the same identity. The association to the old P is still
intact because the ID is the same, and the tracer gets confused -- it
appears as if two Ps are running on the same M!

On non-pthread platforms, GoDestroySyscall is emitted on every return to
C from Go code. In this case, the same thread with the same identity is
naturally going to keep calling back into Go. But again, since the
runtime trashes syscalltick in dropm, it's always going to acquire a P
from the tracer's perspective. But if this is a different P than before,
just like the pthread case, the parser is going to get confused, since
it looks like two Ps are running on the same M!

The case that CL 545515 actually handled was actually the non-pthread
case, specifically where the same P is reacquired by an M calling back
into Go. In this case, if we tolerate having a P, then what we'll
observe is the M stealing its own P from itself, then running with it.

Now that we know what the problem is, how do we fix it? This change
addresses the problem by emitting an extra event when encountering a
GoDestroySyscall with an active P in its context. In this case, it emits
an additional ProcSteal event to steal from itself, indicating that the
P stopped running. This removes any association between that M and that
P, resolving any ambiguity in the tracer.

There's one other minor detail that needs to be worked out, and that's
what happens to any *real* ProcSteal event that stole the P we're now
emitting an extra ProcSteal event for. Since, this event is going to
look for an M that may have moved on already and the P at this point is
already idle. Luckily, we have *exactly* the right fix for this. The
handler for GoDestroySyscall now moves any active P it has to the
ProcSyscallAbandoned state, indicating that we've lost information about
the P and that it should be treated as already idle. Conceptually this
all makes sense: this is a P in _Psyscall that has been abandoned by the
M it was previously bound to.

It's unfortunate how complicated this has all ended up being, but we can
take a closer look at that in the future.

Fixes #64060.

Change-Id: Ie9e6eb9cf738607617446e3487392643656069a2
Reviewed-on: https://go-review.googlesource.com/c/go/+/546096
Reviewed-by: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>

5 months agoruntime: add the disablethp GODEBUG setting
Michael Anthony Knyszek [Tue, 5 Dec 2023 17:31:34 +0000 (17:31 +0000)]
runtime: add the disablethp GODEBUG setting

Go 1.21.1 and Go 1.22 have ceased working around an issue with Linux
kernel defaults for transparent huge pages that can result in excessive
memory overheads. (https://bugzilla.kernel.org/show_bug.cgi?id=93111)

Many Linux distributions disable huge pages altogether these days, so
this problem isn't quite as far-reaching as it used to be. Also, the
problem only affects Go programs with very particular memory usage
patterns.

That being said, because the runtime used to actively deal with this
problem (but with some unpredictable behavior), it's preventing users
that don't have a lot of control over their execution environment from
upgrading to Go beyond Go 1.20.

This change adds a GODEBUG to smooth over the transition. The GODEBUG
setting disables transparent huge pages for all heap memory on Linux,
which is much more predictable than restoring the old behavior.

Fixes #64332.

Change-Id: I73b1894337f0f0b1a5a17b90da1221e118e0b145
Reviewed-on: https://go-review.googlesource.com/c/go/+/547475
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>

5 months agodoc/go1.22: document enabling PIE by default on darwin/amd64
Cherry Mui [Tue, 5 Dec 2023 17:30:19 +0000 (12:30 -0500)]
doc/go1.22: document enabling PIE by default on darwin/amd64

Updates #61229.
For #61422.

Change-Id: I6cf8169c1e310e0de734250dbe04fb36e14728d9
Reviewed-on: https://go-review.googlesource.com/c/go/+/547455
Reviewed-by: Than McIntosh <thanm@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

5 months agodoc: add release note for math/big.Rat.FloatPrec
Robert Griesemer [Mon, 4 Dec 2023 18:45:50 +0000 (10:45 -0800)]
doc: add release note for math/big.Rat.FloatPrec

For #50489.

Change-Id: I4544a24327196eb3ed62af64ae5ddb1f60441d12
Reviewed-on: https://go-review.googlesource.com/c/go/+/546357
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Bypass: Robert Griesemer <gri@google.com>

5 months agolog/slog: correct doc examples for Handler.WithGroup
Jes Cok [Tue, 5 Dec 2023 04:12:45 +0000 (04:12 +0000)]
log/slog: correct doc examples for Handler.WithGroup

Fixes #64519

Change-Id: Iaea5de74402b77eb5a42979bd3baa1276b13d585
GitHub-Last-Rev: 5080a257b2d7aa7c4333d05bdef0b5dcbb0449ed
GitHub-Pull-Request: golang/go#64551
Reviewed-on: https://go-review.googlesource.com/c/go/+/547215
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Run-TryBot: Jes Cok <xigua67damn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

5 months agonet/http: limit chunked data overhead
Damien Neil [Tue, 7 Nov 2023 18:47:56 +0000 (10:47 -0800)]
net/http: limit chunked data overhead

The chunked transfer encoding adds some overhead to
the content transferred. When writing one byte per
chunk, for example, there are five bytes of overhead
per byte of data transferred: "1\r\nX\r\n" to send "X".

Chunks may include "chunk extensions",
which we skip over and do not use.
For example: "1;chunk extension here\r\nX\r\n".

A malicious sender can use chunk extensions to add
about 4k of overhead per byte of data.
(The maximum chunk header line size we will accept.)

Track the amount of overhead read in chunked data,
and produce an error if it seems excessive.

Fixes #64433
Fixes CVE-2023-39326

Change-Id: I40f8d70eb6f9575fb43f506eb19132ccedafcf39
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/2076135
Reviewed-by: Tatiana Bradley <tatianabradley@google.com>
Reviewed-by: Roland Shoemaker <bracewell@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/547335
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>

5 months agomaps: fix aliasing problems with Clone
Keith Randall [Fri, 1 Dec 2023 06:59:04 +0000 (22:59 -0800)]
maps: fix aliasing problems with Clone

Make sure to alloc+copy large keys and values instead of aliasing them,
when they might be updated by a future assignment.

Fixes #64474

Change-Id: Ie2226a81cf3897e4e2ee24472f2966d397ace53f
Reviewed-on: https://go-review.googlesource.com/c/go/+/546515
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
5 months agoruntime: require cgo for cgo gdb test
Michael Pratt [Mon, 4 Dec 2023 22:47:52 +0000 (17:47 -0500)]
runtime: require cgo for cgo gdb test

Fixes #64542.

Change-Id: Ic0dc37dfefac83fd3aab6dacfec58b8ee9105fbd
Reviewed-on: https://go-review.googlesource.com/c/go/+/547135
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Commit-Queue: Michael Pratt <mpratt@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
5 months agodoc: add release notes for PGO improvements
Michael Pratt [Mon, 4 Dec 2023 18:31:21 +0000 (13:31 -0500)]
doc: add release notes for PGO improvements

For #61577.
For #61422.

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

5 months agocmd/compile: update PGO profile
Cherry Mui [Sat, 2 Dec 2023 21:37:17 +0000 (16:37 -0500)]
cmd/compile: update PGO profile

Since the default.pgo profile is collected, there has been a lot
of development and refactoring in the compiler. It's time to
refresh the compiler's PGO profile. As we are in the freeze, there
will probably not be many major changes to the compiler, so this
should be good for Go 1.22.

Profile collected by running the cmd/compile/profile.sh script on
the linux-amd64-perf gomote.

Benchmark results on Linux/AMD64:

         │  nopgo.txt   │               old.txt               │              new.txt               │
         │    sec/op    │    sec/op     vs base               │   sec/op     vs base               │
Template    127.4m ± 0%    125.3m ± 0%  -1.65% (p=0.000 n=20)   123.5m ± 0%  -3.07% (p=0.000 n=20)
Unicode    105.94m ± 0%   100.77m ± 0%  -4.87% (p=0.000 n=20)   99.26m ± 0%  -6.30% (p=0.000 n=20)
GoTypes     798.2m ± 1%    784.4m ± 0%  -1.73% (p=0.000 n=20)   769.4m ± 1%  -3.61% (p=0.000 n=20)
Compiler    85.10m ± 0%    82.03m ± 1%  -3.61% (p=0.000 n=20)   79.77m ± 1%  -6.26% (p=0.000 n=20)
SSA          6.054 ± 0%     5.945 ± 0%  -1.81% (p=0.000 n=20)    5.811 ± 0%  -4.03% (p=0.000 n=20)
Flate       75.37m ± 1%    74.11m ± 0%  -1.66% (p=0.000 n=20)   73.02m ± 1%  -3.12% (p=0.000 n=20)
GoParser    144.6m ± 1%    141.7m ± 1%  -1.95% (p=0.000 n=20)   140.5m ± 1%  -2.83% (p=0.000 n=20)
Reflect     312.9m ± 1%    304.9m ± 1%  -2.56% (p=0.000 n=20)   300.4m ± 0%  -4.00% (p=0.000 n=20)
Tar         115.8m ± 0%    113.6m ± 0%  -1.88% (p=0.000 n=20)   111.9m ± 1%  -3.33% (p=0.000 n=20)
XML         145.9m ± 1%    143.6m ± 0%  -1.58% (p=0.000 n=20)   141.3m ± 1%  -3.15% (p=0.000 n=20)
geomean     224.1m         218.9m       -2.34%                  215.2m       -3.98%

This also shows that a stale profile (the old one) still brings a
speedup, but smaller, as expected.

As before, the profile is transferrable. Benchmark results on
Darwin/ARM64:

         │  nopgo.txt   │              old.txt               │               new.txt               │
         │    sec/op    │   sec/op     vs base               │    sec/op     vs base               │
Template   71.31m ± 34%   68.97m ± 1%  -3.28% (p=0.000 n=20)   68.66m ± 38%  -3.71% (p=0.030 n=20)
Unicode    58.70m ±  1%   55.64m ± 1%  -5.20% (p=0.000 n=20)   53.05m ±  1%  -9.61% (p=0.000 n=20)
GoTypes    422.9m ±  0%   412.7m ± 0%  -2.43% (p=0.000 n=20)   406.0m ±  1%  -4.01% (p=0.000 n=20)
Compiler   45.89m ±  1%   42.67m ± 2%  -7.00% (p=0.000 n=20)   42.96m ±  1%  -6.38% (p=0.000 n=20)
SSA         3.190 ±  0%    3.090 ± 0%  -3.15% (p=0.000 n=20)    3.007 ±  1%  -5.74% (p=0.000 n=20)
Flate      42.02m ±  1%   41.09m ± 1%  -2.20% (p=0.000 n=20)   40.58m ±  1%  -3.43% (p=0.000 n=20)
GoParser   75.75m ±  1%   73.84m ± 1%  -2.52% (p=0.000 n=20)   72.66m ±  1%  -4.08% (p=0.000 n=20)
Reflect    163.7m ±  1%   158.1m ± 1%  -3.39% (p=0.000 n=20)   155.3m ±  1%  -5.10% (p=0.000 n=20)
Tar        62.03m ±  1%   60.15m ± 0%  -3.02% (p=0.000 n=20)   59.74m ±  1%  -3.69% (p=0.000 n=20)
XML        79.38m ±  1%   77.32m ± 1%  -2.59% (p=0.000 n=20)   75.05m ±  2%  -5.45% (p=0.000 n=20)
geomean    120.9m         116.6m       -3.49%                  114.6m        -5.14%

For #60234.

Change-Id: I4ead6158f835c2e69c0f51ea24d044b82a7320cb
Reviewed-on: https://go-review.googlesource.com/c/go/+/546337
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

5 months agodoc: add release notes for runtime/pprof changes
Michael Anthony Knyszek [Thu, 30 Nov 2023 21:14:52 +0000 (21:14 +0000)]
doc: add release notes for runtime/pprof changes

For #50891.
For #61015.

For #61422.

Change-Id: I30d580814ac02fe9f3fbd1a101b2cc05947a9aaa
Reviewed-on: https://go-review.googlesource.com/c/go/+/546475
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

5 months agodoc: add release notes for the new execution tracer
Michael Anthony Knyszek [Thu, 30 Nov 2023 19:11:58 +0000 (19:11 +0000)]
doc: add release notes for the new execution tracer

For #60773.
For #62627.
For #63960.

For #61422.

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

6 months agoruntime: let the fault thread to crash the process
zzkcode [Thu, 30 Nov 2023 11:39:29 +0000 (11:39 +0000)]
runtime: let the fault thread to crash the process

Let the fault thread to crash the program to make sure while gdb coredump file could see the correct backtrace in the number one thread in gdb.

Fixes #63277.

Change-Id: Ie4473f76f0feba596091433918bcd35a4ff7e11b
GitHub-Last-Rev: f4615c23f663a2f0794ca9e5c86fc2f0cc8552d7
GitHub-Pull-Request: golang/go#63666
Reviewed-on: https://go-review.googlesource.com/c/go/+/536895
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 months agonet/http: avoid leaking io.Copy goroutines (and hijacked connections) in TestTranspor...
Bryan C. Mills [Fri, 1 Dec 2023 21:27:43 +0000 (16:27 -0500)]
net/http: avoid leaking io.Copy goroutines (and hijacked connections) in TestTransportNoReuseAfterEarlyResponse

Fixes #64252 (maybe).

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

6 months agodoc: add release notes for allocation headers
Michael Anthony Knyszek [Thu, 30 Nov 2023 19:36:46 +0000 (19:36 +0000)]
doc: add release notes for allocation headers

For #61422.

Change-Id: Ia7cb2721e52d9ccd932a49e0c331868eb7749f94
Reviewed-on: https://go-review.googlesource.com/c/go/+/546027
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 months agoruntime: check if mp.curg is nil before readgstatus in writeProcStatusForP
Michael Anthony Knyszek [Fri, 1 Dec 2023 21:05:34 +0000 (21:05 +0000)]
runtime: check if mp.curg is nil before readgstatus in writeProcStatusForP

CL 546025 failed to check if mp.curg is nil, causing all sorts of
failures. It can very well be nil in this context.

For #64318.
Fixes #64507.

Change-Id: I4a95c3fa16d5e1dee8041394c4bdb9c6ba04f032
Reviewed-on: https://go-review.googlesource.com/c/go/+/546636
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 months agotesting: add regression tests for reentrant calls to T.Run
Bryan C. Mills [Thu, 30 Nov 2023 16:00:56 +0000 (11:00 -0500)]
testing: add regression tests for reentrant calls to T.Run

These tests represent two patterns of usage, found in Google-internal
tests, that deadlocked after CL 506755.

TestConcurrentRun is a minor variation on TestParallelSub, with the
additional expectation that the concurrent calls to Run (without
explicit calls to Parallel) proceed without blocking. It replaces
TestParallelSub.

TestParentRun is similar, but instead of calling Run concurrently it
calls Run from within the subtest body. It almost certainly represents
an accidental misuse of T.Run, but since that pattern used to run to
completion we don't want to break it accidentally. (Perhaps it should
be diagnosed with a vet check instead?)

While we are testing concurrency, this also cleans up
TestConcurrentCleanup to use a clearer synchronization pattern.

Fixes #64402.

Change-Id: I14fc7e7085a994c284509eac28190c3a8feb04cd
Reviewed-on: https://go-review.googlesource.com/c/go/+/546019
Auto-Submit: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
6 months agodoc: document changes to slices package
Keith Randall [Fri, 1 Dec 2023 20:54:00 +0000 (12:54 -0800)]
doc: document changes to slices package

Change-Id: I4e3f9812463251acd312372dd8a4f8c2cea9e289
Reviewed-on: https://go-review.googlesource.com/c/go/+/545996
Reviewed-by: Eli Bendersky <eliben@google.com>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Bypass: Keith Randall <khr@google.com>

6 months agodoc: remove encoding/binary.NativeEndian release note placeholder
Keith Randall [Fri, 1 Dec 2023 20:37:40 +0000 (12:37 -0800)]
doc: remove encoding/binary.NativeEndian release note placeholder

This was released in 1.21, release noted in CL 524675.
(I think it was missed originally and then and backported,
but then somehow incorrectly made it into the 1.22 dragnet.)

Change-Id: I45f3182f14f77f8b92a3b7d5ef0011b71fd3c176
Reviewed-on: https://go-review.googlesource.com/c/go/+/546675
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Bypass: Keith Randall <khr@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
6 months agogo/types, types2: add testcase for alias issue
Robert Griesemer [Thu, 30 Nov 2023 20:52:01 +0000 (12:52 -0800)]
go/types, types2: add testcase for alias issue

Using the new type Alias node, this issue is now fixed.
Add a test case.

Fixes #50729.

Change-Id: I22a4cf31b83de497e052989ca2054227e65e9937
Reviewed-on: https://go-review.googlesource.com/c/go/+/546455
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>
6 months agocmd/link: update flag doc
Cherry Mui [Fri, 1 Dec 2023 19:04:35 +0000 (14:04 -0500)]
cmd/link: update flag doc

Update the go doc for linker flags. Remove flags that no longer
exist. Also remove flags that are intended for debugging the
linker from user docs. Add -aslr to the doc.

The -n flag does nothing except print a nearly useless message on
XCOFF linking. Deprecate it.

Fixes #64476.

Change-Id: I518c9c6cc009eae50b7c11308348524ad6a62b69
Reviewed-on: https://go-review.googlesource.com/c/go/+/546615
Reviewed-by: Than McIntosh <thanm@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 months agocmd/compile: correct code generation for right shifts on riscv64
Joel Sing [Sat, 25 Nov 2023 15:48:05 +0000 (02:48 +1100)]
cmd/compile: correct code generation for right shifts on riscv64

The code generation on riscv64 will currently result in incorrect
assembly when a 32 bit integer is right shifted by an amount that
exceeds the size of the type. In particular, this occurs when an
int32 or uint32 is cast to a 64 bit type and right shifted by a
value larger than 31.

Fix this by moving the SRAW/SRLW conversion into the right shift
rules and removing the SignExt32to64/ZeroExt32to64. Add additional
rules that rewrite to SRAIW/SRLIW when the shift is less than the
size of the type, or replace/eliminate the shift when it exceeds
the size of the type.

Add SSA tests that would have caught this issue. Also add additional
codegen tests to ensure that the resulting assembly is what we
expect in these overflow cases.

Fixes #64285

Change-Id: Ie97b05668597cfcb91413afefaab18ee1aa145ec
Reviewed-on: https://go-review.googlesource.com/c/go/+/545035
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: M Zhuo <mzh@golangcn.org>
Reviewed-by: Mark Ryan <markdryan@rivosinc.com>
Run-TryBot: Joel Sing <joel@sing.id.au>
TryBot-Result: Gopher Robot <gobot@golang.org>

6 months agoruntime: emit the correct P status from a safepoint in the v2 tracer
Michael Anthony Knyszek [Thu, 30 Nov 2023 18:13:51 +0000 (18:13 +0000)]
runtime: emit the correct P status from a safepoint in the v2 tracer

The GoSyscallBegin event is a signal for both the P and the G to enter a
syscall state for the trace parser. (Ps can't have their own event
because it's too hard to model. As soon as the P enters _Psyscall it can
get stolen out of it.) But there's a window in time between when that
event is emitted and when the P enters _Psyscall where the P's status
can get emitted. In this window the tracer will emit the wrong status:
Running instead of Syscall. Really any call into the tracer could emit a
status event for the P, but in this particular case it's when running a
safepoint function that explicitly emits an event for the P's status.

The fix is straightforward. The source-of-truth on syscall status is the
G's status, so the function that emits the P's status just needs to
check the status of any G attached to it. If it's in _Gsyscall, then the
tracer should emit a Syscall status for the P if it's in _Prunning.

Fixes #64318.

Change-Id: I3b0fb0d41ff578e62810b04fa5a3ef73e2929b0a
Reviewed-on: https://go-review.googlesource.com/c/go/+/546025
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
6 months agodoc: add release notes about bootstrap toolchain version
Michael Anthony Knyszek [Thu, 30 Nov 2023 21:02:24 +0000 (21:02 +0000)]
doc: add release notes about bootstrap toolchain version

For #61422.

Change-Id: Ie0d3c05752d29aa65983add85935d2505560ec55
Reviewed-on: https://go-review.googlesource.com/c/go/+/546029
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
6 months agocmd/compile: fix typecheck range over rune literal
Cuong Manh Le [Thu, 30 Nov 2023 17:16:24 +0000 (00:16 +0700)]
cmd/compile: fix typecheck range over rune literal

With range over int, the rune literal in range expression will be left
as untyped rune, but idealType is not handling this case, causing ICE.

Fixing this by setting the concrete type for untyped rune expresison.

Fixes #64471

Change-Id: I07a151c54ea1d9e1b92e4d96cdfb6e73dca13862
Reviewed-on: https://go-review.googlesource.com/c/go/+/546296
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 months agobytes: add a boundary test for Count of 1 byte
Keith Randall [Thu, 5 Oct 2023 19:20:11 +0000 (12:20 -0700)]
bytes: add a boundary test for Count of 1 byte

This bottoms out in internal/bytealg.Count, which does a fair amount
of avx shenanigans. Make sure we're not reading out of bounds.

Change-Id: Ied0e461f536f75acc24c6797f7fc74e3f3901c10
Reviewed-on: https://go-review.googlesource.com/c/go/+/533116
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Achille Roussel <achille.roussel@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
6 months agocmd/compile: fix memcombine pass for big endian, > 1 byte elements
Keith Randall [Thu, 30 Nov 2023 18:04:16 +0000 (10:04 -0800)]
cmd/compile: fix memcombine pass for big endian, > 1 byte elements

The shift amounts were wrong in this case, leading to miscompilation
of load combining.

Also the store combining was not triggering when it should.

Fixes #64468

Change-Id: Iaeb08972c5fc1d6f628800334789c6af7216e87b
Reviewed-on: https://go-review.googlesource.com/c/go/+/546355
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 months agotesting: remove tests from the running log while they are waiting on parallel subtests
Bryan C. Mills [Wed, 29 Nov 2023 21:13:07 +0000 (16:13 -0500)]
testing: remove tests from the running log while they are waiting on parallel subtests

The parallel subtests are themselves removed from the running map
while they are blocked on calls to t.Parallel, so it is misleading to
log their parents as if they are running when we know they cannot be
making any kind of meaningful progress.

Fixes #64404.

Change-Id: Iaad11d5d4f4c86d775d36e5285c49629dccddd74
Reviewed-on: https://go-review.googlesource.com/c/go/+/546018
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
6 months agodebug/elf: return error in DynValue for invalid dynamic section size
Jes Cok [Wed, 29 Nov 2023 16:23:18 +0000 (16:23 +0000)]
debug/elf: return error in DynValue for invalid dynamic section size

This is a follow-up to CL 536400.

Fixes #64446

Change-Id: I35646732f62cb1937fd448f94ea518544d4295d4
GitHub-Last-Rev: 55db18a909fd44e6b2f2b98fd1a44ad01bb37932
GitHub-Pull-Request: golang/go#64448
Reviewed-on: https://go-review.googlesource.com/c/go/+/545835
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Run-TryBot: Jes Cok <xigua67damn@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

6 months agogo/types: set correct Var.scopePos for parameters/results
Alan Donovan [Mon, 20 Nov 2023 22:22:37 +0000 (17:22 -0500)]
go/types: set correct Var.scopePos for parameters/results

Previously, its value was unset (NoPos), but the correct
value is a point after the signature (FuncType.End) and
before the body.

Also, fix a bug in Scope.Innermost whereby it would return
the wrong (outer) scope when the query position was in
the FuncType portion of a Func{Decl,Lit}.
The fix is to set the scope's pos/end to those of the
complete Func{Decl,Lit}. This is now documented at
Info.Scopes, along with other missing information.

Also, fix a bug in the go/types (but not types2) scope
test, in which comments were discarded by the parser,
causing the entire test to be a no-op (!).

Also, make failures of TestScopeLookupParent more
informative.

Also, add a release note about the change in behavior.

Fixes #64292
Fixes #64295

Change-Id: Ib681f59d1b0b43de977666db08302d7524d3305f
Reviewed-on: https://go-review.googlesource.com/c/go/+/544035
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Run-TryBot: Robert Griesemer <gri@google.com>

6 months agoruntime/pprof: retry vmmap invocation if it failed due to a reported temporary resour...
Cosmos Nicolaou [Wed, 29 Nov 2023 19:04:57 +0000 (11:04 -0800)]
runtime/pprof: retry vmmap invocation if it failed due to a reported temporary resource shortage

As per #62352 the invocation of vmmap may fail (very rarely) due to
a temporary lack of resources on the test runner machine. This PR
allows for retrying the invocation a fixed number of times before
giving up. This is because we suspect the failure is due to
sensible to retry.

Fixes: #62352
Change-Id: I51aa66b949753d8127cc307181b6ef32e91d5b05
Reviewed-on: https://go-review.googlesource.com/c/go/+/545935
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
6 months agoall: update vendored dependencies
Dmitri Shuralyov [Wed, 29 Nov 2023 20:42:53 +0000 (15:42 -0500)]
all: update vendored dependencies

The Go 1.22 code freeze has recently started. 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: I76525261b9a954ed21a3bd3cb6c4a12e6c031d80
Cq-Include-Trybots: luci.golang.try:gotip-windows-amd64-longtest,gotip-linux-amd64-longtest,gotip-linux-386-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/546055
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>

6 months agotypes2, go/types: fix type checking of ~[]E passing to unsafe builtins
Cuong Manh Le [Tue, 28 Nov 2023 02:50:25 +0000 (09:50 +0700)]
types2, go/types: fix type checking of ~[]E passing to unsafe builtins

Fixes #64406

Change-Id: I58002ad722a229fe6db0be08d745fbad86048c6d
Reviewed-on: https://go-review.googlesource.com/c/go/+/545395
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>

6 months agodoc: release notes for GOARM hardfloat/softfloat change
Keith Randall [Tue, 28 Nov 2023 21:09:42 +0000 (13:09 -0800)]
doc: release notes for GOARM hardfloat/softfloat change

See CL 514907

Change-Id: Ieba2d7737115c66990b0ea7629033e787a99be93
Reviewed-on: https://go-review.googlesource.com/c/go/+/545655
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Ludi Rehak <ludi317@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Keith Randall <khr@golang.org>

6 months agoruntime: docfix countAlloc
Peter Feichtinger [Fri, 24 Nov 2023 12:15:54 +0000 (12:15 +0000)]
runtime: docfix countAlloc

fix typo in `countAlloc` doc

Change-Id: I9f0752412b7a7dfae4915870edeab4ac52e38b2d
GitHub-Last-Rev: 6080d3c03ba6cacb1874af9724cfeb7cae27b78f
GitHub-Pull-Request: golang/go#64357
Reviewed-on: https://go-review.googlesource.com/c/go/+/544755
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Hiro Hamada <laciferin@gmail.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>

6 months agocmd/cgo/internal/test: only test specific frames in testCallbackCallersSEH
qmuntal [Wed, 29 Nov 2023 10:15:54 +0000 (11:15 +0100)]
cmd/cgo/internal/test: only test specific frames in testCallbackCallersSEH

testCallbackCallersSEH will break if anything in this call chain is
refactored to have a different number of function calls.

This change makes the test more robust by only testing the frames
that are actually relevant to the test.

Change-Id: Idb51514d7079f55da6e6ddc52ad43b1ffe32c8c8
Reviewed-on: https://go-review.googlesource.com/c/go/+/545755
Run-TryBot: Quim Muntal <quimmuntal@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Auto-Submit: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

6 months agocmd/internal/moddeps: walk GOROOT when it is a symlink
qiulaidongfeng [Wed, 29 Nov 2023 12:45:01 +0000 (12:45 +0000)]
cmd/internal/moddeps: walk GOROOT when it is a symlink

Fixes #64375

Change-Id: I24ce67ef254db447cdf37a3fda5b5ab5fc782a36
GitHub-Last-Rev: 05590b9e20b31413d455a6e87bc38843e33ff116
GitHub-Pull-Request: golang/go#64376
Reviewed-on: https://go-review.googlesource.com/c/go/+/544757
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
6 months agogo/types: include AST in instantiatedIdent panic message
Alan Donovan [Tue, 28 Nov 2023 21:07:01 +0000 (16:07 -0500)]
go/types: include AST in instantiatedIdent panic message

Updates golang/go#63933

Change-Id: I3ff71e92d124c850eb8b4d136e163bf5786897a2
Reviewed-on: https://go-review.googlesource.com/c/go/+/545615
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>

6 months agointernal/trace/v2: tolerate having a P in GoCreateSyscall
Michael Anthony Knyszek [Tue, 28 Nov 2023 17:10:46 +0000 (17:10 +0000)]
internal/trace/v2: tolerate having a P in GoCreateSyscall

On non-pthread platforms, it's totally possible for the same M to
GoCreateSyscall/GoDestroySyscall on the same thread multiple times. That
same thread may hold onto its P through all those calls.

For #64060.

Change-Id: Ib968bfd439ecd5bc24fc98d78c06145b0d4b7802
Reviewed-on: https://go-review.googlesource.com/c/go/+/545515
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 months agoruntime: put ReadMemStats debug assertions behind a double-check mode
Michael Anthony Knyszek [Mon, 27 Nov 2023 22:27:32 +0000 (22:27 +0000)]
runtime: put ReadMemStats debug assertions behind a double-check mode

ReadMemStats has a few assertions it makes about the consistency of the
stats it's about to produce. Specifically, how those stats line up with
runtime-internal stats. These checks are generally useful, but crashing
just because some stats are wrong is a heavy price to pay.

For a long time this wasn't a problem, but very recently it became a
real problem. It turns out that there's real benign skew that can happen
wherein sysmon (which doesn't synchronize with a STW) generates a trace
event when tracing is enabled, and may mutate some stats while
ReadMemStats is running its checks.

Fix this by synchronizing with both sysmon and the tracer. This is a bit
heavy-handed, but better that than false positives.

Also, put the checks behind a debug mode. We want to reduce the risk of
backporting this change, and again, it's not great to crash just because
user-facing stats are off. Still, enable this debug mode during the
runtime tests so we don't lose quite as much coverage from disabling
these checks by default.

Fixes #64401.

Change-Id: I9adb3e5c7161d207648d07373a11da8a5f0fda9a
Reviewed-on: https://go-review.googlesource.com/c/go/+/545277
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Felix Geisendörfer <felix.geisendoerfer@datadoghq.com>
6 months agodoc: document PCALIGN directive
Mauri de Souza Meneguzzo [Tue, 28 Nov 2023 18:50:01 +0000 (18:50 +0000)]
doc: document PCALIGN directive

Fixes #64283

Change-Id: Ie0167410fc5557143f0b2e17af56ad9fe34605cf
GitHub-Last-Rev: 77144c76d38ca261b6728ba12ff128d22553efa5
GitHub-Pull-Request: golang/go#64296
Reviewed-on: https://go-review.googlesource.com/c/go/+/544115
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
6 months agosort: add available godoc link
cui fliter [Fri, 3 Nov 2023 11:54:41 +0000 (19:54 +0800)]
sort: add available godoc link

Change-Id: I64645fef0ffd1cea7c7710ec974520f85e0f7496
Reviewed-on: https://go-review.googlesource.com/c/go/+/539579
Run-TryBot: shuang cui <imcusg@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: qiulaidongfeng <2645477756@qq.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
6 months agoruntime: test for contention in both semaphore paths
Rhys Hiltner [Tue, 21 Nov 2023 23:31:26 +0000 (15:31 -0800)]
runtime: test for contention in both semaphore paths

Most contention on the runtime locks inside semaphores is observed in
runtime.semrelease1, but it can also appear in runtime.semacquire1. When
examining contention profiles in TestRuntimeLockMetricsAndProfile, allow
call stacks that include either.

For #64253

Change-Id: Id4f16af5e9a28615ab5032a3197e8df90f7e382f
Reviewed-on: https://go-review.googlesource.com/c/go/+/544375
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Rhys Hiltner <rhys@justin.tv>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
6 months agocmd/compile: use correct type for slice pointer
Keith Randall [Tue, 28 Nov 2023 01:21:08 +0000 (17:21 -0800)]
cmd/compile: use correct type for slice pointer

The type of the data pointer field of a slice should be a pointer
to the element type, not a *uint8.

This ensures that the SSA value representing the slice's data pointer
can be spilled to the stack slot for the corresponding argument.
Before this change the types didn't match so we ended up spilling the
argument to an autotmp instead of to the dedicated argument slot.

Fixes #64414

Change-Id: I09ee39e93f05aee07e3eceb14e39736d7fd70a33
Reviewed-on: https://go-review.googlesource.com/c/go/+/545357
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: David Chase <drchase@google.com>
6 months agosyscall: remove ptrace1 on darwin
Cherry Mui [Mon, 27 Nov 2023 20:17:11 +0000 (15:17 -0500)]
syscall: remove ptrace1 on darwin

On Darwin, the ptrace syscall is called in ptrace1, which then be
called in ptrace. This allows ptrace1 be disabled on iOS (by
implementing ptrace differently). But we can also achieve this by
adding a conditional directly in ptrace. This reduces stack usage
with -N -l, while keeping ptrace disabled on iOS.

For #64113.

Change-Id: I89d8e317e77352fffdbb5a25ba21ee9cdf2e1e20
Reviewed-on: https://go-review.googlesource.com/c/go/+/545276
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

6 months agodoc: update release notes from the relnote tool
Michael Anthony Knyszek [Wed, 22 Nov 2023 20:37:13 +0000 (20:37 +0000)]
doc: update release notes from the relnote tool

For #61422.

Change-Id: I0e091c30a445dbc55054c31837c6f051fea3c07d
Reviewed-on: https://go-review.googlesource.com/c/go/+/544537
Auto-Submit: Michael Knyszek <mknyszek@google.com>
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>

6 months agotext/template: more godoc links
Olivier Mengué [Thu, 23 Nov 2023 08:17:56 +0000 (09:17 +0100)]
text/template: more godoc links

Change-Id: I4f3684ea6cbdcc09985c93fef5107d3bd006699e
Reviewed-on: https://go-review.googlesource.com/c/go/+/544735
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>

6 months ago.github: clean up issue forms
Sean Liao [Thu, 23 Nov 2023 18:43:12 +0000 (18:43 +0000)]
.github: clean up issue forms

bugs:
* drop unused labels
* drop the reproduce checkbox:
  it's not a strong signal and introduces clutter in github as a task list
* link go.dev/play

govuln:
* use correct label
* ask for version of the tool
* link go.dev/play

telemetry:
* align title with purpose

Change-Id: Id7dd876e518c75dc22e9aec43d9af6e18af088fc
Reviewed-on: https://go-review.googlesource.com/c/go/+/544775
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Bypass: Dmitri Shuralyov <dmitshur@golang.org>

6 months agoRevert "testing: simplify concurrency and cleanup logic"
Lasse Folger [Fri, 24 Nov 2023 15:30:07 +0000 (15:30 +0000)]
Revert "testing: simplify concurrency and cleanup logic"

reverts CL 506755

Reason for revert: This leads to deadlocks of tests in Google internal testing

For #64402

Change-Id: I78329fc9dcc2377e7e880b264ac1d18d577ef99a
Reviewed-on: https://go-review.googlesource.com/c/go/+/544895
Auto-Submit: Bryan Mills <bcmills@google.com>
Auto-Submit: Lasse Folger <lassefolger@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>

6 months agoio/fs, os: unify PathError.Path for dirFS.{ReadFile, ReadDir}
Jes Cok [Fri, 24 Nov 2023 10:02:34 +0000 (10:02 +0000)]
io/fs, os: unify PathError.Path for dirFS.{ReadFile, ReadDir}

Fixes #64366

Change-Id: Ie78ab2cb9e11c0766665cd37fd7a26d36a1c24fa
GitHub-Last-Rev: 3cb3bb84a0ccccc88ba30258f52f699ac1364a7b
GitHub-Pull-Request: golang/go#64372
Reviewed-on: https://go-review.googlesource.com/c/go/+/544835
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Jes Cok <xigua67damn@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
6 months agoall: fix field names
cui fliter [Sat, 18 Nov 2023 05:51:35 +0000 (13:51 +0800)]
all: fix field names

Change-Id: I3ad7a50707486ebdbbd676b3581df6e3ed0fd3a1
Reviewed-on: https://go-review.googlesource.com/c/go/+/543476
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: shuang cui <imcusg@gmail.com>

6 months agopath: add available godoc link
cui fliter [Fri, 3 Nov 2023 11:18:00 +0000 (19:18 +0800)]
path: add available godoc link

Change-Id: I6d40a59cde4c3f1d5094f5126fdbc1195285195f
Reviewed-on: https://go-review.googlesource.com/c/go/+/539577
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>

6 months ago.github: try "import/path: issue title" instead of "affected/package: "
Dmitri Shuralyov [Wed, 22 Nov 2023 19:31:37 +0000 (14:31 -0500)]
.github: try "import/path: issue title" instead of "affected/package: "

The multiple issue templates pre-populate the issue title with a prefix
that Go issues customarily have. The "affected/package" phrase is short
for "the import path of the affected package". Let's try simplifying it
to just "import/path", and also include "issue title" to make the title
a more representative template of what the final title should look like.

Updates #29839.

Change-Id: I9736d24cf3d0a51536ac13dd07dd189fb51da021
Reviewed-on: https://go-review.googlesource.com/c/go/+/544556
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Sean Liao <sean@liao.dev>
6 months ago.github: delete archived issue templates
Dmitri Shuralyov [Wed, 22 Nov 2023 20:09:57 +0000 (15:09 -0500)]
.github: delete archived issue templates

We can get the previous templates back from version control if needed.
Delete these unused copies to avoid confusion.

For #63970.

Change-Id: I44e54da06e259239745f4a493de1dae94cca3755
Reviewed-on: https://go-review.googlesource.com/c/go/+/544536
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 months agoruntime: throw from the systemstack in wirep
Michael Anthony Knyszek [Wed, 22 Nov 2023 16:36:23 +0000 (16:36 +0000)]
runtime: throw from the systemstack in wirep

The exitsyscall path, since the introduction of the new execution
tracer, stores a just little bit more data in the exitsyscall stack
frame, causing a build failure from exceeding the nosplit limit with
'-N -l' set on all packages (like Delve does).

One of the paths through which this fails is "throw" from wirep, called
by a callee of exitsyscall. By switching to the systemstack on this
path, we can avoid hitting the nosplit limit, fixing the build. It's
also not totally unreasonable to switch to the systemstack for the
throws in this function, since the function has to be nosplit anyway. It
gives the throw path a bit more wiggle room to dump information than it
otherwise would have.

Fixes #64113.

Change-Id: I56e94e40614a202b8ac2fdc8b8b731493b74e5d0
Reviewed-on: https://go-review.googlesource.com/c/go/+/544535
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
6 months agoapi: promote next to go1.22
Michael Anthony Knyszek [Wed, 22 Nov 2023 16:54:29 +0000 (16:54 +0000)]
api: promote next to go1.22

Change-Id: Ib9d1eabfe6199575ea57183ccb21f62c40e11d84
Reviewed-on: https://go-review.googlesource.com/c/go/+/544555
Reviewed-by: Heschi Kreinick <heschi@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 months agogithub: use forms for issue templates
Hiro [Wed, 22 Nov 2023 17:20:35 +0000 (17:20 +0000)]
github: use forms for issue templates

Migrate from markdown github issue templates to more user friendly yaml templates.

Fixes #63970

Change-Id: I1baf8989f72c1b98bf0027bbb794c0324ea21e32
GitHub-Last-Rev: 725110bf87fa879c2787158a68d01612665ad4e6
GitHub-Pull-Request: golang/go#63655
Reviewed-on: https://go-review.googlesource.com/c/go/+/536776
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: t hepudds <thepudds1460@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Heschi Kreinick <heschi@google.com>

6 months agoruntime: hold sched.lock over traceThreadDestroy in dropm
Michael Anthony Knyszek [Tue, 21 Nov 2023 23:57:36 +0000 (23:57 +0000)]
runtime: hold sched.lock over traceThreadDestroy in dropm

This is required by traceThreadDestroy, though it's not strictly
necessary in this case. The requirement to hold sched.lock comes from
the assumption that traceThreadDestroy is getting called when the thread
leaves the tracer's view, but in this case the extra m that dropm is
dropping never leaves the allm list. Nevertheless, traceThreadDestroy
requires it just as a safety measure, and that's reasonable. dropm is
generally rare on pthread platforms, so the extra lock acquire over this
short critical section (and only when tracing is enabled) is fine.

Change-Id: Ib631820963c74f2f087d14a0067d0441d75d6785
Reviewed-on: https://go-review.googlesource.com/c/go/+/544396
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

6 months agoruntime: move the wakeableSleep lock under sched in the lock rank
Michael Anthony Knyszek [Tue, 21 Nov 2023 23:46:48 +0000 (23:46 +0000)]
runtime: move the wakeableSleep lock under sched in the lock rank

Currently the wakeableSleep lock is placed just after timers in the
ranking, but it turns out the timers lock can never be held over a timer
func, so that's wrong. Meanwhile, wakeableSleep can acquire sched.lock.

wakeableSleep, as it turns out, doesn't have any dependencies -- it's
always acquired in a (mostly) regular goroutine context.

Change-Id: Icc8ea76a8b309fbaf0f02215f16e5f706d49cd95
Reviewed-on: https://go-review.googlesource.com/c/go/+/544395
TryBot-Bypass: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
6 months agoruntime: don't hold trace.lock over semrelease in readTrace0
Michael Anthony Knyszek [Tue, 21 Nov 2023 23:24:59 +0000 (23:24 +0000)]
runtime: don't hold trace.lock over semrelease in readTrace0

semrelease may unblock a goroutine, but the act of unblocking a
goroutine may emit an event, which in turn may try to acquire trace.lock
again.

It's safe to release trace.lock in readTrace0 for this because all of
the state (one variable) it uses under the lock will be recomputed when
it reacquires the lock. There's also no other synchronization
requirement to hold trace.lock. This is just a mistake.

Change-Id: Iff6c6b02efa298ebed8e60cdf6539ec161d5ec48
Reviewed-on: https://go-review.googlesource.com/c/go/+/544178
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
6 months agoruntime: don't hold the table lock in (*traceStackTable).dump
Michael Anthony Knyszek [Tue, 21 Nov 2023 22:42:35 +0000 (22:42 +0000)]
runtime: don't hold the table lock in (*traceStackTable).dump

There's a conceptual cycle between traceStackTable.lock and
allocation-related locks, but it can't happen in practice because the
caller guarantees that there are no more writers to the table at the
point that dump is called.

But if that's true, then the lock isn't necessary at all. It would be
difficult to model this quiesence in the lockrank mode, so just don't
hold the lock and expand the documentation of the dump method.

Change-Id: Id4db61363f075b7574135529915e8bd4f4f4c082
Reviewed-on: https://go-review.googlesource.com/c/go/+/544177
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
6 months agocmd/link/internal/loadpe: fix .xdata unwind info parsing
Davis Goodin [Wed, 22 Nov 2023 01:12:48 +0000 (17:12 -0800)]
cmd/link/internal/loadpe: fix .xdata unwind info parsing

Unwind info in .xdata was being parsed incorrectly, causing targetOff to
be incorrect and miss finding data in .xdata that it should have found.
This causes a linker issue when using the MinGW MSVCRT compiler.

Contains several fixes based on the exception handling docs: the offset
used to get the number of unwind codes, the calculation of the target
offset based on the dynamic size of the unwind data, and the
UNW_FLAG_CHAININFO flag's value.

Fixes #64200

Change-Id: I6483d921b2bf8a2512a95223bf3c8ce8bc63dc4a
Reviewed-on: https://go-review.googlesource.com/c/go/+/544415
TryBot-Result: Gopher Robot <gobot@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Quim Muntal <quimmuntal@gmail.com>
Run-TryBot: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
6 months agocmd/link/internal/ld: fix DWARF type DIE "go kind" bug for synthetic ptr types
Than McIntosh [Tue, 21 Nov 2023 19:44:41 +0000 (14:44 -0500)]
cmd/link/internal/ld: fix DWARF type DIE "go kind" bug for synthetic ptr types

The code path in linker DWARF type generation that synthesizes pointer
type DIEs needed for other synthesized types wasn't properly setting
the DW_AT_go_kind attribute for the new pointer types.

Fixes #64231.

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

6 months agoruntime/internal/atomic: deduplicate And/Or code on wasm
Mauri de Souza Meneguzzo [Tue, 21 Nov 2023 19:34:36 +0000 (19:34 +0000)]
runtime/internal/atomic: deduplicate And/Or code on wasm

When I initially added the wasm code for these ops I did not saw that
wasm actually has the Cas operations implemented, although they are
merely pointer assignments since wasm is single threaded.

Now with a generic implementation for And/Or we can add wasm to the
build tags.

For #61395

Change-Id: I997dc90477c772882d6703df1b795dfc0d90a699
GitHub-Last-Rev: 92736a6e34104a9d234c791673fe0bb79fc97b0b
GitHub-Pull-Request: golang/go#64300
Reviewed-on: https://go-review.googlesource.com/c/go/+/544116
Run-TryBot: Mauri de Souza Meneguzzo <mauri870@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

6 months agointernal/abi, runtime, reflect, cmd: merge maxZero const into internal/abi
qiulaidongfeng [Tue, 21 Nov 2023 22:57:59 +0000 (22:57 +0000)]
internal/abi, runtime,  reflect, cmd: merge maxZero const into internal/abi

For #59670

Change-Id: If38a74ad067a3ea3ff551c0c25c8ef41abec114b
GitHub-Last-Rev: fb1f2f3c9f320017627bc3342b061e1e7f6f7fad
GitHub-Pull-Request: golang/go#64268
Reviewed-on: https://go-review.googlesource.com/c/go/+/543655
Run-TryBot: qiulaidongfeng <2645477756@qq.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
6 months agocmd/asm: fix the KMCTR instruction encoding and argument passing
Srinivas Pokala [Mon, 16 Oct 2023 09:18:50 +0000 (11:18 +0200)]
cmd/asm: fix the KMCTR instruction encoding and argument passing

KMCTR encoding arguments incorrect way, which leading illegal instruction wherver we call KMCTR instruction.IBM z13 machine test's TestAESGCM test using gcmASM implementation, which uses KMCTR instruction to encrypt using AES in counter mode and the KIMD instruction for GHASH. z14+ machines onwards uses gcmKMA implementation for the same.

Fixes #63387

Change-Id: I86aeb99573c3f636a71908c99e06a9530655aa5d
Reviewed-on: https://go-review.googlesource.com/c/go/+/535675
Reviewed-by: Vishwanatha HD <vishwanatha.hd@ibm.com>
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>
Reviewed-by: Keith Randall <khr@golang.org>
6 months agoruntime: change the name of variables in asan-related assembly functions
fanzha02 [Tue, 21 Nov 2023 06:52:54 +0000 (06:52 +0000)]
runtime: change the name of variables in asan-related assembly functions

Variables in functions implemented in assembly should have the
same names as when they were defined. The names of some variables
in asan-related assembly functions do not follow the above rule,
which will cause the runtime test to fail. This CL fixes this issue.

Updates #64257

Change-Id: I261f4db807d25e460513ef1c92cd1b707cdd1a16
Reviewed-on: https://go-review.googlesource.com/c/go/+/543837
Run-TryBot: Fannie Zhang <Fannie.Zhang@arm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
6 months agointernal/bytealg: optimize Count with PCALIGN in riscv64
Meng Zhuo [Sun, 12 Nov 2023 09:13:29 +0000 (17:13 +0800)]
internal/bytealg: optimize Count with PCALIGN in riscv64

For #63678

Benchmark on Milk-V Mars CM eMMC (Starfive/JH7110 SoC)

goos: linux
goarch: riscv64
pkg: bytes
                │ /root/bytes.old.bench │        /root/bytes.pc16.bench         │
                │        sec/op         │   sec/op     vs base                  │
Count/10                    223.9n ± 1%   220.8n ± 1%   -1.36% (p=0.001 n=10)
Count/32                    571.6n ± 0%   571.3n ± 0%        ~ (p=0.054 n=10)
Count/4K                    38.56µ ± 0%   38.55µ ± 0%   -0.01% (p=0.010 n=10)
Count/4M                    40.13m ± 0%   39.21m ± 0%   -2.28% (p=0.000 n=10)
Count/64M                   627.5m ± 0%   627.4m ± 0%   -0.01% (p=0.019 n=10)
CountEasy/10                101.3n ± 0%   101.3n ± 0%        ~ (p=1.000 n=10) ¹
CountEasy/32                139.3n ± 0%   139.3n ± 0%        ~ (p=1.000 n=10) ¹
CountEasy/4K                5.565µ ± 0%   5.564µ ± 0%   -0.02% (p=0.001 n=10)
CountEasy/4M                5.619m ± 0%   5.619m ± 0%        ~ (p=0.190 n=10)
CountEasy/64M               89.94m ± 0%   89.93m ± 0%        ~ (p=0.436 n=10)
CountSingle/10              53.80n ± 0%   46.06n ± 0%  -14.39% (p=0.000 n=10)
CountSingle/32             104.30n ± 0%   79.64n ± 0%  -23.64% (p=0.000 n=10)
CountSingle/4K             10.413µ ± 0%   7.247µ ± 0%  -30.40% (p=0.000 n=10)
CountSingle/4M             11.603m ± 0%   8.388m ± 0%  -27.71% (p=0.000 n=10)
CountSingle/64M             230.9m ± 0%   172.3m ± 0%  -25.40% (p=0.000 n=10)
CountHard1                  9.981m ± 0%   9.981m ± 0%        ~ (p=0.810 n=10)
CountHard2                  9.981m ± 0%   9.981m ± 0%        ~ (p=0.315 n=10)
CountHard3                  9.981m ± 0%   9.981m ± 0%        ~ (p=0.159 n=10)
geomean                     144.6µ        133.5µ        -7.70%
¹ all samples are equal

                │ /root/bytes.old.bench │        /root/bytes.pc16.bench         │
                │          B/s          │      B/s       vs base                │
Count/10                   42.60Mi ± 1%    43.19Mi ± 1%   +1.39% (p=0.001 n=10)
Count/32                   53.38Mi ± 0%    53.42Mi ± 0%   +0.06% (p=0.049 n=10)
Count/4K                   101.3Mi ± 0%    101.3Mi ± 0%        ~ (p=0.077 n=10)
Count/4M                   99.68Mi ± 0%   102.01Mi ± 0%   +2.34% (p=0.000 n=10)
Count/64M                  102.0Mi ± 0%    102.0Mi ± 0%        ~ (p=0.076 n=10)
CountEasy/10               94.18Mi ± 0%    94.18Mi ± 0%        ~ (p=0.054 n=10)
CountEasy/32               219.1Mi ± 0%    219.1Mi ± 0%   +0.01% (p=0.016 n=10)
CountEasy/4K               702.0Mi ± 0%    702.0Mi ± 0%   +0.00% (p=0.000 n=10)
CountEasy/4M               711.9Mi ± 0%    711.9Mi ± 0%        ~ (p=0.133 n=10)
CountEasy/64M              711.6Mi ± 0%    711.7Mi ± 0%        ~ (p=0.447 n=10)
CountSingle/10             177.2Mi ± 0%    207.0Mi ± 0%  +16.81% (p=0.000 n=10)
CountSingle/32             292.7Mi ± 0%    383.2Mi ± 0%  +30.91% (p=0.000 n=10)
CountSingle/4K             375.1Mi ± 0%    539.0Mi ± 0%  +43.70% (p=0.000 n=10)
CountSingle/4M             344.7Mi ± 0%    476.9Mi ± 0%  +38.33% (p=0.000 n=10)
CountSingle/64M            277.2Mi ± 0%    371.5Mi ± 0%  +34.05% (p=0.000 n=10)
geomean                    199.7Mi         219.8Mi       +10.10%

Change-Id: I1abf6b220b9802028f8ad5eebc8d3b7cfa3e89ea
Reviewed-on: https://go-review.googlesource.com/c/go/+/541756
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Joel Sing <joel@sing.id.au>
Run-TryBot: M Zhuo <mzh@golangcn.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Wang Yaduo <wangyaduo@linux.alibaba.com>
Reviewed-by: Mark Ryan <markdryan@rivosinc.com>
6 months agocmd/internal/obj/riscv: add support of PCALIGN directive
Meng Zhuo [Sun, 12 Nov 2023 09:05:57 +0000 (17:05 +0800)]
cmd/internal/obj/riscv: add support of PCALIGN directive

Add support for PCALIGN directive on riscv.
This directive can be used within Go asm to align instruction
by padding NOP directives.

This patch also adds a test to verify the correctness of the PCALIGN
directive.

Original credit by Cooper Qu (Alibaba)
https://gitee.com/xuantie_riscv/xuantie-patch

Change-Id: I8b6524a2bf81a1baf7c9d04b7da2db6c1a7b428f
Reviewed-on: https://go-review.googlesource.com/c/go/+/541740
Run-TryBot: M Zhuo <mzh@golangcn.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Wang Yaduo <wangyaduo@linux.alibaba.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Mark Ryan <markdryan@rivosinc.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

6 months agocrypto/tls: mark RSA KEX cipher suites insecure
Filippo Valsorda [Tue, 21 Nov 2023 22:25:51 +0000 (23:25 +0100)]
crypto/tls: mark RSA KEX cipher suites insecure

Updates #63413

Change-Id: I31fc2f9728582524cac5d101d0011093dbd05ed3
Reviewed-on: https://go-review.googlesource.com/c/go/+/544336
Auto-Submit: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
6 months agocrypto/tls: check and record godebugs more granularly
Filippo Valsorda [Tue, 21 Nov 2023 22:16:56 +0000 (23:16 +0100)]
crypto/tls: check and record godebugs more granularly

We should call Value as late as possible to allow programs to set
GODEBUG with os.Setenv, and IncNonDefault only when (and every time) the
GODEBUG has an effect on a connection (that we'd have regularly
rejected).

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