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

54013 Commits

Author SHA1 Message Date
cuiweixie
59ba97bf3b cmd/go: record the -buildmode flag in debug.BuildInfo
Fixes #53856

Change-Id: Ib533e9fbe063b74c81f6512464a4dac5e2af0ccc
GitHub-Last-Rev: c2ae8d6f75
GitHub-Pull-Request: golang/go#54218
Reviewed-on: https://go-review.googlesource.com/c/go/+/420937
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: xie cui <523516579@qq.com>
2022-09-09 20:25:35 +00:00
cui fliter
b244b89d56 net/http: convert allowQuerySemicolonsInUse to atomic type
For #53821

Change-Id: I135783bd5472011f6a74d2f5ee34ce96ff49ad2b
GitHub-Last-Rev: 4da2d67ff3
GitHub-Pull-Request: golang/go#54863
Reviewed-on: https://go-review.googlesource.com/c/go/+/428336
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
2022-09-09 18:42:57 +00:00
Cuong Manh Le
e509452727 sync: convert RWMutex.{readerCount,readerWait} to atomic type
Change-Id: I7fd9c0636cd00891f5cdf36c0f68f897772042f2
Reviewed-on: https://go-review.googlesource.com/c/go/+/429767
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2022-09-09 18:28:35 +00:00
Cuong Manh Le
9dd9174fa5 sync/atomic: reduce inlining cost for atomic types methods
The "&x.v" cost us 2 inline cost budget, causing extra inline cost for
the caller. By taking the fact that "v" is laid out in memory as the
first field of all atomic types, we can accessing it without addressing.

Discovering why attempting to convert sync.RWMutex.readerCount to atomic
type. RWMutex.RUnlock have the inline cost 75, with extra 7 inline cost
from Int32.Add causing it not inlinable anymore.

With this change, Int32.Add only has 5 inline cost budget, RWMutex can
use it while still be inlinable.

Change-Id: Iabe1d1bf53389b0b8b5f56b4611231b732fd9df5
Reviewed-on: https://go-review.googlesource.com/c/go/+/429766
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2022-09-09 18:21:40 +00:00
Tobias Klauser
e2f602003b internal/poll, syscall: convert writev to direct libc call on openbsd (except mips64)
Add and use a writev libc wrapper instead of using syscall(2).

Updates golang/go#36435

Change-Id: I3c67665388ac276d9ef36868e368e91efb92800e
Reviewed-on: https://go-review.googlesource.com/c/go/+/428776
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Joel Sing <joel@sing.id.au>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2022-09-09 16:24:04 +00:00
Tobias Klauser
600db8a514 runtime/race: also unmap memory if TestNonGoMemory fails
Change-Id: I7ea150e4896fc9b2e3a6dbdd9a1c2b651e74b844
Reviewed-on: https://go-review.googlesource.com/c/go/+/428778
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-09 15:36:26 +00:00
cui fliter
861885841d go/ast: use strings.Builder
Change-Id: I9c4c3ada3a8f5d8d198cc42a4afc06972ee00c61
GitHub-Last-Rev: 4ed80119e3
GitHub-Pull-Request: golang/go#54916
Reviewed-on: https://go-review.googlesource.com/c/go/+/428921
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-09 15:35:30 +00:00
Andy Pan
4f3246c6e9 internal/poll: drop redundant ENOSYS in CopyFileRange
Update CL 425881 and CL 428396

I browsed the source code related to copy_file_range in the kernel and found that the latest kernel may still return EXDEV errors in copy_file_range(2) due to certain cases, for details see: https://elixir.bootlin.com/linux/v5.19.7/source/fs/read_write.c#L1559, https://elixir.bootlin.com/linux/v5.19.7/source/fs/read_write.c#L1479, and
https://elixir.bootlin.com/linux/v5.19.7/source/fs/read_write.c#L1439.

Therefore, the EXDEV still needs to be kept, but the ENOSYS error can be safely removed.

Change-Id: I47026b8dd33f7ffc4de1306af6b67c7b4d2062d2
Reviewed-on: https://go-review.googlesource.com/c/go/+/428555
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Andy Pan <panjf2000@gmail.com>
2022-09-09 15:35:09 +00:00
Andy Pan
86477e507f os: add a test case of copying a file itself via io.Copy
Change-Id: Ib9746cb4f27625cb22620271b280d2da242b2fba
Reviewed-on: https://go-review.googlesource.com/c/go/+/428437
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: Andy Pan <panjf2000@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2022-09-09 15:34:46 +00:00
Kir Kolyshkin
bca17d16ca syscall: add CgroupFD support for ForkExec on Linux
Implement CLONE_INTO_CGROUP feature, allowing to put a child in a
specified cgroup in a clean and simple way. Note that the feature only
works for cgroup v2, and requires Linux kernel 5.7 or newer.

Using the feature requires a new syscall, clone3. Currently this is the
only reason to use clone3, but the code is structured in a way so that
other cases may be easily added in the future.

Add a test case.

While at it, try to simplify the syscall calling code in
forkAndExecInChild1, which became complicated over time because:

1. It was using either rawVforkSyscall or RawSyscall6 depending on
   whether CLONE_NEWUSER was set.

2. On Linux/s390, the first two arguments to clone(2) system call are
   swapped (which deserved a mention in Linux ABI hall of shame). It
   was worked around in rawVforkSyscall on s390, but had to be
   implemented via a switch/case when using RawSyscall6, making the code
   less clear.

Let's

 - modify rawVforkSyscall to have two arguments (which is also required
   for clone3);

 - remove the arguments workaround from s390 asm, instead implementing
   arguments swap in the caller (which still looks ugly but at least
   it's done once and is clearly documented now);

 - use rawVforkSyscall for all cases (since it is essentially similar to
   RawSyscall6, except for having less parameters, not returning r2, and
   saving/restoring the return address before/after syscall on 386 and
   amd64).

Updates #51246.

Change-Id: Ifcd418ebead9257177338ffbcccd0bdecb94474e
Reviewed-on: https://go-review.googlesource.com/c/go/+/417695
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: Kirill Kolyshkin <kolyshkin@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-09 15:34:16 +00:00
Tobias Klauser
f53b2111e4 syscall: use unsafe.Slice instead of unsafeheader package
Change-Id: I9de5aafb36d05bdc90bbdba516367eb2b200a7e0
Reviewed-on: https://go-review.googlesource.com/c/go/+/428777
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-09-09 15:30:06 +00:00
Abirdcfly
1b196988d4 cmd/go/internal/modload: use atomic.Pointer for Requirements.graph
Change-Id: Ie543e1b1df667cfaf3aafa4be727881461ee8b7d
GitHub-Last-Rev: ed993dbe24
GitHub-Pull-Request: golang/go#54888
Reviewed-on: https://go-review.googlesource.com/c/go/+/428716
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2022-09-09 15:30:04 +00:00
Daniel Martí
9a5574afe6 go/printer: reduce allocations to improve performance
First, we know that Go source files almost always weigh at least a few
kilobytes, so we can kickstart the output buffer to be a reasonable size
and reduce the initial number of incremental allocations and copies when
appending bytes or strings to output.

Second, in nodeSize we use a nested printer, but we don't actually need
its printed bytes - we only need to know how many bytes it prints.
For that reason, use a throwaway buffer: the part of our output buffer
between length and capacity, as we haven't used it yet.

Third, use a sync.Pool to reuse allocated printers.
The current API doesn't allow reusing printers,
and some programs like gofmt will print many files in sequence.

Those changes combined result in a modest reduction in allocations and
CPU usage. The benchmark uses testdata/parser.go, which has just over
two thousand lines of code, which is pretty standard size-wise.

We also split the Print benchmark to cover both a medium-sized ast.File
as well as a pretty small ast.Decl node. The latter is a somewhat common
scenario in gopls, which has code actions which alter small bits of the
AST and print them back out to rewrite only a few lines in a file.

	name          old time/op    new time/op     delta
	PrintFile-16    5.43ms ± 1%     4.85ms ± 3%  -10.68%  (p=0.000 n=9+10)
	PrintDecl-16    19.1µs ± 0%     18.5µs ± 1%   -3.04%  (p=0.000 n=10+10)

	name          old speed      new speed       delta
	PrintFile-16  9.56MB/s ± 1%  10.69MB/s ± 3%  +11.81%  (p=0.000 n=8+10)
	PrintDecl-16  1.67MB/s ± 0%   1.73MB/s ± 1%   +3.05%  (p=0.000 n=10+10)

	name          old alloc/op   new alloc/op    delta
	PrintFile-16     332kB ± 0%      107kB ± 2%  -67.87%  (p=0.000 n=10+10)
	PrintDecl-16    3.92kB ± 0%     3.28kB ± 0%  -16.38%  (p=0.000 n=10+10)

	name          old allocs/op  new allocs/op   delta
	PrintFile-16     3.45k ± 0%      2.42k ± 0%  -29.90%  (p=0.000 n=10+10)
	PrintDecl-16      56.0 ± 0%       46.0 ± 0%  -17.86%  (p=0.000 n=10+10)

Change-Id: I475a3babca77532b2d51888f49710f74763d81d2
Reviewed-on: https://go-review.googlesource.com/c/go/+/424924
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
2022-09-09 15:10:10 +00:00
Tobias Klauser
218294f11e internal/syscall/windows: use unsafe.Slice instead of unsafeheader package
Follow CL 428777.

Change-Id: I5ce49322e92c5d6539bb08248e3366187c30dcd8
Reviewed-on: https://go-review.googlesource.com/c/go/+/428780
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
2022-09-09 13:00:05 +00:00
hopehook
41089704dd all: transfer reflect.{SliceHeader, StringHeader} to unsafeheader.{Slice, String}
After we deprecated reflect.{SliceHeader, StringHeader}, it is recommended
to use unsafe.{Slice, String} to replace its work. However, the compiler
and linker cannot be migrated for the time being.

As a temporary strategy, using the "internal/unsafeheader" package like
other code is the most suitable choice at present.

For #53003.

Change-Id: I69d0ef72e2d95caabd0706bbb247a719d225c758
Reviewed-on: https://go-review.googlesource.com/c/go/+/429755
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: hopehook <hopehook@golangcn.org>
2022-09-09 01:59:25 +00:00
hopehook
d734203e39 reflect: deprecate SliceHeader and StringHeader
As discussed in CL 401434 there are substantial misuses of these in the
wild, and they are a potential source of unsafety even for code that
does not use them directly.

Since proposal #53003 has already been implemented, now is the right
time to deprecate reflect.{SliceHeader, StringHeader}.

For #53003.

Change-Id: I724cf46d4b22d2ed3cbf2b948e6aac5ee4bf0f6e
Reviewed-on: https://go-review.googlesource.com/c/go/+/428757
Run-TryBot: hopehook <hopehook@golangcn.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
2022-09-09 01:59:23 +00:00
Ian Lance Taylor
76c94eb706 cmd/asm/internal/asm: don't set testOut in testErrors
It's set but the output is never used.

Change-Id: I36ecb9c5f087a85289529907ede9f9bfc295d739
Reviewed-on: https://go-review.googlesource.com/c/go/+/428637
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
2022-09-09 01:04:57 +00:00
cui fliter
3c33c3b327 strconv: remove redundant type conversion
Change-Id: I25c8e8b701d6489f360fea30d09090826276b950
GitHub-Last-Rev: c2c8319dd5
GitHub-Pull-Request: golang/go#54924
Reviewed-on: https://go-review.googlesource.com/c/go/+/428976
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
2022-09-09 00:28:56 +00:00
Kir Kolyshkin
3585e9be67 os: fix wrong error msg from TestDoubleCloseError
When the type assertion fails, the test mistakenly prints the expected
(rather than the actual) type.

When the error string doesn't match, the text mistakenly prints the
original (rather than the converted) error (although there might not be
any difference in the output, the code looks wrong).

Fix both issues.

Change-Id: Ia7dd0632fc677f458fec25d899c46268a12f76e7
Reviewed-on: https://go-review.googlesource.com/c/go/+/428916
Run-TryBot: Ian Lance Taylor <iant@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>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2022-09-08 21:19:00 +00:00
Tobias Klauser
d75e91740a os: use unsafe.{Slice,StringData} instead of unsafeheader package
Change-Id: I213b078effa4b7049c44498d651de5b938e5404b
Reviewed-on: https://go-review.googlesource.com/c/go/+/428779
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: hopehook <hopehook@golangcn.org>
Run-TryBot: hopehook <hopehook@golangcn.org>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
2022-09-08 21:18:58 +00:00
Joe Tsai
e20106ac00 time: optimize FixedZone by caching unnamed zones by the hour
FixedZone is transitively called by Time.UnmarshalJSON or Time.UnmarshalText
for any RFC 3339 timestamp that is not in UTC.
This function is relatively slow since it allocates 3 times.

Given that RFC 3339 never has a zone name and most offsets are by the hour,
we can cache unnamed zones on hour offsets.
Caching a Location should be safe since it has no exported fields or methods
that can mutate the Location. It is functionally immutable.

The only way to observe that the Location was cached is either
by pointer comparison or by shallow copying the struct value.
Neither operation seems sensible to do with a *time.Location.

Performance:

	name           old time/op  new time/op  delta
	UnmarshalText  268ns ± 2%   182ns ± 1%  -32.01%  (p=0.000 n=10+10)

Change-Id: Iab5432f34bdbb485512bb8b5464e076c03fd106f
Reviewed-on: https://go-review.googlesource.com/c/go/+/425116
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Joseph Tsai <joetsai@digital-static.net>
Auto-Submit: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-09-08 21:18:53 +00:00
hopehook
a9a398220f all: use unsafe.{Slice, SliceData, String, StringData} to simplify code
Because most of these APIs are recently supported, we can only do some
advancement work as much as possible under the premise of compatibility.

For #54854.

Change-Id: Id15d11288bf23902570d54eaf2704a5264210b2e
Reviewed-on: https://go-review.googlesource.com/c/go/+/429115
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: hopehook <hopehook@golangcn.org>
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: Michael Knyszek <mknyszek@google.com>
2022-09-08 21:16:39 +00:00
Robert Griesemer
2c3187cd42 spec: describe slice-to-array conversions
For #46505.

Change-Id: I1a30fd895496befd16626afb48717ac837ed5778
Reviewed-on: https://go-review.googlesource.com/c/go/+/429315
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
2022-09-08 16:37:47 +00:00
Michael Anthony Knyszek
51c34e2f0b runtime: remove unused scanSize parameter to gcmarknewobject
This was left over from the old pacer, and never removed when the old
pacer was removed in Go 1.19.

Change-Id: I79e5f0420c6100c66bd06129a68f5bbab7c1ea8f
Reviewed-on: https://go-review.googlesource.com/c/go/+/429256
Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2022-09-08 16:06:04 +00:00
Michael Anthony Knyszek
2caaad942e runtime: use searchIdx in scavengeOne
This is an optimization that prevents N^2 behavior within a chunk, but
was accidentally skipped. There should be no functional change as a
result of this CL.

Fixes #54892.

Change-Id: I861967a2268699fdc3464bd41bc56618b5628e6b
Reviewed-on: https://go-review.googlesource.com/c/go/+/429255
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
2022-09-08 16:06:03 +00:00
Michael Anthony Knyszek
5a37965495 runtime: make mheap.pagesInUse an atomic.Uintptr
This change fixes an old TODO that made it a uint64 because it would
make alignment within mheap more complicated. Now that we don't have to
worry about it since we're using atomic types as much as possible,
switch to using a Uintptr. This likely will improve performance a tiny
bit on 32-bit platforms, but really it's mostly cleanup.

Change-Id: Ie705799a111ccad977fc1f43de8b50cf611be303
Reviewed-on: https://go-review.googlesource.com/c/go/+/429221
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
2022-09-08 16:06:01 +00:00
Michael Anthony Knyszek
e28cc362a8 runtime: remove alignment padding in mheap and pageAlloc
All subfields use atomic types to ensure alignment, so there's no more
need for these fields.

Change-Id: Iada4253f352a074073ce603f1f6b07cbd5b7c58a
Reviewed-on: https://go-review.googlesource.com/c/go/+/429220
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2022-09-08 16:06:00 +00:00
Michael Anthony Knyszek
1c59199c91 runtime: remove atomic store requirement on pageAlloc.chunks
pageAlloc.chunks used to require an atomic store when growing the heap
because the scavenger would look at the list without locking the heap
lock. However, the scavenger doesn't do that anymore, and it looks like
nothing really does at all.

This change updates the comment and makes the store non-atomic.

Change-Id: Ib452d147861060f9f6e74e2d98ee111cf89ce8f5
Reviewed-on: https://go-review.googlesource.com/c/go/+/429219
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2022-09-08 16:05:56 +00:00
Robert Griesemer
cd8aa40149 go/types, types2: implement slice-to-array conversions
For #46505.

Change-Id: I9bc9da5dd4b76cb2d8ff41390e1567678e72d88d
Reviewed-on: https://go-review.googlesource.com/c/go/+/428938
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-08 15:55:44 +00:00
cuiweixie
0e50bf0e40 database: convert Tx.done to atomic type
Change-Id: I9ec725009376f5865adedca6c159b14140dde097
Reviewed-on: https://go-review.googlesource.com/c/go/+/426086
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Daniel Theophanes <kardianos@gmail.com>
Run-TryBot: Daniel Theophanes <kardianos@gmail.com>
2022-09-08 15:52:57 +00:00
Michael Anthony Knyszek
d61ffe8b6c runtime: use atomic types in mspanset.go for alignment and type safety
Right now, span sets use a lot of unsafe.Pointer and naked atomics
operations. This change modifies it to use atomic types everywhere and
wraps any atomic.UnsafePointer in a type to improve type safety.

This change should functionally be a no-op.

Change-Id: I32e6c460faaf6ec41ab1163158f6da7938eef3de
Reviewed-on: https://go-review.googlesource.com/c/go/+/429218
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-08 15:48:37 +00:00
Lynn Boger
403f91c244 cmd/compile/internal: merge rules in PPC64.rules
This uses rulegen syntax which allows similar rules
to be combined, saving lines in the rules file.
The Lsh16x32 rule had an incorrect value and that was
fixed.

Change-Id: I637410e39d8554825076aca5ac24083ce05ab186
Reviewed-on: https://go-review.googlesource.com/c/go/+/429035
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2022-09-08 14:58:11 +00:00
cuiweixie
530a236974 runtime/pprof: use strings.Builder
Change-Id: I0407d96e2ba1376cc33fe91b52b6a8d7e81f59ae
Reviewed-on: https://go-review.googlesource.com/c/go/+/428277
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2022-09-08 14:57:47 +00:00
cuiweixie
e5ed2212a3 cmd/trace: use strings.Builder
Change-Id: I690dc517c08be4cd66439baad8b91f16622ff0d2
Reviewed-on: https://go-review.googlesource.com/c/go/+/428292
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-08 14:33:45 +00:00
cuiweixie
c263fa07b1 cmd/pack: use strings.Builder
Change-Id: I1c9f91e983fb26b3e46c65513a4f14508774e543
Reviewed-on: https://go-review.googlesource.com/c/go/+/428291
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: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-08 14:33:43 +00:00
cuiweixie
ab0d057e64 cmd/link: use strings.Builder
Change-Id: I5780c3f26302fd5cf21e4a1f0bc1777abb658c82
Reviewed-on: https://go-review.googlesource.com/c/go/+/428290
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
2022-09-08 14:33:41 +00:00
cuiweixie
9c147cc617 cmd/fix: use strings.Builder
Change-Id: I761766e147202970f82ce804dbaf5d491508995c
Reviewed-on: https://go-review.googlesource.com/c/go/+/428289
TryBot-Result: Gopher Robot <gobot@golang.org>
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: Michael Knyszek <mknyszek@google.com>
2022-09-08 14:33:39 +00:00
cuiweixie
866fbb67d0 cmd/dist: use strings.Builder
Change-Id: I56bd5d6b1333a96339340e5af5e6470cc7fb11a2
Reviewed-on: https://go-review.googlesource.com/c/go/+/428287
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2022-09-08 14:33:38 +00:00
cuiweixie
47faad111f cmd/cover: use strings.Builder
Change-Id: Ifb51cb4ed98a93742ce4b221137a0ad73b939b06
Reviewed-on: https://go-review.googlesource.com/c/go/+/428286
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-08 14:33:36 +00:00
cuiweixie
33628ce195 cmd/cgo: use strings.Builder
Change-Id: I427776e5b2d9c7279932548c86c8faded0eed041
Reviewed-on: https://go-review.googlesource.com/c/go/+/428285
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: xie cui <523516579@qq.com>
2022-09-08 14:33:35 +00:00
cuiweixie
cf4edac16e cmd/asm: use strings.Builder
Change-Id: I2ec419f475f9c5d5ef1d4557cb5862a55a699d9c
Reviewed-on: https://go-review.googlesource.com/c/go/+/428284
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-08 14:33:33 +00:00
cuiweixie
596b0d0410 cmd/api: use strings.Builder
Change-Id: I4e05b892373713365f60258f64b3de94382ad983
Reviewed-on: https://go-review.googlesource.com/c/go/+/428283
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: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2022-09-08 14:33:31 +00:00
Paul E. Murphy
2b6ff90851 debug/elf: define additional PPC64 ELFv2 relocations
The PPC64 ELFv2 supplement version 1.5 defines a handful of
new relocation types, similarly some were not added.

Fixes #54345

Change-Id: Id39b29d404298fca4a10ccf1e96b5964dc452c9e
Reviewed-on: https://go-review.googlesource.com/c/go/+/425555
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-08 13:31:46 +00:00
cuiweixie
51fdfeb1ce runtime/race: use strings.Builder
Change-Id: I644f696d00b5bce448e0a00835b3162f5203f346
Reviewed-on: https://go-review.googlesource.com/c/go/+/428278
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2022-09-08 13:27:43 +00:00
cuiweixie
2960431278 text/template: use strings.Builder
Change-Id: I559986b5408d3967c58c9abc6e8f4b04b25496a6
Reviewed-on: https://go-review.googlesource.com/c/go/+/428280
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Run-TryBot: Ian Lance Taylor <iant@google.com>
2022-09-08 10:48:29 +00:00
cui fliter
cdc6aeb673 internal: convert calls to atomic type
For #53821

Change-Id: Iee8ccea714726bbb6a4b384887bb107c29b823a9
GitHub-Last-Rev: 119aad3624
GitHub-Pull-Request: golang/go#54862
Reviewed-on: https://go-review.googlesource.com/c/go/+/428335
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Keith Randall <khr@google.com>
2022-09-07 20:54:43 +00:00
Paul E. Murphy
a50c434308 cmd/asm: improve argument to obj.Prog assignment on PPC64
These can be simplified with the knowledge of how arguments are
assigned to obj.Prog objects on PPC64. If the argument is not
a register type, the Reg argument (a2 in optab) of obj.Prog is
not used, and those arguments are placed into RestArgs (a3, a4, a5
in optab).

This relaxes the special case handling enforced by IsPPC64RLD and
IsPPC64ISEL. Instead, arguments are assigned as noted above, and
incorrect usage of such opcodes is checked by optab rules, not by
the assembler front-end.

Likewise, add support for handling 6 argument opcodes, these do
not exist today, but will be added with ISA 3.1 (Power10).

Finally, to maintain backwards compatibility, some 4-arg opcodes
whose middle arguments are a register and immediate, could swap
these arguments and generate identical machine code. This likely
wasn't intended, but is possible. These are explicitly fixed up
in the backend, and the asm tests are extended to check these.

Change-Id: I5f8190212427dfe8e6f062185bfefb5fa4fd0e75
Reviewed-on: https://go-review.googlesource.com/c/go/+/427516
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Paul Murphy <murp@ibm.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
2022-09-07 20:53:33 +00:00
Paul E. Murphy
85c0d26c6a cmd/asm,cmd/internal/obj/ppc64: recognize ppc64 ISA 3.1 MMA registers
Allow the assembler frontend to match MMA register arguments added by
ISA 3.1. The prefix "A" (for accumulator) is chosen to identify them.

Updates #44549

Change-Id: I363e7d1103aee19d7966829d2079c3d876621efc
Reviewed-on: https://go-review.googlesource.com/c/go/+/419534
Reviewed-by: Cherry Mui <cherryyz@google.com>
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: Michael Knyszek <mknyszek@google.com>
2022-09-07 20:53:19 +00:00
ruinan
454a058ffc cmd/compile: Add shiftIsBounded check for logic shifts of arm64
This CL adds shiftIsBounded checks for the Lsh* and Rsh* rules in arm64.
There is no need to check the shift value again with CMP + CSEL when the
shift value is valid.

Change-Id: I54620de64f02a1b5a11089add237248ae2de01b4
Reviewed-on: https://go-review.googlesource.com/c/go/+/417714
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2022-09-07 20:10:13 +00:00
Kir Kolyshkin
e828fbdffe os/exec: skip TestFindExecutableVsNoexec if mount failed
Apparently, some testing environments do not allow root to mount tmpfs
(due to e.g. AppArmor profile disallowing mount(2) syscall).

Always skip the test if the mount has failed.

Fixes the test issue introduced by CL 414824.

Change-Id: Ic565d2e6f277f2926d85a351be7df2498ffba656
Reviewed-on: https://go-review.googlesource.com/c/go/+/429175
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2022-09-07 18:41:21 +00:00