1
0
mirror of https://github.com/golang/go synced 2024-11-22 19:05:01 -07:00
Commit Graph

53696 Commits

Author SHA1 Message Date
Wayne Zuo
7d574466a9 cmd/internal/obj/loong64: add ROTR, ROTRV instructions support
Reference: https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html

Change-Id: I29adb84eb70bffd963c79ed6957a5197896fb2bf
Reviewed-on: https://go-review.googlesource.com/c/go/+/422316
Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2022-08-30 03:21:06 +00:00
Cuong Manh Le
629ae1cee6 cmd/compile: fix wrong position when rewriting to OpArg/OpArgXXX
When spilling arg to stack or register, if it's a newly created value,
the arg position should be preserved. Otherwise, we may end up using
position information from deadcode lines.

This fixes the minimized test case in #54625 by mdempsky@, and make
building std successfully. However, the inline trees for these tests
still be corrupted:

 - fixedbugs/issue53982.go
 - typeparam/issue47775.go
 - typeparam/issue47775b.go
 - typeparam/issue49432.go

We probably still mess up the inline position somewhere else.

Updates #54625

Change-Id: I0d87e26b9ab451b85b6e79787da74a2b79a16209
Reviewed-on: https://go-review.googlesource.com/c/go/+/425785
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2022-08-30 00:49:19 +00:00
Cuong Manh Le
47f8db368c reflect: clarify Value.Equal behavior for non-comparable values
The current implementation always returns false for non-comparable
values, update the doc to reflect that.

Change-Id: I87f2da408874b0a209c8f51949e3310da15c5904
Reviewed-on: https://go-review.googlesource.com/c/go/+/426195
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: xie cui <523516579@qq.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: hopehook <hopehook@golangcn.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-08-30 00:37:15 +00:00
Bryan C. Mills
65535581aa cmd/go: skip gccgo cgo tests in TestScript/build_overlay
cgo builds with -compiler=gccgo are broken as of CL 421879.

For #54761.
Updates #46731.

Change-Id: I0306b0bd96669f70279fc96814cc72d934a1ad6e
Reviewed-on: https://go-review.googlesource.com/c/go/+/426496
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
2022-08-29 22:04:21 +00:00
Bryan C. Mills
7b689dcbef cmd/go/internal/modfetch: distinguish "unsupported" errors from RecentTag
CL 426079 started checking errors from RecentTag.
Unfortunately, we forgot to run "-longtest" SlowBots, and it turns out
to have broken non-short tests for non-git VCS implementations,
because those don't implement the RecentTag method.

Updates #53935.

Change-Id: I5935f2f4b3f684515e99e8bf70a840154c36249f
Reviewed-on: https://go-review.googlesource.com/c/go/+/426495
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-29 21:29:04 +00:00
cuiweixie
2113fefe7d context: convert goroutines to atomic type
Change-Id: I021fbc9786a3e3f858770fe3e109a0de487390d8
Reviewed-on: https://go-review.googlesource.com/c/go/+/426089
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: xie cui <523516579@qq.com>
Reviewed-by: Damien Neil <dneil@google.com>
2022-08-29 20:21:48 +00:00
cuiweixie
fd2ac5ef96 testing: convert common.hasSub to atomic type
Change-Id: I3d8a9b901efabe62f432c06361826f46c78d2605
Reviewed-on: https://go-review.googlesource.com/c/go/+/426080
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-29 20:19:15 +00:00
Joe Tsai
b0144b3843 sync: switch Map to use atomic.Pointer
There was no noticeable change in performance.

Change-Id: I9c57bf836c8b6066e0620afb3d536ce99e4b9d87
Reviewed-on: https://go-review.googlesource.com/c/go/+/426074
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Auto-Submit: Joseph Tsai <joetsai@digital-static.net>
Run-TryBot: Joseph Tsai <joetsai@digital-static.net>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-29 20:09:02 +00:00
Dan Kortschak
36d1f23661 debug/macho: use saferio to allocate Load and Symbol slices
Avoid allocating large amounts of memory for corrupt input.

No test case because the problem can only happen for invalid data.
Let the fuzzer find cases like this.

Change-Id: I2d1745200611f0af06ca58adcc3e2309ad6742d8
Reviewed-on: https://go-review.googlesource.com/c/go/+/425882
Run-TryBot: Dan Kortschak <dan@kortschak.io>
Auto-Submit: Dan Kortschak <dan@kortschak.io>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2022-08-29 20:08:15 +00:00
byarbrough
f3a1f9220a testing: explain using a _test package
The existing documentation did not explain the difference between
placing a _test.go file in the same package as what is being
tested vs. adding it to a separate _test package. This explains the
distinction and adds an example.

Concept is explained well here:  https://stackoverflow.com/a/31443271

Fixes #25223

Change-Id: Iebaba15207d8aa24f0b370d8dd4062eadb504b5c
GitHub-Last-Rev: 7f49c5f462
GitHub-Pull-Request: golang/go#54160
Reviewed-on: https://go-review.googlesource.com/c/go/+/420415
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
2022-08-29 20:08:10 +00:00
Andy Pan
c108a682ff internal/poll: use sync.Once instead to guard CopyFileRange() with kernel 5.3
The existing implementation creates more branches with more states: -1, 0, 1,
which makes it not very intuitive to understand, let's use sync.Once and boolean
instead to make it more straightforward.

Change-Id: I05766e5fdf7dba37d6565f84d3db4373f9342fe5
Reviewed-on: https://go-review.googlesource.com/c/go/+/425880
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Heschi Kreinick <heschi@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>
2022-08-29 20:06:09 +00:00
Tobias Klauser
9da49a7d2e time: use internal/itoa
In initLocal for GOOS=js, use internal/itoa introduced in CL 301549
instead of a local implementation.

Change-Id: If107d5cf0ce56f4d926507db2cbd6da422c6d15a
Reviewed-on: https://go-review.googlesource.com/c/go/+/425302
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-29 20:05:34 +00:00
Dan Kortschak
dbd0ce84d7 debug/elf: validate offset and file size ranges
Change-Id: Iebe31b91c6e81438120f50a8089a8efca3d5339d
Reviewed-on: https://go-review.googlesource.com/c/go/+/426115
Run-TryBot: Dan Kortschak <dan@kortschak.io>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-29 20:04:56 +00:00
Andy Pan
59bdbb3eff net: add the missing OS Darwin in the comment of sendFile
Change-Id: Ice7e3762d4a1d71e23d619be699697f5c6523cc5
Reviewed-on: https://go-review.googlesource.com/c/go/+/425879
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Heschi Kreinick <heschi@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>
2022-08-29 20:04:53 +00:00
Zeke Lu
5cfeaed4de cmd/go/internal/modfetch: report error on failing to derive pseudo version from recent tag
The current implementation ignores the error when it tries to get
the recent tag on revisions, which results in incorrect pseudo
version (v0.0.0-) is derived.

Fixes #53935

Change-Id: I153d851eb913fb7e40051e194c92b9ca5bf0e906
GitHub-Last-Rev: 6ba1d90df5
GitHub-Pull-Request: golang/go#54701
Reviewed-on: https://go-review.googlesource.com/c/go/+/426079
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
2022-08-29 19:38:15 +00:00
Joe Tsai
4029124cf4 time: add fuzz test for Time.appendFormatRFC3339
Time.appendFormatRFC3339 is a specialized implementation of
Time.appendFormat. We expect the two to be identical.
Add a fuzz test to ensure this property.

Updates #54093

Change-Id: I0bc41ee6e016d3dac75d1ac372d8c9c7266d0299
Reviewed-on: https://go-review.googlesource.com/c/go/+/425100
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
2022-08-29 19:29:37 +00:00
Ikko Ashimine
68b10c2bb8 internal/trace: fix typo in goroutines.go
assosciated -> associated

Change-Id: Id1cbbdea12f0239a9e173ece934c18cc9ffcf0f4
GitHub-Last-Rev: 7fea9de6c2
GitHub-Pull-Request: golang/go#54739
Reviewed-on: https://go-review.googlesource.com/c/go/+/425596
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
2022-08-29 19:23:57 +00:00
Pascal S. de Kloe
0e16d67a56 net/http: FileServer method check + minimal OPTIONS implementation
FileServer provides a read-only service. Methods other than GET or HEAD should
be denied with an Allow header.

Fixes #53501

Change-Id: I1d31b405eefd90565ecd474ac3f8d8d6e3b15072
Reviewed-on: https://go-review.googlesource.com/c/go/+/413554
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Damien Neil <dneil@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2022-08-29 17:12:01 +00:00
eric fang
eeb1ba7a89 cmd/compile/obj/arm64: fix encoding error of FMOVD/FMOVS $0|ZR
Previously the first operand of FMOVD and FMOVS could be $0, which
would be converted to the ZR register. This is prohibited by CL 404316,
also it broken the encoding of "FMOVD/FMOVS ZR, Rn", this CL restores
this instruction format and fixes the encoding issue.

Fixes #54655.
Fixes #54729.

Change-Id: I9c42cd41296bed7ffd601609bd8ecaa27d11e659
Reviewed-on: https://go-review.googlesource.com/c/go/+/425188
Run-TryBot: Eric Fang <eric.fang@arm.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-29 17:03:10 +00:00
Cuong Manh Le
7393049780 reflect: simplify array value comparable check
If array element is not interface, array or struct, we just need to
check whether the array element type is comparable.

Change-Id: I1ab94cfa17ae86feb6cd3fbdf878af5a776e7bec
Reviewed-on: https://go-review.googlesource.com/c/go/+/426194
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-29 16:39:37 +00:00
Nigel Tao
63e129ba1c image/png: allow both PLTE and tRNS chunks for TrueColor
Prior to this commit, png.Decode would allow TrueColor PNG images that
have one but not both of PLTE and tRNS chunks.

Fixes #54142

Change-Id: I259c1fff86a0aa5640dbadf7ad834e05fbd1430c
Reviewed-on: https://go-review.googlesource.com/c/go/+/424916
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Nigel Tao (INACTIVE; USE @golang.org INSTEAD) <nigeltao@google.com>
2022-08-29 15:11:31 +00:00
cuiweixie
a1c9783ca1 testing: convert numFailed to atomic type
Change-Id: Ic3464e95ad8901df5477d7717760b8c6d08ce97b
Reviewed-on: https://go-review.googlesource.com/c/go/+/426078
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2022-08-29 14:52:44 +00:00
ianwoolf
863d57cc7d cmd/go/internal/modload: return error when duplicate module paths among modules in go.work
Fixes #54048

Change-Id: I27350af451ff50532856092f2d99b6cc6dc6743d
Reviewed-on: https://go-review.googlesource.com/c/go/+/419557
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-29 14:48:48 +00:00
David Chase
7f92ccea5c debug/pe: check size in uint64 to avoid overflow
uint32(sz) != n*uint32(ddSz) can go wrong if
the RHS overflows, so do it in wider precision.

Fixes #54640.

Change-Id: I776563330e46de6cdacd4055f6ff08e7de67797f
Reviewed-on: https://go-review.googlesource.com/c/go/+/425364
Reviewed-by: Dan Kortschak <dan@kortschak.io>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-29 01:35:52 +00:00
Cuong Manh Le
846c378b8c cmd/cgo: add and use runtime/cgo.Incomplete instead of //go:notinheap
Updates #46731

Change-Id: Ia83f27c177cc2f57e240cb5c6708d4552423f5be
Reviewed-on: https://go-review.googlesource.com/c/go/+/421879
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-28 16:04:49 +00:00
Wayne Zuo
a6219737e3 cmd/compile: intrinsify Sub64 on riscv64
After this CL, the performance difference in crypto/elliptic
benchmarks on linux/riscv64 are:

name                 old time/op    new time/op    delta
ScalarBaseMult/P256    1.64ms ± 1%    1.60ms ± 1%   -2.36%  (p=0.008 n=5+5)
ScalarBaseMult/P224    1.53ms ± 1%    1.47ms ± 2%   -4.24%  (p=0.008 n=5+5)
ScalarBaseMult/P384    5.12ms ± 2%    5.03ms ± 2%     ~     (p=0.095 n=5+5)
ScalarBaseMult/P521    22.3ms ± 2%    13.8ms ± 1%  -37.89%  (p=0.008 n=5+5)
ScalarMult/P256        4.49ms ± 2%    4.26ms ± 2%   -5.13%  (p=0.008 n=5+5)
ScalarMult/P224        4.33ms ± 1%    4.09ms ± 1%   -5.59%  (p=0.008 n=5+5)
ScalarMult/P384        16.3ms ± 1%    15.5ms ± 2%   -4.78%  (p=0.008 n=5+5)
ScalarMult/P521         101ms ± 0%      47ms ± 2%  -53.36%  (p=0.008 n=5+5)

Change-Id: I31cf0506e27f9d85f576af1813630a19c20dda8a
Reviewed-on: https://go-review.googlesource.com/c/go/+/420095
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Joel Sing <joel@sing.id.au>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-27 05:43:59 +00:00
Wayne Zuo
969f48a3a2 cmd/compile: intrinsify Add64 on riscv64
According to RISCV instruction set manual v2.2 Sec 2.4, we can
implement overflowing check for unsigned addition cheaply using
SLTU instructions.

After this CL, the performance difference in crypto/elliptic
benchmarks on linux/riscv64 are:

name                 old time/op    new time/op    delta
ScalarBaseMult/P256    1.93ms ± 1%    1.64ms ± 1%  -14.96%  (p=0.008 n=5+5)
ScalarBaseMult/P224    1.80ms ± 2%    1.53ms ± 1%  -14.89%  (p=0.008 n=5+5)
ScalarBaseMult/P384    6.15ms ± 2%    5.12ms ± 2%  -16.73%  (p=0.008 n=5+5)
ScalarBaseMult/P521    25.9ms ± 1%    22.3ms ± 2%  -13.78%  (p=0.008 n=5+5)
ScalarMult/P256        5.59ms ± 1%    4.49ms ± 2%  -19.79%  (p=0.008 n=5+5)
ScalarMult/P224        5.42ms ± 1%    4.33ms ± 1%  -20.01%  (p=0.008 n=5+5)
ScalarMult/P384        19.9ms ± 2%    16.3ms ± 1%  -18.15%  (p=0.008 n=5+5)
ScalarMult/P521        97.3ms ± 1%   100.7ms ± 0%   +3.48%  (p=0.008 n=5+5)

Change-Id: Ic4c82ced4b072a4a6575343fa9f29dd09b0cabc4
Reviewed-on: https://go-review.googlesource.com/c/go/+/420094
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org>
Reviewed-by: Joel Sing <joel@sing.id.au>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-27 05:43:32 +00:00
Jianwei Mao
a2d2e6e7cb net: add FlagRunning to exactly reflect the states of an interface.
Correctly set this flag while parsing the syscall result.

The FlagUp flag can not distinguish the following situations:
1. interface is plugged, automatically up, and in running(UP) state
2. interface is not plugged, administratively or manually set to up,
but in DOWN state

So, We can't distinguish the state of a NIC by the FlagUp flag alone.

Fixes #53482

Change-Id: I43796bea1a7f72d1fddfef914efe603c81995e1b
GitHub-Last-Rev: 686b5d888e
GitHub-Pull-Request: golang/go#53484
Reviewed-on: https://go-review.googlesource.com/c/go/+/413454
TryBot-Result: Gopher Robot <gobot@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>
Reviewed-by: Ryan Schuster <shuey19831@gmail.com>
Reviewed-by: Jianwei Mao <maojianwei2020@gmail.com>
Reviewed-by: Damien Neil <dneil@google.com>
2022-08-27 05:42:03 +00:00
Paul E. Murphy
a0948493ac debug/elf: fix reloc number of R_PPC64_SECTOFF_LO_DS
R_PPC64_SECTOFF_LO_DS is defined as reloc 62 on all PPC64 ELF ABIs.

Fixes #53356

Change-Id: I5fabf6be32f3310c5aed47d4d654e05fb7bc9de0
Reviewed-on: https://go-review.googlesource.com/c/go/+/411915
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-27 02:36:28 +00:00
ianwoolf
333681d6a8 net: Resolver.LookupIP return error for empty string
Fixes #53995

Change-Id: Ib0de237b57382feb6b8070f2310945aef6c7db01
Reviewed-on: https://go-review.googlesource.com/c/go/+/419734
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Damien Neil <dneil@google.com>
2022-08-26 22:52:50 +00:00
cuiweixie
acabf87127 reflect: add Value.{Comparable,Equal}
For #46746

Change-Id: I879124974cdb55932cd9d07d3b384d49d5059857
Reviewed-on: https://go-review.googlesource.com/c/go/+/423794
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-08-26 20:56:48 +00:00
Lynn Boger
897ad2fe90 cmd/compile: fix score for Select{0,1} with type flags
A recent change was made for ppc64x to treat ANDCCconst as
a tuple, allowing ANDconst to be removed from the list
of ops. Included in that change were some improvements to the
rules to avoid some extra code, mainly the elimination of a
cmp 0 following an andi. and in some cases the following
isel. While those changes worked for most cases, in a few
cases some extra unnecessary code was generated.

Currently the snippet appears in archive/zip.(*FileHeader).Mode:

        ANDCC R4,$1,R5                       // andi. r5,r4,1
        ANDCC R4,$16,R5                      // andi. r5,r4,16
        CMPW R5,R0                           // cmpw r5,r0
        ADDIS $0,$-32768,R5                  // lis r5,-32768
        OR R5,$511,R5                        // ori r5,r5,511
        MOVD $438,R6                         // li r6,438
        ISEL $2,R6,R5,R5                     // isel r5,r6,r5,eq
        MOVD $-147,R6                        // li r6,-147
        AND R6,R5,R6                         // and r6,r5,r6
        ANDCC R4,$1,R4                       // andi. r4,r4,1
        ISEL $2,R5,R6,R4                     // isel r4,r5,r6,eq

The first ANDCC is never used and should not be there.
From the ssa.html file, the scheduler is not putting the Select1
close to the ISEL, which results in the flag being clobbered
before it can be used. By changing the score for a Select0 or Select1
with type Flags, the extra ANDCC does not occur.

Change-Id: I82f4bc7c02afb1c2b1c048dc6995e0b3f9363fb3
Reviewed-on: https://go-review.googlesource.com/c/go/+/424294
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Paul Murphy <murp@ibm.com>
2022-08-26 19:15:02 +00:00
cuiweixie
3d6ba27f4f net/http: don't panic on very large MaxBytesReaderLimit
Fixes #54408

Change-Id: I454199ae5bcd087b8fc4169b7622412105e71113
GitHub-Last-Rev: a33fe7e206
GitHub-Pull-Request: golang/go#54415
Reviewed-on: https://go-review.googlesource.com/c/go/+/423314
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: xie cui <523516579@qq.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: hopehook <hopehook@qq.com>
2022-08-26 18:17:27 +00:00
Archana R
9e810997c0 runtime: add address sanitizer support for ppc64le
updates #44853

Change-Id: I71905ee1bcb99ce7300bbed2daad3617d2643c53
Reviewed-on: https://go-review.googlesource.com/c/go/+/408814
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Archana Ravindar <aravind5@in.ibm.com>
2022-08-26 18:13:33 +00:00
Lynn Boger
62125c9b79 cmd/compile: remove branch in atomicCas{32,64} sequence on ppc64x.
This removes one of the branches in the atomicCas sequences for
ppc64/ppc64le.

Change-Id: Ibb46fbfdce052889c69e3da298f28caff540d99b
Reviewed-on: https://go-review.googlesource.com/c/go/+/422014
Reviewed-by: Archana Ravindar <aravind5@in.ibm.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Paul Murphy <murp@ibm.com>
2022-08-26 18:09:56 +00:00
Alex Studer
afd792feb5 net/http: mention io.Seeker requirement in FS documentation
Both FileServer and NewFileTransport can try to seek a file, specifically
when MIME type sniffing is performed. This can be somewhat surprising to an
implementer of an fs.FS, as their filesystem will appear to work until a
user tries to access a file with an unrecognized extension (which requires
type sniffing and therefore seeking). With FileServer, this results in a
"seeker can't seek" message, which is not very clear for the developer.

The issue arises because fs.FS does not require Seek, while http.FileSystem
does. Therefore, this change adds a line to the documentation of net/http's
adapter function mentioning the requirement.

Change-Id: Ieb955b7a7f34e2be39dd696cb712513c70100b3a
GitHub-Last-Rev: fddccdae36
GitHub-Pull-Request: golang/go#48781
Reviewed-on: https://go-review.googlesource.com/c/go/+/353874
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2022-08-26 18:05:21 +00:00
Akshay Shah
4d13aabdf6 net/http: add errors.As support for x/net/http2.StreamError
To make it easier to extract the HTTP/2 error code (if any) from
net/http errors, implement an As method on the vendored copy of
golang.org/x/net/http2.StreamError. The new As method lets users work
with the vendored error type as though it were the x/net/http2
StreamError.

Fixes #53896.

Change-Id: Ib18eb428adc05a3c0e19a946ece936e2378e1c7c
Reviewed-on: https://go-review.googlesource.com/c/go/+/425104
Run-TryBot: Damien Neil <dneil@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: David Chase <drchase@google.com>
2022-08-26 18:03:42 +00:00
Cuong Manh Le
bcd1ac7120 runtime: drop padding alignment field for timeHistogram
After CL 419449, timeHistogram always have 8-byte alignment.

Change-Id: I93145502bcafa1712b811b1a6d62da5d54d0db42
Reviewed-on: https://go-review.googlesource.com/c/go/+/425777
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2022-08-26 18:01:35 +00:00
Paschalis Tsilias
dba9323f76 mime: allow duplicate media type parameters with equivalent values
Fixes #48866

Change-Id: I2bd2c806e44eb4064b1fb9a6509d79cecbbef013
Reviewed-on: https://go-review.googlesource.com/c/go/+/363094
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Tim King <taking@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Damien Neil <dneil@google.com>
Reviewed-by: David Chase <drchase@google.com>
2022-08-26 17:58:37 +00:00
Andy Pan
296c40dbbe runtime: mark all methods of atomic types with go:nosplit
Atomic types may be used anywhere in the runtime,
so they must omit its usual stack overflow checks to avoid errors from stack splits.

Change-Id: Icb497334c860bcaa284a2d5a3edc47ee89844301
Reviewed-on: https://go-review.googlesource.com/c/go/+/425484
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
2022-08-26 17:48:20 +00:00
Andy Pan
c8bb3cff9e internal/poll: optimize the maximum amount of bytes that can be transferred by one splice(2) call
Fixes #40222

name                          old time/op    new time/op    delta
Splice/tcp-to-tcp/1024-4        5.16µs ± 1%    5.17µs ± 4%     ~     (p=0.481 n=10+10)
Splice/tcp-to-tcp/2048-4        5.46µs ± 2%    5.48µs ± 2%     ~     (p=0.617 n=10+10)
Splice/tcp-to-tcp/4096-4        6.07µs ± 3%    6.09µs ± 5%     ~     (p=0.927 n=10+10)
Splice/tcp-to-tcp/8192-4        7.07µs ± 5%    7.16µs ± 3%     ~     (p=0.324 n=10+10)
Splice/tcp-to-tcp/16384-4       8.82µs ±10%    8.83µs ±11%     ~     (p=1.000 n=10+10)
Splice/tcp-to-tcp/32768-4       12.3µs ±12%    12.7µs ± 4%     ~     (p=0.268 n=10+9)
Splice/tcp-to-tcp/65536-4       22.1µs ± 3%    22.0µs ± 3%     ~     (p=0.912 n=10+10)
Splice/tcp-to-tcp/131072-4      40.0µs ± 4%    39.9µs ± 4%     ~     (p=1.000 n=9+8)
Splice/tcp-to-tcp/262144-4      69.1µs ± 3%    67.9µs ± 2%   -1.67%  (p=0.010 n=9+10)
Splice/tcp-to-tcp/524288-4       128µs ± 3%     124µs ± 2%   -2.67%  (p=0.001 n=9+10)
Splice/tcp-to-tcp/1048576-4      242µs ± 3%     242µs ± 2%     ~     (p=0.912 n=10+10)
Splice/unix-to-tcp/1024-4       1.97µs ± 3%    1.96µs ± 2%     ~     (p=0.342 n=10+10)
Splice/unix-to-tcp/2048-4       2.19µs ± 2%    2.21µs ± 2%     ~     (p=0.150 n=9+10)
Splice/unix-to-tcp/4096-4       2.52µs ± 5%    2.50µs ± 1%     ~     (p=0.393 n=10+10)
Splice/unix-to-tcp/8192-4       3.27µs ± 4%    3.24µs ± 7%     ~     (p=0.968 n=9+10)
Splice/unix-to-tcp/16384-4      4.68µs ± 9%    4.79µs ± 8%     ~     (p=0.739 n=10+10)
Splice/unix-to-tcp/32768-4      7.82µs ±12%    7.76µs ±12%     ~     (p=0.912 n=10+10)
Splice/unix-to-tcp/65536-4      17.9µs ± 3%    17.3µs ±10%     ~     (p=0.661 n=9+10)
Splice/unix-to-tcp/131072-4     35.9µs ± 1%    31.3µs ± 4%  -12.88%  (p=0.000 n=10+9)
Splice/unix-to-tcp/262144-4     72.4µs ± 3%    55.4µs ± 2%  -23.55%  (p=0.000 n=10+10)
Splice/unix-to-tcp/524288-4      146µs ± 3%     113µs ± 1%  -22.87%  (p=0.000 n=9+9)
Splice/unix-to-tcp/1048576-4     288µs ± 3%     223µs ± 3%  -22.49%  (p=0.000 n=10+9)

name                          old speed      new speed      delta
Splice/tcp-to-tcp/1024-4       198MB/s ± 1%   198MB/s ± 4%     ~     (p=0.481 n=10+10)
Splice/tcp-to-tcp/2048-4       375MB/s ± 2%   374MB/s ± 2%     ~     (p=0.631 n=10+10)
Splice/tcp-to-tcp/4096-4       674MB/s ± 3%   673MB/s ± 5%     ~     (p=0.912 n=10+10)
Splice/tcp-to-tcp/8192-4      1.16GB/s ± 6%  1.15GB/s ± 3%     ~     (p=0.315 n=10+10)
Splice/tcp-to-tcp/16384-4     1.86GB/s ±10%  1.84GB/s ±13%     ~     (p=0.720 n=10+9)
Splice/tcp-to-tcp/32768-4     2.68GB/s ±13%  2.57GB/s ± 7%     ~     (p=0.165 n=10+10)
Splice/tcp-to-tcp/65536-4     2.97GB/s ± 3%  2.98GB/s ± 3%     ~     (p=0.912 n=10+10)
Splice/tcp-to-tcp/131072-4    3.28GB/s ± 4%  3.29GB/s ± 4%     ~     (p=1.000 n=9+8)
Splice/tcp-to-tcp/262144-4    3.80GB/s ± 3%  3.86GB/s ± 2%   +1.70%  (p=0.010 n=9+10)
Splice/tcp-to-tcp/524288-4    4.10GB/s ± 3%  4.21GB/s ± 2%   +2.74%  (p=0.001 n=9+10)
Splice/tcp-to-tcp/1048576-4   4.34GB/s ± 3%  4.33GB/s ± 2%     ~     (p=0.912 n=10+10)
Splice/unix-to-tcp/1024-4      519MB/s ± 3%   523MB/s ± 2%     ~     (p=0.353 n=10+10)
Splice/unix-to-tcp/2048-4      934MB/s ± 2%   926MB/s ± 2%     ~     (p=0.156 n=9+10)
Splice/unix-to-tcp/4096-4     1.63GB/s ± 5%  1.64GB/s ± 1%     ~     (p=0.393 n=10+10)
Splice/unix-to-tcp/8192-4     2.51GB/s ± 3%  2.53GB/s ± 7%     ~     (p=0.968 n=9+10)
Splice/unix-to-tcp/16384-4    3.52GB/s ± 8%  3.43GB/s ± 8%     ~     (p=0.739 n=10+10)
Splice/unix-to-tcp/32768-4    4.21GB/s ±14%  4.24GB/s ±13%     ~     (p=0.912 n=10+10)
Splice/unix-to-tcp/65536-4    3.65GB/s ± 5%  3.81GB/s ±11%     ~     (p=0.436 n=10+10)
Splice/unix-to-tcp/131072-4   3.65GB/s ± 1%  4.19GB/s ± 4%  +14.81%  (p=0.000 n=10+9)
Splice/unix-to-tcp/262144-4   3.62GB/s ± 3%  4.73GB/s ± 2%  +30.78%  (p=0.000 n=10+10)
Splice/unix-to-tcp/524288-4   3.59GB/s ± 3%  4.66GB/s ± 1%  +29.64%  (p=0.000 n=9+9)
Splice/unix-to-tcp/1048576-4  3.65GB/s ± 3%  4.70GB/s ± 3%  +29.01%  (p=0.000 n=10+9)

name                          old alloc/op   new alloc/op   delta
Splice/tcp-to-tcp/1024-4         0.00B          0.00B          ~     (all equal)
Splice/tcp-to-tcp/2048-4         0.00B          0.00B          ~     (all equal)
Splice/tcp-to-tcp/4096-4         0.00B          0.00B          ~     (all equal)
Splice/tcp-to-tcp/8192-4         0.00B          0.00B          ~     (all equal)
Splice/tcp-to-tcp/16384-4        0.00B          0.00B          ~     (all equal)
Splice/tcp-to-tcp/32768-4        0.00B          0.00B          ~     (all equal)
Splice/tcp-to-tcp/65536-4        0.00B          0.00B          ~     (all equal)
Splice/tcp-to-tcp/131072-4       0.00B          0.00B          ~     (all equal)
Splice/tcp-to-tcp/262144-4       0.00B          0.00B          ~     (all equal)
Splice/tcp-to-tcp/524288-4       0.00B          0.00B          ~     (all equal)
Splice/tcp-to-tcp/1048576-4      0.00B          0.00B          ~     (all equal)
Splice/unix-to-tcp/1024-4        0.00B          0.00B          ~     (all equal)
Splice/unix-to-tcp/2048-4        0.00B          0.00B          ~     (all equal)
Splice/unix-to-tcp/4096-4        0.00B          0.00B          ~     (all equal)
Splice/unix-to-tcp/8192-4        0.00B          0.00B          ~     (all equal)
Splice/unix-to-tcp/16384-4       0.00B          0.00B          ~     (all equal)
Splice/unix-to-tcp/32768-4       0.00B          0.00B          ~     (all equal)
Splice/unix-to-tcp/65536-4       0.00B          0.00B          ~     (all equal)
Splice/unix-to-tcp/131072-4      0.00B          0.00B          ~     (all equal)
Splice/unix-to-tcp/262144-4      0.00B          0.00B          ~     (all equal)
Splice/unix-to-tcp/524288-4      0.00B          0.00B          ~     (all equal)
Splice/unix-to-tcp/1048576-4     0.00B          0.00B          ~     (all equal)

name                          old allocs/op  new allocs/op  delta
Splice/tcp-to-tcp/1024-4          0.00           0.00          ~     (all equal)
Splice/tcp-to-tcp/2048-4          0.00           0.00          ~     (all equal)
Splice/tcp-to-tcp/4096-4          0.00           0.00          ~     (all equal)
Splice/tcp-to-tcp/8192-4          0.00           0.00          ~     (all equal)
Splice/tcp-to-tcp/16384-4         0.00           0.00          ~     (all equal)
Splice/tcp-to-tcp/32768-4         0.00           0.00          ~     (all equal)
Splice/tcp-to-tcp/65536-4         0.00           0.00          ~     (all equal)
Splice/tcp-to-tcp/131072-4        0.00           0.00          ~     (all equal)
Splice/tcp-to-tcp/262144-4        0.00           0.00          ~     (all equal)
Splice/tcp-to-tcp/524288-4        0.00           0.00          ~     (all equal)
Splice/tcp-to-tcp/1048576-4       0.00           0.00          ~     (all equal)
Splice/unix-to-tcp/1024-4         0.00           0.00          ~     (all equal)
Splice/unix-to-tcp/2048-4         0.00           0.00          ~     (all equal)
Splice/unix-to-tcp/4096-4         0.00           0.00          ~     (all equal)
Splice/unix-to-tcp/8192-4         0.00           0.00          ~     (all equal)
Splice/unix-to-tcp/16384-4        0.00           0.00          ~     (all equal)
Splice/unix-to-tcp/32768-4        0.00           0.00          ~     (all equal)
Splice/unix-to-tcp/65536-4        0.00           0.00          ~     (all equal)
Splice/unix-to-tcp/131072-4       0.00           0.00          ~     (all equal)
Splice/unix-to-tcp/262144-4       0.00           0.00          ~     (all equal)
Splice/unix-to-tcp/524288-4       0.00           0.00          ~     (all equal)
Splice/unix-to-tcp/1048576-4      0.00           0.00          ~     (all equal)

Change-Id: I899c1fdcb3f7b9997faf2b0d2336016a3f1fd3ea
Reviewed-on: https://go-review.googlesource.com/c/go/+/425051
Reviewed-by: David Chase <drchase@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>
2022-08-26 17:47:23 +00:00
Cuong Manh Le
a52f4952cb runtime: remove gcCPULimiterState padding for atomic fields alignment
assistTimePool and lastUpdate are now atomic.Int64, so they are
guaranteed to have 64-bit alignment, even on 32-bit platforms.

Change-Id: Ib6062a47c3a92d46d43899e1ae9d119e7f5b8bb0
Reviewed-on: https://go-review.googlesource.com/c/go/+/425460
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2022-08-26 17:46:00 +00:00
hopehook
78aef56062 cmd/go/internal/modload: convert atomicLoadPkgFlags.bits to atomic type
Change-Id: I9e59530953439dec6f4524c5a7adc75c98c12b8f
Reviewed-on: https://go-review.googlesource.com/c/go/+/425456
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
2022-08-26 17:45:20 +00:00
hopehook
48ecc152e4 cmd/go/internal/trace: convert traceStarted to atomic type
Change-Id: Ia4214a29775f1178273b9b7dc84c0420bfa968de
Reviewed-on: https://go-review.googlesource.com/c/go/+/425457
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-26 17:44:58 +00:00
Dan Kortschak
297e3de7a1 debug/macho: use saferio to read segment and section data
Avoid allocating large amounts of memory for corrupt input.

No test case because the problem can only happen for invalid data.
Let the fuzzer find cases like this.

Change-Id: Ib09d5fea54aabcb6941e541b42689222fba69632
Reviewed-on: https://go-review.googlesource.com/c/go/+/425303
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Dan Kortschak <dan@kortschak.io>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: hopehook <hopehook@qq.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-26 17:44:36 +00:00
Zeke Lu
6ba2674ddc cmd/go/internal/imports: include ToolTags in the Tags map
This fixes a regression introduced when the "race" mode tag was moved to
the ToolTags field in CL 358539.

Fixes #54468

Change-Id: I107771948a4fe9d743cc13d1c15f324212b08e03
GitHub-Last-Rev: d211e351ef
GitHub-Pull-Request: golang/go#54618
Reviewed-on: https://go-review.googlesource.com/c/go/+/425154
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-26 17:43:59 +00:00
Ludi Rehak
f50e47308d cmd/go/internal/par: change cacheEntry.done type to atomic.Bool
Change-Id: I95c941f83f74d57dfdd2d6803c9059691fb649b8
Reviewed-on: https://go-review.googlesource.com/c/go/+/422176
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: hopehook <hopehook@qq.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
2022-08-26 17:41:34 +00:00
ianwoolf
f1f9e45143 cmd/test2json: add signal handler
Updates #53563

Change-Id: I35a3fd56718e198f68cbf73075a78b2fbc66bd7d
Reviewed-on: https://go-review.googlesource.com/c/go/+/419295
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Ryan Schuster <shuey19831@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
2022-08-26 17:38:40 +00:00
Joe Tsai
bc1d0d8eb1 reflect: add Value.SetZero
The v.SetZero method is a faster equivalent of v.Set(Zero(v.Type())).

Performance:

	                     Direct         CachedZero     NewZero
	SetZero/Bool         2.20ns ± 0%    8.97ns ± 5%    11.4ns ± 1%
	SetZero/Int          3.08ns ± 1%    9.06ns ± 1%    11.5ns ± 0%
	SetZero/Uint         2.88ns ± 1%    9.04ns ± 1%    11.7ns ± 5%
	SetZero/Float        2.65ns ± 2%    9.05ns ± 1%    11.5ns ± 1%
	SetZero/Complex      2.68ns ± 3%    9.31ns ± 1%    11.7ns ± 1%
	SetZero/Array        6.69ns ± 4%    9.32ns ± 1%    11.8ns ± 1%
	SetZero/Chan         3.31ns ± 1%    6.19ns ± 1%    8.20ns ± 1%
	SetZero/Func         3.32ns ± 1%    6.20ns ± 0%    8.24ns ± 1%
	SetZero/Interface    2.66ns ± 1%    9.31ns ± 1%    11.8ns ± 1%
	SetZero/Map          3.31ns ± 1%    6.21ns ± 2%    8.19ns ± 1%
	SetZero/Pointer      3.30ns ± 1%    6.22ns ± 1%    8.17ns ± 1%
	SetZero/Slice        2.90ns ± 4%    9.13ns ± 1%    11.6ns ± 1%
	SetZero/String       3.11ns ± 1%    9.30ns ± 1%    11.8ns ± 2%
	SetZero/Struct       6.37ns ± 1%    9.18ns ± 4%    11.5ns ± 1%

where:

	* Direct is measuring Value.SetZero
	* CachedZero is measuring Value.Set with a cached Zero value
	* NewZero is measuring Value.Set with a new Zero value

Fixes #52376

Change-Id: I793ca723aa97627824c5f5b356b2da30c8e46d71
Reviewed-on: https://go-review.googlesource.com/c/go/+/411476
Auto-Submit: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Dan Kortschak <dan@kortschak.io>
2022-08-26 17:15:08 +00:00
Andy Pan
e0ec1d6770 runtime: convert forcegcstate.idle to internal atomic type
Note that this changes a few unsynchronized operations of forcegcstate.idle to synchronized operations.

Updates #53821

Change-Id: I041654cc84a188fad45e2df7abce3a434f9a1f15
Reviewed-on: https://go-review.googlesource.com/c/go/+/425361
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2022-08-26 16:35:29 +00:00