1
0
mirror of https://github.com/golang/go synced 2024-11-15 10:40:35 -07:00
Commit Graph

60059 Commits

Author SHA1 Message Date
Felix Geisendörfer
2141315251 runtime: move profiling pc buffers to m
Move profiling pc buffers from being stack allocated to an m field.

This is motivated by the next patch, which will increase the default
stack depth to 128, which might lead to undesirable stack growth for
goroutines that produce profiling events.

Additionally, this change paves the way to make the stack depth
configurable via GODEBUG.

Change-Id: Ifa407f899188e2c7c0a81de92194fdb627cb4b36
Reviewed-on: https://go-review.googlesource.com/c/go/+/574699
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2024-05-08 17:48:38 +00:00
Michael Anthony Knyszek
c3bd543cc3 internal/trace/v2: add gotraceeventstats utility
Change-Id: Ibf83d74a76edf2fe2896fa1e7f93ab1296fc5d75
Reviewed-on: https://go-review.googlesource.com/c/go/+/583378
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>
2024-05-08 17:47:38 +00:00
Michael Anthony Knyszek
724bab1505 runtime: add traceallocfree GODEBUG for alloc/free events in traces
This change adds expensive alloc/free events to traces, guarded by a
GODEBUG that can be set at run time by mutating the GODEBUG environment
variable. This supersedes the alloc/free trace deleted in a previous CL.

There are two parts to this CL.

The first part is adding a mechanism for exposing experimental events
through the tracer and trace parser. This boils down to a new
ExperimentalEvent event type in the parser API which simply reveals the
raw event data for the event. Each experimental event can also be
associated with "experimental data" which is associated with a
particular generation. This experimental data is just exposed as a bag
of bytes that supplements the experimental events.

In the runtime, this CL organizes experimental events by experiment.
An experiment is defined by a set of experimental events and a single
special batch type. Batches of this special type are exposed through the
parser's API as the aforementioned "experimental data".

The second part of this CL is defining the AllocFree experiment, which
defines 9 new experimental events covering heap object alloc/frees, span
alloc/frees, and goroutine stack alloc/frees. It also generates special
batches that contain a type table: a mapping of IDs to type information.

Change-Id: I965c00e3dcfdf5570f365ff89d0f70d8aeca219c
Reviewed-on: https://go-review.googlesource.com/c/go/+/583377
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-08 17:47:01 +00:00
Michael Anthony Knyszek
11047345f5 runtime: remove allocfreetrace
allocfreetrace prints all allocations and frees to stderr. It's not
terribly useful because it has a really huge overhead, making it not
feasible to use except for the most trivial programs. A follow-up CL
will replace it with something that is both more thorough and also lower
overhead.

Change-Id: I1d668fee8b6aaef5251a5aea3054ec2444d75eb6
Reviewed-on: https://go-review.googlesource.com/c/go/+/583376
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
2024-05-08 17:44:56 +00:00
Keith Randall
93e3696b5d cmd/compile: avoid past-the-end pointer when zeroing
When we optimize append(s, make([]T, n)...), we have to be careful
not to pass &s[0] + len(s)*sizeof(T) as the argument to memclr, as that
pointer might be past-the-end. This can only happen if n is zero, so
just special-case n==0 in the generated code.

Fixes #67255

Change-Id: Ic680711bb8c38440eba5e759363ef65f5945658b
Reviewed-on: https://go-review.googlesource.com/c/go/+/584116
Reviewed-by: Austin Clements <austin@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
2024-05-08 17:09:06 +00:00
Michael Matloob
ad27916c24 cmd/go: rename flag counters and add buildmode values separately
Rename the subcommand flag counter names from
go/flag/<subcommand>/<flagname> to go/<subcommand>/flag/<flagname>.

Also remove the special case that adds counters for buildmode flag
values and instead add an additional counter for the flag values.
The new counter has the form go/<subcommand>/flag/buildmode:<flagvalue>.
We use a new CountFlagValue function that's been added to the
internal/telemetry package to help with this.

Finally add the go/invocations counter

Change-Id: I995b6b0009ba0f58faeb3e2a75f3b137e4136209
Reviewed-on: https://go-review.googlesource.com/c/go/+/583917
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2024-05-08 16:49:53 +00:00
Michael Matloob
328aa9e39f all: vendor golang.org/x/telemetry@2790727
Commands run (in both src/ and src/cmd/)
    go get golang.org/x/telemetry@2790727
    go mod tidy
    go mod vendor

Change-Id: Idbabcc4a3069afac08d2735fac264577846ea1d7
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/584236
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2024-05-08 16:13:09 +00:00
Michael Matloob
5be95e0951 cmd: vendor golang.org/x/sys@v0.20.0
This is a requirement of golang.org/x/telemetry@2790727 but the diff is
so big it's being vendored in a separate CL.

Commands run:

    go get golang.org/x/sys@v0.20.0
    go mod tidy
    go mod vendor

Change-Id: Idbeef95dab71449f67d21552636137e08db0f54d
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/584235
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2024-05-08 16:12:58 +00:00
Russ Cox
46aa30ff48 time: more deflaking asynctimer tests
For #66322.

Change-Id: I1d83c7a3cacd2ab012039d954270a7c87bbdf5ce
Reviewed-on: https://go-review.googlesource.com/c/go/+/584195
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Russ Cox <rsc@golang.org>
2024-05-08 15:49:05 +00:00
Rob Findley
4ed358b57e go/types, types: represent any using Alias
When GODEBUG=gotypesalias=1 is set, use an actual Alias type to
represent any, rather than a legacy alias representation. This makes any
consistent with other interface aliases, and will eventually make
obsolete the various workarounds for formatting any as 'any' rather than
'interface{}'.

Since any is a global in the Universe scope, we must hijack Scope.Lookup
to select the correct representation. Of course, this also means that we
can't support type checking concurrently while mutating gotypesalias
(or, in the case of types2, Config.EnableAlias). Some care is taken to
ensure that the type checker panics in the event of this type of misuse.

For now, we must still support the legacy representation of any, and the
existing workarounds that look for a distinguished any pointer. This is
done by ensuring that both representations have the same underlying
pointer, and by updating workarounds to consider Underlying.

Fixes golang/go#66921

Change-Id: I81db7e8e15317b7a6ed3b406545db15a2fc42f57
Reviewed-on: https://go-review.googlesource.com/c/go/+/580355
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-07 20:08:23 +00:00
Robert Findley
9c5269c253 .github: improve formatting of the telemetry proposal template
Tweak the new telemetry proposal template added in CL 583496:
 - Shorten the description, as it is formatted on one conspicuously long
   line in the template picker.
 - Use folded style for label descriptions, as their line breaks cause
   the resulting paragraph to flow awkwardly.

Change-Id: I3089ac0717646e153765548d4bebd8d4751933b2
Reviewed-on: https://go-review.googlesource.com/c/go/+/583916
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
2024-05-07 19:58:26 +00:00
Daniel Martí
5f5e9f4ff1 go/ast: simplify walking lists with generics
Change-Id: Ib6e3fd9c5788400420555b2889e6dba0853446bc
Reviewed-on: https://go-review.googlesource.com/c/go/+/582495
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-05-07 18:48:48 +00:00
aimuz
dc548bb322 os: use filepathlite.Base
Replace custom basename implementations with filepathlite.Base across
all relevant os/stat files to unify path processing across platforms.

Change-Id: I7c4795661926949bae71e66d8b4f9363e7caef15
GitHub-Last-Rev: 1236e93ebc
GitHub-Pull-Request: golang/go#67195
Reviewed-on: https://go-review.googlesource.com/c/go/+/583415
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-05-07 18:44:48 +00:00
Tobias Klauser
c40bb87486 internal/sysinfo: rename osCpuInfoName to osCPUInfoName
Follow https://go.dev/wiki/CodeReviewComments#initialisms

Change-Id: Ie7418cebb0eda130e7db5bc91475a4a4012192dc
Reviewed-on: https://go-review.googlesource.com/c/go/+/583716
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-07 18:42:42 +00:00
Tobias Klauser
723d34f171 internal/sysinfo: use strings.Cut in osCpuInfoName
Change-Id: I78a6189f0fc5d52b5f88cc0db0d3dbc36f94f826
Reviewed-on: https://go-review.googlesource.com/c/go/+/583715
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-07 18:42:00 +00:00
aimuz
008cc58a11 flag: replace sort.Slice with slices.SortFunc
Change-Id: I874f0c0399cb09de4fe4dd2097602c5fa0512b12
GitHub-Last-Rev: 73be01ae2a
GitHub-Pull-Request: golang/go#67223
Reviewed-on: https://go-review.googlesource.com/c/go/+/583735
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-05-07 18:38:24 +00:00
qiulaidongfeng
709d6d5d22 io/fs: use slices.Contains
Change-Id: Ifd91722fd63af89af96a90dd69c73488f7fab5d3
GitHub-Last-Rev: da03963a07
GitHub-Pull-Request: golang/go#67179
Reviewed-on: https://go-review.googlesource.com/c/go/+/583296
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-05-07 18:36:52 +00:00
Alan Donovan
1e4de0584e cmd/compile: describe export data
Updates #30074

Change-Id: Ic74d482943d992c20f69edb106c666a7b26291c1
Reviewed-on: https://go-review.googlesource.com/c/go/+/578055
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2024-05-07 18:24:33 +00:00
Robert Findley
9d54d5466b .github: simplify the telemetry proposal template
Reduce the telemetry proposal template to make it easier to file
telemetry proposals. At a high level, the proposal is just a request to
merge a specific configuration change, so a free text rationale as well
as proposed CL link should suffice. The proposal committee can make sure
that all concerns about new uploading are addressed.

Also, fix links to the chartconfig package documentation, as well as the
config.txt file, and reference the new go.dev/doc/telemetry.

Change-Id: I9eefba14967a18327abfcb2de427dc4bec6d659f
Reviewed-on: https://go-review.googlesource.com/c/go/+/583496
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Findley <rfindley@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2024-05-07 18:15:25 +00:00
Russ Cox
9c4849bf20 math/rand/v2: add Uint
Uint was part of the approved proposal but was inadvertently left
out of Go 1.22. Add for Go 1.23.

Change-Id: Ifaf24447bd70c8524c2fd299eefdf4aa29e49e66
Reviewed-on: https://go-review.googlesource.com/c/go/+/583455
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Griesemer <gri@google.com>
2024-05-07 18:03:11 +00:00
Sam Thanawalla
27ed85d4d1 cmd/go: download 1.X.0 instead of 1.X during toolchain upgrade.
This CL modifies the download behavior when downloading a toolchain for 1.21+. Previously, Go would attempt to download 1.X when upgrading the toolchain which would cause the download to fail for 1.21+ since 1.X is an invalid toolchain. We will attempt to download 1.X.0 since that's likely what the user intended.

Additionally, we will also now provide a better error message when the
user provides a language version instead of a toolchain version for
1.21+.

Fixes #66175
Fixes #62278

Change-Id: I28f894290a19d8e3cd220e9d70aeca8f4447e5a1
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/580217
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-07 17:25:05 +00:00
apocelipes
55a06f7920 reflect: remove redundent ifaceIndir
Use abi.(*Type).IfaceIndir instead.

Change-Id: I31197cbf0edaf53bbb0455fa76d2a4a2ab40b420
GitHub-Last-Rev: 2659b696ef
GitHub-Pull-Request: golang/go#67227
Reviewed-on: https://go-review.googlesource.com/c/go/+/583755
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-07 17:08:32 +00:00
apocelipes
c637d4b939 internal/reflectlite: remove redundent ifaceIndir
Use abi.(*Type).IfaceIndir instead.

Change-Id: I55a1a593d76601fb615d131abcf1b32012741e8c
GitHub-Last-Rev: 14de2a9d67
GitHub-Pull-Request: golang/go#67228
Reviewed-on: https://go-review.googlesource.com/c/go/+/583756
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
2024-05-07 17:01:54 +00:00
Roland Shoemaker
348b23830d cmd/go: disallow -lto_library in LDFLAGS
The darwin linker allows setting the LTO library with the -lto_library
flag. This wasn't caught by our "safe linker flags" check because it
was covered by the -lx flag used for linking libraries. This change
adds a specific check for excluded flags which otherwise satisfy our
existing checks.

Loading a mallicious LTO library would allow an attacker to cause the
linker to execute abritrary code when "go build" was called.

Thanks to Juho Forsén of Mattermost for reporting this issue.

Fixes #67119
Fixes CVE-2024-24787

Change-Id: I77ac8585efbdbdfd5f39c39ed623b9408a0f9eaf
Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/1380
Reviewed-by: Russ Cox <rsc@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/583815
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-07 15:41:16 +00:00
Sam Thanawalla
38ee0c7630 cmd/go: import vendored packages only listed in modules.txt
Fixes: #60922

Change-Id: I4a18267596441b97c6a701a2befd75ee10644d7d
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/572200
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-07 15:21:14 +00:00
Jorropo
ad10fbd3c4 image/png: remove go-fuzz test
An identical go1.18 test exists at `src/image/png/fuzz_test.go`.

Change-Id: I3e4db46296fb6a56655f849da8c0689aa5a1c28c
Reviewed-on: https://go-review.googlesource.com/c/go/+/576795
Reviewed-by: qiu laidongfeng2 <2645477756@qq.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2024-05-06 22:40:18 +00:00
Cherry Mui
e988d6c423 cmd/cgo/internal/testsanitizers: add test case for #66427
The added program fails consistently with "signal handler spoils
errno" error under TSAN.

For #66427.

Change-Id: Id57b9e62aa30b273a1c793aecd86ec1f211062fc
Reviewed-on: https://go-review.googlesource.com/c/go/+/581722
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2024-05-06 21:14:49 +00:00
Cherry Mui
be003bd00b runtime: don't re-raise ignored signal
If a signal lands on a non-Go thread, and Go code doesn't want to
handle it, currently we re-raise the signal in the signal handler
after uninstalling our handler, so the C code can handle it.

But if there is no C signal handler and the signal is ignored,
there is no need to re-raise the signal. Just ignore it. This
avoids uninstalling and reinstalling our handler, which, for some
reason, changes errno when TSAN is used. And TSAN does not like
errno being changed in the signal handler.

Not really sure if this is the bset of complete fix, but it does
fix the immediate problem, and it seems a reasonable thing to do
by itself.

Test case is CL 581722.

Fixes #66427.

Change-Id: I7a043d53059f1ff4080f4fc8ef4065d76ee7d78a
Reviewed-on: https://go-review.googlesource.com/c/go/+/582077
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-06 21:13:43 +00:00
Michael Anthony Knyszek
be29a02161 runtime: delete dead code in the tracer
This code was just missed during the cleanup. There's maybe some merit
to keeping OneNewExtraM, but it would still be fairly optimistic. It's
trivial to bring back, so delete it for now.

Change-Id: I2d033c6daae787e0e8d6b92524f3e59610e2599f
Reviewed-on: https://go-review.googlesource.com/c/go/+/583375
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-06 20:59:12 +00:00
Russ Cox
5a181c5042 iter: expose fundamental types to Go 1.23
These were previously only available with GOEXPERIMENT=rangefunc.

For #61897.

Change-Id: I86aea5ae8be1f7a2975b623325811221ed40d384
Reviewed-on: https://go-review.googlesource.com/c/go/+/557836
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
2024-05-06 20:33:25 +00:00
qiulaidongfeng
5122a6796e runtime: parallel run test
This CL reduces
the go test runtime time from 130s to 59s.

Change-Id: I91babcd15723a2e7bc706e4e9bddaf3ce39d5b2f
GitHub-Last-Rev: 54c3c82269
GitHub-Pull-Request: golang/go#65765
Cq-Include-Trybots: luci.golang.try:gotip-linux-386-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/564995
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
2024-05-06 17:50:18 +00:00
Techassi
9050ce9b33 crypto/x509: include OID in duplicate extension error message
Include the OID in the error message when parsing X.509
certificates. This should ease fixing such issues, because
users can clearly identify the duplicate extension via the
reported error. Previously, this wasn't possible and
required either manually adjusting the standard library or
inspecting the certificate with various debugging tools.

Fixes #66880

Change-Id: I8c22f3a9f9c648ccff66073840830208832a3f85
GitHub-Last-Rev: b855a161d4
GitHub-Pull-Request: golang/go#67157
Reviewed-on: https://go-review.googlesource.com/c/go/+/583096
Reviewed-by: Roland Shoemaker <roland@golang.org>
Auto-Submit: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-05-06 17:39:08 +00:00
khr@golang.org
3c72dd513c cmd/compile: don't combine loads in generated equality functions
... if the architecture can't do unaligned loads.
We already handle this in a few places, but this particular place
was added in CL 399542 and missed this additional restriction.

Fixes #67160

Change-Id: I45988f11ff3ed45df1c4da3f0931ab1fdb22dbfe
Reviewed-on: https://go-review.googlesource.com/c/go/+/583175
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Auto-Submit: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Derek Parker <parkerderek86@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-05-06 15:34:04 +00:00
Filippo Valsorda
cc1659916d crypto/internal/mlkem768: various performance optimizations
goos: linux
goarch: amd64
pkg: crypto/internal/mlkem768
cpu: Intel(R) Core(TM) i5-7400 CPU @ 3.00GHz
                  │  c0a0ba254c  │              2aeb615fa6               │
                  │    sec/op    │   sec/op     vs base                  │
KeyGen-4             73.36µ ± 0%   67.38µ ± 1%   -8.15% (p=0.000 n=20)
Encaps-4            108.96µ ± 0%   99.56µ ± 1%   -8.63% (p=0.000 n=20)
Decaps-4            132.19µ ± 0%   96.85µ ± 0%  -26.74% (p=0.000 n=20)
RoundTrip/Alice-4    216.4µ ± 0%   173.1µ ± 0%  -20.01% (p=0.000 n=20)
RoundTrip/Bob-4      109.5µ ± 0%   100.5µ ± 0%   -8.19% (p=0.000 n=20)

Change-Id: I600116baa0b390bb83950a42c7693cd7806dba9a
Reviewed-on: https://go-review.googlesource.com/c/go/+/578797
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
2024-05-06 15:27:18 +00:00
Jes Cok
eabf59bc47 all: make use of stringslite.{HasPrefix, HasSuffix}
Just a code cleanup.

Change-Id: Ie887ab2c71de11b4844c4e6fd4e5aca3265ac3aa
Reviewed-on: https://go-review.googlesource.com/c/go/+/583216
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2024-05-06 14:00:54 +00:00
Jayanth Krishnamurthy
ac174400f4 hash/crc32: improve asm for ppc64SlicingUpdateBy8
Improvements are made in the assembler code which improves  time and
space by 9-10%.
1. ANDCC, followed by SLD is combined and replaced by CLRLSLDI.
2. MOVWZ can use an indexed load and eliminate an ADD instruction in some cases.
	Example: ADD R7,R10,R7 followed by MOVWZ 0(R7),R5 can be replaced with just MOVWZ (R7)(R10),R5.
3. Optimizations for the block after the "short" label includes the same MOVWZ use of indexed load, as well as other improvements.

The gain from code  changes can be seen as follows, generated by
benchstat:

goos: linux
goarch: ppc64le
pkg: hash/crc32
cpu: POWER10
                                     |  oldCrc.out   |  newCrc.out                     	 |
                                     |    sec/op     |   sec/op     vs base            	 |
CRC32/poly=IEEE/size=15/align=0-12      50.19n ±  1%   39.85n ± 0%  -20.59% (p=0.002 n=6)
CRC32/poly=IEEE/size=15/align=1-12      50.18n ±  1%   39.87n ± 0%  -20.54% (p=0.002 n=6)
CRC32/poly=IEEE/size=40/align=0-12      40.25n ±  0%   36.95n ± 0%   -8.19% (p=0.002 n=6)
CRC32/poly=IEEE/size=40/align=1-12      40.31n ±  0%   36.95n ± 0%   -8.36% (p=0.002 n=6)
CRC32/poly=IEEE/size=512/align=0-12     38.03n ±  0%   38.17n ± 0%   +0.37% (p=0.002 n=6)
CRC32/poly=IEEE/size=512/align=1-12     89.19n ±  1%   73.65n ± 0%  -17.43% (p=0.002 n=6)
CRC32/poly=IEEE/size=1kB/align=0-12     50.73n ±  7%   50.14n ± 0%   -1.18% (p=0.002 n=6)
CRC32/poly=IEEE/size=1kB/align=1-12    101.00n ± 37%   81.58n ± 0%  -19.23% (p=0.002 n=6)
CRC32/poly=IEEE/size=4kB/align=0-12     98.30n ± 45%   93.05n ± 0%   -5.34% (p=0.043 n=6)
CRC32/poly=IEEE/size=4kB/align=1-12     140.8n ±  0%   125.8n ± 0%  -10.65% (p=0.002 n=6)
CRC32/poly=IEEE/size=32kB/align=0-12    525.8n ±  0%   528.5n ± 0%   +0.52% (p=0.011 n=6)
CRC32/poly=IEEE/size=32kB/align=1-12    584.4n ±  1%   576.3n ± 0%   -1.39% (p=0.002 n=6)
geomean                                 90.51n         81.74n        -9.69%

	                             |    oldCrc.out |    newCrc.out           		  |
                                     |      B/s      |     B/s       vs base    	  |
CRC32/poly=IEEE/size=15/align=0-12     285.0Mi ±  1%    359.0Mi ± 0%  +25.94% (p=0.002 n=6)
CRC32/poly=IEEE/size=15/align=1-12     285.1Mi ±  1%    358.8Mi ± 0%  +25.86% (p=0.002 n=6)
CRC32/poly=IEEE/size=40/align=0-12     947.8Mi ±  0%   1032.3Mi ± 0%   +8.91% (p=0.002 n=6)
CRC32/poly=IEEE/size=40/align=1-12     946.2Mi ±  0%   1032.5Mi ± 0%   +9.12% (p=0.002 n=6)
CRC32/poly=IEEE/size=512/align=0-12    12.54Gi ±  0%    12.49Gi ± 0%   -0.37% (p=0.002 n=6)
CRC32/poly=IEEE/size=512/align=1-12    5.346Gi ±  1%    6.475Gi ± 0%  +21.12% (p=0.002 n=6)
CRC32/poly=IEEE/size=1kB/align=0-12    18.80Gi ±  7%    19.02Gi ± 0%   +1.20% (p=0.002 n=6)
CRC32/poly=IEEE/size=1kB/align=1-12    9.454Gi ± 27%   11.690Gi ± 0%  +23.66% (p=0.002 n=6)
CRC32/poly=IEEE/size=4kB/align=0-12    38.86Gi ± 31%    41.00Gi ± 0%   +5.49% (p=0.041 n=6)
CRC32/poly=IEEE/size=4kB/align=1-12    27.10Gi ±  0%    30.32Gi ± 0%  +11.89% (p=0.002 n=6)
CRC32/poly=IEEE/size=32kB/align=0-12   58.05Gi ±  0%    57.74Gi ± 0%   -0.53% (p=0.009 n=6)
CRC32/poly=IEEE/size=32kB/align=1-12   52.22Gi ±  1%    52.95Gi ± 0%   +1.41% (p=0.002 n=6)
geomean                                6.074Gi          6.724Gi       +10.70%

Change-Id: I378c0e84e798656384a8009f4ac48b51614489b2
Cq-Include-Trybots: luci.golang.try:gotip-linux-ppc64_power10,gotip-linux-ppc64_power8,gotip-linux-ppc64le_power8,gotip-linux-ppc64le_power9,gotip-linux-ppc64le_power10
Reviewed-on: https://go-review.googlesource.com/c/go/+/582395
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Eli Bendersky <eliben@google.com>
2024-05-06 12:09:50 +00:00
Mauri de Souza Meneguzzo
ff0bc4669e runtime: add crash stack support for mips/mipsle
Change-Id: Ic6fcdfb6a9a912a9b1dd268836d2e5ab44d80440
GitHub-Last-Rev: dab6ecc066
GitHub-Pull-Request: golang/go#65305
Reviewed-on: https://go-review.googlesource.com/c/go/+/558698
Reviewed-by: Michael Knyszek <mknyszek@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>
Run-TryBot: Mauri de Souza Meneguzzo <mauri870@gmail.com>
2024-05-06 11:46:29 +00:00
apocelipes
619b419a4b os: use stringslite.TrimSuffix
Change-Id: Ie51a1550181c9478455c757fc82a88bc549ad687
GitHub-Last-Rev: 4b6ffd043b
GitHub-Pull-Request: golang/go#67153
Reviewed-on: https://go-review.googlesource.com/c/go/+/583095
Auto-Submit: Ian Lance Taylor <iant@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-05-05 00:26:04 +00:00
qiulaidongfeng
c3dff93a8c strconv: use stringslite.Clone
Change-Id: Ifa3c022ad5453301573593a3d05e7b1d42b931ff
GitHub-Last-Rev: a7468b068b
GitHub-Pull-Request: golang/go#67167
Reviewed-on: https://go-review.googlesource.com/c/go/+/583215
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
2024-05-05 00:24:26 +00:00
qiulaidongfeng
a80543a987 time: use stringslite.Clone
Change-Id: I82f0e7c0c0c80a3cc0e4a732a59ae1debb37d8d9
GitHub-Last-Rev: c8a081f5b3
GitHub-Pull-Request: golang/go#67166
Reviewed-on: https://go-review.googlesource.com/c/go/+/583195
Commit-Queue: Ian Lance Taylor <iant@google.com>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-05-05 00:24:24 +00:00
qiulaidongfeng
4dccb78582 unique: use stringslite.Clone
Change-Id: Icb1ba7df1f0414090632e663b6a92b492546070d
GitHub-Last-Rev: 5169d26813
GitHub-Pull-Request: golang/go#67092
Reviewed-on: https://go-review.googlesource.com/c/go/+/581940
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>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
Reviewed-by: Keith Randall <khr@google.com>
2024-05-05 00:24:21 +00:00
Joel Sing
20130cc36a syscall: remove references to SYS_syscall on openbsd
OpenBSD 7.5 no longer has a syscall symbol in libc. This will
typically result in external linking failures since the syscall
package still has a reference to an undefined `syscall' symbol.
Remove these references and return ENOSYS if syscall.Syscall* or
syscall.RawSyscall* are used for a system call number that does not
currently have an internal remapping.

Fixes #63900

Change-Id: Ic757bf8872ad98a92dd5b34cf58312c32fbc9a96
Reviewed-on: https://go-review.googlesource.com/c/go/+/582257
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2024-05-04 07:51:20 +00:00
Joel Sing
8841f50d98 syscall: reroute SYS_IOCTL and SYS_SYSCTL on openbsd
OpenBSD 7.5 no longer supports indirect syscalls. A number of Go
packages make use of syscall.Syscall with SYS_IOCTL or SYS_SYSCTL,
since neither is well supported by golang.org/x/sys/unix. Reroute
calls with either of these system call numbers to the respective
libc stub so that they continue to work.

Updates #63900

Change-Id: I3323a3fa311ee9227e6220417834253763866881
Reviewed-on: https://go-review.googlesource.com/c/go/+/582256
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-04 07:50:55 +00:00
Joel Sing
17fce63239 cmd/dist,internal/platform: temporarily disable race detector on openbsd/amd64
Unfortunately, LLVM TSAN decided to remove OpenBSD support, which
means that the syso files cannot currently be regenerated (see #52090).
The race_openbsd.syso contains a reference to the syscall symbol,
which has been removed from OpenBSD's libc in 7.5. As such, this
means that the race detector no longer works on openbsd/amd64 (at
least until LLVM TSAN support is reinstated for OpenBSD).

Updates #63900

Change-Id: I3474fc43a94e5197815862b7dc420b71d5e08815
Reviewed-on: https://go-review.googlesource.com/c/go/+/582255
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Joel Sing <joel@sing.id.au>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-04 07:50:22 +00:00
qiulaidongfeng
ae6af9b3d8 strings: move Clone to stringslite
Follow-up CL help package like unique use Clone.

Change-Id: Ie64adf7e1a331f47c3cfe178c368d72fc72493ff
GitHub-Last-Rev: 499476cc4a
GitHub-Pull-Request: golang/go#67106
Reviewed-on: https://go-review.googlesource.com/c/go/+/581956
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
2024-05-04 01:23:42 +00:00
Paul E. Murphy
7994da4cc1 cmd/compile/internal/ssa: on PPC64, try combining CLRLSLDI and SRDconst into RLWINM
This provides a small performance bump to crc64 as measured on ppc64le/power10:

name              old time/op    new time/op    delta
Crc64/ISO64KB       49.6µs ± 0%    46.6µs ± 0%  -6.18%
Crc64/ISO4KB        3.16µs ± 0%    2.97µs ± 0%  -5.83%
Crc64/ISO1KB         840ns ± 0%     794ns ± 0%  -5.46%
Crc64/ECMA64KB      49.6µs ± 0%    46.5µs ± 0%  -6.20%
Crc64/Random64KB    53.1µs ± 0%    49.9µs ± 0%  -6.04%
Crc64/Random16KB    15.9µs ± 1%    15.0µs ± 0%  -5.73%

Change-Id: I302b5431c7dc46dfd2d211545c483bdcdfe011f1
Cq-Include-Trybots: luci.golang.try:gotip-linux-ppc64_power10,gotip-linux-ppc64_power8,gotip-linux-ppc64le_power8,gotip-linux-ppc64le_power9,gotip-linux-ppc64le_power10
Reviewed-on: https://go-review.googlesource.com/c/go/+/581937
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Eli Bendersky <eliben@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2024-05-03 21:12:29 +00:00
Michael Matloob
99fc317948 cmd/go: add flag values to counter for buildmode
Usually, when we increment counters for flags, the counter only contains
the flag name. For the buildmode flag, we now include the flag value
because there's a limited set of values.

We can't use CountFlags directly anymore since we have different
behavior for buildmode.

Change-Id: I956a1a97d62850df3199b5514ad507ea51355c9f
Reviewed-on: https://go-review.googlesource.com/c/go/+/582896
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
2024-05-03 19:05:42 +00:00
Michael Matloob
23f760fd58 cmd/go: remove checks that all counters incremented are in counters.txt
This change removes cmd/go/testdata/counters.txt. It also removes the
code that prepares it and checks that it contains all registered
counters as well as counters for all flags and subcommands. It removes
the counter registration mechanism, and uses telemetry.NewCounter to
create new counters instead. It keeps the tests that check that at least
one counter is incremented if the go command is invoked in a script test.

Change-Id: Ic6bda5c64e90f0dd7e221968fce0e375e84d6e17
Cq-Include-Trybots: luci.golang.try:gotip-windows-amd64-longtest,gotip-linux-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/582715
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
2024-05-03 18:15:22 +00:00
Russ Cox
7b5206bdf3 internal/bisect: use f.Function instead of f.Func.Name in stack trace
For inlined frames f.Func is nil and f.Func.Name is an empty string.
f.Function is correct all the time.

Change-Id: I7c30f80e7176128ae5576b130d2891f884ee47c4
Reviewed-on: https://go-review.googlesource.com/c/go/+/581996
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Russ Cox <rsc@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2024-05-03 17:28:43 +00:00
apocelipes
10c035acd6 strings: move TrimPrefix and TrimSuffix to stringslite
To help packages use these functions like "os" which using
the copied function "stringsTrimSuffix".

Change-Id: I223028ed264c7b7e95534b4883223af0988cda68
GitHub-Last-Rev: 2fd8fbf528
GitHub-Pull-Request: golang/go#67151
Reviewed-on: https://go-review.googlesource.com/c/go/+/583075
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: qiu laidongfeng2 <2645477756@qq.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2024-05-03 16:48:16 +00:00