1
0
mirror of https://github.com/golang/go synced 2024-09-30 12:18:33 -06:00
Commit Graph

54180 Commits

Author SHA1 Message Date
Zeke Lu
d7e663d909 os/signal: disable GNU readline to deflake TestTerminalSignal
Fixes #55903.

Change-Id: I992865277fb6526929d6c7db2b3b8d22ca0760f2
GitHub-Last-Rev: fc6f28e17c
GitHub-Pull-Request: golang/go#55904
Reviewed-on: https://go-review.googlesource.com/c/go/+/435735
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
2022-09-28 16:30:21 +00:00
Archana R
4350c4a131 cmd/internal/obj/ppc64: remove unnecessary opcodes
This CL removes some opcode placeholders that do not correspond
to any existing instructions and hence create confusion. Some
instructions that are no longer valid like LDMX are also removed.
Any references to this instruction in ISA 3.0 are considered
as documentation errata.

Change-Id: Ib71a657099723bbe1db88873233ee573b5c42fe7
Reviewed-on: https://go-review.googlesource.com/c/go/+/429860
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Paul Murphy <murp@ibm.com>
Run-TryBot: Archana Ravindar <aravind5@in.ibm.com>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Archana Ravindar <aravind5@in.ibm.com>
2022-09-28 15:27:05 +00:00
cui fliter
190973eb60 all: fix some typos
Change-Id: I8b28aebbb9494b2c877139a4584a5a42253e3bea
GitHub-Last-Rev: e3703fd3a5
GitHub-Pull-Request: golang/go#55902
Reviewed-on: https://go-review.googlesource.com/c/go/+/435617
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-09-28 15:13:20 +00:00
Lynn Boger
6e1b769377 cmd/compile: remove some lines from PPC64.rules
In CL 429035 Keith suggested removing some
rules that were covered by generic rules. This
follows up on that comment.

Change-Id: I57b6c9ae0cd85f33a0eb2fef8356575d3d7820fb
Reviewed-on: https://go-review.googlesource.com/c/go/+/430417
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Paul Murphy <murp@ibm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2022-09-28 14:15:04 +00:00
Than McIntosh
53773a5d08 cmd/go: support new hybrid coverage instrumentation
If GOEXPERIMENT=coverageredesign is in effect, introduce a new
top-level '-cover' option to "go build" to turn on new-style hybrid
code coverage instrumentation. Similarly, use the new instrumentation
for "go test -cover".

The main effects of "-cover" under the hood are to instrument files at
the package level using cmd/cover and to pass additional options to
the compiler when building instrumented packages.

The previous workflow for "go tool -cover mypkg" would expand to a
series of "go tool cover" commands (one per file) followed by a single
package compilation command to build the rewritten sources.

With the new workflow, the Go command will pass all of the Go files in
a package to the cover tool as a chunk (along with a config file
containing other parameters), then the cover tool will write
instrumented versions of the sources along with another "output"
config with info on coverage variable names for the the compiler. The
Go command will then kick off the compiler on the modified source
files, also passing in the config file generated by cmd/cover.

Updates #51430.

Change-Id: Id65621ff6a8c70a30168c1412c2d6f805ff3b9e7
Reviewed-on: https://go-review.googlesource.com/c/go/+/355452
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
2022-09-28 11:50:58 +00:00
Than McIntosh
b32689f6c3 cmd/go: refactor package references in Builder.build
Refactor references to "a.Package" in Builder.build to be consistent,
e.g. all via the "p" helper variable. No change in functionality, this
is just intended to make the code more readable/consistent (since
prior to this point we had a random mix of "p" and "a.Package").

Change-Id: Ifea5ff9b314c39a0cf6e688511907d08cc56c603
Reviewed-on: https://go-review.googlesource.com/c/go/+/424819
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
2022-09-28 11:49:14 +00:00
Than McIntosh
06e8022ed4 cmd/go: add hook to check for GOEXPERIMENT in script tests
Add a new hook to allow script tests to check whether a specific
GOEXPERIMENT is enabled.

Updates #51430.

Change-Id: Icdf39f845ff2c8b10c634d49e9c27bc90e7984f8
Reviewed-on: https://go-review.googlesource.com/c/go/+/402174
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-28 11:49:00 +00:00
Than McIntosh
5f18e46328 cmd/cover: add hybrid instrumentation mode
Add a new mode of coverage instrumentation that works as a hybrid
between purely tool-based and purely compiler-based. The cmd/cover
tool still does source-to-source rewriting, but it also generates
information to be used by the compiler to do things like marking
meta-data vars as read-only.

In hybrid mode, the cmd/cover tool is invoked not on a single source
file but on all the files in a package, and is passed a config file
containing the import path of the package in question, along with
other parameters needed for the run. It writes a series of modified
files and an output config file to be passed to the compiler when
compiling the modified files.

Not completely useful by itself, still needs a corresponding set of
changes in the Go command and in the compiler.

Updates #51430.

Change-Id: I0fcbd93a9a8fc25064187b159152486a2549ea54
Reviewed-on: https://go-review.googlesource.com/c/go/+/395896
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
2022-09-28 11:48:40 +00:00
Than McIntosh
87db4ffada runtime/coverage: runtime routines to emit coverage data
This patch fleshes out the runtime support for emitting coverage data
at the end of a run of an instrumented binary. Data is emitted in the
form of a pair of files, a meta-out-file and counter-data-outfile,
each written to the dir GOCOVERDIR. The meta-out-file is emitted only
if required; no need to emit again if an existing meta-data file with
the same hash and length is present.

Updates #51430.

Change-Id: I59d20a4b8c05910c933ee29527972f8e401b1685
Reviewed-on: https://go-review.googlesource.com/c/go/+/355451
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Than McIntosh <thanm@google.com>
2022-09-28 11:48:10 +00:00
Than McIntosh
7a74829858 cmd/covdata: add tools to read/manipulate coverage data files
Add a set of helper packages for reading collections of related
meta-data and counter-data files ("pods") produced by runs of
coverage-instrumented binaries, and a new tool program (cmd/covdata)
for dumping and/or manipulating coverage data files.

Currently "go tool covdata" subcommands include 'merge', 'intersect',
'percent', 'pkglist', 'subtract', 'debugdump', and 'textfmt'
(conversion to the legacy "go tool cover" format).

Updates #51430.

Change-Id: I44167c578f574b4636ab8726e726388531fd3258
Reviewed-on: https://go-review.googlesource.com/c/go/+/357609
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2022-09-28 11:47:16 +00:00
Robert Griesemer
dbe56ff6c7 go/types, types2: use "invalid operation: x rel y (cause)" for comparison error messages
Matches compiler behavior and is consistent with what we do with other
binary operations.

While at it, also use parentheses rather than a colon for a couple of
errors caused by not having a core type.

For #55326.

Change-Id: I0a5cec1a31ffda98d363e5528791965a1ccb5842
Reviewed-on: https://go-review.googlesource.com/c/go/+/435618
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
2022-09-28 10:36:02 +00:00
Ian Lance Taylor
2c4c2a5106 time: add comment explaining >>33 in Now
Change-Id: I022b617cd345b412bee0b50a862676a1dca94e01
Reviewed-on: https://go-review.googlesource.com/c/go/+/418376
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2022-09-28 09:05:54 +00:00
Mikael Urankar
d268504fd9 cmd/nm, runtime/cgo: add cgo support for freebsd/riscv64
Updates #53466

Change-Id: I08ea279c905e265a579b6b3e23aee012165beaee
Reviewed-on: https://go-review.googlesource.com/c/go/+/431658
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Goutnik <dgoutnik@gmail.com>
2022-09-28 05:38:32 +00:00
Mikael Urankar
a48fc816e7 cmd/dist: enable cgo tests on freebsd/riscv64
Updates #53466

Change-Id: I17a41adb93c22fa84a7bdcec9d8c65001c5a8ba9
Reviewed-on: https://go-review.googlesource.com/c/go/+/431657
Reviewed-by: Dmitri Goutnik <dgoutnik@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Meng Zhuo <mzh@golangcn.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-28 04:13:48 +00:00
cuiweixie
56fb2cff9f crypto: use bytes.Clone
Change-Id: I92e110023739c6f8f7815c7e47ad7639c4e8812d
Reviewed-on: https://go-review.googlesource.com/c/go/+/435279
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: xie cui <523516579@qq.com>
2022-09-28 03:55:33 +00:00
cuiweixie
acc5e3a0c2 net/textproto: use bytes.Clone
Change-Id: Ic73d667a98df3f2d1705a67e7e8625c6ba65cc0a
Reviewed-on: https://go-review.googlesource.com/c/go/+/435284
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
2022-09-28 03:55:14 +00:00
cuiweixie
a59e614aa1 internal: use bytes.Clone
Change-Id: Ia96ddd520a7bd2fd53bff55315c6fac04ae96a2f
Reviewed-on: https://go-review.googlesource.com/c/go/+/435282
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
2022-09-28 03:44:27 +00:00
cuiweixie
09919ac339 encoding/xml: use bytes.Clone
Change-Id: I3218b1e3f8869f579facddb29471df13c835dc66
Reviewed-on: https://go-review.googlesource.com/c/go/+/435281
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
2022-09-28 03:44:25 +00:00
Mikael Urankar
9aa7107cb5 runtime: add support for freebsd/riscv64
Updates #53466

Change-Id: I42ca5f1d0f20b5ecfcfba70d298566b6c851fefc
Reviewed-on: https://go-review.googlesource.com/c/go/+/431656
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Meng Zhuo <mzh@golangcn.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Goutnik <dgoutnik@gmail.com>
2022-09-28 03:17:13 +00:00
cuiweixie
12bf9ff8dc database: use bytes.Clone
Change-Id: I66aad199884cffd51946f53f01580a3a353f5c97
Reviewed-on: https://go-review.googlesource.com/c/go/+/435280
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Meng Zhuo <mzh@golangcn.org>
2022-09-28 03:16:54 +00:00
Roland Shoemaker
61ed6d5c33 crypto/rsa,crypto/internal/boring: fix PSS salt handling
Fix the coversion between our sentinel salt length variables and the
BoringSSL versions in SignRSAPSS. We previously set -1 (hash length
equals salt length) when 0 was passed when we should've been setting
-2. This now matches the conversion that happens in VerifyRSAPSS. Also
adds a note documenting why we do this.

Additionally in non-Boring mode, properly handle passing of salt lengths
with a negative value which aren't one of the magic constants, returning
an error instead of panicking.

See https://commondatastorage.googleapis.com/chromium-boringssl-docs/rsa.h.html#RSA_sign_pss_mgf1
for the BoringSSL docs.

Fixes #54803

Change-Id: Id1bd14dcf0ef4733867367257830ed43e25ef882
Reviewed-on: https://go-review.googlesource.com/c/go/+/426659
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Run-TryBot: Roland Shoemaker <roland@golang.org>
2022-09-27 23:19:20 +00:00
Robert Griesemer
b2137e7dad go/types, types2: use 2nd operand position for comparison type mismatch errors
When a comparison is invalid due to mismatched types, we only know
when we see the 2nd operand; so use that operand's position for the
error message. This matches compiler behavior.

For #55326.

Change-Id: I79450756bbdd2b4bb90ed4e960a451be0197b186
Reviewed-on: https://go-review.googlesource.com/c/go/+/435555
Run-TryBot: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-27 23:19:02 +00:00
Zeke Lu
fa13731a45 debug/elf: return error on reading from SHT_NOBITS sections
An SHT_NOBITS section contains no bytes and occupies no space in the
file. This change makes it return an error on reading from this section
so that it will force the caller to check for an SHT_NNOBITS section.

We have considered another option to return "nil, nil" for the Data
method. It's abandoned because it might lead a program to simply do
the wrong thing, thinking that the section is empty.

Please note that it breaks programs which expect a byte slice with the
length described by the sh_size field. There are two reasons to
introduce this breaking change: 1. SHT_NOBITS means no data and it's
unnecessary to allocate memory for it; 2. it could result in an OOM if
the file is corrupted and has a huge sh_size.

Fixes #54967.

Change-Id: I0c3ed4e097214fe88413d726a89122105ad45d4f
GitHub-Last-Rev: 994c12d9da
GitHub-Pull-Request: golang/go#54994
Reviewed-on: https://go-review.googlesource.com/c/go/+/429601
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2022-09-27 22:16:32 +00:00
Ian Lance Taylor
a451713286 crypto/x509: use unsafe.Slice
Change-Id: I40fdfbd5cfb9f5ccb80d55bca28ff9ba1ec490f3
Reviewed-on: https://go-review.googlesource.com/c/go/+/435285
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-27 22:00:10 +00:00
Robert Griesemer
7398c3c0c6 cmd/compile: use "method T.m already declared" for method redeclaration errors
Compromise between old compiler error "T.m redeclared in this block"
(where the "in this block" is not particularly helpful) and the old
type-checker error "method m already declared for type T ...".
In the case where we have position information for the original
declaration, the error message is "method T.m already declared at
<position>". The new message is both shorter and more precise.

For #55326.

Change-Id: Id4a7f326fe631b11db9e8030eccb417c72d6c7db
Reviewed-on: https://go-review.googlesource.com/c/go/+/435016
Run-TryBot: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2022-09-27 21:59:19 +00:00
Robert Griesemer
b16501c08b go/types, types2: use "unknown field f in struct literal of type S" in error messages
This is a compromise of the error reported by the compiler (quotes
around field name removed) and the error reported by the type checkers
(added mention of struct type).

For #55326.

Change-Id: Iac4fb5c717f17c6713e90d327d39e68d3be40074
Reviewed-on: https://go-review.googlesource.com/c/go/+/434815
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
2022-09-27 21:59:09 +00:00
Robert Griesemer
3b5188ed2c go/types, types2: use "multiple-value" instead "n-valued" in error messages
This matches current compiler behavior.

For #55326.

Change-Id: I9ebe2914323072b5454fb9af2d15c9dd2d711bad
Reviewed-on: https://go-review.googlesource.com/c/go/+/434735
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
2022-09-27 21:14:06 +00:00
Robert Griesemer
605148c0fb go/types, types2: uniformly use "cannot convert X to type T"
This matches current compiler behavior.

For #55326.

Change-Id: I660bd15f13a8d9eb00fafa937f8261e664b0e065
Reviewed-on: https://go-review.googlesource.com/c/go/+/433276
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Robert Griesemer <gri@google.com>
2022-09-27 21:14:03 +00:00
Robert Griesemer
4360fd8d6f go/types, types2: use "and not used" instead of "but not used" in error messages
This matches longstanding compiler behavior.

Also, for unused packages, report:

`"pkg" imported and not used`
`"pkg" imported as X and not used`

This matches the other `X declared and not used` errors.

For #55326.

Change-Id: Ie71cf662fb5f4648449c64fc51bede298a1bdcbf
Reviewed-on: https://go-review.googlesource.com/c/go/+/432557
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
2022-09-27 21:10:19 +00:00
Paul E. Murphy
871a3a409a cmd/compile: rework PPC64 Mul64uhilo lowering rules
Remove OpPPC64LoweredMuluhilo as this operation can be done
more efficiently with MULHDU and MULLD directly. This has the
benefit of not needing to use tuple select operations, and giving
the scheduler more freedom to place these operations.

The primary reason to avoid using tuples here is to to avoid
suboptimal scheduling when carry ops (e.x ADDC/ADDE) are used in
the same block as 64->128b multiples. CL 432275 modifies the
scheduling priorities which may cause non-flag/non-carry generating
tuple ops to interfere with carry opcodes. Thus resulting in excess
saving and restoring of the XER register.

This allows CL 432275 to adjust the scheduling priorities without
having to workaround odd tuple scheduling behavior.

Change-Id: Id04ef009ec4b86416e5436f2b44ae1474e73720e
Reviewed-on: https://go-review.googlesource.com/c/go/+/434855
Run-TryBot: Paul Murphy <murp@ibm.com>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-09-27 21:00:51 +00:00
David Chase
caa8e1f977 cmd/compile: make a type-specialized copy of encoding/binary.ReadUvarint
This is to get better escape analysis for a frequently-allocated object.

Change-Id: I1942a4e1c3cd1f0fa870bc8433a0165c18ce9c75
Reviewed-on: https://go-review.googlesource.com/c/go/+/435336
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2022-09-27 20:58:46 +00:00
David Chase
e8afb29111 cmd/compile: introduce "temporary" readers for more storage reuse
Change-Id: Id05d6099624284a9c1583b066d1a703e806b1e22
Reviewed-on: https://go-review.googlesource.com/c/go/+/433037
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
2022-09-27 20:36:31 +00:00
Keith Randall
6485e8f503 cmd/compile: use stricter rule for possible partial overlap
Partial overlaps can only happen for strict sub-pieces of larger arrays.
That's a much stronger condition than the current optimization rules.

Update #54467

Change-Id: I11e539b71099e50175f37ee78fddf69283f83ee5
Reviewed-on: https://go-review.googlesource.com/c/go/+/433056
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2022-09-27 20:09:33 +00:00
Alan Donovan
92a94a7024 go/scanner: emit implicit semicolon tokens in correct order
Prior to this change, the scanner, in ScanComments mode, would emit
the implicit SEMICOLON token generated by a newline ahead of any
immediately preceding comment "tokens". For example:

 foo /*a*/ /*b*/ /*c*/ \n   =>  [IDENT SEMICOLON COMMENT COMMENT COMMENT]

Now, tokens and comments are emitted by the scanner in lexical order
of their start position. SEMICOLON tokens corresponding to newlines
always have the position of the newline (even in the special case
in which the newline is in the middle of a general comment /*\n*/).

The scanner no longer needs to look ahead, possibly across multiple
comments, for a newline, when it encounters a comment.
The scanner semicolon tests have been rewritten to be less magical.

The parser must now expect line comments before an implicit semicolon.
Line comments for an explicit semicolon still appear after.
The new assertions in the parser TestLeadAndLineComments are
not changes to behavior.

Fixes golang/go#54941

Change-Id: Iffe97fd10e9e0b52882da8659307698ccb31c093
Reviewed-on: https://go-review.googlesource.com/c/go/+/429635
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Alan Donovan <adonovan@google.com>
2022-09-27 19:47:49 +00:00
cuiweixie
86ca550f40 bufio: use bytes.Clone
Change-Id: Ic21d979da8be1a6047b9bcd65b5ee71ca2ef7548
Reviewed-on: https://go-review.googlesource.com/c/go/+/435278
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-09-27 19:42:34 +00:00
Than McIntosh
bf5805eae4 cmd/link: fix coverage counter issue on AIX
Update the linker's XCOFF writer to handle coverage counter sections
properly; they need to be treated as bss, not data. Fixes a problem
with the aix-ppc64 builder introduced in CL 401235), e.g.
"runtime.covctrs: A symbol with type XTY_SD must be in a .text or
.data section".

Updates #51430.

Change-Id: I3fc385a37e2549c46cc7cc3b4718af989a36752a
Reviewed-on: https://go-review.googlesource.com/c/go/+/435335
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: David Chase <drchase@google.com>
2022-09-27 18:33:46 +00:00
Tobias Klauser
f15b81a80f cmd/internal/pkgpath: use MustHaveExec in TestToSymbolFunc
ToSymbolFunc executes a command using exec.Command.

Change-Id: Ic6c274bdc23050d021ec98ba67748338ac34f12c
Reviewed-on: https://go-review.googlesource.com/c/go/+/435236
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
2022-09-27 18:26:59 +00:00
Tobias Klauser
17078f5860 cmd/api: skip tests on platforms that cannot exec
These tests execute commands using exec.Command.

Change-Id: I2708d6d24762fe2b2a902b1b221cc67392bf5c41
Reviewed-on: https://go-review.googlesource.com/c/go/+/435235
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
2022-09-27 18:26:56 +00:00
Paul E. Murphy
edd1273b84 cmd/link: refactor usage of SymLocalentry helper functions
PPC64 ELFv2 uses the st_other field of a symbol to specify an offset
from the global entry point to its local entry point. Similarly, some
values (i.e 1) may also require additional linker support which is
missing today.

For now, generate an error if we encounter unsupported local entry
values on PPC64, and update the Localentry values to use bytes, not
32b instruction words.

Similarly, ELFv2 1.5 also updates the wording of values 2-6. They
now map to a specific number of bytes.

Change-Id: Id1b71c3b0fea982bdcfb7eac91d9f93e04ae43f9
Reviewed-on: https://go-review.googlesource.com/c/go/+/431876
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Paul Murphy <murp@ibm.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2022-09-27 17:29:05 +00:00
Marko Kungla
ff34676cdd misc/wasm: update deprecated substr usage
String.prototype.substr is deprecated and usage is no longer
recommended so using String.prototype.substring instead.

Change-Id: I9eb49a8c065890df73301e3a04af59f550bc3ae1
Reviewed-on: https://go-review.googlesource.com/c/go/+/406094
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2022-09-27 17:15:12 +00:00
cuiweixie
6c3567873c runtime: using bytes.CutPrefix
Change-Id: I3f2dae17496b5b4efbdc022802f941a616abd87a
Reviewed-on: https://go-review.googlesource.com/c/go/+/435276
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-27 17:14:59 +00:00
Keith Randall
b52783c1e9 cmd/compile: abstract type type+value obtained from types2
In preparation for encoding it in a more efficient way.

Change-Id: I299dd2befc3d07107a1b7b49225bbb9f2e48a343
Reviewed-on: https://go-review.googlesource.com/c/go/+/432896
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2022-09-27 17:08:05 +00:00
Carlo Alberto Ferraris
dcb90152a4 bytes,strings: optimize Repeat
When generating long strings or slices with Repeat we
currently reuse intermediate states as a way to quickly
build exponentially longer results.

This works well as long as the intermediate states fit into
the processor D-cache. If they don't we start thrashing the
D-cache by reading in the whole intermediate state over and
over on each iteration.

Instead, once we reach a large enough intermediate state (that
allows the memcpy operation to perform at peak) we cap the
size of chunk of the state that is used as source for subsequent
appends. This ensures that this smaller source chunk is always
present in the D-cache, and the append operation does not need
to read the state contents from memory.

Currently the cap is set to 8KB, a number derived via
experimentation to yield the highest performance across a
a large range of result sizes. Slightly higher caps also
produced similar results: 8KB was chosen as the smallest one
in this performance plateau with the intention to minimize
D-cache pollution.

For result sizes larger than the fastest cache levels we get
significantly higher performance compared to the current
implementation:
strings:
name                            old speed      new speed      delta
RepeatLarge/256/1-16            1.73GB/s ± 1%  1.73GB/s ± 0%      ~     (p=0.556 n=5+4)
RepeatLarge/256/16-16           2.02GB/s ± 0%  1.95GB/s ± 8%      ~     (p=0.222 n=5+5)
RepeatLarge/512/1-16            2.30GB/s ±13%  2.47GB/s ± 1%      ~     (p=0.548 n=5+5)
RepeatLarge/512/16-16           2.38GB/s ±16%  2.77GB/s ± 1%   +16.27%  (p=0.032 n=5+5)
RepeatLarge/1024/1-16           3.17GB/s ± 1%  3.18GB/s ± 0%      ~     (p=0.730 n=4+5)
RepeatLarge/1024/16-16          3.39GB/s ± 2%  3.38GB/s ± 1%      ~     (p=0.548 n=5+5)
RepeatLarge/2048/1-16           3.32GB/s ± 2%  3.32GB/s ± 2%      ~     (p=1.000 n=5+5)
RepeatLarge/2048/16-16          3.41GB/s ± 4%  3.46GB/s ± 2%      ~     (p=0.310 n=5+5)
RepeatLarge/4096/1-16           3.60GB/s ± 4%  3.67GB/s ± 3%      ~     (p=0.690 n=5+5)
RepeatLarge/4096/16-16          3.74GB/s ± 3%  3.71GB/s ± 5%      ~     (p=0.690 n=5+5)
RepeatLarge/8192/1-16           3.94GB/s ± 4%  4.01GB/s ± 1%      ~     (p=0.222 n=5+5)
RepeatLarge/8192/16-16          3.94GB/s ± 6%  4.05GB/s ± 1%      ~     (p=0.222 n=5+5)
RepeatLarge/8192/4097-16        4.25GB/s ± 6%  4.32GB/s ± 3%      ~     (p=0.690 n=5+5)
RepeatLarge/16384/1-16          4.96GB/s ± 1%  5.02GB/s ± 2%      ~     (p=0.421 n=5+5)
RepeatLarge/16384/16-16         4.99GB/s ± 2%  5.07GB/s ± 1%      ~     (p=0.421 n=5+5)
RepeatLarge/16384/4097-16       5.15GB/s ± 3%  5.17GB/s ± 1%      ~     (p=1.000 n=5+5)
RepeatLarge/32768/1-16          5.44GB/s ± 2%  5.42GB/s ± 1%      ~     (p=0.841 n=5+5)
RepeatLarge/32768/16-16         5.46GB/s ± 4%  5.44GB/s ± 1%      ~     (p=0.905 n=5+4)
RepeatLarge/32768/4097-16       4.84GB/s ± 2%  4.59GB/s ±12%    -5.05%  (p=0.032 n=5+5)
RepeatLarge/65536/1-16          5.85GB/s ± 0%  5.84GB/s ± 1%      ~     (p=0.690 n=5+5)
RepeatLarge/65536/16-16         5.81GB/s ± 2%  5.84GB/s ± 2%      ~     (p=0.421 n=5+5)
RepeatLarge/65536/4097-16       5.38GB/s ± 6%  5.45GB/s ± 1%      ~     (p=1.000 n=5+5)
RepeatLarge/131072/1-16         6.20GB/s ± 1%  6.31GB/s ± 1%    +1.80%  (p=0.008 n=5+5)
RepeatLarge/131072/16-16        6.12GB/s ± 3%  6.25GB/s ± 3%      ~     (p=0.095 n=5+5)
RepeatLarge/131072/4097-16      5.95GB/s ± 1%  5.85GB/s ±10%      ~     (p=1.000 n=5+5)
RepeatLarge/262144/1-16         6.33GB/s ± 1%  6.56GB/s ± 0%    +3.62%  (p=0.016 n=5+4)
RepeatLarge/262144/16-16        6.42GB/s ± 0%  6.65GB/s ± 1%    +3.58%  (p=0.016 n=4+5)
RepeatLarge/262144/4097-16      6.31GB/s ± 1%  6.44GB/s ± 1%    +1.94%  (p=0.008 n=5+5)
RepeatLarge/524288/1-16         6.23GB/s ± 1%  6.92GB/s ± 3%   +11.02%  (p=0.008 n=5+5)
RepeatLarge/524288/16-16        6.24GB/s ± 1%  6.97GB/s ± 2%   +11.77%  (p=0.016 n=4+5)
RepeatLarge/524288/4097-16      6.14GB/s ± 2%  6.73GB/s ± 3%    +9.50%  (p=0.008 n=5+5)
RepeatLarge/1048576/1-16        5.23GB/s ± 1%  6.53GB/s ± 6%   +24.85%  (p=0.008 n=5+5)
RepeatLarge/1048576/16-16       5.21GB/s ± 1%  6.56GB/s ± 4%   +25.93%  (p=0.008 n=5+5)
RepeatLarge/1048576/4097-16     5.22GB/s ± 1%  6.26GB/s ± 2%   +20.09%  (p=0.008 n=5+5)
RepeatLarge/2097152/1-16        3.95GB/s ± 1%  5.96GB/s ± 1%   +51.01%  (p=0.008 n=5+5)
RepeatLarge/2097152/16-16       3.94GB/s ± 1%  5.98GB/s ± 2%   +51.99%  (p=0.008 n=5+5)
RepeatLarge/2097152/4097-16     4.94GB/s ± 1%  5.71GB/s ± 2%   +15.63%  (p=0.008 n=5+5)
RepeatLarge/4194304/1-16        3.10GB/s ± 1%  5.89GB/s ± 1%   +89.90%  (p=0.008 n=5+5)
RepeatLarge/4194304/16-16       3.09GB/s ± 1%  5.86GB/s ± 1%   +89.89%  (p=0.008 n=5+5)
RepeatLarge/4194304/4097-16     3.13GB/s ± 1%  5.89GB/s ± 1%   +88.36%  (p=0.008 n=5+5)
RepeatLarge/8388608/1-16        3.06GB/s ± 1%  6.31GB/s ±16%  +105.84%  (p=0.008 n=5+5)
RepeatLarge/8388608/16-16       3.08GB/s ± 1%  6.62GB/s ± 1%  +114.66%  (p=0.008 n=5+5)
RepeatLarge/8388608/4097-16     3.13GB/s ± 2%  6.87GB/s ± 1%  +119.62%  (p=0.008 n=5+5)
RepeatLarge/16777216/1-16       3.21GB/s ± 3%  5.88GB/s ± 1%   +83.27%  (p=0.008 n=5+5)
RepeatLarge/16777216/16-16      3.23GB/s ± 2%  5.84GB/s ± 2%   +80.49%  (p=0.008 n=5+5)
RepeatLarge/16777216/4097-16    3.30GB/s ± 6%  5.88GB/s ± 2%   +78.18%  (p=0.008 n=5+5)
RepeatLarge/33554432/1-16       3.71GB/s ± 3%  5.91GB/s ± 2%   +59.17%  (p=0.008 n=5+5)
RepeatLarge/33554432/16-16      3.67GB/s ± 3%  5.91GB/s ± 2%   +61.13%  (p=0.008 n=5+5)
RepeatLarge/33554432/4097-16    3.71GB/s ± 1%  5.77GB/s ± 6%   +55.51%  (p=0.008 n=5+5)
RepeatLarge/67108864/1-16       4.61GB/s ±11%  6.00GB/s ± 5%   +30.15%  (p=0.008 n=5+5)
RepeatLarge/67108864/16-16      4.62GB/s ± 7%  6.11GB/s ± 2%   +32.35%  (p=0.008 n=5+5)
RepeatLarge/67108864/4097-16    4.71GB/s ± 2%  6.24GB/s ± 2%   +32.60%  (p=0.008 n=5+5)
RepeatLarge/134217728/1-16      4.53GB/s ± 8%  6.28GB/s ±11%   +38.57%  (p=0.008 n=5+5)
RepeatLarge/134217728/16-16     4.78GB/s ± 3%  6.36GB/s ± 3%   +33.16%  (p=0.008 n=5+5)
RepeatLarge/134217728/4097-16   4.73GB/s ± 6%  6.46GB/s ± 3%   +36.63%  (p=0.008 n=5+5)
RepeatLarge/268435456/1-16      4.09GB/s ±25%  6.37GB/s ±19%   +56.00%  (p=0.008 n=5+5)
RepeatLarge/268435456/16-16     4.50GB/s ± 4%  6.86GB/s ± 0%   +52.49%  (p=0.016 n=5+4)
RepeatLarge/268435456/4097-16   4.73GB/s ± 5%  6.90GB/s ± 0%   +45.94%  (p=0.008 n=5+5)
RepeatLarge/536870912/1-16      4.38GB/s ±36%  6.52GB/s ± 8%   +48.68%  (p=0.008 n=5+5)
RepeatLarge/536870912/16-16     4.69GB/s ±12%  6.90GB/s ± 1%   +46.97%  (p=0.008 n=5+5)
RepeatLarge/536870912/4097-16   4.87GB/s ± 8%  6.98GB/s ± 0%   +43.36%  (p=0.008 n=5+5)
RepeatLarge/1073741824/1-16     3.87GB/s ±28%  6.96GB/s ± 1%   +79.94%  (p=0.016 n=5+4)
RepeatLarge/1073741824/16-16    4.79GB/s ± 9%  6.93GB/s ± 0%   +44.79%  (p=0.008 n=5+5)
RepeatLarge/1073741824/4097-16  4.65GB/s ± 8%  7.02GB/s ± 1%   +51.02%  (p=0.008 n=5+5)

bytes:
name                            old speed      new speed      delta
RepeatLarge/256/1-16            1.93GB/s ± 1%  1.84GB/s ± 1%    -4.81%  (p=0.000 n=10+10)
RepeatLarge/256/16-16           2.25GB/s ± 2%  2.15GB/s ± 1%    -4.45%  (p=0.000 n=9+8)
RepeatLarge/512/1-16            2.71GB/s ± 1%  2.62GB/s ± 1%    -3.27%  (p=0.000 n=10+9)
RepeatLarge/512/16-16           2.96GB/s ± 4%  2.91GB/s ± 1%      ~     (p=0.243 n=9+10)
RepeatLarge/1024/1-16           3.35GB/s ± 1%  3.27GB/s ± 1%    -2.61%  (p=0.000 n=9+10)
RepeatLarge/1024/16-16          3.56GB/s ± 2%  3.52GB/s ± 1%    -1.10%  (p=0.010 n=10+9)
RepeatLarge/2048/1-16           3.52GB/s ± 1%  3.45GB/s ± 1%    -1.92%  (p=0.000 n=10+10)
RepeatLarge/2048/16-16          3.61GB/s ± 1%  3.58GB/s ± 0%    -0.82%  (p=0.008 n=9+8)
RepeatLarge/4096/1-16           3.85GB/s ± 2%  3.80GB/s ± 2%      ~     (p=0.165 n=10+10)
RepeatLarge/4096/16-16          3.88GB/s ± 3%  3.84GB/s ± 4%      ~     (p=0.393 n=10+10)
RepeatLarge/8192/1-16           4.12GB/s ± 2%  4.04GB/s ± 1%    -1.96%  (p=0.000 n=10+10)
RepeatLarge/8192/16-16          4.11GB/s ± 2%  4.09GB/s ± 1%      ~     (p=0.278 n=9+10)
RepeatLarge/8192/4097-16        4.38GB/s ± 1%  4.39GB/s ± 4%      ~     (p=0.720 n=9+10)
RepeatLarge/16384/1-16          5.06GB/s ± 2%  4.95GB/s ± 3%    -2.29%  (p=0.001 n=10+9)
RepeatLarge/16384/16-16         5.11GB/s ± 3%  5.06GB/s ± 3%      ~     (p=0.315 n=10+9)
RepeatLarge/16384/4097-16       5.22GB/s ± 3%  5.26GB/s ± 3%      ~     (p=0.211 n=9+10)
RepeatLarge/32768/1-16          5.54GB/s ± 2%  5.50GB/s ± 3%      ~     (p=0.353 n=10+10)
RepeatLarge/32768/16-16         5.55GB/s ± 1%  5.60GB/s ± 1%    +0.91%  (p=0.035 n=10+9)
RepeatLarge/32768/4097-16       4.88GB/s ± 2%  4.85GB/s ± 2%      ~     (p=0.447 n=10+9)
RepeatLarge/65536/1-16          5.86GB/s ± 1%  5.93GB/s ± 2%    +1.18%  (p=0.043 n=8+10)
RepeatLarge/65536/16-16         5.83GB/s ± 2%  5.98GB/s ± 1%    +2.67%  (p=0.000 n=10+10)
RepeatLarge/65536/4097-16       5.57GB/s ± 0%  5.56GB/s ± 3%      ~     (p=0.696 n=8+10)
RepeatLarge/131072/1-16         6.23GB/s ± 1%  6.38GB/s ± 2%    +2.51%  (p=0.000 n=9+10)
RepeatLarge/131072/16-16        6.21GB/s ± 2%  6.37GB/s ± 1%    +2.72%  (p=0.000 n=9+10)
RepeatLarge/131072/4097-16      6.04GB/s ± 1%  6.09GB/s ± 3%      ~     (p=0.356 n=9+10)
RepeatLarge/262144/1-16         6.47GB/s ± 1%  6.63GB/s ± 2%    +2.57%  (p=0.003 n=10+10)
RepeatLarge/262144/16-16        6.45GB/s ± 2%  6.69GB/s ± 2%    +3.65%  (p=0.000 n=10+10)
RepeatLarge/262144/4097-16      6.35GB/s ± 1%  6.51GB/s ± 2%    +2.48%  (p=0.000 n=9+10)
RepeatLarge/524288/1-16         6.21GB/s ± 2%  6.95GB/s ± 1%   +11.95%  (p=0.000 n=10+10)
RepeatLarge/524288/16-16        6.24GB/s ± 2%  6.93GB/s ± 2%   +11.11%  (p=0.000 n=10+10)
RepeatLarge/524288/4097-16      6.18GB/s ± 2%  6.82GB/s ± 1%   +10.39%  (p=0.000 n=9+10)
RepeatLarge/1048576/1-16        5.34GB/s ± 2%  6.41GB/s ± 2%   +20.05%  (p=0.000 n=10+10)
RepeatLarge/1048576/16-16       5.33GB/s ± 1%  6.45GB/s ± 2%   +20.84%  (p=0.000 n=10+9)
RepeatLarge/1048576/4097-16     5.28GB/s ± 1%  6.17GB/s ± 2%   +16.75%  (p=0.000 n=10+10)
RepeatLarge/2097152/1-16        4.04GB/s ± 1%  6.21GB/s ± 1%   +53.89%  (p=0.000 n=9+8)
RepeatLarge/2097152/16-16       4.02GB/s ± 1%  6.20GB/s ± 2%   +54.37%  (p=0.000 n=10+9)
RepeatLarge/2097152/4097-16     4.94GB/s ± 1%  6.04GB/s ± 1%   +22.36%  (p=0.000 n=10+10)
RepeatLarge/4194304/1-16        3.10GB/s ± 1%  5.74GB/s ± 0%   +85.04%  (p=0.000 n=10+9)
RepeatLarge/4194304/16-16       3.10GB/s ± 2%  5.72GB/s ± 1%   +84.26%  (p=0.000 n=9+10)
RepeatLarge/4194304/4097-16     3.03GB/s ± 4%  5.61GB/s ± 1%   +85.06%  (p=0.000 n=10+9)
RepeatLarge/8388608/1-16        3.08GB/s ± 2%  6.25GB/s ± 1%  +103.09%  (p=0.000 n=9+9)
RepeatLarge/8388608/16-16       3.07GB/s ± 2%  6.26GB/s ± 3%  +104.07%  (p=0.000 n=10+9)
RepeatLarge/8388608/4097-16     3.08GB/s ± 2%  6.23GB/s ± 2%  +102.09%  (p=0.000 n=9+10)
RepeatLarge/16777216/1-16       3.25GB/s ± 2%  5.78GB/s ± 3%   +78.03%  (p=0.000 n=9+9)
RepeatLarge/16777216/16-16      3.25GB/s ± 1%  5.75GB/s ± 1%   +77.21%  (p=0.000 n=9+10)
RepeatLarge/16777216/4097-16    3.29GB/s ± 3%  5.72GB/s ± 2%   +73.74%  (p=0.000 n=10+10)
RepeatLarge/33554432/1-16       3.68GB/s ± 2%  5.90GB/s ± 1%   +60.20%  (p=0.000 n=10+10)
RepeatLarge/33554432/16-16      3.69GB/s ± 3%  5.88GB/s ± 1%   +59.54%  (p=0.000 n=10+9)
RepeatLarge/33554432/4097-16    3.74GB/s ± 1%  5.94GB/s ± 2%   +58.68%  (p=0.000 n=7+10)
RepeatLarge/67108864/1-16       4.62GB/s ±12%  6.11GB/s ± 3%   +32.23%  (p=0.000 n=10+9)
RepeatLarge/67108864/16-16      4.77GB/s ± 2%  6.09GB/s ± 2%   +27.88%  (p=0.000 n=9+9)
RepeatLarge/67108864/4097-16    4.78GB/s ± 1%  6.19GB/s ± 1%   +29.51%  (p=0.000 n=9+10)
RepeatLarge/134217728/1-16      4.60GB/s ±16%  6.52GB/s ± 9%   +41.67%  (p=0.000 n=10+10)
RepeatLarge/134217728/16-16     4.80GB/s ± 4%  6.81GB/s ± 2%   +41.82%  (p=0.000 n=10+9)
RepeatLarge/134217728/4097-16   4.79GB/s ± 4%  6.81GB/s ± 2%   +42.31%  (p=0.000 n=9+10)
RepeatLarge/268435456/1-16      4.43GB/s ±25%  6.27GB/s ±14%   +41.52%  (p=0.000 n=10+10)
RepeatLarge/268435456/16-16     4.75GB/s ± 4%  6.68GB/s ± 4%   +40.50%  (p=0.000 n=9+10)
RepeatLarge/268435456/4097-16   4.75GB/s ± 3%  6.58GB/s ± 4%   +38.68%  (p=0.000 n=9+10)
RepeatLarge/536870912/1-16      4.96GB/s ± 9%  6.39GB/s ±16%   +28.90%  (p=0.000 n=8+10)
RepeatLarge/536870912/16-16     4.66GB/s ± 6%  6.57GB/s ± 7%   +40.82%  (p=0.000 n=10+9)
RepeatLarge/536870912/4097-16   4.68GB/s ±11%  6.88GB/s ± 3%   +47.01%  (p=0.000 n=10+9)
RepeatLarge/1073741824/1-16     4.39GB/s ±23%  6.57GB/s ± 5%   +49.75%  (p=0.000 n=10+8)
RepeatLarge/1073741824/16-16    4.73GB/s ±13%  6.89GB/s ± 1%   +45.68%  (p=0.000 n=9+8)
RepeatLarge/1073741824/4097-16  4.97GB/s ±15%  6.73GB/s ± 9%   +35.45%  (p=0.000 n=10+10)

The results above come from a Intel i9-9980HK (256KB L2) with
TurboBoost disabled.

Change-Id: I79dd57da0429aee9020ffd7bc458a034b999b740
Reviewed-on: https://go-review.googlesource.com/c/go/+/419054
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-27 16:55:15 +00:00
Zeke Lu
7d157fd0eb debug/elf: suport files with >= 65280 (0xff00) sections
The spec https://refspecs.linuxfoundation.org/elf/gabi4+/ch4.eheader.html
states:

1. e_shnum: If the number of sections is greater than or equal to
SHN_LORESERVE (0xff00), this member has the value zero and the actual
number of section header table entries is contained in the sh_size
field of the section header at index 0.

2. e_shstrndx: If the section name string table section index is
greater than or equal to SHN_LORESERVE (0xff00), this member has the
value SHN_XINDEX (0xffff) and the actual index of the section name
string table section is contained in the sh_link field of the section
header at index 0.

This CL makes these changes to support files with >= 0xff00 sections:

1. if shoff > 0 && shnum == 0, read sh_size from the initial section
header entry as shnum.
2. if shstrndx == SHN_XINDEX, read sh_link from the initial section
header entry as shstrndx.

It returns an error if the type of the initial section is not SHT_NULL.

A file with >= 0xff00 sections is too big to include in the repository,
so the test case constructs one on the fly, with some of the sections
zeroed out.

While here, remove the unnecessary use of reflect.DeepEqual in the test.

Fixes #55294.

Change-Id: I15ec43612c7cce6e8decfe4e81da3a5b16de47f7
GitHub-Last-Rev: 797c16480b
GitHub-Pull-Request: golang/go#55295
Reviewed-on: https://go-review.googlesource.com/c/go/+/432255
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
2022-09-27 16:50:30 +00:00
Than McIntosh
1e4989c336 cmd: relocate search.MatchPattern to cmd/internal/pkgpattern
Relocate cmd/go's search.MatchPattern helper routine to a new package
in cmd/internal from its current location, as to allow it to be used
in other tools that accept package pattern command line flags. No
change in functionality along the way.

Updates #51430.

Change-Id: I726e974ccd66a055bb5a94497b36b8d68d47cad1
Reviewed-on: https://go-review.googlesource.com/c/go/+/432757
Reviewed-by: Bryan Mills <bcmills@google.com>
2022-09-27 16:43:40 +00:00
doujiang24
fb6c210dc3 runtime/trace: add missing events for the locked g in extra M.
Extra Ms may lead to the "no consistent ordering of events possible" error when parsing trace file with cgo enabled, since:
1. The gs in the extra Ms may be in `_Gdead` status while starting trace by invoking `runtime.StartTrace`,
2. and these gs will trigger `traceEvGoSysExit` events in `runtime.exitsyscall` when invoking go functions from c,
3. then, the events of those gs are under non-consistent ordering, due to missing the previous events.

Add two events, `traceEvGoCreate` and `traceEvGoInSyscall`, in `runtime.StartTrace`, will make the trace parser happy.

Fixes #29707

Change-Id: I2fd9d1713cda22f0ddb36efe1ab351f88da10881
GitHub-Last-Rev: 7bbfddb81b
GitHub-Pull-Request: golang/go#54974
Reviewed-on: https://go-review.googlesource.com/c/go/+/429858
Run-TryBot: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: xie cui <523516579@qq.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Michael Pratt <mpratt@google.com>
2022-09-27 16:37:51 +00:00
cui fliter
48a58c5d2c cmd/go/internal: use strings.CutSuffix
Updates #42537

Change-Id: I2d4c5e911c8a2ddfe9a976896b05d3cd8be61f6b
GitHub-Last-Rev: a87597d8a7
GitHub-Pull-Request: golang/go#55830
Reviewed-on: https://go-review.googlesource.com/c/go/+/433275
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
2022-09-27 16:36:36 +00:00
Ian Lance Taylor
b0f8e20d04 reflect: clarify that Value.Comparable checks the value
For #46746

Change-Id: Ic7a31ddf7cd6bf6dd0db6b9eb3fee68fc180f72e
Reviewed-on: https://go-review.googlesource.com/c/go/+/435277
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-27 16:24:53 +00:00
Ian Lance Taylor
c929a5b855 debug/dwarf: don't crash on invalid range/rnglist offset
No test case because the problem can only happen for invalid data. Let
the fuzzer find cases like this.

Fixes #53529

Change-Id: I318c87795e545fe5a006d16b4d361cd4bf5d502d
Reviewed-on: https://go-review.googlesource.com/c/go/+/434936
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2022-09-27 16:08:16 +00:00
Andy Pan
d9d2ef991c net/http: fix the potential leak of textproto.Reader from pool
Fixes #55835

Change-Id: I6109bab2941b859e8cfef22f65a6a3a5f977a8d7
Reviewed-on: https://go-review.googlesource.com/c/go/+/433835
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Andy Pan <panjf2000@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
2022-09-27 16:01:59 +00:00