Commit graph

51955 commits

Author SHA1 Message Date
Paul E. Murphy d11e417285 cmd/compile/internal/ssa: cleanup ANDCCconst rewrite rules on PPC64
Avoid creating duplicate usages of ANDCCconst. This is preparation for
a patch to reintroduce ANDconst to simplify the lower pass while
treating ANDCCconst like other *CC* ssa opcodes.

Also, move many of the similar rules wich retarget ANDCCconst users
to the flag result to a common rule for all compares against zero.

Change-Id: Ida86efe17ff413cb82c349d8ef69d2899361f4c0
Reviewed-on: https://go-review.googlesource.com/c/go/+/585400
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-05-17 15:28:00 +00:00
Kir Kolyshkin 2f6426834c os: make use of pidfd on linux
Use Process.handle field to store pidfd, and make use of it. Only use
pidfd functionality if all the needed syscalls are available.

1. Add/use pidfdWorks, which checks that all needed pidfd-related
   functionality works.

2. os.StartProcess: obtain the pidfd from the kernel, if possible, using
   the functionality added by CL 520266. Note we could not modify
   syscall.StartProcess to return pidfd directly because it is a public
   API and its callers do not expect it, so we have to use ensurePidfd
   and getPidfd.

3. (*Process).Kill: use pidfdSendSignal, if available and the pidfd is
   known. Otherwise, fall back to the old implementation.

4. (*Process).Wait: use pidfdWait, if available, otherwise fall back to
   using waitid/wait4. This is more complicated than expected due to
   struct siginfo_t idiosyncrasy.

NOTE pidfdSendSignal and pidfdWait are used without a race workaround
(blockUntilWaitable and sigMu, added by CL 23967) because with pidfd,
PID recycle issue doesn't exist (IOW, pidfd, unlike PID, is guaranteed
to refer to one particular process) and thus the race doesn't exist
either.

Rework of CL 528438 (reverted in CL 566477 because of #65857).

For #62654.
Updates #13987.

Change-Id: If5ef8920bd8619dc428b6282ffe4fb8c258ca224
Reviewed-on: https://go-review.googlesource.com/c/go/+/570036
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Kirill Kolyshkin <kolyshkin@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Cherry Mui <cherryyz@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2024-05-17 01:23:00 +00:00
qiulaidongfeng 69105d79ef cmd/go: unexport loadImport
Complete a TODO.

Change-Id: I39869df4d95a5a5f6019e281719b942fbf4ba7db
GitHub-Last-Rev: c664b5332e
GitHub-Pull-Request: golang/go#67091
Reviewed-on: https://go-review.googlesource.com/c/go/+/581939
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-05-17 00:11:59 +00:00
Jorropo 1b8117b34a cmd/compile: fix indentation level in generic.rules
Change-Id: I60a9abe72f786e18a59339df271c5521d2d1cda2
Reviewed-on: https://go-review.googlesource.com/c/go/+/555155
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-05-16 22:21:05 +00:00
Mauri de Souza Meneguzzo c89318667f runtime: cleanup crashstack code
This patch removes redundant guards for the crash stack feature, as all
supported Go architectures now have a crash stack implementation.

Change-Id: I7ffb61c57955778d687073418130b2aaab0ff183
GitHub-Last-Rev: 6ff56d6420
GitHub-Pull-Request: golang/go#67202
Reviewed-on: https://go-review.googlesource.com/c/go/+/583416
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Mauri de Souza Meneguzzo <mauri870@gmail.com>
2024-05-16 21:49:14 +00:00
Michael Matloob 036e93ba76 cmd/go: add go telemetry command and GOTELEMETRY, GOTELEMETRYDIR
Add the go telemetry command to support setting and viewing the
telemetry mode. Also add the non-settable GOTELEMETRY and GOTELEMETRYDIR
variables to go env, which contain the mode and telemetry dir.

For #67111

Change-Id: Id7e89cefe30acfe3d865fa467315fe7cda975de9
Reviewed-on: https://go-review.googlesource.com/c/go/+/584535
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-16 20:16:39 +00:00
Robert Griesemer 26ed0528c7 go/types, types2: report error for floating-point iteration variable
While at it, slightly improve documentation and code.
Also, add additional test cases for #66561.

Updates #66561.
Fixes #67027.

Change-Id: I682b0e9227e065d6bbd199871c2e1ecff13edc66
Reviewed-on: https://go-review.googlesource.com/c/go/+/580937
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
2024-05-16 18:56:00 +00:00
Chen.Zhidong a523152ea1 net/http: add Pattern field in Request to return matched pattern info
Fixes #66405

Change-Id: Icd80944b6ca081aa7addd4fb85d2b3c29b6c9542
GitHub-Last-Rev: c6e32742c4
GitHub-Pull-Request: golang/go#66618
Reviewed-on: https://go-review.googlesource.com/c/go/+/574997
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-16 18:42:34 +00:00
Mike Beaumont 78e50d0fa0 crypto/tls: don't call tlsrsakex.IncNonDefault with FIPS
We haven't called tlsrsakex.Value() yet at this point if we're using
FIPS, like if CipherSuites != nil. This adds needFIPS as a gate next to
CipherSuites != nil. FIPS specifies suites that would be skipped if
tlsarsakex were set.

Fixes #65991

Change-Id: I8070d8f43f27c04067490af8cc7ec5e787f2b9bd
Reviewed-on: https://go-review.googlesource.com/c/go/+/582315
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Bypass: Filippo Valsorda <filippo@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-05-16 17:33:18 +00:00
Yoann Congal 18104621ce crypto/x509: fix certificate request creation with RSA-PSS
In case of a RSA-PSS algorithm, the hashFunc of CreateCertificateRequest
is embedded in a rsa.PSSOptions struct. Given to key.Sign(), this will
generate a proper RSA-PSS signature.

Pasted from the RSA-PSS handling code in CreateCertificate().

Fixes #45990
Fixes #65074

Change-Id: I8475afa79d8add107f092cc2871d38300e7b3903
GitHub-Last-Rev: 63fb0214c3
GitHub-Pull-Request: golang/go#55153
Reviewed-on: https://go-review.googlesource.com/c/go/+/431916
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
TryBot-Bypass: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Alex Scheel <alex.scheel@hashicorp.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-05-16 17:32:30 +00:00
Tobias Klauser 6ed31e3c3e net: fix typo in ctrlCtxFn parameter name
context.Context parameters are commonly named ctx, not cxt.

Change-Id: Icaadbcd38b054694959e5e8a058552a3e54be6d4
Reviewed-on: https://go-review.googlesource.com/c/go/+/586016
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-05-16 16:54:32 +00:00
apocelipes 2b42ed6483 crypto: use byteorder to simplify consumeUint32 and consumeUint64
A follow-up for the recent CL 585017.

Change-Id: I9faaff7fdf62fc931fc7f64dbe238de277280730
GitHub-Last-Rev: 468d60c396
GitHub-Pull-Request: golang/go#67425
Reviewed-on: https://go-review.googlesource.com/c/go/+/586035
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-16 16:50:58 +00:00
Rob Findley 6a05055780 go/ast: fix bug handling the result of yield in Preorder
Once yield returns false, ast.Preorder must not call yield on any more
nodes. Even after the function passed to ast.Inspect returns false, it
may be invoked again with a non-nil node. Therefore, we must explicitly
truncate the inspection.

For #66339

Change-Id: I2b01e4e96a2d7aca785467c15ab59da13208c161
Reviewed-on: https://go-review.googlesource.com/c/go/+/585520
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-16 16:34:10 +00:00
Jonathan Amsterdam db7bb2742c log/slog: handle times with undefined UnixNanos
slog tries to represent a time.Time without allocations, which involves
storing its UnixNanos value. But UnixNanos is undefined for some valid
times. Provide a fallback representation for those times by storing them
in the `any` field of `Value`.

Fixes #65902.

Change-Id: I736c739a92f77d7b1122ea0831524acdd2c4703f
Reviewed-on: https://go-review.googlesource.com/c/go/+/585519
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
2024-05-16 16:12:08 +00:00
Damien Neil 505000b2d3 net/http: simplify HTTP/1 request cancelation
HTTP requests have three separate user cancelation signals:

	Transport.CancelRequest
	Request.Cancel
	Request.Context()

In addition, a request can be canceled due to errors.

The Transport keeps a map of all in-flight requests,
with an associated func to run if CancelRequest is
called. Confusingly, this func is *not* run if
Request.Cancel is closed or the request context expires.

The map of in-flight requests is also used to communicate
between roundTrip and readLoop. In particular, if readLoop
reads a response immediately followed by an EOF, it may
send racing signals to roundTrip: The connection has
closed, but also there is a response available.
This race is resolved by readLoop communicating through
the request map that this request has successfully
completed.

This CL refactors all of this.

In-flight requests now have a context which is canceled
when any of the above cancelation events occurs.

The map of requests to cancel funcs remains, but is
used strictly for implementing Transport.CancelRequest.
It is not used to communicate information about the
state of a request.

Change-Id: Ie157edc0ce35f719866a0a2cb0e70514fd119ff8
Reviewed-on: https://go-review.googlesource.com/c/go/+/546676
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-05-16 15:57:17 +00:00
Damien Neil 33d725e575 archive/zip: treat truncated EOCDR comment as an error
When scanning for an end of central directory record,
treat an EOCDR signature with a record containing a truncated
comment as an error. Previously, we would skip over the invalid
record and look for another one. Other implementations do not
do this (they either consider this a hard error, or just ignore
the truncated comment). This parser misalignment allowed
presenting entirely different archive contents to Go programs
and other zip decoders.

Fixes #66869

Change-Id: I94e5cb028534bb5704588b8af27f1e22ea49c7c6
Reviewed-on: https://go-review.googlesource.com/c/go/+/585397
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-16 15:56:19 +00:00
Michael Matloob 643ad42d5c cmd/go/internal/envcmd: fix showing GODEBUG env value
It was accidently dropped in CL 563137

For #34208

Change-Id: I0aea93fda6260f07bc662dea92d1eabb26f82ca0
Reviewed-on: https://go-review.googlesource.com/c/go/+/586095
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
2024-05-16 15:26:42 +00:00
Alan Donovan a22cb5cabe runtime/debug: eliminate temporary variadicity from SetCrashOutput
Updates #67182

Change-Id: I33fc8c515f4a9d120262ba30f61aea80ede5e9f8
Reviewed-on: https://go-review.googlesource.com/c/go/+/585420
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Austin Clements <austin@google.com>
2024-05-16 15:19:04 +00:00
qiulaidongfeng 6cd066f8b2 cmd/go: add -changed to query for non-defaults in the env
Fixes #34208

Change-Id: I8ec2d96262dcd7cbf870f6173690143c54190722
GitHub-Last-Rev: 6543df4784
GitHub-Pull-Request: golang/go#65655
Reviewed-on: https://go-review.googlesource.com/c/go/+/563137
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2024-05-16 14:34:32 +00:00
Alan Donovan d367b2a475 cmd/vendor/golang.org/x/telemetry: update to 9ff3ad9
Updates #67182

Change-Id: I76b312ccbd1ea98eb2f4e3beec9e8b42e633ea5b
Reviewed-on: https://go-review.googlesource.com/c/go/+/585819
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Austin Clements <austin@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-16 14:32:04 +00:00
Mateusz Poliwczak 722d59436b crypto/x509: add text and binary marshal methods to OID
Fixes #66249

Change-Id: I5973a19a087a35ad951e8a220d3e6e4456c7577f
GitHub-Last-Rev: 921ca8bd0c
GitHub-Pull-Request: golang/go#66599
Reviewed-on: https://go-review.googlesource.com/c/go/+/575295
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Auto-Submit: Roland Shoemaker <roland@golang.org>
2024-05-16 02:00:26 +00:00
Tobias Klauser 63a0a905fa math/rand/v2: use max builtin in tests
Change-Id: I6d0050319c66fb62c817206e646e1a9449dc444c
Reviewed-on: https://go-review.googlesource.com/c/go/+/585715
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Griesemer <gri@google.com>
2024-05-16 01:44:46 +00:00
Michael Pratt 1ffc296717 runtime: always update stack bounds on cgocallback
callbackUpdateSystemStack contains a fast path to exit early without
update if SP is already within the g0.stack bounds.

This is not safe, as a subsequent call may have new stack bounds that
only partially overlap the old stack bounds. In this case it is possible
to see an SP that is in the old stack bounds, but very close to the
bottom of the bounds due to the partial overlap. In that case we're very
likely to "run out" of space on the system stack.

We only need to do this on extra Ms, as normal Ms have precise bounds
defined when we allocated the stack.

TSAN annotations are added to x_cgo_getstackbounds because bounds is a
pointer into the Go stack. The stack can be reused when an old thread
exits and a new thread starts, but TSAN can't see the synchronization
there. This isn't a new case, but we are now calling more often.

Fixes #62440.

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest
Change-Id: I5389050494987b7668d0b317fb92f85e61d798ac
Reviewed-on: https://go-review.googlesource.com/c/go/+/584597
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-16 01:32:45 +00:00
Hiroaki Nakamura fba90c9096 cmd/go/internal/script: Fix build tags of isETXTBSY
syscall.ETXTBSY is only meaningful on Unix platforms, not on Windows.

Fixes #67356

Change-Id: I1b13292d821d61d820b396e08be9a4dd1683e843
Reviewed-on: https://go-review.googlesource.com/c/go/+/585695
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: Michael Matloob <matloob@golang.org>
2024-05-16 00:12:01 +00:00
Jes Cok ae5ee7042e net/http, reflect: rename Test function names
To be consistent with other tests.

Change-Id: Ibea1d3bf57a295f024e05173d17112ce46a4f0bc
Reviewed-on: https://go-review.googlesource.com/c/go/+/585895
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2024-05-15 23:39:44 +00:00
Michael Matloob 13d36a9b46 cmd/go: don't start upload until after toolchain selection
Run telemetry.Start (without the upload) first thing so we can increment
counters in toolchain selection. Then run telemetry.StartWithUpload
after toolchain selection so we don't start the upload until after
toolchain selection has happened so we don't start something heavyweight
before selection.

Change-Id: Ia8979175a163265c3e29f6cb11a4ada4714d1d95
Reviewed-on: https://go-review.googlesource.com/c/go/+/585419
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
2024-05-15 21:51:49 +00:00
Alan Donovan 7730e5b783 go/ast: add Preorder go1.23 iterator
This CL adds a new function Preorder that makes it
easier to iterate over the nodes of a syntax tree.
In particular, break, continue, and return retain
their usual continuations.

Fixes #66339

Change-Id: I438b3c23780c91ed589871ad3b8822d54e8fabc7
Reviewed-on: https://go-review.googlesource.com/c/go/+/570680
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-15 21:44:50 +00:00
Robert Griesemer 3c8f925606 go/types, types2: factor out type parameter access into genericType
Also, remove types2.Signature.SetTypeParams as it is not used
and does not exist in go/types.

Change-Id: I16c3ae988988d3735907e9c6c56e8626497ea405
Reviewed-on: https://go-review.googlesource.com/c/go/+/581817
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2024-05-15 21:33:05 +00:00
Robert Griesemer bf279b71e2 go/types, types2: add Alias.{TypeParams, SetTypeParams, TypeArgs, Origin}
Fixes #67143.

Change-Id: I8bf9c2559f95d3d6a40874454208ae074b68875c
Reviewed-on: https://go-review.googlesource.com/c/go/+/583757
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-15 21:32:30 +00:00
Alan Donovan 36b06c3d2f cmd/vendor/golang.org/x/telemetry: update to ac8fed8
Updates #67182

Change-Id: I14f6a35491e3a58fff2f33285bd13ac706668df6
Reviewed-on: https://go-review.googlesource.com/c/go/+/585818
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Austin Clements <austin@google.com>
2024-05-15 21:12:15 +00:00
Alan Donovan 3f7a030e02 runtime/debug: add SetCrashOutput(...CrashOptions) parameter
This is a placeholder for future options (e.g. JSON).

The parameter is temporarily variadic to avoid breaking
x/telemetry (see CL 585378), but I plan to remove
the "..." later this week.

Updates #67182

Change-Id: I3f6f39455d852f92902f8e3f007d3093cbe555db
Reviewed-on: https://go-review.googlesource.com/c/go/+/585557
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Austin Clements <austin@google.com>
2024-05-15 21:04:14 +00:00
Rob Findley 3d80761531 go/types, types2: add additional documentation for Underlying
The concept of an underlying type has become more complicated with the
addition of TypeParam and Alias types. Update the documentation to
clarify that it strips off Named, TypeParam, and Alias types, and to
reference the spec.

Fixes #65774

Change-Id: I40a8efe15b45591b95068acbf4ef9eae17a4cef1
Reviewed-on: https://go-review.googlesource.com/c/go/+/585456
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Findley <rfindley@google.com>
2024-05-15 20:03:31 +00:00
Cherry Mui c4772d30bf cmd/link: disallow pull-only linknames
As mentioned in CL 584598, linkname is a mechanism that, when
abused, can break API integrity and even safety of Go programs.
CL 584598 is a first step to restrict the use of linknames, by
implementing a blocklist. This CL takes a step further, tightening
up the restriction by allowing linkname references ("pull") only
when the definition side explicitly opts into it, by having a
linkname on the definition (possibly to itself). This way, it is at
least clear on the definition side that the symbol, despite being
unexported, is accessed outside of the package. Unexported symbols
without linkname can now be actually private. This is similar to
the symbol visibility rule used by gccgo for years (which defines
unexported non-linknamed symbols as C static symbols).

As there can be pull-only linknames in the wild that may be broken
by this change, we currently only enforce this rule for symbols
defined in the standard library. Push linknames are added in the
standard library to allow things build.

Linkname references to external (non-Go) symbols are still allowed,
as their visibility is controlled by the C symbol visibility rules
and enforced by the C (static or dynamic) linker.

Assembly symbols are treated similar to linknamed symbols.

This is controlled by -checklinkname linker flag, currently not
enabled by default. A follow-up CL will enable it by default.

Change-Id: I07344f5c7a02124dbbef0fbc8fec3b666a4b2b0e
Reviewed-on: https://go-review.googlesource.com/c/go/+/585358
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
2024-05-15 19:57:43 +00:00
Cherry Mui 849770dec9 cmd/compile: disallow linkname referring to instantiations
Linknaming an instantiated generic symbol isn't particularly
useful: it doesn't guarantee the instantiation exists, and the
instantiated symbol name may be subject to change. Checked with a
large code corpus, currently there is no occurrance of linkname
to an instantiated generic symbol (or symbol with a bracket in its
name). This also suggests that it is not very useful. Linkname is
already an unsafe mechanism. We don't need to allow it to do more
unsafe things without justification.

Change-Id: Ifaa20c98166b28a9d7dc3290c013c2b5bb7682e7
Reviewed-on: https://go-review.googlesource.com/c/go/+/585458
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2024-05-15 19:27:25 +00:00
Alan Donovan bf0b605dfb runtime: make convTstring write barrier unreachable from throw
CL 581215 changed 'throw' so that instead of print(s) it called
a more complicated function, printpanicval, that statically
appeared to have convTstring in its call graph, even though this
isn't dynamically reachable when called with a string argument.

However, this caused the link-time static callgraph test to point
out that throw (which is called in nowritebarrierrec contexts
such as markgc) reaches a write barrier.

The solution is to inline and specialize the printpanicval
function for strings; it reduces to printindented.

Thanks to mpratt for pointing out that the reachability
check is on the fully lowered code, and is thus sensitive
to optimizations such as inlining.
I added an explanatory comment on the line that generates
the error message to help future users confused as I was.

Fixes golang/go#67274

Change-Id: Ief110d554de365ce4c09509dceee000cbee30ad9
Reviewed-on: https://go-review.googlesource.com/c/go/+/584617
Reviewed-by: Than McIntosh <thanm@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2024-05-15 17:29:46 +00:00
Michael Matloob 90b1521138 cmd/go/internal/modload: compute direct in workspace mode
The Requirements structure, which represents the root level requirements
of the module graph also has a 'direct' field which contains the set of
direct dependencies of a module.

Before this change, in workspace mode, the direct field was not set on
the Requirements structure. This change sets direct in the two places
it's needed: when initializing Requirements from the workspace's mod
files and when updating Requirements based on imports.

When initializing Requirements from the workspace's mod files, this
change will use the 'indirect' comments in those mod files to record the
set of direct modules passed to the Requirements.

There is a loop in updateRequirements where we consider the imports of
the packages we loaded from the main module to make sure that all those
imported packages' modules are required.  The loop also updates direct
for each of those modules (which have at least one package directly
imported by the main modules).  Before this change, in the workspace
case we continued early from the loop and didn't proceed to the code
where direct is computed. This change fixes that.

Fixes #66789

Change-Id: I2b497fbf28c2197e8ba8e8ca5314c1a720f16364
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/580256
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
2024-05-15 16:04:44 +00:00
David Chase 18d0e6a14f cmd/compile, cmd/internal: fine-grained fiddling with loop alignment
This appears to be useful only on amd64, and was specifically
benchmarked on Apple Silicon and did not produce any benefit there.
This CL adds the assembly instruction `PCALIGNMAX align,amount`
which aligns to `align` if that can be achieved with `amount`
or fewer bytes of padding. (0 means never, but will align the
enclosing function.)

Specifically, if low-order-address-bits + amount are
greater than or equal to align; thus, `PCALIGNMAX 64,63` is
the same as `PCALIGN 64` and `PCALIGNMAX 64,0` will never
emit any alignment, but will still cause the function itself
to be aligned to (at least) 64 bytes.

Change-Id: Id51a056f1672f8095e8f755e01f72836c9686aa3
Reviewed-on: https://go-review.googlesource.com/c/go/+/577935
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2024-05-15 15:44:14 +00:00
Matthew Dempsky 31c8150082 cmd/compile/internal/noder: enable type aliases in type checker
This CL fixes an initialization loop during IR construction, that
stems from IR lacking first-class support for aliases. As a
workaround, we avoid publishing alias declarations until the RHS type
expression has been constructed.

Thanks to gri@ for investigating while I was out.

Fixes #66873.

Change-Id: I11e0d96ea6c357c295da47f44b6ec408edef89b7
Reviewed-on: https://go-review.googlesource.com/c/go/+/585399
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
2024-05-15 15:09:14 +00:00
Kir Kolyshkin c3c97ad1bf run.bash: rm bumping open files soft limit
Since CL 393354 this should no longer be necessary.

Change-Id: Ie9a7f779515aaf8b40a4f0083ba680f7b0231f04
Reviewed-on: https://go-review.googlesource.com/c/go/+/585576
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Kirill Kolyshkin <kolyshkin@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2024-05-15 15:02:23 +00:00
Cherry Mui 27603028eb cmd/internal/obj/x86: make SEH symbols content-addressable
Currently, the SEH symbol is defined as an aux symbol of the
function symbol, without adding to ctxt.Data. Each function has
its own SEH symbol. As there are a lot of duplications of the
SEH symbol contents, currently a Go object file may contain many
copies of identical SEH symbols. They are deduplicated at link
time. But it does make the linker do redundant work, and make it
hard to reason about the SEH symbol writing in the object file
writer, and its resolution in the linker. In fact, in the object
file writer, the same SEH symbol may be added to the ctxt.defs
multiple times (as it is the aux of multiple function symbols),
which is not expected.

In fact, "aux symbol" is just a mechanism to associate auxiliary
data to another symbol. The auxiliary data symbol itself can be an
ordinary data symbol, even a content-addressable symbol. Define
the SEH symbol as a conntent-addressable symbol and add it to
ctxt.Data. This way there is only one definition of each unique
SEH symbol, which can be the aux of many functions.

While here, add a check to ensure that we add a symbol at most
once to the defs list.

Change-Id: Ie7a0cf02ca114060423e025931b30de97ca330fe
Reviewed-on: https://go-review.googlesource.com/c/go/+/585656
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2024-05-15 14:41:10 +00:00
Cherry Mui 8056540772 cmd/internal/obj: print symbol index at -S=3
When the compiler or assembler's -S flag is set to 3 or higher,
print the symbol index, for debugging.

Change-Id: Ia7a42b0c017105ef12fd97b3e52de0e155b0cf2e
Reviewed-on: https://go-review.googlesource.com/c/go/+/585655
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2024-05-15 14:39:06 +00:00
Paul E. Murphy 408739fc96 cmd/compile,cmd/asm: on PPC64, generate compares against constant 0
Merge the handling of CMPx r,r,cr and CMPx r,i,cr when assembling.

This prevents generating machine code like cmpd rx,r0 when cmpdi rx,0
is preferred. The preferred form can be fused on Power10 for faster
execution of some instruction sequences.

Likewise, update a common case to use $0 instead of R0 to take
advantage of this.

Change-Id: If2549ca25a5f7d23001885ad444c70d829b3b066
Cq-Include-Trybots: luci.golang.try:gotip-linux-ppc64_power10,gotip-linux-ppc64_power8,gotip-linux-ppc64le_power10,gotip-linux-ppc64le_power8,gotip-linux-ppc64le_power9
Reviewed-on: https://go-review.googlesource.com/c/go/+/585137
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-15 13:55:28 +00:00
Russ Cox 6ccd8e4cf6 cmd/go: add support for godebug lines in go.mod and go.work
The fact that the go line sets both the language version and the
GODEBUG compatibility version can be a problem, especially since
the go line is also required to be ≥ the go lines of any required
dependency modules.

This change adds a new 'godebug' line to go.mod and go.work
to allow setting the GODEBUG values for the entire module.

It also adds a new meta-value default=go1.21 that means
take the defaults from Go 1.21 no matter what the go line says.

These were discussed in proposal #65573.

Fixes #65573.

Change-Id: I91746322a10178370ed1015ce5278372a024c824
Reviewed-on: https://go-review.googlesource.com/c/go/+/584476
Auto-Submit: Russ Cox <rsc@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2024-05-15 13:52:10 +00:00
Paul E. Murphy 0222a028f1 cmd/compile/internal/ssa: combine more shift and masking on PPC64
Investigating binaries, these patterns seem to show up frequently.

Change-Id: I987251e4070e35c25e98da321e444ccaa1526912
Reviewed-on: https://go-review.googlesource.com/c/go/+/583302
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-05-15 13:27:41 +00:00
Michael Stapelberg d05af62695 syscall: skip TestAmbientCapsUserns when restricted, document
fixes golang/go#67088

Change-Id: I42e7a8d02b161187772f147e3e136ab6e0f71d7f
Reviewed-on: https://go-review.googlesource.com/c/go/+/585059
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-05-15 07:45:37 +00:00
Damien Neil a524b87253 net/http: avoid panic when writing 100-continue after handler done
When a request contains an "Expect: 100-continue" header,
the first read from the request body causes the server to
write a 100-continue status.

This write caused a panic when performed after the server handler
has exited. Disable the write when cleaning up after a handler
exits.

This also fixes a bug where an implicit 100-continue could be
sent after a call to WriteHeader has sent a non-1xx header.

This change drops tracking of whether we've written a
100-continue or not in response.wroteContinue. This tracking
was used to determine whether we should consume the remaining
request body in chunkWriter.writeHeader, but the discard-the-body
path was only taken when the body was already consumed.
(If the body is not consumed, we set closeAfterReply, and we
don't consume the remaining body when closeAfterReply is set.
If the body is consumed, then we may attempt to discard the
remaining body, but there is obviously no body remaining.)

Fixes #53808

Change-Id: I3542df26ad6cdfe93b50a45ae2d6e7ef031e46fa
Reviewed-on: https://go-review.googlesource.com/c/go/+/585395
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2024-05-14 22:34:15 +00:00
Cherry Mui b86527ec05 cmd/compile/internal/ssa: print output on failure in TestFmaHash
When the test fails to run the command, print the error message
to help debug.

Change-Id: I443579a622ba1bf67ef27071f141e945303d4c2b
Reviewed-on: https://go-review.googlesource.com/c/go/+/585357
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-14 21:57:53 +00:00
apocelipes 1f6a983baf database/sql: reordering fields to reduce struct sizes
There are 16 bytes reduced.

Change-Id: I33ca96fd22002b3111f0462c3029d70df48adb6e
GitHub-Last-Rev: 8df56a9655
GitHub-Pull-Request: golang/go#67055
Reviewed-on: https://go-review.googlesource.com/c/go/+/581935
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2024-05-14 20:18:21 +00:00
Tobias Klauser c7597a8d23 internal/poll: use internal/byteorder
Change-Id: Ied768b8b675281b340f91f4ac6f688594be8bf4e
Reviewed-on: https://go-review.googlesource.com/c/go/+/585118
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-05-14 20:14:02 +00:00
Tobias Klauser 7ba8a23b67 syscall: use internal/byteorder
Change-Id: I798729a6095494e9d0bd18d6b7d4372910056218
Reviewed-on: https://go-review.googlesource.com/c/go/+/585117
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-05-14 20:13:24 +00:00
Tobias Klauser 7008859ae1 os: use internal/byteorder
Change-Id: Ic88535f05a55966e35e5da7abb499aa5fadb5cc7
Reviewed-on: https://go-review.googlesource.com/c/go/+/585116
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
2024-05-14 20:11:45 +00:00
Michael Matloob eef288da1e cmd: add telemetry for commands in cmd
This change modifies the commands in cmd to open counter files,
increment invocations counters and to increment counters for the names
of the flags that were passed in.

cmd/pprof and cmd/vet are both wrappers around tools defined in other
modules which do their own flag processing so we can't directly
increment flag counters right after flags are parsed. For those two
commands we wait to increment counters until after the programs have
returned.

cmd/dist is built with the bootstrap go so it can't depend on telemetry
yet. We can add telemetry support to it once 1.23 is the minimum
bootstrap version.

For #58894

Change-Id: Ic7f6009992465e55c56ad4dc6451bcb1ca51374a
Reviewed-on: https://go-review.googlesource.com/c/go/+/585235
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-14 19:41:17 +00:00
Michael Matloob efc347348e cmd: pull in golang.org/x/telemetry@7d78a97
Commands run:
    go get golang.org/x/telemetry@7d78a97
    go mod tidy
    go mod vendor

Change-Id: Iea0fbe11bcc69fac35fba0ee3d02cd14344a3ee9
Reviewed-on: https://go-review.googlesource.com/c/go/+/585455
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2024-05-14 19:09:33 +00:00
Russ Cox ca5fc8de65 cmd/vendor: pull in x/mod/modfile godebug changes
go get golang.org/x/mod@c0bdc7bd
	go mod tidy
	go mod vendor

Pulls in CL 584300.

For #65573.

Change-Id: Ia8ec86e2ee049b911fcf09d57f83972786b0470d
Reviewed-on: https://go-review.googlesource.com/c/go/+/584475
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Russ Cox <rsc@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
2024-05-14 18:34:56 +00:00
Russ Cox 2cc42f7328 time: more flake removal in asynctimerchan test
Trying to write a test for the corner cases in the old async timer chan
implementation may have been a mistake, especially since this isn't
going to be the default timer chan implementation anymore.
But let's try one more time to fix the test.

I reproduced the remaining builder failures on my Mac laptop
by overloading the CPU in one window and then running 48 instances
of the flaky test in loops using 'stress' in another window.

It turns out that, contrary to my understanding of async timers
and therefore contrary to what the test expected, it is technically
possible for

	t := time.NewTicker(1)
	t.Reset(1000*time.Hour)
	<-t.C
	<-t.C

to observe two time values on t.C, as opposed to blocking forever.

We always expect the first time value, since the ticker goes off
immediately (after 1ns) and sends that value into the channel buffer.
To get the second value, the ticker has to be in the process of
going off (which it is doing constantly anyway), and the timer
goroutine has to be about to call sendTime and then get rescheduled.
Then t.Reset and the first <-t.C have to happen.
Then the timer goroutine gets rescheduled and can run sendTime's
non-blocking send on t.C, which finds an empty buffer and writes
a value.

This is unlikely, of course, but it definitely happens. This program
always panics in just a second or two on my laptop:

	package main

	import (
		"os"
		"time"
	)

	func main() {
		os.Setenv("GODEBUG", "asynctimerchan=1")
		for  {
			go func() {
				t := time.NewTicker(1)
				t.Reset(1000*time.Hour)
				<-t.C
				select {
				case <-t.C:
					panic("two receives")
				case <-time.After(1*time.Second):
				}
			}()
		}
	}

Because I did not understand this nuance, the test did not expect it.

This CL rewrites the test to expect that possibility. I can no longer
make the test fail under 'stress' on my laptop.

For #66322.

Change-Id: I15c75d2c6f24197c43094da20d6ab55306a0a9f1
Reviewed-on: https://go-review.googlesource.com/c/go/+/585359
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-14 18:27:21 +00:00
Than McIntosh 3454ac0d63 cmd/link/internal/ld: clean tmpdir obj timestamps
This patch changes the Go linker to "clean" (reset to Unix epoch) the
timestamps on object files copied to the tmpdir that is presented to
the external linker or archive tool. The intent is to improve build
reproducibility on Darwin, where later versions of xcode seem to want
to incorporate object file timestamps into the hash used for the final
build ID (which precludes the possibility of having reproducible Go
builds). Credit for this idea goes to Cherry (see
https://github.com/golang/go/issues/64947#issuecomment-1887667189).

Updates #64947.

Change-Id: I2eb7dddff538e247122b04fdcf8a57c923f61201
Reviewed-on: https://go-review.googlesource.com/c/go/+/585355
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-14 16:44:47 +00:00
Niklas Ott c7c578cdf3 encoding/base32: use correct length for unpadded buffer in Read
If unpadded content was passed, in some occassions content was omitted,
because the division result was floored. Ceiling it makes sure all
content is always read.

Fixes #65166

Change-Id: I1d8ee7ef436080483ed8f0e615b70a1013455f92
Reviewed-on: https://go-review.googlesource.com/c/go/+/581415
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-14 16:25:54 +00:00
Tobias Klauser 9fa34d9fa2 net/netip: fix TestInlining after CL 585057
Addr.AsSlice is not inlinable on all architectures.

Fixes #67354

Change-Id: Ibaf7daa2e1188a05952f8df3c84255436b29478d
Reviewed-on: https://go-review.googlesource.com/c/go/+/585058
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Mateusz Poliwczak <mpoliwczak34@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-05-14 16:17:33 +00:00
Mateusz Poliwczak 8623c0ba95 internal/chacha8rand: use internal/byteorder
Change-Id: Ia5bcaba47da949583a720ca3506d6bd9e3794824
GitHub-Last-Rev: 1ed3dad2bf
GitHub-Pull-Request: golang/go#67320
Reviewed-on: https://go-review.googlesource.com/c/go/+/584996
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-13 21:47:29 +00:00
Tobias Klauser 9f9afbf332 net/netip: test that Addr.AsSlice is inlineable
CL 584995 made Addr.AsSlice inlineable as a side effect. Make sure we
don't regress.

Updates #56136

Change-Id: Ib5f77a430db66ffe45c4cbb264da7a401945fec9
Reviewed-on: https://go-review.googlesource.com/c/go/+/585057
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-05-13 21:43:09 +00:00
Mateusz Poliwczak 259d2347d2 net/netip: replace != nil with != "" in comment
Change-Id: Ie204f90e51c210efe520a075b917c6178e109676
GitHub-Last-Rev: 9ca21ff92f
GitHub-Pull-Request: golang/go#67341
Reviewed-on: https://go-review.googlesource.com/c/go/+/585155
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Auto-Submit: Brad Fitzpatrick <bradfitz@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-13 21:42:34 +00:00
Tobias Klauser 4015277b61 net/netip: combine import groups
Change-Id: If79f4452a34281796c4b8e7b0246c978e09a64af
Reviewed-on: https://go-review.googlesource.com/c/go/+/585056
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-13 21:42:31 +00:00
Alberto Donizetti cc1479653d slices: fix punctuation in the documentation of Values
Change-Id: Idea4f92d511b5f18531758667cb0cb5ed6f91a0a
Reviewed-on: https://go-review.googlesource.com/c/go/+/584359
Reviewed-by: Ian Lance Taylor <iant@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: Dmitri Shuralyov <dmitshur@google.com>
2024-05-13 21:40:32 +00:00
apocelipes a949ade592 image/gif: use internal/byteorder
Change-Id: Ic00e63aa35bcea4c97a5885d61edb8fc37d84e22
GitHub-Last-Rev: 1ad3a5d0ed
GitHub-Pull-Request: golang/go#67324
Reviewed-on: https://go-review.googlesource.com/c/go/+/584997
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: Dmitri Shuralyov <dmitshur@google.com>
2024-05-13 21:38:09 +00:00
nobishino 133cdfb469 encoding/csv: clarify that Writer uses different line break than RFC 4180 by default
Package documentation of encoding/csv says:

> this package supports the format described in RFC 4180.

According to section 2 of RFC 4180:

> Each record is located on a separate line, delimited by a line break (CRLF).

On the other hand, Writer uses LF (not CRLF) as newline character by default.

> If [Writer.UseCRLF] is true, the Writer ends each output line with \r\n instead of \n.

Strictly speaking, this behavior is different from RFC 4180.
Package documentation would improve if we clarify that point.

Change-Id: I120e9332b593e1ac9ed8e49f6f8419ea88efc57d
GitHub-Last-Rev: 489167eb04
GitHub-Pull-Request: golang/go#67290
Reviewed-on: https://go-review.googlesource.com/c/go/+/584835
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-05-13 21:32:28 +00:00
Mateusz Poliwczak 509bbeb407 math/rand/v2, math/big: use internal/byteorder
Change-Id: Id07f16d14133ee539bc2880b39641c42418fa6e2
GitHub-Last-Rev: 7b327d508f
GitHub-Pull-Request: golang/go#67319
Reviewed-on: https://go-review.googlesource.com/c/go/+/585016
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-05-13 21:31:58 +00:00
aimuz 7e196c04ed fmt, internal/fmtsort: refactor SortedMap to use slice of structs for map sorting
This change refactors the SortedMap type in the fmtsort package from using
two parallel slices for keys and values to a single slice of structs. This
improves code clarity and reduces the complexity of handling map entries.
Affected files and their respective functions have been updated to work
with the new structure, including adjustments in fmt/print.go and
text/template/exec.go to iterate over the new map representation.

goos: darwin
goarch: arm64
pkg: fmt
cpu: Apple M2 Max
                                 │   old.txt    │               new.txt                │
                                 │    sec/op    │    sec/op     vs base                │
SprintfPadding-12                  21.29n ±  5%   20.89n ±  8%        ~ (p=0.393 n=10)
SprintfEmpty-12                    2.986n ±  4%   2.997n ± 10%        ~ (p=0.697 n=10)
SprintfString-12                   8.327n ±  9%   8.493n ± 12%        ~ (p=0.579 n=10)
SprintfTruncateString-12           15.93n ± 10%   15.56n ± 10%        ~ (p=0.853 n=10)
SprintfTruncateBytes-12            14.56n ± 12%   14.13n ± 11%        ~ (p=0.796 n=10)
SprintfSlowParsingPath-12          9.026n ± 15%   9.511n ± 14%        ~ (p=0.646 n=10)
SprintfQuoteString-12              40.88n ±  3%   40.73n ±  1%        ~ (p=0.782 n=10)
SprintfInt-12                      6.279n ±  7%   6.130n ±  6%        ~ (p=0.218 n=10)
SprintfIntInt-12                   11.08n ± 10%   11.37n ± 10%        ~ (p=0.424 n=10)
SprintfPrefixedInt-12              31.24n ±  3%   31.21n ±  2%        ~ (p=0.912 n=10)
SprintfFloat-12                    13.96n ±  7%   13.99n ± 15%        ~ (p=0.986 n=10)
SprintfComplex-12                  49.16n ±  7%   50.57n ±  6%        ~ (p=0.436 n=10)
SprintfBoolean-12                  7.578n ± 15%   7.267n ± 11%        ~ (p=0.529 n=10)
SprintfHexString-12                36.14n ±  2%   35.74n ±  1%        ~ (p=0.118 n=10)
SprintfHexBytes-12                 48.74n ±  1%   48.34n ±  4%        ~ (p=0.128 n=10)
SprintfBytes-12                    60.16n ±  3%   61.36n ±  5%        ~ (p=0.218 n=10)
SprintfStringer-12                 39.02n ± 10%   39.31n ±  9%        ~ (p=0.739 n=10)
SprintfStructure-12                161.2n ±  1%   133.9n ±  4%  -16.90% (p=0.000 n=10)
ManyArgs-12                        31.87n ± 17%   33.00n ± 12%        ~ (p=0.165 n=10)
FprintInt-12                       32.32n ±  0%   33.13n ±  1%   +2.49% (p=0.000 n=10)
FprintfBytes-12                    47.31n ±  0%   47.99n ±  1%   +1.44% (p=0.000 n=10)
FprintIntNoAlloc-12                32.05n ±  1%   33.12n ±  0%   +3.34% (p=0.000 n=10)
ScanInts-12                        130.5µ ±  1%   131.3µ ±  0%   +0.57% (p=0.000 n=10)
ScanRecursiveInt-12                40.83m ±  1%   40.65m ±  2%        ~ (p=0.353 n=10)
ScanRecursiveIntReaderWrapper-12   40.77m ±  2%   40.83m ±  2%        ~ (p=0.971 n=10)
geomean                            100.6n         100.3n         -0.32%

                                 │    old.txt     │                new.txt                 │
                                 │      B/op      │     B/op      vs base                  │
SprintfPadding-12                    16.00 ± 0%       16.00 ± 0%        ~ (p=1.000 n=10) ¹
SprintfEmpty-12                      0.000 ± 0%       0.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfString-12                     5.000 ± 0%       5.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfTruncateString-12             16.00 ± 0%       16.00 ± 0%        ~ (p=1.000 n=10) ¹
SprintfTruncateBytes-12              16.00 ± 0%       16.00 ± 0%        ~ (p=1.000 n=10) ¹
SprintfSlowParsingPath-12            5.000 ± 0%       5.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfQuoteString-12                32.00 ± 0%       32.00 ± 0%        ~ (p=1.000 n=10) ¹
SprintfInt-12                        0.000 ± 0%       0.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfIntInt-12                     3.000 ± 0%       3.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfPrefixedInt-12                64.00 ± 0%       64.00 ± 0%        ~ (p=1.000 n=10) ¹
SprintfFloat-12                      8.000 ± 0%       8.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfComplex-12                    24.00 ± 0%       24.00 ± 0%        ~ (p=1.000 n=10) ¹
SprintfBoolean-12                    4.000 ± 0%       4.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfHexString-12                  80.00 ± 0%       80.00 ± 0%        ~ (p=1.000 n=10) ¹
SprintfHexBytes-12                   104.0 ± 0%       104.0 ± 0%        ~ (p=1.000 n=10) ¹
SprintfBytes-12                      88.00 ± 0%       88.00 ± 0%        ~ (p=1.000 n=10) ¹
SprintfStringer-12                   32.00 ± 0%       32.00 ± 0%        ~ (p=1.000 n=10) ¹
SprintfStructure-12                  216.0 ± 0%       168.0 ± 0%  -22.22% (p=0.000 n=10)
ManyArgs-12                          0.000 ± 0%       0.000 ± 0%        ~ (p=1.000 n=10) ¹
FprintInt-12                         0.000 ± 0%       0.000 ± 0%        ~ (p=1.000 n=10) ¹
FprintfBytes-12                      24.00 ± 0%       24.00 ± 0%        ~ (p=1.000 n=10) ¹
FprintIntNoAlloc-12                  0.000 ± 0%       0.000 ± 0%        ~ (p=1.000 n=10) ¹
ScanInts-12                        14.87Ki ± 0%     14.87Ki ± 0%        ~ (p=1.000 n=10) ¹
ScanRecursiveInt-12                16.37Ki ± 0%     16.34Ki ± 9%        ~ (p=0.950 n=10)
ScanRecursiveIntReaderWrapper-12   16.43Ki ± 8%     16.35Ki ± 0%        ~ (p=0.052 n=10)
geomean                                         ²                  -1.03%                ²
¹ all samples are equal
² summaries must be >0 to compute geomean

                                 │    old.txt    │                new.txt                │
                                 │   allocs/op   │  allocs/op   vs base                  │
SprintfPadding-12                   1.000 ± 0%      1.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfEmpty-12                     0.000 ± 0%      0.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfString-12                    1.000 ± 0%      1.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfTruncateString-12            1.000 ± 0%      1.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfTruncateBytes-12             1.000 ± 0%      1.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfSlowParsingPath-12           1.000 ± 0%      1.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfQuoteString-12               1.000 ± 0%      1.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfInt-12                       0.000 ± 0%      0.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfIntInt-12                    1.000 ± 0%      1.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfPrefixedInt-12               1.000 ± 0%      1.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfFloat-12                     1.000 ± 0%      1.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfComplex-12                   1.000 ± 0%      1.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfBoolean-12                   1.000 ± 0%      1.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfHexString-12                 1.000 ± 0%      1.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfHexBytes-12                  2.000 ± 0%      2.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfBytes-12                     2.000 ± 0%      2.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfStringer-12                  4.000 ± 0%      4.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfStructure-12                 8.000 ± 0%      6.000 ± 0%  -25.00% (p=0.000 n=10)
ManyArgs-12                         0.000 ± 0%      0.000 ± 0%        ~ (p=1.000 n=10) ¹
FprintInt-12                        0.000 ± 0%      0.000 ± 0%        ~ (p=1.000 n=10) ¹
FprintfBytes-12                     1.000 ± 0%      1.000 ± 0%        ~ (p=1.000 n=10) ¹
FprintIntNoAlloc-12                 0.000 ± 0%      0.000 ± 0%        ~ (p=1.000 n=10) ¹
ScanInts-12                        1.590k ± 0%     1.590k ± 0%        ~ (p=1.000 n=10) ¹
ScanRecursiveInt-12                1.592k ± 0%     1.592k ± 0%        ~ (p=0.303 n=10)
ScanRecursiveIntReaderWrapper-12   1.594k ± 0%     1.594k ± 0%        ~ (p=0.582 n=10)
geomean                                        ²                 -1.14%                ²
¹ all samples are equal
² summaries must be >0 to compute geomean

Change-Id: I2e850d827d2fd7d6618db60f7071977af5639032
GitHub-Last-Rev: 5a4afcf045
GitHub-Pull-Request: golang/go#67256
Reviewed-on: https://go-review.googlesource.com/c/go/+/584155
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: qiu laidongfeng2 <2645477756@qq.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2024-05-13 21:22:43 +00:00
Lorenz Bauer ec1724bc99 encoding/binary: simplify encoder.value
Remove some duplicate type switching from encoder.value. reflect.Uint and
reflect.Int don't have a case statement anymore, but since they aren't valid
types there is no change in semantics.

goos: darwin
goarch: arm64
pkg: encoding/binary
cpu: Apple M1 Pro
                            │   base.txt   │            simplify.txt             │
                            │    sec/op    │    sec/op     vs base               │
ReadSlice1000Int32s-10         2.649µ ± 1%    2.645µ ± 0%        ~ (p=0.069 n=6)
ReadStruct-10                  204.8n ± 2%    199.9n ± 0%   -2.39% (p=0.002 n=6)
WriteStruct-10                 185.6n ± 2%    154.0n ± 0%  -17.03% (p=0.002 n=6)
WriteSlice1000Structs-10       157.9µ ± 1%    125.0µ ± 0%  -20.86% (p=0.002 n=6)
ReadSlice1000Structs-10        162.6µ ± 2%    159.3µ ± 0%        ~ (p=0.065 n=6)
ReadInts-10                    159.7n ± 1%    156.7n ± 0%   -1.88% (p=0.002 n=6)
WriteInts-10                   134.2n ± 0%    134.1n ± 0%   -0.11% (p=0.011 n=6)
WriteSlice1000Int32s-10        2.680µ ± 0%    2.680µ ± 0%        ~ (p=0.955 n=6)
PutUint16-10                  0.6253n ± 2%   0.6211n ± 0%   -0.67% (p=0.013 n=6)
AppendUint16-10                1.417n ± 2%    1.413n ± 0%        ~ (p=0.065 n=6)
PutUint32-10                  0.6210n ± 0%   0.6210n ± 0%        ~ (p=0.835 n=6)
AppendUint32-10                1.414n ± 0%    1.414n ± 0%        ~ (p=1.000 n=6)
PutUint64-10                  0.6210n ± 0%   0.6212n ± 0%        ~ (p=0.260 n=6)
AppendUint64-10                1.414n ± 1%    1.417n ± 0%        ~ (p=0.097 n=6)
LittleEndianPutUint16-10      0.6236n ± 0%   0.6238n ± 0%        ~ (p=0.426 n=6)
LittleEndianAppendUint16-10    1.419n ± 0%    1.421n ± 1%        ~ (p=0.054 n=6)
LittleEndianPutUint32-10      0.6236n ± 0%   0.6239n ± 0%        ~ (p=0.457 n=6)
LittleEndianAppendUint32-10    1.421n ± 3%    1.421n ± 0%        ~ (p=1.000 n=6)
LittleEndianPutUint64-10      0.6242n ± 1%   0.6239n ± 0%        ~ (p=0.372 n=6)
LittleEndianAppendUint64-10    1.421n ± 0%    1.421n ± 0%        ~ (p=1.000 n=6)
ReadFloats-10                  39.39n ± 0%    39.35n ± 0%   -0.10% (p=0.026 n=6)
WriteFloats-10                 33.64n ± 0%    33.65n ± 0%        ~ (p=0.297 n=6)
ReadSlice1000Float32s-10       2.661µ ± 0%    2.664µ ± 0%        ~ (p=0.916 n=6)
WriteSlice1000Float32s-10      2.763µ ± 0%    2.758µ ± 2%        ~ (p=0.225 n=6)
ReadSlice1000Uint8s-10         129.5n ± 2%    129.5n ± 2%        ~ (p=0.485 n=6)
WriteSlice1000Uint8s-10        144.4n ± 4%    146.1n ± 2%        ~ (p=0.065 n=6)
PutUvarint32-10                12.12n ± 0%    12.12n ± 2%        ~ (p=0.933 n=6)
PutUvarint64-10                30.75n ± 0%    31.29n ± 1%   +1.76% (p=0.002 n=6)
geomean                        33.44n         32.89n        -1.65%

Change-Id: Ibce978012c268a7f26fe7567c340c861fa4b115d
Reviewed-on: https://go-review.googlesource.com/c/go/+/579156
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-13 21:22:39 +00:00
lifubang 59003b6d87 syscall: don't change local limit if prlimit used for another process
Fixes: #67184

Change-Id: Ibdf3810cbba30ae29f466f7f95f357e8512f228b
GitHub-Last-Rev: 5eabc760be
GitHub-Pull-Request: golang/go#67185
Reviewed-on: https://go-review.googlesource.com/c/go/+/583299
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2024-05-13 21:18:19 +00:00
Tim King 99283b81f4 cmd/go: add module information to vet actions
Update golang/go#66315

Change-Id: Ica9b7e010ea9a0a12f80cc83b8ace51f22822ec2
Reviewed-on: https://go-review.googlesource.com/c/go/+/580076
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-13 20:08:58 +00:00
Mateusz Poliwczak c98867d23a crypto: replace encoding/binary in favour of internal/byteorder
Updates #54097

Change-Id: I827a5efd1736ce057b76f079466f2d9ead225898
GitHub-Last-Rev: 40af10469d
GitHub-Pull-Request: golang/go#67321
Reviewed-on: https://go-review.googlesource.com/c/go/+/585017
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Commit-Queue: Ian Lance Taylor <iant@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-13 18:57:38 +00:00
Ian Lance Taylor a32e94d43e cmd/cgo, cmd/go: add cgo -ldflags option, use it in cmd/go
This will automatically use a response file if ldflags is long,
avoiding "argument list too long" errors with a very large CGO_LDFLAGS.

Fixes #66456

Change-Id: I5f9ee86e03b4e6d6430f7f9d8357ef37a9c22465
Reviewed-on: https://go-review.googlesource.com/c/go/+/584655
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: 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: Ian Lance Taylor <iant@google.com>
2024-05-13 17:12:16 +00:00
Nick Ripley f4494522dc runtime: use frame pointer unwinding for block and mutex profilers
Use frame pointer unwinding, where supported, to collect call stacks for
the block, and mutex profilers. This method of collecting call stacks is
typically an order of magnitude faster than callers/tracebackPCs. The
marginal benefit for these profile types is likely small compared to
using frame pointer unwinding for the execution tracer. However, the
block profiler can have noticeable overhead unless the sampling rate is
very high. Additionally, using frame pointer unwinding in more places
helps ensure more testing/support, which benefits systems like the
execution tracer which rely on frame pointer unwinding to be practical
to use.

Change-Id: I4b36c90cd2df844645fd275a41b247352d635727
Reviewed-on: https://go-review.googlesource.com/c/go/+/533258
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2024-05-13 16:42:35 +00:00
Nick Ripley b5bfb5a3ce runtime: refactor fpunwindExpand to use provided buffer
fpunwindExpand currently allocates a new slice to hold the expanded call
stack. In each place it's used, the resulting slice won't be needed
immediately afterward, so the allocation is wasteful. Refactor
fpunwindExpand to instead expand the call stack into a provided buffer.

Change-Id: I05b26c191a8f76404c21ccbe3bd422325540425b
Reviewed-on: https://go-review.googlesource.com/c/go/+/543715
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2024-05-13 16:41:50 +00:00
Mateusz Poliwczak f43d9c40f3 net/netip: use internal/byteorder
This also as a side effect fixes #56136 because internal/byteorder
package has a special treatment in the inliner.

Fixes #56136

Change-Id: Ib90eb716f7a67659fb4cea7e99c14cf7e819ef7b
GitHub-Last-Rev: a78d8f6fee
GitHub-Pull-Request: golang/go#67317
Reviewed-on: https://go-review.googlesource.com/c/go/+/584995
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-05-13 15:55:25 +00:00
qiulaidongfeng f933f78d17 cmd/go: remove unused code
Change-Id: I39e8533a646d171a84c1ef307915286213006543
GitHub-Last-Rev: 3c21684ad0
GitHub-Pull-Request: golang/go#67090
Reviewed-on: https://go-review.googlesource.com/c/go/+/581938
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Cherry Mui <cherryyz@google.com>
2024-05-13 15:54:54 +00:00
Guoqi Chen 9ea4770e14 cmd/internal/obj/loong64: improve the definition of plan9 assembly format in optab
In the three formats corresponding to case 7 of the function asmout, BREAK actually
corresponds to the cacop instruction of Loong64, refer to the loong64 instruction
manual volume 1 [1], the cacop instruction is a privileged instruction used to
maintain the cache, and the user mode does not have permission to execute.

Referring to the loong64 instruction manual volume 1 [1], the SYSCALL, BREAK and DBAR
instructions have similar formats and can be grouped into one category, the RDTIMED,
RDTIMELW and RDTIMEHW instructions can be grouped into one category, and the NOOP and
UNDEF instructions can be grouped into one category.

[1]: https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html

Change-Id: I0b8998270102d1557fc2b2410cf8c0b078bd0c2e
Reviewed-on: https://go-review.googlesource.com/c/go/+/493435
Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: Carlos Amedee <carlos@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Qiqi Huang <huangqiqi@loongson.cn>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Cherry Mui <cherryyz@google.com>
2024-05-13 15:52:19 +00:00
Guoqi Chen ec711aaaaa all: delete loong64 non-register ABI fallback path
Change-Id: If1d3eba9a922ac6f9d78301bb8f07e445c712899
Reviewed-on: https://go-review.googlesource.com/c/go/+/525576
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Commit-Queue: abner chenc <chenguoqi@loongson.cn>
Run-TryBot: abner chenc <chenguoqi@loongson.cn>
2024-05-13 15:04:25 +00:00
Michael Matloob 5881ae742f cmd: vendor golang.org/x/telemetry@51e8b5d
Commands run
    go get golang.org/x/telemetry@51e8b5d
    go mod tidy
    go mod vendor

Change-Id: Ie11f207d25902c3ef932237eec66bdd586564fc0
Reviewed-on: https://go-review.googlesource.com/c/go/+/584237
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2024-05-13 14:38:01 +00:00
qiulaidongfeng 0eaf8d97b6 runtime: remove unused code
Change-Id: Ifb9864704f55e27adfa5c21452fed5a243468d13
GitHub-Last-Rev: 6b000e7314
GitHub-Pull-Request: golang/go#67013
Reviewed-on: https://go-review.googlesource.com/c/go/+/581376
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>
2024-05-13 14:20:38 +00:00
Mateusz Poliwczak 07fc59199b hash: use internal/byteorder
Change-Id: I58c24a58a7b32d3f8d544509db04baac1ea1b56e
GitHub-Last-Rev: 7a648fda00
GitHub-Pull-Request: golang/go#67318
Reviewed-on: https://go-review.googlesource.com/c/go/+/585015
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Commit-Queue: Ian Lance Taylor <iant@google.com>
2024-05-12 05:36:29 +00:00
Mauri de Souza Meneguzzo 9623a3586f runtime/internal/atomic: add mips operators for And/Or
These primitives will be used by the new And/Or sync/atomic apis.

Implemented for mips/mipsle and mips64/mips64le.

For #61395

Change-Id: Icc604a2b5cdfe72646d47d3c6a0bb49a0fd0d353
GitHub-Last-Rev: 95dca2a9f1
GitHub-Pull-Request: golang/go#63297
Reviewed-on: https://go-review.googlesource.com/c/go/+/531835
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-11 21:29:34 +00:00
Alessandro Arzilli 7f9edb4225 runtime: add runtime.debugPinnerV1
Adds runtime.debugPinnerV1 which returns a runtime.Pinner object that
pins itself. This is intended to be used by debuggers in conjunction
with runtime.debugCall to keep heap memory reachable even if it isn't
referenced from anywhere else.

Change-Id: I508ee6a7b103e68df83c96f2e04a0599200300dc
Reviewed-on: https://go-review.googlesource.com/c/go/+/558276
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Austin Clements <austin@google.com>
2024-05-11 20:38:24 +00:00
Michael Matloob 74a49188d3 cmd/go/testdata/script: disable build_plugin_reproducible on darwin
It's broken with the latest XCode versions, and is also already disabled
on darwin builders. Disable the test to get go test cmd/go working on
local builds again.

For #64947

Change-Id: I5a4b46cf23cbe887df4903f90b54cd2225f51233
Reviewed-on: https://go-review.googlesource.com/c/go/+/584937
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2024-05-11 00:21:41 +00:00
Michael Matloob a0a6026bb1 cmd/go/testdata/script: clear path in gotoolchain_issue66175
The gotoolchain_issue66175 script test would fail if a binary named
go1.21 or go1.22 was present in the system PATH. Clear the path at the
beginning of the test to make it independent of the system path.

Fixes #67277

Change-Id: I6d9133aee5b20ab116e07b659e8ecf3eb8add4ed
Reviewed-on: https://go-review.googlesource.com/c/go/+/584258
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-05-10 21:32:07 +00:00
guoguangwu cf6124f807 cmd/trace: pkg import only once
Change-Id: Iaaf2e9dbcffb4b1944817b0a4aaecd3554ebfec1
GitHub-Last-Rev: f4ec85a05e
GitHub-Pull-Request: golang/go#67280
Reviewed-on: https://go-review.googlesource.com/c/go/+/584695
Reviewed-by: Cherry Mui <cherryyz@google.com>
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>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-05-10 21:16:43 +00:00
Mateusz Poliwczak f3a743981d internal/byteorder: new package
Currently in a lot of packages we define functions for appending/decoding
mostly BigEndian data (see internal/chacha8rand, net/netip,
internal/boring/sha, hash/crc64, and probably more), because we don't
want to depend on encoding/binary, because of #54097.

This change introduces a new package internal/byteorder, that
will allow us to remove all of the functions and replace them with
internal/byteorder.

Updates #54097

Change-Id: I03e5ea1eb721dd98bdabdb25786f889cc5de54c5
GitHub-Last-Rev: 3f07d3dfb4
GitHub-Pull-Request: golang/go#67183
Reviewed-on: https://go-review.googlesource.com/c/go/+/583298
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Commit-Queue: Ian Lance Taylor <iant@golang.org>
2024-05-10 20:31:29 +00:00
Matt Layher f6c3a3e3c8 slices: add Chunk
Chunk returns an iterator over consecutive sub-slices of up to n elements of s.

Fixes #53987.

Change-Id: I508274eca388db39550eb9e4d8abd5ce68d29d8d
Reviewed-on: https://go-review.googlesource.com/c/go/+/562935
Reviewed-by: Cherry Mui <cherryyz@google.com>
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>
2024-05-10 17:28:50 +00:00
Alireza Ghasemi 69c74c9ea9 net/http/httptest: add comment to Server.Client() about Server.URL
Updates #30774.

Change-Id: I9564f955b15c701bee27aa9fbf3972de8fdb55e4
GitHub-Last-Rev: 50bd6bd54e
GitHub-Pull-Request: golang/go#67037
Reviewed-on: https://go-review.googlesource.com/c/go/+/581777
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-10 17:26:10 +00:00
Cherry Mui 4721f95058 cmd/compile, cmd/link: disallow linkname of some newly added internal functions
Go API is defined through exported symbols. When a package is
imported, the compiler ensures that only exported symbols can be
accessed, and the go command ensures that internal packages cannot
be imported. This ensures API integrity. But there is a hole:
using linkname, one can access internal or non-exported symbols.
Linkname is a mechanism to give access of a symbol to a package
without adding it to the public API. It is intended for coupled
packages to share some implementation details, or to break
circular dependencies, and both "push" (definition) and "pull"
(reference) sides are controlled, so they can be updated in sync.
Nevertheless, it is abused as a mechanism to reach into internal
details of other packages uncontrolled by the user, notably the
runtime. As the other package evolves, the code often breaks,
because the linknamed symbol may no longer exist, or change its
signature or semantics.

This CL adds a mechanism to enforce the integrity of linknames.
Generally, "push" linkname is allowed, as the package defining
the symbol explicitly opt in for access outside of the package.
"Pull" linkname is checked and only allowed in some circumstances.
Given that there are existing code that use "pull"-only linkname
to access other package's internals, disallowing it completely is
too much a change at this point in the release cycle. For a start,
implement a hard-coded blocklist, which contains some newly added
internal functions that, if used inappropriately, may break memory
safety or runtime integrity. All blocked symbols are newly added
in Go 1.23. So existing code that builds with Go 1.22 will
continue to build.

For the implementation, when compiling a package, we mark
linknamed symbols in the current package with an attribute. At
link time, marked linknamed symbols are checked against the
blocklist. Care is taken so it distinguishes a linkname reference
in the current package vs. a reference of a linkname from another
package and propagated to the current package (e.g. through
inlining or instantiation).

Symbol references in assembly code are similar to linknames, and
are treated similarly.

Change-Id: I8067efe29c122740cd4f1effd2dec2d839147d5d
Reviewed-on: https://go-review.googlesource.com/c/go/+/584598
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-10 17:05:33 +00:00
zzkcode df4f40b9e0 runtime: crash asap and extend total sleep time for slow machine in test
Running with few threads usually does not need 500ms to crash, so let it
crash as soon as possible. While the test may caused more time on slow
machine, try to expand the sleep time in test.

Updates #64752

Change-Id: I635fab846bd5e1735808d4d47bb9032d5a04cc2b
GitHub-Last-Rev: 84f3844ac0
GitHub-Pull-Request: golang/go#65018
Reviewed-on: https://go-review.googlesource.com/c/go/+/554615
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-05-10 16:04:54 +00:00
qiulaidongfeng b44600f83f reflect: let Value.Seq iterate integer conform to the spec
See CL 557596, according to the go specification,
the iterated variable type should
be the same as the iterated integer type.

For #66056

Change-Id: I96c87440328c2c50c40d76ecf2f222a331be1ce9
GitHub-Last-Rev: 8f80e401e5
GitHub-Pull-Request: golang/go#67269
Reviewed-on: https://go-review.googlesource.com/c/go/+/584516
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Cherry Mui <cherryyz@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-05-10 14:27:54 +00:00
Than McIntosh a548dee75c cmd/link/internal/ld: fix overlapping sections in ELF relro links
This patch fixes a problem with how the .dynamic and .got sections are
handled during PIE linking on ELF targets. These sections were being
given addresses that overlapped with the .data.rel.ro section, which
resulted in binaries that worked correctly but confused the binutils
"strip" tool (which, confusingly, produced non-working stripped output
when used on Go PIE binaries without returning a non-zero exit
status). The new RELRO PIE code path preserves .dynamic and .got as
their own independent sections, while ensuring that they make it into
the RELRO segment. A new test verifies that we can successfully strip
and run Go PIE binaries, and also that we don't wind up with any
sections whose address ranges overlap.

Fixes #67261.
Updates #45681.

Change-Id: If874be05285252a9b074d4a1fc6a4023b9a28b5e
Reviewed-on: https://go-review.googlesource.com/c/go/+/584595
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-10 13:44:07 +00:00
guoguangwu 1259a30a58 os: change ioutil-test to os-test in test
Change-Id: I8c5c0831b94261c5880ca22b7ea52cce034d88f1
GitHub-Last-Rev: 5fd119d4e8
GitHub-Pull-Request: golang/go#67248
Reviewed-on: https://go-review.googlesource.com/c/go/+/583876
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-10 02:36:46 +00:00
Ian Lance Taylor 6584fe8195 cmd/dist: don't copy files ending in ~ to bootstrap directory
They are editor backup files. They are ignored by .gitignore,
so they can never be real files in the Go repo.

Change-Id: I58800e6e9f939e0bd21b086243b9260bcc8cd770
Reviewed-on: https://go-review.googlesource.com/c/go/+/584675
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
2024-05-09 23:29:41 +00:00
Ian Lance Taylor 2315412535 reflect: improved ifaceIndir comment
Change-Id: Ic88ef6b60b5a772865603971411fd5d37ef45006
Reviewed-on: https://go-review.googlesource.com/c/go/+/584656
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2024-05-09 23:28:18 +00:00
Roland Shoemaker 671696a22d crypto/x509: reject critical AKI
Updates #65085

Change-Id: I8cc60990737d582edf4f7f85ec871f5e42f82b78
Reviewed-on: https://go-review.googlesource.com/c/go/+/562341
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Roland Shoemaker <roland@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
2024-05-09 23:09:41 +00:00
Ian Lance Taylor 2064413b54 reflect: restore ifaceIndir function for now
CL 583755 removed all uses of the ifaceIndir function,
and the function itself. Unfortunately, ifaceIndir is accessed
using go:linkname by the popular github.com/goccy/go-json package.
A bug has been filed to fix this upstream:
https://github.com/goccy/go-json/issues/506
Until that bug is fixed and the fix is distributed,
keep this function available.
With luck we can remove this in the 1.24 release.

For #67279

Change-Id: I15fccf82d7a172a0b15cdbefb0a0a48381998938
Reviewed-on: https://go-review.googlesource.com/c/go/+/584676
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-05-09 23:06:39 +00:00
Roland Shoemaker e0aab32c7f crypto/x509: reject critical SKI extensions
Updates #65085

Change-Id: I8a00fff6b2af4e55bcb88456813b5ee1f7b1c01d
Reviewed-on: https://go-review.googlesource.com/c/go/+/562344
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>
2024-05-09 22:43:14 +00:00
Roland Shoemaker f4bb7b9186 crypto/x509: reject critical AIA extensions
Updates #65085

Change-Id: I86d8a85130286e1ec2aca3249808ec1dc8ec97ca
Reviewed-on: https://go-review.googlesource.com/c/go/+/562342
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-05-09 22:42:58 +00:00
Roland Shoemaker 5856162487 crypto/x509: properly reject invalid DNS names when checking constraints
A DNS name prefixed with an empty label should be considered invalid
when checking constraints (i.e. ".example.com" does not satisfy a
constraint of "example.com").

Updates #65085

Change-Id: I42919dc06abedc0e242ff36b2a42b583b14857b1
Reviewed-on: https://go-review.googlesource.com/c/go/+/561615
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-09 22:40:21 +00:00
qiulaidongfeng 95a3779ebc reflect: clarify documentation for Value.Seq/Seq2
For #66056

Change-Id: Ib47c07b2527d8213584b72e2575a353f2deaed68
GitHub-Last-Rev: 525a5c3fa4
GitHub-Pull-Request: golang/go#67268
Reviewed-on: https://go-review.googlesource.com/c/go/+/584515
Reviewed-by: Cherry Mui <cherryyz@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: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-05-09 22:12:20 +00:00
Than McIntosh 9eebdca8a9 runtime: add workaround to "throw" pending resolution of issue #67274
Temporarily mark the function runtime.throw as "go:noinline" for the
time being to work around problems introduced by CL 581215. We do not
ordinarily inline runtime.throw unless the build is beind done with an
elevated inline budget (e.g. "-gcflags=-l=4"), so this change should
only have an effect for those special builds.

Updates #67274.

Change-Id: I3811913b8d441e0ddb1d4c7d7297ef23555582a2
Reviewed-on: https://go-review.googlesource.com/c/go/+/584616
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Than McIntosh <thanm@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
2024-05-09 20:33:37 +00:00
Michael Matloob e2375c49ff cmd: vendor golang.org/x/mod@6686f41
To pull in CL 583836

Commands run
    go get golang.org/x/mod@6686f416970d4b8e2f54f521955dee89e6763c4b
    go mod tidy
    go mod vendor

For #67238
For #66625

Change-Id: I77e49706481e068d27072a38d0d2464aa40d2dd0
Cq-Include-Trybots: luci.golang.try:gotip-windows-amd64-longtest,gotip-linux-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/584335
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-09 20:17:07 +00:00
Ian Lance Taylor 0b5f72251b slices: add iterator-related functions
Fixes #61899

Change-Id: Icbde1ac8293723eefc3251008ae9711e756ed1b3
Reviewed-on: https://go-review.googlesource.com/c/go/+/568477
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-09 19:20:55 +00:00
CP Lepage cecbf4f28e cmd/link: Add missing platform for Mac Catalyst
Fixes #67175

Defines a MachoPlatorm constant in OS_Darwin for MacCatalyst build. This enables adding the suffix $INODE64 on syscall methods needed for amd64 Darwin platform.

Change-Id: Ie677e241599e2a14359c5809fa9ddb3b63161629
GitHub-Last-Rev: feae982e68
GitHub-Pull-Request: golang/go#67176
Reviewed-on: https://go-review.googlesource.com/c/go/+/583295
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2024-05-09 17:45:45 +00:00
Russ Cox dd6dee48b2 net/http: remove misleading response headers on error
This is a reapply of CL 544019 and CL 569815, but with
less aggressive semantics as discussed in proposal #66343.

Error deletes Content-Encoding, since it is writing the response
and any preset encoding may not be correct.

On the error-serving path in ServeContent/ServeFile/ServeFS,
these functions delete additional headers: Etag, Last-Modified,
and Cache-Control. The caller may have set these intending
them for the success response, and they may well not be correct
for error responses.

Fixes #50905.
Fixes #66343.

Change-Id: I873d33edde1805990ca16d85ea8d7735b7448626
Reviewed-on: https://go-review.googlesource.com/c/go/+/571995
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-09 17:06:47 +00:00
Michael Matloob 7fcf38d715 cmd/link: add support for telemetry
Add counters for invocations and provided flag names.

For #58894

Change-Id: Ibd4eeca905d277879b601d95bab524fbced6a98b
Reviewed-on: https://go-review.googlesource.com/c/go/+/584276
Reviewed-by: Than McIntosh <thanm@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-05-09 16:18:18 +00:00
Michael Matloob 483a913a55 cmd/compile: add support for telemetry
Add cmd/internal/telemetry to cmd/dist's bootstrapDirs so it's built
when bootstrapping the compiler. cmd/internal/telemetry is a wrapper
arount telemetry functions that stubs out the functions when built in
bootstrap mode to avoid dependencies on x/telemetry in bootstrap mode.

Call telemetry.Start with an empty config to open the counter file, and
increment a counter for when the command is invoked.

After flags are parsed, increment a counter for each of the names of the
flags that were passed in. The counter names will be compile/flag:<name>
so for example we'll have compile/flag:e and compile/flag:E.

In FatalfAt, increment a stack counter for internal errors.

For #58894

Change-Id: Ia5a8a63aa43b2276641181626cbfbea7e4647faa
Reviewed-on: https://go-review.googlesource.com/c/go/+/570679
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-05-09 16:18:10 +00:00
Russ Cox 805f6b3f5d cmd/dist: reject accidental use of internal packages from bootstrap toolchain
The compiler was accidentally using internal/godebug from
the Go 1.20 bootstrap toolchain and didn't get the behavior
it expected. Generalizing, we should never assume we know
the behavior of an internal package from an earlier bootstrap
toolchain, so disallow that case in cmd/dist.

Change-Id: I41e079f6120f4081124619bbe2b30069c96b9f29
Reviewed-on: https://go-review.googlesource.com/c/go/+/581496
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Russ Cox <rsc@golang.org>
2024-05-09 13:50:06 +00:00
Russ Cox acda0107ba cmd/compile: stop using internal/godebug
The main reason not to use internal/godebug is that
people often set GODEBUGs to change the behavior
of the programs they are running with 'go run' or 'go test'.
We don't want the compiler to behave differently as well
in that case: that's too many changes.

Using internal/godebug also breaks bootstrapping
with toolchains that don't have it, or future toolchains
that have a different API in that package.

Change-Id: Ib5a8a74e2451649d8838b71f274b4e3a78939dfa
Reviewed-on: https://go-review.googlesource.com/c/go/+/581495
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-09 13:50:03 +00:00
qiulaidongfeng 524a774634 reflect: add iterative related methods
Fixes #66056

Change-Id: I1e24636e43e68cd57576c39b014e0826fb6c322c
GitHub-Last-Rev: 319ad8ea7c
GitHub-Pull-Request: golang/go#66824
Reviewed-on: https://go-review.googlesource.com/c/go/+/578815
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-09 11:54:18 +00:00
Ian Lance Taylor 49eedfb4d0 net: use port 53 when checking for UDP routes
Using port 9 is weird and at least once triggered a suspicious
activity alert.

Fixes #67264

Change-Id: If4179f054829c175b9f3a51c3bc2a3ca4afa74b9
Reviewed-on: https://go-review.googlesource.com/c/go/+/584416
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-05-09 00:24:06 +00:00
Mateusz Poliwczak a878d3dfa0 encoding/hex: don't overallocate memory in DecodeString
Now as []byte(string) doesn't always cause heap allocation (CL 520599, #2205)
we can make DecodeString simpler and more performant, by not allocating
x2 the required memory.

goos: linux
goarch: amd64
pkg: encoding/hex
cpu: AMD Ryzen 5 4600G with Radeon Graphics
                      │  beforehex   │              afterhex               │
                      │    sec/op    │   sec/op     vs base                │
DecodeString/256-12      197.9n ± 1%   172.2n ± 1%  -13.01% (p=0.000 n=10)
DecodeString/1024-12     684.9n ± 1%   598.5n ± 1%  -12.61% (p=0.000 n=10)
DecodeString/4096-12     2.764µ ± 0%   2.343µ ± 1%  -15.23% (p=0.000 n=10)
DecodeString/16384-12   10.774µ ± 1%   9.348µ ± 1%  -13.23% (p=0.000 n=10)
geomean                  1.417µ        1.226µ       -13.53%

                      │  beforehex   │               afterhex               │
                      │     B/s      │     B/s       vs base                │
DecodeString/256-12     1.205Gi ± 1%   1.385Gi ± 1%  +14.94% (p=0.000 n=10)
DecodeString/1024-12    1.393Gi ± 1%   1.593Gi ± 1%  +14.42% (p=0.000 n=10)
DecodeString/4096-12    1.380Gi ± 0%   1.628Gi ± 1%  +17.97% (p=0.000 n=10)
DecodeString/16384-12   1.416Gi ± 1%   1.632Gi ± 1%  +15.25% (p=0.000 n=10)
geomean                 1.346Gi        1.556Gi       +15.64%

                      │   beforehex   │               afterhex               │
                      │     B/op      │     B/op      vs base                │
DecodeString/256-12        256.0 ± 0%     128.0 ± 0%  -50.00% (p=0.000 n=10)
DecodeString/1024-12      1024.0 ± 0%     512.0 ± 0%  -50.00% (p=0.000 n=10)
DecodeString/4096-12     4.000Ki ± 0%   2.000Ki ± 0%  -50.00% (p=0.000 n=10)
DecodeString/16384-12   16.000Ki ± 0%   8.000Ki ± 0%  -50.00% (p=0.000 n=10)
geomean                  2.000Ki        1.000Ki       -50.00%

                      │ beforehex  │              afterhex               │
                      │ allocs/op  │ allocs/op   vs base                 │
DecodeString/256-12     1.000 ± 0%   1.000 ± 0%       ~ (p=1.000 n=10) ¹
DecodeString/1024-12    1.000 ± 0%   1.000 ± 0%       ~ (p=1.000 n=10) ¹
DecodeString/4096-12    1.000 ± 0%   1.000 ± 0%       ~ (p=1.000 n=10) ¹
DecodeString/16384-12   1.000 ± 0%   1.000 ± 0%       ~ (p=1.000 n=10) ¹
geomean                 1.000        1.000       +0.00%

Change-Id: I5676e48f222d90786ea18e808cb4ecde9de82597
GitHub-Last-Rev: aeedf3f6c4
GitHub-Pull-Request: golang/go#67259
Reviewed-on: https://go-review.googlesource.com/c/go/+/584118
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-05-08 19:30:23 +00:00
Oleksandr Redko 59493f32ed internal/fuzz: fix names of noCopy methods
Must be Lock/Unlock to be flagged by vet.

Change-Id: I792ebd68b168621a660b9595b5d06a465d0d7bf2
Reviewed-on: https://go-review.googlesource.com/c/go/+/584355
Auto-Submit: Roland Shoemaker <roland@golang.org>
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>
2024-05-08 19:28:14 +00:00
Michael Pratt 20721e5c79 runtime: fix eagerly typo
Change-Id: I3150e2d0b9f5590c6da95392b0b51df94b8c20eb
Reviewed-on: https://go-review.googlesource.com/c/go/+/584338
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>
2024-05-08 19:11:58 +00:00
Alan Donovan 69e75c8581 runtime: properly frame panic values in tracebacks
This CL causes the printing of panic values to ensure that all
newlines in the output are immediately followed by a tab, so
that there is no way for a maliciously crafted panic value to
fool a program attempting to parse the traceback into thinking
that the panic value is in fact a goroutine stack.

See https://github.com/golang/go/issues/64590#issuecomment-1932675696

+ release note

Updates #64590
Updates #63455

Change-Id: I5142acb777383c0c122779d984e73879567dc627
Reviewed-on: https://go-review.googlesource.com/c/go/+/581215
Auto-Submit: Alan Donovan <adonovan@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 19:10:41 +00:00
Michael Anthony Knyszek 4513f1a1c1 internal/trace/v2: correctly handle a broken spilled batch
Currently if the first batch of the next generation in the trace is
broken, then the previous generation will fail to parse. The parser
currently relies on one complete batch of the next generation to
continue.

However, this means that recovering a complete generation from a trace
with a broken tail doesn't always work. Luckily, this is fixable. When
the parser encounters an error reading a batch in a generation, it
simply writes down that error and processes it later, once the
generation has been handled. If it turns out the error was for the same
generation and something bigger is broken, then the parser will catch
that sooner when validating the generation's events and the error will
never show up. Otherwise, the generation will parse through successfully
and we'll emit the error once that's done.

Fixes #55160.

Change-Id: I9c9c19d5bb163c5225e18d11594ca2a8793c6950
Reviewed-on: https://go-review.googlesource.com/c/go/+/584275
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-08 19:04:05 +00:00
Michael Anthony Knyszek ff743ce862 iter: detect and reject double next and double yield in Pull, Pull2
Currently it's possible for next and yield to be called out of sequence,
which will result in surprising behavior due to the implementation.
Because we blindly coroswitch between goroutines, calling next from the
iterator, or yield from the calling goroutine, will actually switch back
to the other goroutine. In the case of next, we'll switch back with a
stale (or zero) value: the results are basically garbage. In the case of
yield, we're switching back to the *same* goroutine, which will crash in
the runtime.

This change adds a single bool to ensure that next and yield are always
called in sequence. That is, every next must always be paired with a
yield before continuing. This restricts what can be done with Pull, but
prevents observing some truly strange behaviors that the user of Pull
likely did not intend, or can't easily predict.

Change-Id: I6f72461f49c5635d6914bc5b968ad6970cd3c734
Reviewed-on: https://go-review.googlesource.com/c/go/+/583676
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
2024-05-08 18:03:22 +00:00
Michael Anthony Knyszek 36d32f68f4 runtime: update large object stats before freeSpan in sweep
Currently freeSpan is called before large object stats are updated when
sweeping large objects. This means heapStats.inHeap might get subtracted
before the large object is added to the largeFree field. The end result
is that the /memory/classes/heap/unused:bytes metric, which subtracts
live objects (alloc-free) from inHeap may overflow.

Fix this by always updating the large object stats before calling
freeSpan.

Fixes #67019.

Change-Id: Ib02bd8dcd1cf8cd1bc0110b6141e74f678c10445
Reviewed-on: https://go-review.googlesource.com/c/go/+/583380
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Felix Geisendörfer <felix.geisendoerfer@datadoghq.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:52:18 +00:00
Michael Anthony Knyszek 97c13cfb25 runtime: delete pagetrace GOEXPERIMENT
The page tracer's functionality is now captured by the regular execution
tracer as an experimental GODEBUG variable. This is a lot more usable
and maintainable than the page tracer, which is likely to have bitrotted
by this point. There's also no tooling available for the page tracer.

Change-Id: I2408394555e01dde75a522e9a489b7e55cf12c8e
Reviewed-on: https://go-review.googlesource.com/c/go/+/583379
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-08 17:48:45 +00:00
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
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
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
Tobias Klauser 0bc093a1aa internal/sysinfo: use sync.OnceValue for CPUName
Change-Id: I0f3ae97f2bd5ff3f533c5bf4570a8cda8b92b16a
Reviewed-on: https://go-review.googlesource.com/c/go/+/582836
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
2024-05-03 16:47:15 +00:00
qiulaidongfeng 44e48c7e6c hash/maphash: parallel run test
This is a reapplication of CL 564576.

This reduces the go test hash/maphash time
by more than half.

After investigation it was confirmed that
the original CL would cause OOM when 32-bit machine.

This CL add testenv.ParallelOn64Bit for tests
that can be parallel on 64-bit machines,
it is not parallel on 32-bit machines,
because CL 564995 require the same API.

Change-Id: I1b7feaa07716cb3f55db4671653348fabf2396b0
GitHub-Last-Rev: 2827725558
GitHub-Pull-Request: golang/go#66359
Cq-Include-Trybots: luci.golang.try:gotip-linux-386-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/572195
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-03 16:41:38 +00:00
zhangjian 18dd682672 cmd/compile/internal/ssa: correct error message for AuxArm64BitField
Change-Id: I2e1f48c02cb5c6e90a9cb894eb3bc330a4c5c4b5
GitHub-Last-Rev: 303d1f8a13
GitHub-Pull-Request: golang/go#67124
Reviewed-on: https://go-review.googlesource.com/c/go/+/582615
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2024-05-03 16:40:22 +00:00
go101 44b54b99c9 strings,bytes: improve Repeat panic messages
The Repeat("-", maxInt) call should produce

   panic: runtime error: makeslice: len out of range

instead of

   panic: strings: Repeat output length overflow

This PR is only for theory perfection.

Change-Id: If67d87b147d666fbbb7238656f2a0cb6cf1dbb5b
GitHub-Last-Rev: 29dc0cb9c9
GitHub-Pull-Request: golang/go#67068
Reviewed-on: https://go-review.googlesource.com/c/go/+/581936
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@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-05-03 12:58:37 +00:00
qiulaidongfeng 2f5b420fb5 runtime,reflect: move zeroVal to internal/abi
Change-Id: I0e19e4aa2ea47a714e27b8d66c23c449e27861f2
GitHub-Last-Rev: 2d59b9589e
GitHub-Pull-Request: golang/go#67014
Reviewed-on: https://go-review.googlesource.com/c/go/+/581395
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Joedian Reid <joedian@google.com>
2024-05-03 12:00:41 +00:00
Alan Donovan a3eb55cea9 cmd/vendor: update x/tools to v0.20.1-0.20240429173604-74c9cfe4d22f
The golang.org/x/tools/go/analysis/passes/stdversion was forcibly
added by means of an import in a throwaway file not committed.

Change-Id: I194012ae354f6f8d2d0c1fa39612e5554a4ab1cf
Reviewed-on: https://go-review.googlesource.com/c/go/+/582555
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2024-05-03 02:38:00 +00:00
Alan Donovan 6defff5005 cmd/vet: add stdversion analyzer
+ release note, test

Fixes #46136

Change-Id: Ib157c5343dde379f8d6f67bdfa64b3f6a6432bab
Reviewed-on: https://go-review.googlesource.com/c/go/+/582556
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2024-05-03 01:02:40 +00:00
Ian Lance Taylor e602625c5e cmd/go: pass -Wl,-z,nodelete for c-shared mode with gccgo
This is the gccgo version of CL 15605.

For https://gcc.gnu.org/PR114699

For #11100
For #12582
For #12873

Change-Id: I30e23130737022d772971f0bd629b57269174886
Reviewed-on: https://go-review.googlesource.com/c/go/+/582975
Reviewed-by: Than McIntosh <thanm@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
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>
2024-05-02 22:18:34 +00:00
Tobias Klauser b64e5e38ab net: use stringslite.HasPrefix
Change-Id: Ib14c70f580d0891b3fbedf9e4cde93077409d4e6
Reviewed-on: https://go-review.googlesource.com/c/go/+/582915
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-05-02 22:14:43 +00:00
Russ Cox 8f71c7633f runtime: remove note about goid reuse
Goids are designed to be big enough that they will never be reused:
a uint64 is enough to generate a new goroutine every nanosecond
for 500+ years before wrapping around, and after 500 years you
should probably stop and pick up some security updates.

This note was added in CL 70993 and appears to have just been
a misunderstanding by the CL author.

Change-Id: Ida7099b5191a4e5dbb1e3e9e44b4b86d7779fd6d
Reviewed-on: https://go-review.googlesource.com/c/go/+/582895
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>
2024-05-02 21:10:56 +00:00
Jorropo 865cf5c5f6 testing: improve the documentation around b.N
Fixes #67137

- Make it clear the benchmark function is called multiple times.
- Demonstrate range over int.

Change-Id: I7e993d938b0351012cdd4aed8528951e0ad406ae
Reviewed-on: https://go-review.googlesource.com/c/go/+/582835
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-05-02 18:41:57 +00:00
Michael Matloob 660a071906 cmd/internal/telemetry: add NewStackCounter functions
This CL adds a wrapper for the golang.org/x/telemetry/counter.NewStack
function so that it can be used by the compiler.

Also add build constraints for compiler_bootstrap to build the stubs
when we're bootstrapping the compiler.

For #58894

Change-Id: Icdbdd7aa6d2a3f1147112739c6939e14414f5ee9
Cq-Include-Trybots: luci.golang.try:gotip-linux-arm64-longtest,gotip-windows-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/582695
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
2024-05-01 17:37:58 +00:00
cui fliter c5698e3155 cmd/pprof: fix exception when file or path contains colon
Fixes #63924

Change-Id: I4ea17979faaca04eb6b046abffca2dd77397e0cb
Reviewed-on: https://go-review.googlesource.com/c/go/+/539595
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Run-TryBot: shuang cui <imcusg@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2024-05-01 03:56:37 +00:00
Daniel Martí 959e65c41c bytes: fix up godoc link errors
[Reader.Reader] does not exist in this package.
These docs most likely meant to refer to [Reader] itself.

Change-Id: I4fa117e8541573e0be7c13751fdfc102d5f2d604
Reviewed-on: https://go-review.googlesource.com/c/go/+/582515
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-04-30 19:45:36 +00:00
Jonathan Amsterdam cf05873029 net/http: represent multi wildcards properly
The routing tree used for matching ServeMux patterns used the
key "*" to hold a child node for a multi-segment wildcard.
The problem is that "*" is a valid path segment, which confused
the matching algorithm: it would fetch the multi wildcard child
when looking for the literal child for "*".

Eschew clever encodings. Use a separate field in the node to
represent the multi wildcard child.

Fixes #67067.

Change-Id: I300ca08b8628f5367626cf41979f6c238ed8c831
Reviewed-on: https://go-review.googlesource.com/c/go/+/582115
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-04-30 15:43:24 +00:00
qmuntal 8509f6939c os: use filepathlite.FromSlash
Change-Id: Id15ebd9e97a8626e64665f6830a662e62432a619
Reviewed-on: https://go-review.googlesource.com/c/go/+/582500
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-04-30 15:38:38 +00:00
qmuntal 5616ab6025 os: use filepathlite.VolumeName
It is better to have a single implementation of VolumeName, which is
quite tricky to get right on Windows.

Change-Id: Ibba82dd71fe10b594cb6f782582430aa422e7078
Reviewed-on: https://go-review.googlesource.com/c/go/+/582499
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Run-TryBot: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-04-30 15:38:09 +00:00
qmuntal d95fa7aca7 os: use filepathlite.IsAbs
It is better to have a single implementation of IsAbs, which is quite
tricky to get right on Windows.

Change-Id: I45933b0ceff2920d9eddb61e62aacb2602c3dc8c
Reviewed-on: https://go-review.googlesource.com/c/go/+/582498
Run-TryBot: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-04-30 15:37:05 +00:00
Tobias Klauser 150f45b2c4 os: use stringslite.HasPrefix
Change-Id: I791bdfecc6c94ee9dac592d60d95e97182bf0120
Reviewed-on: https://go-review.googlesource.com/c/go/+/582496
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-04-30 15:35:30 +00:00
The Backend Grip 3206a9b562 http: fix some comments typo in server.go
Change-Id: I826412175876a84ab978aba9418be28593484fba
GitHub-Last-Rev: d35753c7e0
GitHub-Pull-Request: golang/go#67112
Reviewed-on: https://go-review.googlesource.com/c/go/+/582435
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-04-30 15:35:05 +00:00
Tobias Klauser 476a352522 syscall: use stringslite.Has{Prefix,Suffix}
Change-Id: I393191b95eeb8e17345ce28cfa1fb54a3ef13951
Reviewed-on: https://go-review.googlesource.com/c/go/+/582237
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2024-04-30 15:34:18 +00:00
qmuntal dc164eade1 os: remove ineffective else branch
Change-Id: Ic9cf871d862aec54ab8f491b8bc8d2820aecc875
Reviewed-on: https://go-review.googlesource.com/c/go/+/582497
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-04-30 12:44:22 +00:00
David du Colombier 16ce8b3925 net: fix lookupHost on Plan 9
CL 532217 added the newDNSError function.

However, the implementation was not correct on
Plan 9, which lead TestLookupNoSuchHost to fail.

This change fixes lookupHost on Plan 9.

Fixes #67096.

Change-Id: I39271f7d588b19c1b1608f18a24d871460be09cd
Reviewed-on: https://go-review.googlesource.com/c/go/+/582236
Reviewed-by: Joedian Reid <joedian@google.com>
Run-TryBot: David du Colombier <0intro@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-04-29 14:35:28 +00:00
Jes Cok cf164403d1 slices: reduce code nesting depth for Compact and CompactFunc
To make it easier to read.

Change-Id: I2fa1eb78d879b9d86b4dc839be7ede37c7c864f4
Reviewed-on: https://go-review.googlesource.com/c/go/+/581976
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Joedian Reid <joedian@google.com>
2024-04-29 14:01:59 +00:00
aimuz 9e0685f9c2 encoding/json: optimize field sorting with slices and cmp
Refactor field sorting in typeFields to use slices.SortFunc and cmp.Compare,
resulting in performance improvements in cache misses and slight increases in
hit latency. Memory allocation and operation counts also reduced significantly
for cache misses.

goos: darwin
goarch: arm64
pkg: encoding/json
cpu: Apple M2 Max
                                    │   old.txt    │              new.txt               │
                                    │    sec/op    │   sec/op     vs base               │
TypeFieldsCache/MissTypes1-12          5.068µ ± 2%   5.032µ ± 1%       ~ (p=0.055 n=10)
TypeFieldsCache/MissTypes10-12         15.22µ ± 2%   14.79µ ± 2%  -2.84% (p=0.000 n=10)
TypeFieldsCache/MissTypes100-12        98.40µ ± 3%   94.72µ ± 1%  -3.73% (p=0.002 n=10)
TypeFieldsCache/MissTypes1000-12       860.3µ ± 3%   840.7µ ± 1%       ~ (p=0.105 n=10)
TypeFieldsCache/MissTypes10000-12      8.092m ± 3%   7.987m ± 4%       ~ (p=0.280 n=10)
TypeFieldsCache/MissTypes100000-12     80.90m ± 9%   80.62m ± 2%       ~ (p=0.631 n=10)
TypeFieldsCache/MissTypes1000000-12   1009.5m ± 7%   933.8m ± 7%  -7.50% (p=0.011 n=10)
TypeFieldsCache/HitTypes1-12           1.554n ± 3%   1.617n ± 3%  +4.05% (p=0.004 n=10)
TypeFieldsCache/HitTypes10-12          1.575n ± 1%   1.624n ± 6%  +3.14% (p=0.000 n=10)
TypeFieldsCache/HitTypes100-12         1.566n ± 1%   1.627n ± 5%  +3.86% (p=0.000 n=10)
TypeFieldsCache/HitTypes1000-12        1.526n ± 4%   1.596n ± 3%  +4.55% (p=0.001 n=10)
TypeFieldsCache/HitTypes10000-12       1.506n ± 0%   1.573n ± 3%  +4.41% (p=0.000 n=10)
TypeFieldsCache/HitTypes100000-12      1.480n ± 1%   1.529n ± 7%  +3.35% (p=0.001 n=10)
TypeFieldsCache/HitTypes1000000-12     1.473n ± 2%   1.468n ± 2%       ~ (p=0.739 n=10)
geomean                                1.371µ        1.374µ       +0.25%

                                    │     old.txt     │                new.txt                 │
                                    │      B/op       │     B/op       vs base                 │
TypeFieldsCache/MissTypes1-12          2.023Ki ± 0%      2.000Ki ± 0%  -1.16% (p=0.000 n=10)
TypeFieldsCache/MissTypes10-12         10.95Ki ± 0%      10.71Ki ± 0%  -2.17% (p=0.000 n=10)
TypeFieldsCache/MissTypes100-12       101.91Ki ± 0%      99.53Ki ± 0%  -2.34% (p=0.000 n=10)
TypeFieldsCache/MissTypes1000-12      1044.3Ki ± 0%     1020.8Ki ± 0%  -2.25% (p=0.000 n=10)
TypeFieldsCache/MissTypes10000-12      9.957Mi ± 0%      9.730Mi ± 0%  -2.29% (p=0.000 n=10)
TypeFieldsCache/MissTypes100000-12     97.79Mi ± 0%      95.50Mi ± 0%  -2.34% (p=0.000 n=10)
TypeFieldsCache/MissTypes1000000-12   1018.4Mi ± 0%      995.5Mi ± 0%  -2.25% (p=0.000 n=10)
TypeFieldsCache/HitTypes1-12             0.000 ± 0%        0.000 ± 0%       ~ (p=1.000 n=10) ¹
TypeFieldsCache/HitTypes10-12            0.000 ± 0%        0.000 ± 0%       ~ (p=1.000 n=10) ¹
TypeFieldsCache/HitTypes100-12           0.000 ± 0%        0.000 ± 0%       ~ (p=1.000 n=10) ¹
TypeFieldsCache/HitTypes1000-12          0.000 ± 0%        0.000 ± 0%       ~ (p=1.000 n=10) ¹
TypeFieldsCache/HitTypes10000-12         0.000 ± 0%        0.000 ± 0%       ~ (p=1.000 n=10) ¹
TypeFieldsCache/HitTypes100000-12        0.000 ± 0%        0.000 ± 0%       ~ (p=1.000 n=10) ¹
TypeFieldsCache/HitTypes1000000-12       0.000 ± 0%        0.000 ± 0%       ~ (p=1.000 n=10) ¹
geomean                                             ²                  -1.06%                ²
¹ all samples are equal
² summaries must be >0 to compute geomean

                                    │    old.txt    │               new.txt                │
                                    │   allocs/op   │  allocs/op   vs base                 │
TypeFieldsCache/MissTypes1-12          46.00 ± 0%      45.00 ± 0%  -2.17% (p=0.000 n=10)
TypeFieldsCache/MissTypes10-12         215.0 ± 0%      205.0 ± 0%  -4.65% (p=0.000 n=10)
TypeFieldsCache/MissTypes100-12       1.845k ± 0%     1.745k ± 0%  -5.42% (p=0.000 n=10)
TypeFieldsCache/MissTypes1000-12      18.08k ± 0%     17.08k ± 0%  -5.53% (p=0.000 n=10)
TypeFieldsCache/MissTypes10000-12     180.3k ± 0%     170.3k ± 0%  -5.55% (p=0.000 n=10)
TypeFieldsCache/MissTypes100000-12    1.804M ± 0%     1.704M ± 0%  -5.54% (p=0.000 n=10)
TypeFieldsCache/MissTypes1000000-12   18.04M ± 0%     17.04M ± 0%  -5.54% (p=0.000 n=10)
TypeFieldsCache/HitTypes1-12           0.000 ± 0%      0.000 ± 0%       ~ (p=1.000 n=10) ¹
TypeFieldsCache/HitTypes10-12          0.000 ± 0%      0.000 ± 0%       ~ (p=1.000 n=10) ¹
TypeFieldsCache/HitTypes100-12         0.000 ± 0%      0.000 ± 0%       ~ (p=1.000 n=10) ¹
TypeFieldsCache/HitTypes1000-12        0.000 ± 0%      0.000 ± 0%       ~ (p=1.000 n=10) ¹
TypeFieldsCache/HitTypes10000-12       0.000 ± 0%      0.000 ± 0%       ~ (p=1.000 n=10) ¹
TypeFieldsCache/HitTypes100000-12      0.000 ± 0%      0.000 ± 0%       ~ (p=1.000 n=10) ¹
TypeFieldsCache/HitTypes1000000-12     0.000 ± 0%      0.000 ± 0%       ~ (p=1.000 n=10) ¹
geomean                                           ²                -2.49%                ²
¹ all samples are equal
² summaries must be >0 to compute geomean

Change-Id: I62b8f524f5747f4f1b9241a1d849efeef1851049
GitHub-Last-Rev: d16772d4fb
GitHub-Pull-Request: golang/go#67046
Reviewed-on: https://go-review.googlesource.com/c/go/+/581895
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: Joedian Reid <joedian@google.com>
2024-04-29 14:01:21 +00:00
plasmatium f6e6b637c0 time: add notes about monotonic time paused
See #66870

Change-Id: I781265355a3dbd0d9538bc9dcafaa83b482ec3f8
GitHub-Last-Rev: 9d92f116b0
GitHub-Pull-Request: golang/go#66922
Reviewed-on: https://go-review.googlesource.com/c/go/+/580515
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Joedian Reid <joedian@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-04-29 14:01:17 +00:00
Koya IWAMURA a81c8b3bf2 net/url: improve URL.String performance
URL.String performs memory allocation many times, but it can improve
performance by allocating memory that it clearly knows it needs.
This CL achieves 24.6% speedup, 18.3% memory reduction, and 46.7% fewer memory
allocations on existing benchmarks.

          │ string_old.txt │           string_new2.txt           │
          │     sec/op     │   sec/op     vs base                │
String-16      3.622µ ± 5%   2.730µ ± 2%  -24.63% (p=0.000 n=10)

          │ string_old.txt │           string_new2.txt            │
          │      B/op      │     B/op      vs base                │
String-16     1.406Ki ± 0%   1.148Ki ± 0%  -18.33% (p=0.000 n=10)

          │ string_old.txt │          string_new2.txt           │
          │   allocs/op    │ allocs/op   vs base                │
String-16       60.00 ± 0%   32.00 ± 0%  -46.67% (p=0.000 n=10)

Change-Id: I70199be952eddc44134945077e52740e8921088f
Reviewed-on: https://go-review.googlesource.com/c/go/+/581155
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Joedian Reid <joedian@google.com>
2024-04-29 13:58:27 +00:00
Egon Elbre 99ee616250 internal/runtime/atomic: fix TestAnd64 and TestOr64
The local variable may not be 64bit aligned, which caused arm tests
to fail.

Fixes #67077

Change-Id: Ia3ae4abcc90319cb10cd593bdc7994cc6eeb3a28
Reviewed-on: https://go-review.googlesource.com/c/go/+/581916
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
2024-04-27 20:49:32 +00:00
Egon Elbre 644a4ff333 testing: use time.Since in highPrecisionTime
time.Since has optimizations for measuring monotonic time.

For #31160.

Change-Id: I0529b9f69b9f008e3414b8e386b6faa64af4a008
Reviewed-on: https://go-review.googlesource.com/c/go/+/582135
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-04-27 19:42:36 +00:00
Russ Cox 774d5b366c make.bash: avoid ksh bug in nogoenv
ksh handles make.bash surprisingly well and is a smaller
supply chain attack surface, so it's reasonable to want
to use "ksh make.bash" to build Go.

The only place where ksh and bash disagree in running
make.bash is an arguable bug in ksh that

	X=Y foo

accidentally changes the real value of X following that
command when foo is a shell function. (It correctly preserves
the original value of X when foo is a command being invoked.)

More specifically,

	GOROOT=$GOROOT_BOOTSTRAP nogoenv foo

incorrectly changes $GOROOT in the rest of the script.

CL 580020 suggested using a subshell, but subshells
historically have lost "set -e", so we'd have to use (...) || exit 1.
Instead of that, this CL refactors nogoenv into bootstrapenv,
putting it in charge of changing $GOROOT the same way it
changes all the other environment variables.

This CL also updates make.rc for parallelism.
It does not bother updating make.bat: that part is already
a bit different, and attempting to change it is all risk, no reward.

Change-Id: I5923a6fb5016a3862363363859365d1cd4f61a1d
Reviewed-on: https://go-review.googlesource.com/c/go/+/582076
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Eric Grosse <grosse@gmail.com>
2024-04-27 11:30:21 +00:00
Damien Neil ceef0633b3 path/filepath, internal/filepathlite: move parts of filepath to filepathlite
The path/filepath package needs to depend on the os package to
implement Abs, Walk, and other functions. Move the implementation
of purely lexical functions from path/filepath into
internal/filepathlite, so they can be used by os and
other low-level packages.

Change-Id: Id211e547d6f1f58c82419695ff2d75cd6cd14a12
Reviewed-on: https://go-review.googlesource.com/c/go/+/566556
Reviewed-by: Behroz Karimpor <behrozkarimpor201@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-04-26 23:07:50 +00:00
Damien Neil ad22356ec6 all: rename internal/safefilepath to internal/filepathlite
The safefilepath package was originally added to contain
the FromFS function. We subsequently added FromFS to path/filepath
as Localize. The safefilepath package now exists only to permit
the os package to import Localize.

Rename safefilepath to filepathlite to better indicate that it's
a low-dependency version of filepath.

Change-Id: I4c5f9b28e8581f841947b48c5cac9954cd0c9535
Reviewed-on: https://go-review.googlesource.com/c/go/+/581517
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-04-26 23:07:37 +00:00
Damien Neil d69f87445c strings, internal/stringslite: lite version of strings package
To be used by internal/filepathlite, which is to be used by os.
There are probably other places where it would be convenient
to have strings functions accessible to RUNTIME level packages.

Change-Id: Icda59e7a9e26d9e8f3692db0ea4fb7b3dbf570d7
Reviewed-on: https://go-review.googlesource.com/c/go/+/581516
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-04-26 23:07:25 +00:00
Egon Elbre 1c4704991a testing: use QueryPerformanceCounter on Windows
Windows time.Now granularity is around 0.5ms on modern systems,
which introduces a significant noise into benchmark results.
Instead of relying time.Now use QueryPerformanceCounter, which
has significantly better granularity compared to time.Now.

 │ TimeNow-32  │        HighPrecisionTimeNow-32        │
 │   sec/op    │    sec/op     vs base                 │
   4.812n ± 0%   30.580n ± 0%  +535.43% (p=0.000 n=20)

Fixes #31160

Change-Id: Ib2a574d638c9c6762a2524212def02265574e267
Reviewed-on: https://go-review.googlesource.com/c/go/+/557315
Reviewed-by: Quim Muntal <quimmuntal@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2024-04-26 22:55:25 +00:00
Dmitriy Matrenichev 9effeeab27 internal/weak: remove unnecessary conversion, fix typo
Remove unnecessary conversion from unsafe.Pointer to unsafe.Pointer.
Also fix small typo in weak.Pointer.Strong method documentation.

Change-Id: I84791fba244581bd6218c589827a61914f0797b4
GitHub-Last-Rev: 7978d07d5b
GitHub-Pull-Request: golang/go#66977
Reviewed-on: https://go-review.googlesource.com/c/go/+/580936
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Commit-Queue: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Joedian Reid <joedian@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
2024-04-26 22:13:25 +00:00
Jes Cok b439f32859 all: make use of sync.Map.Clear
Since CL 515015 added sync.Map.Clear method, we can use it to make
the code simpler and clearer.

Change-Id: I29edc969431b4fd95cd5fd864953a71ca1538dd3
Reviewed-on: https://go-review.googlesource.com/c/go/+/582015
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Joedian Reid <joedian@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-04-26 21:32:11 +00:00
Damien Neil b384ee7ceb net, os, internal/poll: test for use of sendfile
The net package's sendfile tests exercise various paths where
we expect sendfile to be used, but don't verify that sendfile
was in fact used.

Add a hook to internal/poll.SendFile to let us verify that
sendfile was called when expected. Update os package tests
(which use their own hook mechanism) to use this hook as well.

For #66988

Change-Id: I7afb130dcfe0063d60c6ea0f8560cf8665ad5a81
Reviewed-on: https://go-review.googlesource.com/c/go/+/581778
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-04-26 18:12:56 +00:00
Philipp Wollermann 196916299d net: fix sendfile regression with io.Copy on macOS
Since CL 472475, io.Copy can no longer use sendfile on macOS for copying
files to a socket due to a too strict type assertion. This CL fixes the
issue by checking for the necessary interfaces instead of the concrete
os.File type in sendfile_unix_alt.go.

Fixes #66988

Change-Id: Ia0dd190f6575016a191c34a935132907147c8e10
Reviewed-on: https://go-review.googlesource.com/c/go/+/581035
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-04-26 17:08:30 +00:00
Than McIntosh deeebf5655 cmd/link/internal/ld: more fixes to TestElfBindNow readonly .got check
Second try at fixing the TestElfBindNow testpoint: don't try to check
for readonly ".got" section when using the external linker, since
there is code in some linkers (BFD in particular) that will skip
placing ".got" in relro if the section is below a specific size
threshold. Revised version of the test checks only for readonly
".dynamic" in the external linking case.

Fixes #67063.

Change-Id: Idb6b82ec7893baddf171654775587f6050fc6258
Reviewed-on: https://go-review.googlesource.com/c/go/+/581995
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-04-26 15:38:14 +00:00
apocelipes 2dd82d97b6 compress: reordering fields to reduce struct sizes
Overall, there are 32 bytes reduced.

Change-Id: I455bf0874b33fa47719f42618e4800c7ff2a9e88
GitHub-Last-Rev: 7670344c4a
GitHub-Pull-Request: golang/go#67010
Reviewed-on: https://go-review.googlesource.com/c/go/+/581355
Reviewed-by: Joedian Reid <joedian@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
2024-04-26 13:32:40 +00:00
go101 4370cfbdf9 slices: optimize Compact and CompactFunc
Try to save a comparison in the loop bodies of Compact and CompactFunc.

Note: due to #64272, some bound checks still fail to be removed.

                            │ old.txt  │             new.txt              │
                            │   sec/op    │   sec/op     vs base                │
Compact/nil-4                 4.191n ± 9%   3.402n ± 1%  -18.84% (p=0.000 n=10)
Compact/one-4                 5.289n ± 2%   4.553n ± 2%  -13.93% (p=0.000 n=10)
Compact/sorted-4              9.865n ± 0%   6.882n ± 1%  -30.24% (p=0.000 n=10)
Compact/2_items-4             11.10n ± 2%   12.11n ± 2%   +9.00% (p=0.000 n=10)
Compact/unsorted-4            9.831n ± 3%   6.918n ± 2%  -29.62% (p=0.000 n=10)
Compact/many-4                16.40n ± 4%   14.90n ± 1%   -9.20% (p=0.000 n=10)
Compact/dup_start-4           29.87n ± 0%   28.06n ± 3%   -6.04% (p=0.001 n=10)
Compact_Large/all_dup-4       13.11µ ± 0%   13.12µ ± 0%        ~ (p=0.971 n=10)
Compact_Large/no_dup-4        6.972µ ± 0%   5.806µ ± 0%  -16.73% (p=0.000 n=10)
CompactFunc/nil-4             5.300n ± 0%   5.309n ± 1%        ~ (p=0.289 n=10)
CompactFunc/one-4             6.051n ± 1%   6.442n ± 3%   +6.46% (p=0.000 n=10)
CompactFunc/sorted-4          16.24n ± 1%   12.79n ± 2%  -21.24% (p=0.000 n=10)
CompactFunc/2_items-4         17.89n ± 1%   17.75n ± 0%   -0.75% (p=0.000 n=10)
CompactFunc/unsorted-4        16.26n ± 0%   12.83n ± 1%  -21.07% (p=0.000 n=10)
CompactFunc/many-4            30.71n ± 1%   29.07n ± 0%   -5.32% (p=0.000 n=10)
CompactFunc/dup_start-4       78.94n ± 1%   67.19n ± 1%  -14.89% (p=0.000 n=10)
CompactFunc_Large/all_dup-4   3.277m ± 0%   3.692m ± 2%  +12.67% (p=0.000 n=10)
CompactFunc_Large/no_dup-4    4.019m ± 0%   2.826m ± 1%  -29.68% (p=0.000 n=10)
geomean                       109.6n        96.99n       -11.47%

Change-Id: Ia4c78fa62e7e9f4ff6a39d0e0a0a84cecf79b9cb
GitHub-Last-Rev: cea3d93155
GitHub-Pull-Request: golang/go#64273
Reviewed-on: https://go-review.googlesource.com/c/go/+/543661
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Joedian Reid <joedian@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
2024-04-26 13:32:06 +00:00
qmuntal 5ff0b53174 bytes: skip TestNewBufferShallow if optimization is disabled
TestNewBufferShallow should be skipped if optimization is disabled.

It is currently failing on no-opt builders.

Change-Id: Ib5e62022a56a4e5f158f247d69a6229d2cb4d99e
Reviewed-on: https://go-review.googlesource.com/c/go/+/581915
Auto-Submit: Than McIntosh <thanm@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Auto-Submit: Quim Muntal <quimmuntal@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Joedian Reid <joedian@google.com>
2024-04-26 13:31:36 +00:00
Than McIntosh 1ca31eac40 cmd/link/internal/ld: revised bindnow/relro test for ELF
This patch re-enables the portion of the TestElfBindNow test that
verifies that selected sections are in a read-only segment. Turns out
we can't always check for read-only ".got" on all architectures (on
ppc64le for example ".got" will only turn up if there is CGO use), so
always look for readonly ".dynamic", but only look for readonly ".got"
if the section is present.

Updates #45681.

Change-Id: I4687ae3cf9a81818268925e17700170ba34204a7
Reviewed-on: https://go-review.googlesource.com/c/go/+/581115
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-04-25 20:23:29 +00:00
Derek Parker 57026007c8 cmd/compile: teach dse about equivalent LocalAddrs
This patch teaches DSE that two LocalAddrs of the same variable
are equal, even if they are from different memory states. This avoids
dependance on a store into the same LocalAddr being added to
loadUse even though the store is unnecessary and is in fact
shadowed.

Fixes #59021

Change-Id: I0ef128b783c4ad6fd2236fa5ff20345b4d31eddb
GitHub-Last-Rev: b80a6b28fb
GitHub-Pull-Request: golang/go#66793
Reviewed-on: https://go-review.googlesource.com/c/go/+/578376
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Joedian Reid <joedian@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
2024-04-25 20:07:26 +00:00
qmuntal a8ba163695 runtime: fix mcall unwinding on Windows
The Windows native stack unwinder incorrectly classifies the next
instruction after the mcall callback call as being part of the function
epilogue, producing a wrong call stack.

Add a NOP after the callback call to work around this issue.

Fixes #67007.

Change-Id: I6017635da895b272b1852391db9a255ca69e335d
Reviewed-on: https://go-review.googlesource.com/c/go/+/581335
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Quim Muntal <quimmuntal@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-04-25 18:50:21 +00:00
Robert Griesemer fd99157f9d go/types, types2: refactor Checker.rangeStmt for clarity
Change-Id: I0c2f921389416ab222b84f77699fd4b3246ef0e0
Reviewed-on: https://go-review.googlesource.com/c/go/+/581776
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2024-04-25 17:49:48 +00:00
guoguangwu a4031ea1f5 all: fix typos in comments
Change-Id: Ib2e77cff4c10f66316295cbd67f52606cbf9972b
GitHub-Last-Rev: 088c033b2d
GitHub-Pull-Request: golang/go#67032
Reviewed-on: https://go-review.googlesource.com/c/go/+/581675
Auto-Submit: Keith Randall <khr@golang.org>
Commit-Queue: Ian Lance Taylor <iant@google.com>
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: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2024-04-25 17:41:54 +00:00
Robert Griesemer 06478e4b46 go/types, types2: simplify Default function
Change-Id: Ie2b7c1324ec7947c6ff43187dda99b83bcb64f08
Reviewed-on: https://go-review.googlesource.com/c/go/+/581775
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>
2024-04-25 17:07:36 +00:00
Sam Thanawalla 8c0da423f7 cmd/go: go env GOMOD should not download newer toolchain
It is not neccessary to download a newer toolchain to display the path
to GOMOD or GOWORK.

Fixes: #61455

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest
Change-Id: I0b031651ad9bfeb5565361ecaff6908640ccf9c8
Reviewed-on: https://go-review.googlesource.com/c/go/+/581275
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2024-04-25 16:05:39 +00:00
Russ Cox 8960925ad8 time: deflake TestChan/asynctimerchan=1 tests
The overall time package tests increase from 3.85s to 4.85s on my laptop.
But they should be less flaky, and the time is spent sleeping, so it won't
slow down the overall machine running multiple package tests in
parallel.

For #66322.

Change-Id: I66d6647c389c943b53045e8836ede4ba3d4670c7
Reviewed-on: https://go-review.googlesource.com/c/go/+/581315
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-04-25 11:28:32 +00:00
Jes Cok 4351af68eb net/http: improve continue statements for tests
Change-Id: I302368c17fbb6983bd14ab72784076e548ed8829
Reviewed-on: https://go-review.googlesource.com/c/go/+/581475
Auto-Submit: Ian Lance Taylor <iant@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-04-25 01:02:12 +00:00
Nigel Tao e7aeeae0c8 image/jpeg: ignore garbage bytes before a RST marker
Well-formed JPEG images will not have garbage bytes. However, for
corrupted JPEG images, the RST (restart) mechanism is specifically
designed so that a decoder can re-synchronize to an upcoming restartable
MCU (Minimum Coded Unit, e.g. 16x16 block of pixels) boundary and resume
decoding. Even if the resultant image isn't perfect, a 98%-good image is
better than a fatal error.

Every JPEG marker is encoded in two bytes, the first of which is 0xFF.
There are 8 possible RST markers, cycling as "0xFF 0xD0", "0xFF 0xD1",
..., "0xFF 0xD7". Suppose that, our decoder is expecting "0xFF 0xD1".

Before this commit, Go's image/jpeg package would accept only two
possible inputs: a well-formed "0xFF 0xD1" or one very specific pattern
of spec non-compliance, "0xFF 0x00 0xFF 0xD1".

After this commit, it is more lenient, similar to libjpeg's jdmarker.c's
next_marker function.
2dfe6c0fe9/jdmarker.c (L892-L935)

The new testdata file was created by:

$ convert video-001.png a.ppm
$ cjpeg -restart 2 a.ppm > video-001.restart2.jpeg
$ rm a.ppm

Fixes #40130

Change-Id: Ic598a5f489f110d6bd63e0735200fb6acac3aca3
Reviewed-on: https://go-review.googlesource.com/c/go/+/580755
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Joedian Reid <joedian@google.com>
2024-04-25 00:46:29 +00:00
Robert Griesemer 799968dfc3 go.types, types2: factor out isUntypedNumeric predicate
No need for Unalias or under calls for this predicate.

Change-Id: Idcdcda3e153d829ee5b26ad112ccfda3f4efedde
Reviewed-on: https://go-review.googlesource.com/c/go/+/581255
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Griesemer <gri@google.com>
2024-04-25 00:43:27 +00:00
Alan Donovan 9b9de261bd go/types: add Alias.Rhs
This method returns the type on the right-hand side of an
alias declaration such as type L = R.

Fixes #66559

Change-Id: I396f2d999680ad251f47cdde20856ae20fc1c40a
Reviewed-on: https://go-review.googlesource.com/c/go/+/581615
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
2024-04-24 21:50:16 +00:00
Roland Shoemaker e689118852 crypto/tls: skip bogo suite on windows builders
Updates #66913

Change-Id: Ie6bb262ee95593d23a93ef06656a561a7b1006ba
Reviewed-on: https://go-review.googlesource.com/c/go/+/581515
Auto-Submit: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2024-04-24 18:15:23 +00:00
Michael Pratt d037bba19b cmd/compile: add debug log prior to export data lookup
If there is a crash in LookupFunc (which has occurred a few times now),
this ensures that we log the offending symbol before crashing.

For #67016.

Change-Id: I0119597de2be3d1b97c41a9361273d1feb90ec11
Reviewed-on: https://go-review.googlesource.com/c/go/+/581437
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-04-24 15:55:17 +00:00
Michael Pratt 508e761978 cmd/compile: bail PGO method lookup on interface types
Interface types don't have concrete method implementations, so it does
not make sense to attempt a lookup.

An interface method would not normally appear in a PGO profile as it has
no symbol in the final binary. However it can appear if the method was
concrete when the profile was collected and it has since been refactored
to an interface method in the code being compiled.

The guards here (OTYPE, !Alias, !IsInterface) now match
noder.linker.relocObj, which does a similar iteration of all methods.

Fixes #67016.

Change-Id: I858c58929c890ac0b2019fbd7c99f683ab63f8bb
Reviewed-on: https://go-review.googlesource.com/c/go/+/581436
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-04-24 15:55:11 +00:00
Paul E. Murphy 3aad2d0765 cmd/internal/obj/ppc64: fix incorrect int to int64 conversion when checking MOVD opcodes
A type conversion from int to int64 was done in the wrong place causing
some MOVD $const, Rx operations to be incorrectly transformed on 32 bit
hosts cross-compiling for ppc64x.

Fixes #66955

Change-Id: I023ba267a8dac6d6bd22f8146c0d9d2d473bc5c1
Reviewed-on: https://go-review.googlesource.com/c/go/+/580796
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
Reviewed-by: Joedian Reid <joedian@google.com>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-04-24 15:53:25 +00:00
Joe Tsai 62dfa43101 bytes: add test to ensure shallow copy of NewBuffer does not allocate
At present, there is no API to reset the underlying []byte
of an existing Buffer struct, except to shallow copy
the entire Buffer struct.

Updates #67004

Change-Id: I08998f7a95ae5bde0897d86247d47f23cd784583
Reviewed-on: https://go-review.googlesource.com/c/go/+/581297
Auto-Submit: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Joedian Reid <joedian@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-04-24 13:36:51 +00:00
Rhys Hiltner fc6a5ea88c runtime: test mutex contention stacks and counts
Fully testing the runtime's profiles and metrics for contention on its
internal mutex values involves comparing two separate clocks (cputicks
for the profile and nanotime for the metric), verifying its fractional
sampling (when MutexProfileRate is greater than 1), and observing a very
small critical section outside of the test's control (semrelease).
Flakiness (#64253) from those parts of the test have led to skipping it
entirely.

But there are portions of the mutex profiling behavior that should have
more consistent behavior: for a mutex under the test's control, the test
and the runtime should be able to agree that the test successfully
induced contention, and should agree on the call stack that caused the
contention. Allow those more consistent parts to run.

For #64253

Change-Id: I7f368d3265a5c003da2765164276fab616eb9959
Reviewed-on: https://go-review.googlesource.com/c/go/+/581296
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Joedian Reid <joedian@google.com>
Auto-Submit: Rhys Hiltner <rhys.hiltner@gmail.com>
2024-04-24 13:36:48 +00:00
Austin Clements 960fa9bf66 sync: add examples for OnceValue and OnceValues
Updates #56102.

Change-Id: I2ee2dbc43b4333511d9d23752fdc574dfbf5f5bd
Reviewed-on: https://go-review.googlesource.com/c/go/+/481062
Reviewed-by: Andrew Gerrand <adg@golang.org>
Auto-Submit: Austin Clements <austin@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Joedian Reid <joedian@google.com>
2024-04-23 17:45:47 +00:00
gucio321 a62c290c50 src/buildall.bash: use grep -E instead of egrep
according to https://www.phoronix.com/news/GNU-Grep-3.8-Stop-egrep-fgrep egrep and fgrep should not be used anymore. thats why using buildall.bash throws the following warning: egrep: warning: egrep is obsolescent; using grep -E

Change-Id: I2f3be55ebaa7826a7f89a93d756e083b9bddfb03
GitHub-Last-Rev: 60be0651af
GitHub-Pull-Request: golang/go#66990
Reviewed-on: https://go-review.googlesource.com/c/go/+/581055
Reviewed-by: Joedian Reid <joedian@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-04-23 17:45:23 +00:00
Ian Lance Taylor 08e73e6152 debug/elf: remove incorrect doc link
Here Version is a field in Symbol, not the elf.Version type.

Change-Id: I0285937d806d1a9b53b49420b45a07744be244c2
Reviewed-on: https://go-review.googlesource.com/c/go/+/563095
Reviewed-by: 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>
Reviewed-by: Austin Clements <austin@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2024-04-23 16:49:58 +00:00
Ian Lance Taylor 8d880da1c4 cmd/cgo/internal/test: don't skip some tests on musl
They reportedly work at least as of Alpine 3.18.

Fixes #39857

Change-Id: I6a249d61d33e467bf32e8c250f870fc261b90941
Reviewed-on: https://go-review.googlesource.com/c/go/+/563096
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>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Austin Clements <austin@google.com>
2024-04-23 16:49:01 +00:00
racequite 83613293d8 all: fix some typos in comments
This change fixes some typographic errors that I found in various packages.

Change-Id: Ie2d0316f0137d6521496d389a9777659ae22128b
GitHub-Last-Rev: 0307b03d50
GitHub-Pull-Request: golang/go#66917
Reviewed-on: https://go-review.googlesource.com/c/go/+/580077
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Commit-Queue: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
2024-04-23 16:37:32 +00:00
Michael Anthony Knyszek 0304d035cd runtime: switch to systemstack before throw in casgstatus
CL 580255 increased the frame size of entersyscall and reentersyscall,
which is causing the x/sys repository to fail to build for
windows/arm64 because of an overflow of the nosplit stack reservation.

Fix this by wrapping the other call to throw in casgstatus in a system
stack switch. This is a fatal throw anyway indicating a core runtime
invariant is broken, so this path is basically never taken. This cuts
off the nosplit frame chain and allows x/sys to build.

Change-Id: I00b16c9db3a7467413ed48953c7f8a9a750f000a
Reviewed-on: https://go-review.googlesource.com/c/go/+/580775
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-04-23 02:53:00 +00:00
Cherry Mui 9702cd980f cmd/compile: mark closure DUPOK if the outer function is
If a function is DUPOK (e.g. an instantiation of a generic
function) and contains closures, the closure also needs to be
DUPOK. Otherwise, when the outer function is included in multiple
packages, the closure will also be included in these packages, and
the linker will dedup the outer function but not the closure,
causing duplicated symbols. In normal builds it is mostly still ok
as these closure symbols are only referenced by indices. But in
shared build mode all symbols are named and kept live, causing an
error.

Should fix the shared build mode.

Change-Id: I227d26e589465440335a4ec7e33d29739ed44aad
Reviewed-on: https://go-review.googlesource.com/c/go/+/580917
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2024-04-23 01:21:39 +00:00
Cherry Mui 0c39dc1ff7 runtime: reduce stack usage for asmcgocall on PPC64
Define it as ABIInternal, so the result does not take space on
stack.

Also use R10 as a temporary register for arithmetics on SP, so it
is hidden from the assembler's SP delta calculation, which is
irrelevant anyway as we are on the system stack.

Change-Id: I8fed467601c19cad2d7afab26978246d15ce3147
Reviewed-on: https://go-review.googlesource.com/c/go/+/580918
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2024-04-22 22:46:08 +00:00
Sabyrzhan Tasbolatov 552faa8927 runtime: reduced struct sizes found via pahole
During my research of pahole with Go structs, I've found couple of
structs in runtime/ pkg where we can reduce several structs' sizes
highligted by pahole tool which detect byte holes and paddings.

Overall, there are 80 bytes reduced.

Change-Id: I398e5ed6f5b199394307741981cb5ad5b875e98f
Reviewed-on: https://go-review.googlesource.com/c/go/+/578795
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Joedian Reid <joedian@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-04-22 22:07:41 +00:00
Jes Cok 674657e130 net/http: correct error messages for TestParseSetCookie
This change fixes typos in error messages, while here, also improves
'line' strings to indicate the errEqualNotFoundInCookie error.

Change-Id: I0ce6115c605844d2d86f337f208fd3b2d3774674
Reviewed-on: https://go-review.googlesource.com/c/go/+/579799
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Joedian Reid <joedian@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
2024-04-22 22:06:46 +00:00
Lev Ustimenko 5a3b6400ef Refactor output message
"/reflect/all_test.go : refactor message."

This PR corrects a syntax

%value -> %v

Change-Id: Ie56b93d238f090c564a88eb963dc9b7773054356
GitHub-Last-Rev: 023fde3ed4
GitHub-Pull-Request: golang/go#66974
Reviewed-on: https://go-review.googlesource.com/c/go/+/580935
Reviewed-by: Joedian Reid <joedian@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
2024-04-22 22:06:14 +00:00
Michael Anthony Knyszek aa63ef4b8b internal/intern: delete unused package
The functionality within has been replaced with the unique package, and
all uses of it have been replaced by uses of the unique package.

Change-Id: I399ca72972c712711d4ec6a5ddbdbcba7088ecd1
Reviewed-on: https://go-review.googlesource.com/c/go/+/577036
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-04-22 20:48:19 +00:00
Michael Anthony Knyszek 6737f4cee5 runtime: set gp.syscallbp from entersyscallblock_handoff
This was an oversight and is causing a few failures, most notably on
Solaris and Illumos, but also occasionally on the Linux builders.

Change-Id: I38bd28537ad01d955675f61f9b1d42b9ecdd1ef0
Reviewed-on: https://go-review.googlesource.com/c/go/+/580875
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-04-22 20:21:45 +00:00
Michael Pratt 1f4bcee2cd runtime: move zeroVal out of map.go
It isn't specific to maps, so put it in a more general location.

For #54766.

Change-Id: Ia3f3ebe8c347cfa5a8582082a306f4df4e05818d
Reviewed-on: https://go-review.googlesource.com/c/go/+/580777
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-04-22 20:09:01 +00:00
Keith Randall 9f9dd2bfd8 cmd/compile: fix cmpstring rewrite rule
We need to ensure that the Select0 lives in the same block as
its argument. Divide up the rule into 2 so that we can put the
parts in the right places.

(This would be simpler if we could use @block syntax mid-rule, but
that feature currently only works at the top level.)

This fixes the ssacheck builder after CL 578835

Change-Id: Id26a01d9fac0684e0b732d35d0f7999f6de07825
Reviewed-on: https://go-review.googlesource.com/c/go/+/580815
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
2024-04-22 18:24:47 +00:00
Michael Anthony Knyszek 79065f0a5e net/netip: use the unique package instead of internal/intern
This change replaces net/netip's use of the internal/intern package with
the new unique package.

Below are the benchmark results for the package. Lots of things get
faster, but some things get slower. The single-core performance of
unique.Make is expected to be a tad slower than internal/intern, but is
vastly more scalable. No benchmark in this package currently
demonstrates this, however.

                                    │ before.bench  │             after.bench              │
                                    │    sec/op     │    sec/op      vs base               │
IPNextPrev-48                          85.66n ± ∞ ¹    85.61n ± ∞ ¹        ~ (p=0.690 n=5)
BinaryMarshalRoundTrip/ipv4-48         16.12n ± ∞ ¹    15.84n ± ∞ ¹   -1.74% (p=0.008 n=5)
BinaryMarshalRoundTrip/ipv6-48         33.14n ± ∞ ¹    32.49n ± ∞ ¹   -1.96% (p=0.016 n=5)
BinaryMarshalRoundTrip/ipv6+zone-48    88.84n ± ∞ ¹   101.50n ± ∞ ¹  +14.25% (p=0.008 n=5)
StdIPv4-48                             126.6n ± ∞ ¹    157.2n ± ∞ ¹  +24.17% (p=0.008 n=5)
IPv4-48                                101.2n ± ∞ ¹    101.0n ± ∞ ¹        ~ (p=0.452 n=5)
IPv4_inline-48                         131.7n ± ∞ ¹    101.2n ± ∞ ¹  -23.16% (p=0.008 n=5)
StdIPv6-48                             180.6n ± ∞ ¹    178.7n ± ∞ ¹   -1.05% (p=0.040 n=5)
IPv6-48                                136.7n ± ∞ ¹    137.4n ± ∞ ¹        ~ (p=0.135 n=5)
IPv4Contains-48                        4.650n ± ∞ ¹    5.287n ± ∞ ¹  +13.70% (p=0.008 n=5)
IPv6Contains-48                        5.284n ± ∞ ¹    5.290n ± ∞ ¹        ~ (p=0.540 n=5)
ParseAddr/v4-48                        23.94n ± ∞ ¹    23.62n ± ∞ ¹        ~ (p=0.841 n=5)
ParseAddr/v6-48                        84.95n ± ∞ ¹    80.64n ± ∞ ¹   -5.07% (p=0.008 n=5)
ParseAddr/v6_ellipsis-48               51.54n ± ∞ ¹    51.62n ± ∞ ¹        ~ (p=1.000 n=5)
ParseAddr/v6_v4-48                     55.85n ± ∞ ¹    56.56n ± ∞ ¹   +1.27% (p=0.008 n=5)
ParseAddr/v6_zone-48                   110.0n ± ∞ ¹    124.6n ± ∞ ¹  +13.27% (p=0.008 n=5)
StdParseIP/v4-48                       54.05n ± ∞ ¹    53.74n ± ∞ ¹   -0.57% (p=0.016 n=5)
StdParseIP/v6-48                       111.6n ± ∞ ¹    111.7n ± ∞ ¹        ~ (p=0.651 n=5)
StdParseIP/v6_ellipsis-48              81.81n ± ∞ ¹    82.15n ± ∞ ¹   +0.42% (p=0.008 n=5)
StdParseIP/v6_v4-48                    89.36n ± ∞ ¹    90.72n ± ∞ ¹   +1.52% (p=0.008 n=5)
StdParseIP/v6_zone-48                  138.7n ± ∞ ¹    150.7n ± ∞ ¹   +8.65% (p=0.008 n=5)
AddrString/v4-48                       36.43n ± ∞ ¹    36.33n ± ∞ ¹        ~ (p=0.508 n=5)
AddrString/v6-48                       106.1n ± ∞ ¹    102.5n ± ∞ ¹   -3.39% (p=0.008 n=5)
AddrString/v6_ellipsis-48              93.93n ± ∞ ¹    92.87n ± ∞ ¹   -1.13% (p=0.008 n=5)
AddrString/v6_v4-48                    43.09n ± ∞ ¹    43.33n ± ∞ ¹        ~ (p=0.111 n=5)
AddrString/v6_zone-48                  91.15n ± ∞ ¹    89.22n ± ∞ ¹   -2.12% (p=0.008 n=5)
IPStringExpanded/v4-48                 37.99n ± ∞ ¹    37.77n ± ∞ ¹   -0.58% (p=0.032 n=5)
IPStringExpanded/v6-48                 63.59n ± ∞ ¹    63.58n ± ∞ ¹        ~ (p=0.690 n=5)
IPStringExpanded/v6_ellipsis-48        64.33n ± ∞ ¹    63.50n ± ∞ ¹   -1.29% (p=0.024 n=5)
IPStringExpanded/v6_v4-48              64.79n ± ∞ ¹    63.08n ± ∞ ¹   -2.64% (p=0.008 n=5)
IPStringExpanded/v6_zone-48            111.7n ± ∞ ¹    109.7n ± ∞ ¹   -1.79% (p=0.016 n=5)
AddrMarshalText/v4-48                  34.45n ± ∞ ¹    34.04n ± ∞ ¹        ~ (p=0.151 n=5)
AddrMarshalText/v6-48                  105.2n ± ∞ ¹    102.6n ± ∞ ¹   -2.47% (p=0.008 n=5)
AddrMarshalText/v6_ellipsis-48         99.69n ± ∞ ¹    98.56n ± ∞ ¹        ~ (p=0.151 n=5)
AddrMarshalText/v6_v4-48               48.22n ± ∞ ¹    47.33n ± ∞ ¹        ~ (p=0.151 n=5)
AddrMarshalText/v6_zone-48             98.55n ± ∞ ¹    94.82n ± ∞ ¹   -3.78% (p=0.008 n=5)
AddrPortString/v4-48                   59.03n ± ∞ ¹    50.09n ± ∞ ¹  -15.14% (p=0.008 n=5)
AddrPortString/v6-48                   118.2n ± ∞ ¹    113.3n ± ∞ ¹   -4.15% (p=0.008 n=5)
AddrPortString/v6_ellipsis-48          110.1n ± ∞ ¹    107.3n ± ∞ ¹   -2.54% (p=0.008 n=5)
AddrPortString/v6_v4-48                66.48n ± ∞ ¹    58.80n ± ∞ ¹  -11.55% (p=0.008 n=5)
AddrPortString/v6_zone-48              106.7n ± ∞ ¹    104.9n ± ∞ ¹   -1.69% (p=0.008 n=5)
AddrPortMarshalText/v4-48              56.67n ± ∞ ¹    54.19n ± ∞ ¹   -4.38% (p=0.008 n=5)
AddrPortMarshalText/v6-48              125.1n ± ∞ ¹    122.1n ± ∞ ¹   -2.40% (p=0.008 n=5)
AddrPortMarshalText/v6_ellipsis-48     120.1n ± ∞ ¹    118.0n ± ∞ ¹   -1.75% (p=0.024 n=5)
AddrPortMarshalText/v6_v4-48           71.53n ± ∞ ¹    70.25n ± ∞ ¹        ~ (p=0.548 n=5)
AddrPortMarshalText/v6_zone-48         116.4n ± ∞ ¹    114.0n ± ∞ ¹   -2.06% (p=0.016 n=5)
PrefixMasking/IPv4_/32-48              5.259n ± ∞ ¹    5.289n ± ∞ ¹   +0.57% (p=0.016 n=5)
PrefixMasking/IPv4_/17-48              5.286n ± ∞ ¹    5.284n ± ∞ ¹        ~ (p=0.937 n=5)
PrefixMasking/IPv4_/0-48               5.266n ± ∞ ¹    5.280n ± ∞ ¹        ~ (p=0.151 n=5)
PrefixMasking/IPv6_/128-48             5.271n ± ∞ ¹    5.284n ± ∞ ¹        ~ (p=0.151 n=5)
PrefixMasking/IPv6_/65-48              5.256n ± ∞ ¹    5.282n ± ∞ ¹        ~ (p=0.317 n=5)
PrefixMasking/IPv6_/0-48               5.253n ± ∞ ¹    5.284n ± ∞ ¹        ~ (p=0.095 n=5)
PrefixMasking/IPv6_zone_/128-48        5.274n ± ∞ ¹    5.284n ± ∞ ¹        ~ (p=0.222 n=5)
PrefixMasking/IPv6_zone_/65-48         5.280n ± ∞ ¹    5.291n ± ∞ ¹        ~ (p=0.095 n=5)
PrefixMasking/IPv6_zone_/0-48          5.283n ± ∞ ¹    5.292n ± ∞ ¹        ~ (p=0.095 n=5)
PrefixMarshalText-48                   44.60n ± ∞ ¹    44.81n ± ∞ ¹        ~ (p=1.000 n=5)
ParseAddrPort/v4-48                    46.40n ± ∞ ¹    41.27n ± ∞ ¹  -11.06% (p=0.008 n=5)
ParseAddrPort/v6-48                   106.90n ± ∞ ¹    99.29n ± ∞ ¹   -7.12% (p=0.008 n=5)
ParseAddrPort/v6_ellipsis-48           77.10n ± ∞ ¹    69.98n ± ∞ ¹   -9.23% (p=0.008 n=5)
ParseAddrPort/v6_v4-48                 71.82n ± ∞ ¹    74.97n ± ∞ ¹   +4.39% (p=0.008 n=5)
ParseAddrPort/v6_zone-48               130.0n ± ∞ ¹    148.5n ± ∞ ¹  +14.23% (p=0.008 n=5)
As16-48                                7.446n ± ∞ ¹    7.437n ± ∞ ¹        ~ (p=0.286 n=5)
geomean                                45.52n          45.18n         -0.76%
¹ need >= 6 samples for confidence interval at level 0.95

                                   │ before.bench │             after.bench             │
                                   │     B/op     │    B/op      vs base                │
StdIPv4-48                            16.00 ± ∞ ¹   16.00 ± ∞ ¹       ~ (p=1.000 n=5) ²
IPv4-48                               0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
IPv4_inline-48                        0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
StdIPv6-48                            16.00 ± ∞ ¹   16.00 ± ∞ ¹       ~ (p=1.000 n=5) ²
IPv6-48                               0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
IPv4Contains-48                       0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
IPv6Contains-48                       0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
ParseAddr/v4-48                       0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
ParseAddr/v6-48                       0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
ParseAddr/v6_ellipsis-48              0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
ParseAddr/v6_v4-48                    0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
ParseAddr/v6_zone-48                  0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
StdParseIP/v4-48                      16.00 ± ∞ ¹   16.00 ± ∞ ¹       ~ (p=1.000 n=5) ²
StdParseIP/v6-48                      16.00 ± ∞ ¹   16.00 ± ∞ ¹       ~ (p=1.000 n=5) ²
StdParseIP/v6_ellipsis-48             16.00 ± ∞ ¹   16.00 ± ∞ ¹       ~ (p=1.000 n=5) ²
StdParseIP/v6_v4-48                   16.00 ± ∞ ¹   16.00 ± ∞ ¹       ~ (p=1.000 n=5) ²
StdParseIP/v6_zone-48                 16.00 ± ∞ ¹   16.00 ± ∞ ¹       ~ (p=1.000 n=5) ²
AddrString/v4-48                      16.00 ± ∞ ¹   16.00 ± ∞ ¹       ~ (p=1.000 n=5) ²
AddrString/v6-48                      48.00 ± ∞ ¹   48.00 ± ∞ ¹       ~ (p=1.000 n=5) ²
AddrString/v6_ellipsis-48             24.00 ± ∞ ¹   24.00 ± ∞ ¹       ~ (p=1.000 n=5) ²
AddrString/v6_v4-48                   24.00 ± ∞ ¹   24.00 ± ∞ ¹       ~ (p=1.000 n=5) ²
AddrString/v6_zone-48                 24.00 ± ∞ ¹   24.00 ± ∞ ¹       ~ (p=1.000 n=5) ²
IPStringExpanded/v4-48                16.00 ± ∞ ¹   16.00 ± ∞ ¹       ~ (p=1.000 n=5) ²
IPStringExpanded/v6-48                48.00 ± ∞ ¹   48.00 ± ∞ ¹       ~ (p=1.000 n=5) ²
IPStringExpanded/v6_ellipsis-48       48.00 ± ∞ ¹   48.00 ± ∞ ¹       ~ (p=1.000 n=5) ²
IPStringExpanded/v6_v4-48             48.00 ± ∞ ¹   48.00 ± ∞ ¹       ~ (p=1.000 n=5) ²
IPStringExpanded/v6_zone-48           128.0 ± ∞ ¹   128.0 ± ∞ ¹       ~ (p=1.000 n=5) ²
AddrMarshalText/v4-48                 16.00 ± ∞ ¹   16.00 ± ∞ ¹       ~ (p=1.000 n=5) ²
AddrMarshalText/v6-48                 48.00 ± ∞ ¹   48.00 ± ∞ ¹       ~ (p=1.000 n=5) ²
AddrMarshalText/v6_ellipsis-48        48.00 ± ∞ ¹   48.00 ± ∞ ¹       ~ (p=1.000 n=5) ²
AddrMarshalText/v6_v4-48              32.00 ± ∞ ¹   32.00 ± ∞ ¹       ~ (p=1.000 n=5) ²
AddrMarshalText/v6_zone-48            48.00 ± ∞ ¹   48.00 ± ∞ ¹       ~ (p=1.000 n=5) ²
AddrPortString/v4-48                  24.00 ± ∞ ¹   24.00 ± ∞ ¹       ~ (p=1.000 n=5) ²
AddrPortString/v6-48                  48.00 ± ∞ ¹   48.00 ± ∞ ¹       ~ (p=1.000 n=5) ²
AddrPortString/v6_ellipsis-48         32.00 ± ∞ ¹   32.00 ± ∞ ¹       ~ (p=1.000 n=5) ²
AddrPortString/v6_v4-48               32.00 ± ∞ ¹   32.00 ± ∞ ¹       ~ (p=1.000 n=5) ²
AddrPortString/v6_zone-48             32.00 ± ∞ ¹   32.00 ± ∞ ¹       ~ (p=1.000 n=5) ²
AddrPortMarshalText/v4-48             24.00 ± ∞ ¹   24.00 ± ∞ ¹       ~ (p=1.000 n=5) ²
AddrPortMarshalText/v6-48             64.00 ± ∞ ¹   64.00 ± ∞ ¹       ~ (p=1.000 n=5) ²
AddrPortMarshalText/v6_ellipsis-48    64.00 ± ∞ ¹   64.00 ± ∞ ¹       ~ (p=1.000 n=5) ²
AddrPortMarshalText/v6_v4-48          64.00 ± ∞ ¹   64.00 ± ∞ ¹       ~ (p=1.000 n=5) ²
AddrPortMarshalText/v6_zone-48        64.00 ± ∞ ¹   64.00 ± ∞ ¹       ~ (p=1.000 n=5) ²
PrefixMasking/IPv4_/32-48             0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
PrefixMasking/IPv4_/17-48             0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
PrefixMasking/IPv4_/0-48              0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
PrefixMasking/IPv6_/128-48            0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
PrefixMasking/IPv6_/65-48             0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
PrefixMasking/IPv6_/0-48              0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
PrefixMasking/IPv6_zone_/128-48       0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
PrefixMasking/IPv6_zone_/65-48        0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
PrefixMasking/IPv6_zone_/0-48         0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
PrefixMarshalText-48                  24.00 ± ∞ ¹   24.00 ± ∞ ¹       ~ (p=1.000 n=5) ²
ParseAddrPort/v4-48                   0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
ParseAddrPort/v6-48                   0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
ParseAddrPort/v6_ellipsis-48          0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
ParseAddrPort/v6_v4-48                0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
ParseAddrPort/v6_zone-48              0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
geomean                                         ³                +0.00%               ³
¹ need >= 6 samples for confidence interval at level 0.95
² all samples are equal
³ summaries must be >0 to compute geomean

                                   │ before.bench │             after.bench             │
                                   │  allocs/op   │  allocs/op   vs base                │
StdIPv4-48                            1.000 ± ∞ ¹   1.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
IPv4-48                               0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
IPv4_inline-48                        0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
StdIPv6-48                            1.000 ± ∞ ¹   1.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
IPv6-48                               0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
IPv4Contains-48                       0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
IPv6Contains-48                       0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
ParseAddr/v4-48                       0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
ParseAddr/v6-48                       0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
ParseAddr/v6_ellipsis-48              0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
ParseAddr/v6_v4-48                    0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
ParseAddr/v6_zone-48                  0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
StdParseIP/v4-48                      1.000 ± ∞ ¹   1.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
StdParseIP/v6-48                      1.000 ± ∞ ¹   1.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
StdParseIP/v6_ellipsis-48             1.000 ± ∞ ¹   1.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
StdParseIP/v6_v4-48                   1.000 ± ∞ ¹   1.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
StdParseIP/v6_zone-48                 1.000 ± ∞ ¹   1.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
AddrString/v4-48                      1.000 ± ∞ ¹   1.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
AddrString/v6-48                      1.000 ± ∞ ¹   1.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
AddrString/v6_ellipsis-48             1.000 ± ∞ ¹   1.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
AddrString/v6_v4-48                   1.000 ± ∞ ¹   1.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
AddrString/v6_zone-48                 1.000 ± ∞ ¹   1.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
IPStringExpanded/v4-48                1.000 ± ∞ ¹   1.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
IPStringExpanded/v6-48                1.000 ± ∞ ¹   1.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
IPStringExpanded/v6_ellipsis-48       1.000 ± ∞ ¹   1.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
IPStringExpanded/v6_v4-48             1.000 ± ∞ ¹   1.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
IPStringExpanded/v6_zone-48           2.000 ± ∞ ¹   2.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
AddrMarshalText/v4-48                 1.000 ± ∞ ¹   1.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
AddrMarshalText/v6-48                 1.000 ± ∞ ¹   1.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
AddrMarshalText/v6_ellipsis-48        1.000 ± ∞ ¹   1.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
AddrMarshalText/v6_v4-48              1.000 ± ∞ ¹   1.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
AddrMarshalText/v6_zone-48            1.000 ± ∞ ¹   1.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
AddrPortString/v4-48                  1.000 ± ∞ ¹   1.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
AddrPortString/v6-48                  1.000 ± ∞ ¹   1.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
AddrPortString/v6_ellipsis-48         1.000 ± ∞ ¹   1.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
AddrPortString/v6_v4-48               1.000 ± ∞ ¹   1.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
AddrPortString/v6_zone-48             1.000 ± ∞ ¹   1.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
AddrPortMarshalText/v4-48             1.000 ± ∞ ¹   1.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
AddrPortMarshalText/v6-48             1.000 ± ∞ ¹   1.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
AddrPortMarshalText/v6_ellipsis-48    1.000 ± ∞ ¹   1.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
AddrPortMarshalText/v6_v4-48          1.000 ± ∞ ¹   1.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
AddrPortMarshalText/v6_zone-48        1.000 ± ∞ ¹   1.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
PrefixMasking/IPv4_/32-48             0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
PrefixMasking/IPv4_/17-48             0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
PrefixMasking/IPv4_/0-48              0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
PrefixMasking/IPv6_/128-48            0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
PrefixMasking/IPv6_/65-48             0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
PrefixMasking/IPv6_/0-48              0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
PrefixMasking/IPv6_zone_/128-48       0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
PrefixMasking/IPv6_zone_/65-48        0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
PrefixMasking/IPv6_zone_/0-48         0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
PrefixMarshalText-48                  1.000 ± ∞ ¹   1.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
ParseAddrPort/v4-48                   0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
ParseAddrPort/v6-48                   0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
ParseAddrPort/v6_ellipsis-48          0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
ParseAddrPort/v6_v4-48                0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
ParseAddrPort/v6_zone-48              0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
geomean                                         ³                +0.00%               ³
¹ need >= 6 samples for confidence interval at level 0.95
² all samples are equal
³ summaries must be >0 to compute geomean

Change-Id: Ieec7d1f0836f3ee93a33653aee9b0c0fc77f399d
Reviewed-on: https://go-review.googlesource.com/c/go/+/577035
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-04-22 18:14:15 +00:00
Michael Anthony Knyszek a088e230d4 unique: add unique package and implement Make/Handle
This change adds the unique package for canonicalizing values, as
described by the proposal in #62483.

Fixes #62483.

Change-Id: I1dc3d34ec12351cb4dc3838a8ea29a5368d59e99
Reviewed-on: https://go-review.googlesource.com/c/go/+/574355
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ingo Oeser <nightlyone@googlemail.com>
Reviewed-by: David Chase <drchase@google.com>
2024-04-22 18:14:07 +00:00
Ian Lance Taylor 654c3368e5 cmd/go: update comment to not say GO386 does not exist
GO386 was removed by CL 258957, but it was restored by CL 260017.

Change-Id: Iced49ca61512a0f2ef513acbf9700a87ac964c68
Reviewed-on: https://go-review.googlesource.com/c/go/+/580675
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2024-04-22 17:58:25 +00:00
Than McIntosh ed2671aa15 cmd/link/internal/ld: temporarily add skip for new portion of TestElfBindNow
Skip newly added sections in TestElfBindNow from elf_test.go
temporarily pending resolution of failures on loong64 and ppc64le.

Change-Id: I22e0e52c9fbbcad88a4d0088f631ed7be15bf9da
Reviewed-on: https://go-review.googlesource.com/c/go/+/580776
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-04-22 17:13:24 +00:00
zhangjian 734fd7a949 cmd/compile/internal/ssa: fix the description of auxCCop as auxInt
The auxCCop has been modified from aux to auxInt in CL 252517.

Change-Id: I5c472d684c51fd38fd38f61561d1b1644e20bafe
GitHub-Last-Rev: 78d1cf40f4
GitHub-Pull-Request: golang/go#66950
Reviewed-on: https://go-review.googlesource.com/c/go/+/580635
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Joedian Reid <joedian@google.com>
2024-04-22 15:29:10 +00:00
jeffery 69aa1974f3 cmd/compile: combine phielim and copyelim into a single pass
Change-Id: Id21145b14169d28bac2144a31f6d3d9729f4be1e
GitHub-Last-Rev: 5413f4753e
GitHub-Pull-Request: golang/go#63818
Reviewed-on: https://go-review.googlesource.com/c/go/+/538535
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
2024-04-22 14:55:18 +00:00