]> Cypherpunks.ru repositories - gostls13.git/log
gostls13.git
10 months agocmd/compile: intrinsify Sub64 on mips64
Junxian Zhu [Fri, 26 May 2023 05:33:45 +0000 (13:33 +0800)]
cmd/compile: intrinsify Sub64 on mips64

This CL intrinsify Sub64 on mips64.

pkg: math/bits
                  _   sec/op    _   sec/op     vs base               _
Sub-4               2.849n _ 0%   1.948n _ 0%  -31.64% (p=0.000 n=8)
Sub32-4             3.447n _ 0%   3.446n _ 0%        ~ (p=0.982 n=8)
Sub64-4             2.815n _ 0%   1.948n _ 0%  -30.78% (p=0.000 n=8)
Sub64multiple-4     6.124n _ 0%   3.340n _ 0%  -45.46% (p=0.000 n=8)

Change-Id: Ibba91a4350e4a549ae0b60d8cafc4bca05034b84
Reviewed-on: https://go-review.googlesource.com/c/go/+/498497
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Joel Sing <joel@sing.id.au>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
10 months agocmd/compile: intrinsify Add64 on mips64
Junxian Zhu [Fri, 26 May 2023 05:26:51 +0000 (13:26 +0800)]
cmd/compile: intrinsify Add64 on mips64

This CL intrinsify Add64 on mips64.

pkg: math/bits
                  _   sec/op    _   sec/op     vs base               _
Add64-4             2.783n _ 0%   1.950n _ 0%  -29.93% (p=0.000 n=8)
Add64multiple-4     5.713n _ 0%   3.063n _ 0%  -46.38% (p=0.000 n=8)

pkg: crypto/elliptic
                                     _    sec/op    _   sec/op     vs base               _
ScalarBaseMult/P256-4                   353.7_ _ 0%   282.7_ _ 0%  -20.09% (p=0.000 n=8)
ScalarBaseMult/P224-4                   330.5_ _ 0%   250.0_ _ 0%  -24.37% (p=0.000 n=8)
ScalarBaseMult/P384-4                  1228.8_ _ 0%   791.5_ _ 0%  -35.59% (p=0.000 n=8)
ScalarBaseMult/P521-4                  15.412m _ 0%   2.438m _ 0%  -84.18% (p=0.000 n=8)
ScalarMult/P256-4                      1189.4_ _ 0%   904.2_ _ 0%  -23.98% (p=0.000 n=8)
ScalarMult/P224-4                      1138.8_ _ 0%   813.8_ _ 0%  -28.54% (p=0.000 n=8)
ScalarMult/P384-4                       4.419m _ 0%   2.692m _ 0%  -39.08% (p=0.000 n=8)
ScalarMult/P521-4                      59.768m _ 0%   8.773m _ 0%  -85.32% (p=0.000 n=8)
MarshalUnmarshal/P256/Uncompressed-4    8.697_ _ 1%   7.923_ _ 1%   -8.91% (p=0.000 n=8)
MarshalUnmarshal/P256/Compressed-4     104.75_ _ 0%   66.29_ _ 0%  -36.72% (p=0.000 n=8)
MarshalUnmarshal/P224/Uncompressed-4    8.728_ _ 1%   7.823_ _ 1%  -10.37% (p=0.000 n=8)
MarshalUnmarshal/P224/Compressed-4     1035.7_ _ 0%   676.5_ _ 2%  -34.69% (p=0.000 n=8)
MarshalUnmarshal/P384/Uncompressed-4    15.32_ _ 1%   11.81_ _ 1%  -22.90% (p=0.000 n=8)
MarshalUnmarshal/P384/Compressed-4      399.8_ _ 0%   217.4_ _ 0%  -45.62% (p=0.000 n=8)
MarshalUnmarshal/P521/Uncompressed-4    96.79_ _ 0%   20.32_ _ 0%  -79.01% (p=0.000 n=8)
MarshalUnmarshal/P521/Compressed-4     6640.4_ _ 0%   790.8_ _ 0%  -88.09% (p=0.000 n=8)

Change-Id: I8a0960b9665720c1d3e57dce36386e74db37fefa
Reviewed-on: https://go-review.googlesource.com/c/go/+/498496
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Joel Sing <joel@sing.id.au>
Reviewed-by: Keith Randall <khr@golang.org>
10 months agoencoding/json: replace dead link in appendString
korzhao [Thu, 29 Jun 2023 12:09:40 +0000 (20:09 +0800)]
encoding/json: replace dead link in appendString

Change-Id: I534698008b46b23352d9f1fed891fd96dc0947b7
Reviewed-on: https://go-review.googlesource.com/c/go/+/507115
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Ian Lance Taylor <iant@google.com>
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>

10 months agocmd/dist: update isUnsupportedVMASize test skip
Dmitri Shuralyov [Fri, 21 Jul 2023 19:59:02 +0000 (15:59 -0400)]
cmd/dist: update isUnsupportedVMASize test skip

The dist test name changed from "race" to "flag:race", "net:race",
"os:race" and so on in CL 496181, we missed that this skip was checking
the exact dist test name, and no builder reported a problem despite the
skip becoming inactive.

I considered deleting it as obsolete, but it may still be helpful
if someone runs race.bash on a linux/arm64 machine configured with
something other than the supported 48-bit VMA. So for now apply a
simple change to restore the existing skip.

Hopefully one day there will be a good way to check for unsupported VMA
size and disable the race detector conditionally instead of relying on
tests running, failing, and getting marked as skipped in cmd/dist.

For #29948.
For #37486.

Change-Id: I8af6862c92fb0ee538ab27327d43c50921bd1873
Reviewed-on: https://go-review.googlesource.com/c/go/+/512116
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
10 months agocmd/dist: handle -json flag in runPending (clean up)
Dmitri Shuralyov [Fri, 21 Jul 2023 17:49:06 +0000 (13:49 -0400)]
cmd/dist: handle -json flag in runPending (clean up)

Document work fields a bit more, and move code that
synthesizes JSON-encoded skip events to testjson.go.

For #37486.
For #61557.

Change-Id: Iffc23cf990bc39696e1e3fce8ce5a6790fc44e78
Reviewed-on: https://go-review.googlesource.com/c/go/+/512115
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
10 months agosyscall, cmd/cgo: skip tests that shouldn't run under 'unshare -n -r'
Dmitri Shuralyov [Thu, 27 Jul 2023 23:36:55 +0000 (19:36 -0400)]
syscall, cmd/cgo: skip tests that shouldn't run under 'unshare -n -r'

A small number of tests in the main tree are currently skipped in LUCI
because our builders there run tests without root. Unfortunately, these
tests begin to run when run under 'unshare -n -r' as implemented in
the current iteration of a no-network check. Add targeted builder-only
skips so that they don't begin to run and fail with a false positive.

Updates #10719.
For #30612.

Change-Id: I6dd320714a279c395882c1b2ebfbb2fce58f913b
Reviewed-on: https://go-review.googlesource.com/c/go/+/513779
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

10 months agocmd/asm: add PCALIGN support on 386/amd64
Mauri de Souza Meneguzzo [Fri, 28 Jul 2023 19:10:04 +0000 (19:10 +0000)]
cmd/asm: add PCALIGN support on 386/amd64

The PCALIGN asm directive was not supported on 386/amd64,
causing a compile-time error when used. The same directive
is currently supported on arm64, loong64 and ppc64 architectures.

This has potential for noticeable performance improvements on
amd64 across multiple packages, I did a quick test aligning a hot
loop on bytes.IndexByte:

```
IndexByte/10-16                 3.477n ± ∞ ¹   3.462n ± ∞ ¹        ~ (p=0.198 n=5)
IndexByte/32-16                 4.675n ± ∞ ¹   4.834n ± ∞ ¹   +3.40% (p=0.008 n=5)
IndexByte/4K-16                 67.47n ± ∞ ¹   44.44n ± ∞ ¹  -34.13% (p=0.008 n=5)
IndexByte/4M-16                 61.98µ ± ∞ ¹   45.07µ ± ∞ ¹  -27.28% (p=0.008 n=5)
IndexByte/64M-16               1206.6µ ± ∞ ¹   940.9µ ± ∞ ¹  -22.02% (p=0.008 n=5)
IndexBytePortable/10-16         4.064n ± ∞ ¹   4.044n ± ∞ ¹        ~ (p=0.325 n=5)
IndexBytePortable/32-16         9.999n ± ∞ ¹   9.934n ± ∞ ¹        ~ (p=0.151 n=5)
IndexBytePortable/4K-16         975.8n ± ∞ ¹   965.5n ± ∞ ¹        ~ (p=0.151 n=5)
IndexBytePortable/4M-16         973.3µ ± ∞ ¹   972.3µ ± ∞ ¹        ~ (p=0.222 n=5)
IndexBytePortable/64M-16        15.68m ± ∞ ¹   15.89m ± ∞ ¹        ~ (p=0.310 n=5)
geomean                         1.478µ         1.342µ         -9.20%

IndexByte/10-16                2.678Gi ± ∞ ¹   2.690Gi ± ∞ ¹        ~ (p=0.151 n=5)
IndexByte/32-16                6.375Gi ± ∞ ¹   6.165Gi ± ∞ ¹   -3.30% (p=0.008 n=5)
IndexByte/4K-16                56.54Gi ± ∞ ¹   85.85Gi ± ∞ ¹  +51.83% (p=0.008 n=5)
IndexByte/4M-16                63.03Gi ± ∞ ¹   86.68Gi ± ∞ ¹  +37.52% (p=0.008 n=5)
IndexByte/64M-16               51.80Gi ± ∞ ¹   66.42Gi ± ∞ ¹  +28.23% (p=0.008 n=5)
IndexBytePortable/10-16        2.291Gi ± ∞ ¹   2.303Gi ± ∞ ¹        ~ (p=0.421 n=5)
IndexBytePortable/32-16        2.980Gi ± ∞ ¹   3.000Gi ± ∞ ¹        ~ (p=0.151 n=5)
IndexBytePortable/4K-16        3.909Gi ± ∞ ¹   3.951Gi ± ∞ ¹        ~ (p=0.151 n=5)
IndexBytePortable/4M-16        4.013Gi ± ∞ ¹   4.017Gi ± ∞ ¹        ~ (p=0.222 n=5)
IndexBytePortable/64M-16       3.987Gi ± ∞ ¹   3.933Gi ± ∞ ¹        ~ (p=0.310 n=5)
geomean                        8.183Gi         9.013Gi        +10.14%
```

Fixes #56474

Change-Id: Idea022b1a16e6d4b8dd778723adb862c46602c4f
GitHub-Last-Rev: 2eb7e31dc378a02fd83faa7d41239df0f2859677
GitHub-Pull-Request: golang/go#61516
Reviewed-on: https://go-review.googlesource.com/c/go/+/511662
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>

10 months agosyscall: skip TestUnshare if there's nothing more to unshare
Dmitri Shuralyov [Fri, 28 Jul 2023 16:34:30 +0000 (12:34 -0400)]
syscall: skip TestUnshare if there's nothing more to unshare

Tests that need to use the internet are expected not to run when -short
test flag is set, and the Go build system automatically catches when a
test forgets that. It does this by unsharing all real network interfaces
and leaving only a loopback interface in a new network namespace.

TestUnshare tests that a process started with CLONE_NEWNET unshare flag
has fewer network interfaces than before. Of course, if /proc/net/dev
starts out with a single loopback interface, the test would fail with
a false positive:

=== RUN TestUnshare
exec_linux_test.go:139: Got 3 lines of output, want <3
--- FAIL: TestUnshare (0.00s)

Give the test what it wants: a skip when the environment doesn't meet
the minimum requirements for the test, and more useful log output if
it fails.

Change-Id: I6b9c29d88ce725e640a7ee86c7e1be9761f21b02
Reviewed-on: https://go-review.googlesource.com/c/go/+/513762
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>

10 months agocmd/internal/goobj: use unsafe.String in toString func
Jes Cok [Sat, 1 Jul 2023 14:01:23 +0000 (14:01 +0000)]
cmd/internal/goobj: use unsafe.String in toString func

Change-Id: I93a5e0996e48cc74e6b2e39c3a4c7aa68fd6a3a0
GitHub-Last-Rev: afd8feb0deac34f671e0ed11ad55f6be427bd8b1
GitHub-Pull-Request: golang/go#61137
Reviewed-on: https://go-review.googlesource.com/c/go/+/507517
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
10 months agocmd/dist: handle -json flag in runPending (minimal)
Dmitri Shuralyov [Fri, 21 Jul 2023 17:49:06 +0000 (13:49 -0400)]
cmd/dist: handle -json flag in runPending (minimal)

The -json flag is new to Go 1.21, but missed skips in runPending.
This CL adds minimal code to fix that. CL 512115 cleans up a bit.

For #37486.
Fixes (via backport) #61557.

Change-Id: I53e426c9a5585b2703f0ff6661a0470e1993f960
Reviewed-on: https://go-review.googlesource.com/c/go/+/512719
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Austin Clements <austin@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>

10 months agonet/http: perform streaming body feature detection once per process
Dmitri Shuralyov [Sun, 23 Jul 2023 18:19:57 +0000 (14:19 -0400)]
net/http: perform streaming body feature detection once per process

As far a I can tell, there's currently no situation where this feature
detection will report a different result per request, so default to
doing once per process until there's evidence that doing it more often
is worthwhile.

Change-Id: I567d3dbd847af2f49f2e83cd9eb0ae61d82c1f83
Reviewed-on: https://go-review.googlesource.com/c/go/+/513459
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
10 months agomath: support to handle huge arguments in tan function on s390x
root [Thu, 23 Feb 2023 06:44:23 +0000 (06:44 +0000)]
math: support to handle huge arguments in tan function on s390x

Currently on s390x, tan assembly implementation is not handling huge arguments at all. This change is to check for large arguments and revert back to native go implantation from assembly code in case of huge arguments.

The changes are implemented in assembly code to get better performance over native go implementation.

Benchmark details of tan function with table driven inputs are updated as part of the issue link.

Fixes #37854

Change-Id: I4e5321e65c27b7ce8c497fc9d3991ca8604753d2
Reviewed-on: https://go-review.googlesource.com/c/go/+/470595
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Keith Randall <khr@golang.org>

10 months agoreflect: deprecate PtrTo
qiulaidongfeng [Wed, 26 Jul 2023 05:59:50 +0000 (05:59 +0000)]
reflect: deprecate PtrTo

Replace reflect.PtrTo with reflect.PointerTo.

Fixes #59599

Change-Id: I49407193e2050543ef983cd637703acc682d9f51

Change-Id: I49407193e2050543ef983cd637703acc682d9f51
GitHub-Last-Rev: 7bc9ccf1dcb4b444406430b451ad4c47c6ec1be2
GitHub-Pull-Request: golang/go#61440
Reviewed-on: https://go-review.googlesource.com/c/go/+/511035
Run-TryBot: Ian Lance Taylor <iant@golang.org>
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: Keith Randall <khr@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
10 months agoruntime: call miniterrno on m0 on AIX and Solaris
Ian Lance Taylor [Wed, 26 Jul 2023 18:58:44 +0000 (11:58 -0700)]
runtime: call miniterrno on m0 on AIX and Solaris

AIX and Solaris call into libc for syscalls, and expect M.mOS.perrno
to point to the thread-local errno value for the current M.
We initialize that field in miniterrno called from mstart.
However, this means that any libc calls before mstart will not
return the correct errno value.

This caused trouble in checkfds, which runs very early, before mstart.
We worked around that in 513215. This CL reverts 513215 in favor
of a better workaround: call miniterrno for m0 earlier (we will
still wind up calling miniterrno again from mstart, which does
no harm).

This is a better workaround because it means that if we add future
syscalls before mstart, they will behave as expected.

Fixes #61584

Change-Id: Ib6a0d3c53d2c8214cc339a5019f9d4f71a746f0c
Reviewed-on: https://go-review.googlesource.com/c/go/+/513535
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: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>

10 months agonet: make mustHaveExternalNetwork work as usual on GOOS=linux
Dmitri Shuralyov [Tue, 25 Jul 2023 17:58:37 +0000 (13:58 -0400)]
net: make mustHaveExternalNetwork work as usual on GOOS=linux

I considered deleting mustHaveExternalNetwork in favor of just using
the real testenv.MustHaveExternalNetwork. That certainly makes these
tests that call it easier to understand. But that negatively affects
some ports that don't have a longtest builder as it'd make the tests
not run automatically on any builder at all.

So, make a minimal change that applies only to GOOS=linux for now.
If we make more progress on establishing -longtest builders for all
ports, this intermediate layer helper will cease to have any benefit
and can be deleted in favor of the one in testenv package.

Change-Id: Iaea207d98e780db429ab49e6e227650a8b35b786
Reviewed-on: https://go-review.googlesource.com/c/go/+/513416
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>

10 months agoall: use built-in clear to clear maps
Jes Cok [Tue, 25 Jul 2023 23:10:34 +0000 (23:10 +0000)]
all: use built-in clear to clear maps

Change-Id: I7f4ac72fe3230d8b7486fab0c925015cefcbe355
GitHub-Last-Rev: 54455839b674f980fb6c3afceb433db4833d340e
GitHub-Pull-Request: golang/go#61544
Reviewed-on: https://go-review.googlesource.com/c/go/+/512376
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Bryan Mills <bcmills@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>

10 months agocmd/link: sort HOSTOBJ and UNDEFEXT symbols with undefined symbols in Mach-O symbol...
Cherry Mui [Wed, 14 Jun 2023 22:31:44 +0000 (18:31 -0400)]
cmd/link: sort HOSTOBJ and UNDEFEXT symbols with undefined symbols in Mach-O symbol table

HOSTOBJ and UNDEFEXT symbols are actually not defined in the
current translation unit. So put them as undefined symbols, along
with DYNIMPORT.

For #61229.

Change-Id: I1112ca928cdc401bac45adaa3f88b19422813960
Reviewed-on: https://go-review.googlesource.com/c/go/+/503539
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
10 months agocmd/cgo/internal/test: don't pass -lm on darwin
Cherry Mui [Mon, 10 Jul 2023 23:04:57 +0000 (19:04 -0400)]
cmd/cgo/internal/test: don't pass -lm on darwin

On darwin, -lm is not necessary as the math functions are included
in libSystem. Passing -lm multiple times results in linker
warnings. Don't pass it on darwin.

For #61229.

Change-Id: I72d8dab1f0eead68cbeb176ac97b8ed1a0cfddab
Reviewed-on: https://go-review.googlesource.com/c/go/+/508697
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
10 months agocmd/link: don't generate DYSYMTAB when external linking on Mach-O
Cherry Mui [Mon, 12 Jun 2023 17:46:08 +0000 (13:46 -0400)]
cmd/link: don't generate DYSYMTAB when external linking on Mach-O

When external linking, the external linker will generate it.

Updates #60694.
For #61229.

Change-Id: I086a7628dd9baa84b46315641746fc3640473f2b
Reviewed-on: https://go-review.googlesource.com/c/go/+/502617
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

10 months agocmd/asm/internal/asm: fix comment grammar
Jes Cok [Fri, 30 Jun 2023 23:23:03 +0000 (23:23 +0000)]
cmd/asm/internal/asm: fix comment grammar

Change-Id: I6fc0ae765c347669d1b061de018eb97d8e43461c
GitHub-Last-Rev: 9e6c1f1f97c2c7edcc1dddd58db6d4d7bff57f1c
GitHub-Pull-Request: golang/go#61131
Reviewed-on: https://go-review.googlesource.com/c/go/+/507515
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Joedian Reid <joedian@golang.org>
10 months agosrc/buildall.bash: mention no longer being used by Go build system
Dmitri Shuralyov [Thu, 27 Jul 2023 17:03:58 +0000 (13:03 -0400)]
src/buildall.bash: mention no longer being used by Go build system

The buildall.bash script was initially added in 2015 (in CL 9438),
documented as used in the implementation of the new compile-only
builders at the time.

That description was updated as the builder implementation changed
from "linux-amd64-compilesmoke" to "all-compile" and most recently
to "misc-compile", which it still mentions today.

The build system stopped using it in CL 464955 and there are no plans
to use it again in the future, so update the description so that it's
not misleading. Notably, adding additional checks to this script does
not mean they will be caught by builders.

Updates #31916.
Updates #58163.

Change-Id: I17558b1c150a3ad95105de14511c51791287991b
Reviewed-on: https://go-review.googlesource.com/c/go/+/513755
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

10 months agocmd/dist: skip testing packages without tests in short test mode
Dmitri Shuralyov [Wed, 14 Jun 2023 00:14:26 +0000 (20:14 -0400)]
cmd/dist: skip testing packages without tests in short test mode

For short all.bash, we can keep the small speedup of 2-10 seconds by
skipping 'go test' on packages without tests. This is viable without
coverage loss since the Go release process is guaranteed to run long
tests for all first class ports.

For golang/go#60463.

Change-Id: Ib5a6bd357d757141bc8f1c1dec148a6565726587
Reviewed-on: https://go-review.googlesource.com/c/go/+/503115
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
10 months agocmd/dist: test all 'std cmd' packages, even ones without _test.go files
Dmitri Shuralyov [Tue, 13 Jun 2023 20:04:06 +0000 (16:04 -0400)]
cmd/dist: test all 'std cmd' packages, even ones without _test.go files

Remove the optimization added in CL 10492 that skips running 'go test'
on Go packages without _test.go files. By now, 'go test' can find real
problems even in packages that don't have any custom tests.

On my fairly fast laptop, running go test -short on all 164 normal
and 96 vendored packages without tests took around 10 seconds on
the first run and 2.5 seconds on the second, a small fraction of
the total all.bash time. So prioritize gains in the test coverage
over those savings in all.bash time.

Fixes golang/go#60463.

Change-Id: I3d2bec5c367de687e57131e7fd7e6b84fed30187
Reviewed-on: https://go-review.googlesource.com/c/go/+/503095
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
10 months agocmd/asm: add the fifth argument of the instruction to Optab on arm64
erifan01 [Tue, 6 Jun 2023 09:55:58 +0000 (17:55 +0800)]
cmd/asm: add the fifth argument of the instruction to Optab on arm64

Currently the Optab structure contains four arguments of an instruction,
excludes the fifth argument p.RegTo2. It does not participate in
instruction matching and is usually handled separately.

Instructions with five operands are common in the newer arm instruction
set, so this CL adds the fifth argument to Optab, so that instruction
matching is easier. This caused the oplook function also needs to be
updated synchronously, this CL also made some cleaning and modifications
to this function.

Change-Id: I1d95ad99e72a44dfad1e00db182cfc369a0e55c6
Reviewed-on: https://go-review.googlesource.com/c/go/+/505975
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Eric Fang <eric.fang@arm.com>

10 months agomaps: remove Keys and Values
Ian Lance Taylor [Wed, 26 Jul 2023 18:08:03 +0000 (11:08 -0700)]
maps: remove Keys and Values

Preserve the names in case we want them to return an iterator.
Keep the efficient runtime implementations for now,
as we will probably want them under some name, perhaps KeysSlice
and ValuesSlice.

Fixes #61538

Change-Id: I6b03010bf071fb4531cb2f967dad46425962fcb8
Reviewed-on: https://go-review.googlesource.com/c/go/+/513476
Run-TryBot: Ian Lance Taylor <iant@golang.org>
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: Russ Cox <rsc@golang.org>
10 months agocmd/distpack: sort files in standard walk order
Russ Cox [Fri, 21 Jul 2023 17:31:10 +0000 (13:31 -0400)]
cmd/distpack: sort files in standard walk order

The code was sorting files in the archives entirely by path string,
but that's not what fs.WalkDir would do. In a directory with
subdirectory foo/bar and file foo/bar.go, foo/bar gets visited
first, so foo/bar/baz appears before foo/bar.go, even though
"foo/bar/baz" > "foo/bar.go".

This CL replaces the string comparison with a path-aware
comparison that places foo/bar/baz before foo/bar.go,
so that if the tar file is extracted and then repacked using
fs.WalkDir, the files will remain in the same order.

This will make it easier to compare the pristine distpack-produced
tgz for darwin against the rebuilt tgz with signed binaries.

Before:
% tar tzvf /tmp/cmddist.tgz | grep -C1 runtime/cgo.go
-rw-r--r--  0 0      0       11122 Jul 13 15:00 go/src/runtime/callers_test.go
-rw-r--r--  0 0      0        2416 Jul 13 15:00 go/src/runtime/cgo.go
-rw-r--r--  0 0      0        2795 Jul 13 15:00 go/src/runtime/cgo/abi_amd64.h

After:
% tar tzvf pkg/distpack/go1.21rsc.src.tar.gz | grep -C1 runtime/cgo.go
-rw-r--r--  0 0      0        1848 Dec 31  1969 go/src/runtime/cgo/signal_ios_arm64.s
-rw-r--r--  0 0      0        2416 Dec 31  1969 go/src/runtime/cgo.go
-rw-r--r--  0 0      0        2479 Dec 31  1969 go/src/runtime/cgo_mmap.go

For #24904.
For #61513.

Change-Id: Ib7374bc0d6324377f81c561bef57fd87b2111b98
Reviewed-on: https://go-review.googlesource.com/c/go/+/511977
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

10 months agocmd/compile: update README for unified IR
Keith Randall [Wed, 26 Jul 2023 18:01:29 +0000 (11:01 -0700)]
cmd/compile: update README for unified IR

Change-Id: Ie84e88db4b84f04f2c6f7750a2a413ecad6d817a
Reviewed-on: https://go-review.googlesource.com/c/go/+/513436
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Bypass: Keith Randall <khr@google.com>

10 months agocmd/compile: add indexed SET* opcodes for amd64
Keith Randall [Mon, 17 Jul 2023 17:21:07 +0000 (10:21 -0700)]
cmd/compile: add indexed SET* opcodes for amd64

Update #61356

Change-Id: I391af98563b1c068208784c80ea736c78c29639d
Reviewed-on: https://go-review.googlesource.com/c/go/+/510435
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Martin Möhrmann <martin@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Martin Möhrmann <moehrmann@google.com>
10 months agocmd/compile: get rid of special case in scheduler for entry block
Keith Randall [Fri, 14 Jul 2023 16:45:31 +0000 (09:45 -0700)]
cmd/compile: get rid of special case in scheduler for entry block

It isn't needed.

Fixes #61356

Change-Id: Ib466a3eac90c3ea57888cf40c294513033fc6118
Reviewed-on: https://go-review.googlesource.com/c/go/+/509856
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Keith Randall <khr@golang.org>

10 months agocmd/compile: simplify uninterruptable range check for write barriers
Keith Randall [Tue, 30 May 2023 17:19:50 +0000 (10:19 -0700)]
cmd/compile: simplify uninterruptable range check for write barriers

Make the load detection a bit clearer and more precise. In particular,
for architectures which have to materialize the address using a
separate instruction, we were using the address materialization
instruction, not the load itself.

Also apply the marking a bit less. We don't need to mark the load itself,
only the instructions after the load. And we don't need to mark the WBend
itself, only the instructions before it.

Change-Id: Ie367a8023b003d5317b752d873bb385f931bb30e
Reviewed-on: https://go-review.googlesource.com/c/go/+/499395
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
10 months agocmd/compile: optimize s==s for strings
Keith Randall [Thu, 15 Jun 2023 16:14:12 +0000 (09:14 -0700)]
cmd/compile: optimize s==s for strings

s==s is always true for strings. This comes up in NaN testing in
generic code, where we want x==x to compile completely away except for
float types.

Fixes #60777

Change-Id: I3ce054b5121354de2f9751b010fb409f148cb637
Reviewed-on: https://go-review.googlesource.com/c/go/+/503795
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>

10 months agoos: remove 5ms sleep on Windows in (*Process).Wait
qmuntal [Thu, 13 Jul 2023 14:40:49 +0000 (16:40 +0200)]
os: remove 5ms sleep on Windows in (*Process).Wait

The 5ms sleep in (*Process).Wait was added to mitigate errors while
removing executable files using os.RemoveAll.

Windows 10 1903 implements POSIX semantics for DeleteFile, making the
implementation of os.RemoveAll on Windows much more robust. Older
Windows 10 versions also made internal improvements to avoid errors
when removing files, making it less likely that the 5ms sleep is
necessary.

Windows 10 is the oldest version that Go supports (see #57004), so it
makes sense to unconditionally remove the 5ms sleep now. We have all
the Go 1.22 development cycle to see if this causes any regression.

Fixes #25965

Change-Id: Ie0bbe6dc3e8389fd51a32484d5d20cf59b019451
Reviewed-on: https://go-review.googlesource.com/c/go/+/509335
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

10 months agomisc/wasm: switch default WASI runtime
Johan Brandhorst-Satzkorn [Tue, 25 Jul 2023 22:54:16 +0000 (15:54 -0700)]
misc/wasm: switch default WASI runtime

The default WASI runtime was originally set to Wazero, because it was
the first runtime used to test the Go implementation and because we
could easily find and fix issues in our implementation and theirs.

In CL 498675 we switched the default wasip1 runner to Wasmtime as it
runs faster and is a more established and mature runtime. We should
switch the default runtime to Wasmtime to consistently promote
Wasmtime as the primary tested and approved runtime.

Change-Id: Ic6c064142321af90f015e02b7fe0e71444d8842c
Reviewed-on: https://go-review.googlesource.com/c/go/+/513235
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Eli Bendersky <eliben@google.com>
Run-TryBot: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Auto-Submit: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
10 months agocmd/internal/obj/arm64: factor out splitting of 24 bit unsigned scaled immediates
Joel Sing [Fri, 28 Apr 2023 20:07:42 +0000 (06:07 +1000)]
cmd/internal/obj/arm64: factor out splitting of 24 bit unsigned scaled immediates

Rather than duplicating this code, factor it out into a function and
add test coverage.

Change-Id: I37ce568ded4659d98a4ff1361520c5fb2207e947
Reviewed-on: https://go-review.googlesource.com/c/go/+/512537
Run-TryBot: Joel Sing <joel@sing.id.au>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
10 months agocmd/internal/obj/arm64: simplify buildop
Joel Sing [Wed, 3 May 2023 08:19:30 +0000 (18:19 +1000)]
cmd/internal/obj/arm64: simplify buildop

This code stems from the original 7l C code, where one way to determine
the end of a table is to put a sentinel entry, then scan for it. This is
now Go code and the length of an array is readily available.

Remove the sentinel and sentinel scan, then adjust the remaining code to
work accordingly.

Change-Id: I8964c787f5149f3548fa78bf8923aa7a93f9482e
Reviewed-on: https://go-review.googlesource.com/c/go/+/512536
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Joel Sing <joel@sing.id.au>

10 months agoencoding/base32: reduce overflow risk when calc encode/decode len
chanxuehong [Mon, 24 Jul 2023 08:58:16 +0000 (08:58 +0000)]
encoding/base32: reduce overflow risk when calc encode/decode len

Same as https://go-review.googlesource.com/c/go/+/510635, reduces risk of overflow

Change-Id: I18f5560d73af76c3e853464a89ad7e42dbbd5894
GitHub-Last-Rev: 652c8c6712886184e59a110c3fa1e6dcb643d93b
GitHub-Pull-Request: golang/go#61547
Reviewed-on: https://go-review.googlesource.com/c/go/+/512200
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
10 months agoos/exec: avoid calling LookPath in cmd.Start for resolved paths
qiulaidongfeng [Tue, 25 Jul 2023 01:19:30 +0000 (01:19 +0000)]
os/exec: avoid calling LookPath in cmd.Start for resolved paths

Follow up on CL 511458, see https://go-review.googlesource.com/c/go/+/511458/2..4/src/cmd/go/main.go#b270 .

For #36768.

Change-Id: Icc2a4dbb1219b1d69dd10a900478957b0e975847

Change-Id: Icc2a4dbb1219b1d69dd10a900478957b0e975847
GitHub-Last-Rev: bac7e66496806d505270c5b90d53672d80a1ca29
GitHub-Pull-Request: golang/go#61517
Reviewed-on: https://go-review.googlesource.com/c/go/+/512155
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>

10 months agospec: update section on type unification for Go 1.21
Robert Griesemer [Fri, 30 Jun 2023 21:54:34 +0000 (14:54 -0700)]
spec: update section on type unification for Go 1.21

This leaves the specific unification details out in favor
of a (forthcoming) section in an appendix.

Change-Id: If984c48bdf71c278e1a2759f9a18c51ef58df999
Reviewed-on: https://go-review.googlesource.com/c/go/+/507417
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Bypass: Robert Griesemer <gri@google.com>

10 months agoruntime2: don't check fcntl errno in checkfds on AIX and Solaris
Ian Lance Taylor [Tue, 25 Jul 2023 22:14:03 +0000 (15:14 -0700)]
runtime2: don't check fcntl errno in checkfds on AIX and Solaris

On AIX and Solaris the errno value is fetched using m.mOS.perrno.
When checkfds is called, that value has not yet been set up by minit.
Since the error value doesn't really matter in checkfds,
don't bother to check it on AIX and Solaris.

Fixes #61584

Change-Id: I4e679ee3fdad4f0b833ae102597b2d6b8cb46cb6
Reviewed-on: https://go-review.googlesource.com/c/go/+/513215
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>

10 months agocmd/dist: fix broken link in README
Dmitri Shuralyov [Mon, 24 Jul 2023 14:26:10 +0000 (10:26 -0400)]
cmd/dist: fix broken link in README

While here, also update the go15bootstrap link to use the
shorter go.dev domain and https:// prefix for consistency.

For #54265.

Change-Id: I881eeda235589511a93bf47186f91f6c47c12932
Reviewed-on: https://go-review.googlesource.com/c/go/+/512720
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
10 months agocmd/compile/internal/base: add comma in comment for consistency
Jes Cok [Sat, 22 Jul 2023 10:43:45 +0000 (10:43 +0000)]
cmd/compile/internal/base: add comma in comment for consistency

Change-Id: I9e2ca7eee50f1a642ae2c7468d0a4ea931cbd33e
GitHub-Last-Rev: 93fabec69c861bbecf29df8c2c71bc3286d50b32
GitHub-Pull-Request: golang/go#61523
Reviewed-on: https://go-review.googlesource.com/c/go/+/512195
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

10 months agoruntime: enforce standard file descriptors open on init on unix
Roland Shoemaker [Wed, 12 Jul 2023 21:01:26 +0000 (14:01 -0700)]
runtime: enforce standard file descriptors open on init on unix

On Unix-like platforms, enforce that the standard file descriptions (0,
1, 2) are always open during initialization. If any of the FDs are
closed, we open them pointing at /dev/null, or fail.

Fixes #60641

Change-Id: Iaab6b3f3e5ca44006ae3ba3544d47da9a613f58f
Reviewed-on: https://go-review.googlesource.com/c/go/+/509020
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: Roland Shoemaker <roland@golang.org>
Auto-Submit: Roland Shoemaker <roland@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

10 months agosort: add gen_sort_variants support for x/exp/slices
Ian Lance Taylor [Fri, 21 Jul 2023 19:50:48 +0000 (12:50 -0700)]
sort: add gen_sort_variants support for x/exp/slices

Also add a go:generate command to the standard library slices package.

For #61374

Change-Id: I7aae8e451b7c6c4390e0344257478d1a96a14189
Reviewed-on: https://go-review.googlesource.com/c/go/+/511660
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>
Reviewed-by: Eli Bendersky <eliben@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
10 months agoos: mark the share created by TestNetworkSymbolicLink as temporary
Bryan C. Mills [Fri, 21 Jul 2023 18:35:01 +0000 (14:35 -0400)]
os: mark the share created by TestNetworkSymbolicLink as temporary

Also use a unique share name for each run of the test.

This may help with #61467, but since I couldn't reproduce the failure
in the first place I don't know. It passes locally for me.

For #61467.

Change-Id: Ie51e3cf381063e02e4849af5c1a1ed7441ce21c0
Reviewed-on: https://go-review.googlesource.com/c/go/+/512075
Reviewed-by: Quim Muntal <quimmuntal@gmail.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>

10 months agoos: ReadFile: don't check for re-allocation in the first iteration
Jabar Asadi [Sun, 28 May 2023 06:45:23 +0000 (06:45 +0000)]
os: ReadFile: don't check for re-allocation in the first iteration

At the beginning of the for-loop iteration cap(data) > len(data) always.
Therefore, in the first iteration, this check becomes unnecessary.
we can move this check to after the read operation.

Change-Id: I205e4a842ced74f31124b45a39b70523b56ad840
GitHub-Last-Rev: 2fdf25dff2e9984d3a8f8e5e612ea802c88e88a1
GitHub-Pull-Request: golang/go#60473
Reviewed-on: https://go-review.googlesource.com/c/go/+/498915
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Rob Pike <r@golang.org>
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>

10 months agoRevert "net/http: use Copy in ServeContent if CopyN not needed"
Damien Neil [Mon, 24 Jul 2023 16:19:49 +0000 (16:19 +0000)]
Revert "net/http: use Copy in ServeContent if CopyN not needed"

This reverts CL 446276.

Reason for revert: Causing surprising performance regression.

Fixes #61530

Change-Id: Ic970f2e05d875b606ce274ea621f7e4c8c337481
Reviewed-on: https://go-review.googlesource.com/c/go/+/512615
Run-TryBot: Damien Neil <dneil@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

10 months agocmd/go: add support for vendoring in workspace mode
Michael Matloob [Wed, 17 May 2023 18:04:25 +0000 (14:04 -0400)]
cmd/go: add support for vendoring in workspace mode

In most cases this change removes assumptions that there is a single
main module in vendor mode and iterates over the workspace modules
when doing checks. The go mod vendor command will now, if in workspace
mode, create a vendor directory in the same directory as the go.work
file, containing the packages (and modules in modules.txt) loaded from
the workspace. When reassembling the module graph from the vendor
directory, an edges are added from each of the main modules to their
requirements, plus additionally to a fake 'vendor/modules.txt' module
with edges to all the modules listed in vendor/modules.txt.

For #60056

Change-Id: I4a485bb39836e7ab35cdc7726229191c6599903e
Reviewed-on: https://go-review.googlesource.com/c/go/+/495801
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>

10 months agomake.bash,bat,rc: use Go 1.20.6 instead of Go 1.17.13
Russ Cox [Sun, 23 Jul 2023 09:21:31 +0000 (05:21 -0400)]
make.bash,bat,rc: use Go 1.20.6 instead of Go 1.17.13

This was missed in the update of the bootstrap toolchain
and should help people who don't set GOROOT_BOOTSTRAP
and instead assume these scripts will find the right one.

For #54265.

Change-Id: I37a0d0976006d13b73df00013780be5abf202e91
Reviewed-on: https://go-review.googlesource.com/c/go/+/512275
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
10 months agocmd/asm: initialize assembler before running error tests
erifan01 [Wed, 7 Jun 2023 06:49:00 +0000 (14:49 +0800)]
cmd/asm: initialize assembler before running error tests

The Test{ARCH}Errors tests will call ctxt.Arch.Assemble, but this
function requires the assembler has been initialized. So this CL adds
a call to architecture.Init(ctxt) in testErrors, otherwise running
Test{ARCH}Errors alone would fail.

Change-Id: I4f3ba5a5fc1375d28779701989cf700cb4d1b635
Reviewed-on: https://go-review.googlesource.com/c/go/+/505976
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Eric Fang <eric.fang@arm.com>

10 months agocmd/asm: Fix encoding error of register offset shifted by 0 on arm64
eric fang [Tue, 18 Jul 2023 06:50:49 +0000 (06:50 +0000)]
cmd/asm: Fix encoding error of register offset shifted by 0 on arm64

The following instruction is wrongly encoded on arm64:
MOVD (R2)(R3<<0), R1
It's incorrectly encoded as
MOVD (R2)(R3<<3), R1

The reason for the error is that we hard-coded the shift encoding to 6,
which is correct for the MOVB and MOVBU instructions because it only
allows a shift amount of 0, but it is wrong for the MOVD instruction
because it also allows other shift values.

For instructions MOVB, MOVBU and FMOVB, the extension amount must be 0,
encoded in "S" as 0 if omitted, or as 1 if present. But in Go, we don't
distinguish between Rn.<EXT> and Rn.<EXT><<0, so we encode it as that
does not present. This makes no difference to the function of the
instruction.

Change-Id: I2afe3498392cc9b2ecd524c7744f28b9d6d107b8
Reviewed-on: https://go-review.googlesource.com/c/go/+/510995
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Eric Fang <eric.fang@arm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

10 months agotesting: enforce -skip in example tests
Mauri de Souza Meneguzzo [Fri, 21 Jul 2023 18:49:09 +0000 (18:49 +0000)]
testing: enforce -skip in example tests

The go test flag -skip had no effect in example tests.

Fixes #61482

Change-Id: I28dfddb88fef3fead2a3c74f9cb63a674a768231
GitHub-Last-Rev: e8c3c3460af906f4c7be7f7a8b4a4c60b71fcec1
GitHub-Pull-Request: golang/go#61491
Reviewed-on: https://go-review.googlesource.com/c/go/+/511837
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>

10 months agocmd/compile: memcombine if values being stored are from consecutive loads
Keith Randall [Sat, 10 Jun 2023 15:26:34 +0000 (08:26 -0700)]
cmd/compile: memcombine if values being stored are from consecutive loads

If we load 2 values and then store those 2 loaded values, we can likely
perform that operation with a single wider load and store.

Fixes #60709

Change-Id: Ifc5f92c2f1b174c6ed82a69070f16cec6853c770
Reviewed-on: https://go-review.googlesource.com/c/go/+/502295
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: Keith Randall <khr@golang.org>

10 months agoruntime: consider core PID in gdb test
Ian Lance Taylor [Fri, 21 Jul 2023 18:14:41 +0000 (11:14 -0700)]
runtime: consider core PID in gdb test

Add the PID to the core file name if the current system uses it
when generating core files.

Fixes #61487

Change-Id: I3b53a6c850c754795c8022921160f03c588d4c91
Reviewed-on: https://go-review.googlesource.com/c/go/+/511659
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@golang.org>

10 months agospec: fix a couple of minor mistakes in type inference section
Robert Griesemer [Thu, 20 Jul 2023 23:36:08 +0000 (16:36 -0700)]
spec: fix a couple of minor mistakes in type inference section

Change-Id: I9cdb301163b67add39928c8fc7df2b7f3893f45e
Reviewed-on: https://go-review.googlesource.com/c/go/+/511836
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Bypass: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>

10 months agocmd/link: allow enabling DWARF with -s
Cherry Mui [Fri, 5 May 2023 17:31:05 +0000 (13:31 -0400)]
cmd/link: allow enabling DWARF with -s

The -s flag is to documented to disable symbol table, not DWARF
(which is the -w flag). However, due to a bug (#15166), -s was
made to also disable DWARF. That bug can be fixed without
disabling DWARF. So do that, and make it possible to enable DWARF
with -s.

Since -s has been disabling DWARF for quite some time, and users
who use -s may want to suppress all symbol information, as DWARF
also contains symbol information, we keep the current behavior,
having -s continue to disable DWARF by default. But we allow
enabling DWARF by specifying -w=0 (or false).

In summary, this is the behavior now:
-s       no symbol table, no DWARF
-w       has symbol table, no DWARF
-s -w    no symbol table, no DWARF (same as -s)
-s -w=0  no symbol table, has DWARF

Change-Id: I1883f0aa3618abccfd735d104d983f7f531813d2
Reviewed-on: https://go-review.googlesource.com/c/go/+/492984
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>

10 months agocmd/link: test the -s flag
Cherry Mui [Wed, 28 Jun 2023 17:27:17 +0000 (13:27 -0400)]
cmd/link: test the -s flag

Add a test checking the -s flag actually suppresses the symbol
table.

Change-Id: I7216d4811a72c62b823d2daa12f6462568243b12
Reviewed-on: https://go-review.googlesource.com/c/go/+/506759
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cherry Mui <cherryyz@google.com>

10 months agocmd/link: print dsymutil and strip commands in -v mode
Cherry Mui [Fri, 16 Jun 2023 20:03:29 +0000 (16:03 -0400)]
cmd/link: print dsymutil and strip commands in -v mode

If -v is specified, print dsymutil and strip commands.

Change-Id: Icaff2b41ab582d8c58a4ec65438c2986d88def9f
Reviewed-on: https://go-review.googlesource.com/c/go/+/506758
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cherry Mui <cherryyz@google.com>

10 months agocmd/link: rationalize -s and -w flags with Mach-O external linking
Cherry Mui [Fri, 5 May 2023 22:52:39 +0000 (18:52 -0400)]
cmd/link: rationalize -s and -w flags with Mach-O external linking

Currently, on Mach-O in external linking mode, the handling of -s
and -w flags are a bit mixed: neither flag disables the symbol
table, and both flags disable DWARF.

This CL makes it do what is documented: -s disables symbol table,
and -w disables DWARF. For the Darwin system linker, the -s flag
(strip symbol table) is obsolete. So we strip it afterwards. We
already use the strip command to strip the debug STAB symbols if
we need to combine DWARF. With this CL we'll use an additional
flag to strip more symbols. And we now also use strip if -s is
specified and we don't need to combine DWARF.

Change-Id: I9bed24fd388f2bd5b0ffa4ec2db46a4a2f6b1016
Reviewed-on: https://go-review.googlesource.com/c/go/+/493136
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

10 months agocmd/link: suppress symbol table on Mach-O when -s
Cherry Mui [Fri, 5 May 2023 21:04:45 +0000 (17:04 -0400)]
cmd/link: suppress symbol table on Mach-O when -s

Currently, on Mach-O, we don't strip the symbol table even the -s
flag is set. This CL makes it suppress the symbol table, as
documented.

On Mach-O, even with -s, we still need to keep symbols that are
dynamically exported or referenced symbol. Otherwise the dynamic
linker cannot resolve them and the binary doesn't run.
(Interestingly, for a PIE binary it is okay to strip the symbol
table entirely. We keep the dynamic symbols for consistency. And
this is also in consistent with what the system "strip" command
does.)

Change-Id: I39c572553fe0215ae3bdf5349bf2bab7205fbdc9
Reviewed-on: https://go-review.googlesource.com/c/go/+/492744
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

10 months agocmd/cgo/internal/testshared: skip in short mode and not on builders
Cherry Mui [Thu, 20 Jul 2023 18:21:07 +0000 (14:21 -0400)]
cmd/cgo/internal/testshared: skip in short mode and not on builders

We already skip testcarchive, testcshared, and testplugin in short
mode and not on builders. The shared build mode is not more
supported than the c-archive, c-shared, and plugin build modes. No
need to run it everywhere by default.

Updates #61025.

Change-Id: I6a06e04c1a1dc78f0f85456320d128bd67277915
Reviewed-on: https://go-review.googlesource.com/c/go/+/511696
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
10 months agoencoding/base64: reduce the overflow risk when computing encode/decode length
chanxuehong [Thu, 20 Jul 2023 04:43:38 +0000 (04:43 +0000)]
encoding/base64: reduce the overflow risk when computing encode/decode length

Change-Id: I0a55cdc38ae496e2070f0b9ef317a41f82352afd
GitHub-Last-Rev: c19527a26b0778cbb4548f49e1e365102709f068
GitHub-Pull-Request: golang/go#61407
Reviewed-on: https://go-review.googlesource.com/c/go/+/510635
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>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
10 months agolog/slog: fix comment above log levels
zikaeroh [Fri, 21 Jul 2023 00:41:06 +0000 (17:41 -0700)]
log/slog: fix comment above log levels

This extra newline causes pkg.go.dev and gopls to only show the bottom
half of this comment; I'm pretty sure this entire thing is meant to be
in the docs.

Change-Id: I5bbf081fb2072d9d773d5a995bc3693dc44f65ff
Reviewed-on: https://go-review.googlesource.com/c/go/+/511855
Run-TryBot: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

10 months agocmd/dist: apply timeout scale even if timeout isn't overridden
Dmitri Shuralyov [Thu, 20 Jul 2023 14:23:47 +0000 (10:23 -0400)]
cmd/dist: apply timeout scale even if timeout isn't overridden

The timeout field is documented as being available so that it's possible
to override timeout by setting a non-zero value. If it's left at zero,
we don't need to override the default go test timeout, but we still need
to apply the timeout scale whenever it's something other than 1.

Fixes (via backport) #61468.

Change-Id: I63634e9b3ef8c4ec7f334b5a6b4bf3cad121355c
Reviewed-on: https://go-review.googlesource.com/c/go/+/511567
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>

10 months agosort: forward fixed-type slice sorting to slices package
Eli Bendersky [Thu, 6 Jul 2023 15:19:25 +0000 (08:19 -0700)]
sort: forward fixed-type slice sorting to slices package

Forwards the following functions to the slices package:

    sort.Ints
    sort.Strings
    sort.Float64s
    sort.IntsAreSorted
    sort.StringsAreSorted
    sort.Float64sAreSorted

benchstat results on the sort package's benchmarks:

goos: linux
goarch: amd64
pkg: sort
cpu: 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz
SearchWrappers-8        58.10n ± 0%   58.43n ± 1%   +0.57% (p=0.004 n=10)
SortString1K-8          76.53µ ± 1%   66.04µ ± 2%  -13.71% (p=0.000 n=10)
SortString1K_Slice-8    71.99µ ± 1%   72.32µ ± 2%        ~ (p=0.481 n=10)
StableString1K-8        92.66µ ± 1%   92.10µ ± 2%   -0.61% (p=0.019 n=10)
SortInt1K-8             34.31µ ± 0%   11.49µ ± 2%  -66.50% (p=0.000 n=10)
SortInt1K_Sorted-8     2699.5n ± 1%   959.0n ± 3%  -64.47% (p=0.000 n=10)
SortInt1K_Reversed-8    3.990µ ± 1%   1.429µ ± 4%  -64.19% (p=0.000 n=10)
SortInt1K_Mod8-8       13.695µ ± 1%   5.129µ ± 2%  -62.55% (p=0.000 n=10)
StableInt1K-8           46.22µ ± 1%   46.80µ ± 1%        ~ (p=0.109 n=10)
StableInt1K_Slice-8     44.12µ ± 1%   44.32µ ± 2%        ~ (p=0.315 n=10)
SortInt64K-8            3.848m ± 0%   1.857m ± 2%  -51.76% (p=0.000 n=10)
SortInt64K_Slice-8      3.690m ± 0%   3.740m ± 0%   +1.36% (p=0.002 n=10)
StableInt64K-8          3.901m ± 0%   3.917m ± 0%   +0.42% (p=0.003 n=10)
Sort1e2-8               32.22µ ± 2%   32.40µ ± 2%        ~ (p=0.529 n=10)
Stable1e2-8             54.11µ ± 1%   54.11µ ± 1%        ~ (p=0.796 n=10)
Sort1e4-8               5.998m ± 1%   5.993m ± 1%        ~ (p=0.579 n=10)
Stable1e4-8             15.23m ± 0%   15.32m ± 0%   +0.59% (p=0.000 n=10)
Sort1e6-8               902.8m ± 0%   904.3m ± 0%        ~ (p=0.075 n=10)
Stable1e6-8              3.089 ± 0%    3.089 ± 0%        ~ (p=0.971 n=10)
geomean                 259.8µ        200.0µ       -22.99%

Most of the benchmarks are unaffected. The ones with significant reductions
are precisely for the functions that were forwarded.

This CL has to move some things around to avoid a circular dependency
between sort and slices. Since sort depends on slices now, nothing in
slices can depend on sort - not even in tests.

Fixes #61180

Change-Id: Ic0e5f519863d96a139fada08aefb1bcdf4c7a9a3
Reviewed-on: https://go-review.googlesource.com/c/go/+/508135
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Eli Bendersky <eliben@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

10 months agogo/types, types2: update documentation for GoVersion
Rob Findley [Wed, 19 Jul 2023 15:21:00 +0000 (11:21 -0400)]
go/types, types2: update documentation for GoVersion

Update the documentation for Config.GoVersion to reflect the changes
made for #61175.

Change-Id: I9f3fbcf8ee88e52d6a5e7cf80dad3d2fb5313893
Reviewed-on: https://go-review.googlesource.com/c/go/+/511096
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
10 months agoreflect: panic on recv channel close
Mauri de Souza Meneguzzo [Thu, 20 Jul 2023 23:14:03 +0000 (23:14 +0000)]
reflect: panic on recv channel close

It is possible to call reflect.ValueOf(ch).Close() on a recv-only channel,
 while close(ch) is a compile-time error. Following the same reflect
semantics as send and recv this should result in a panic.

Fixes #61445

Change-Id: I2a9ee8f45963593a37bd6df4643dd64fb322f9f9
GitHub-Last-Rev: fe2d5e09f5bb5536ac25d1606cf3744fb7a0a4a9
GitHub-Pull-Request: golang/go#61453
Reviewed-on: https://go-review.googlesource.com/c/go/+/511295
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
10 months agoruntime/cgo: reduce runtime init done check using atomic
Cuong Manh Le [Fri, 23 Jun 2023 06:20:33 +0000 (13:20 +0700)]
runtime/cgo: reduce runtime init done check using atomic

Every call from C to Go does acquire a mutex to check whether Go runtime
has been fully initialized. This often does not matter, because the lock
is held only briefly. However, with code that does a lot of parallel
calls from C to Go could cause heavy contention on the mutex.

Since this is an initialization guard, we can double check with atomic
operation to provide a fast path in case the initialization is done.
With this CL, program in #60961 reduces from ~2.7s to ~1.8s.

Fixes #60961

Change-Id: Iba4cabbee3c9bc646e70ef7eb074212ba63fdc04
Reviewed-on: https://go-review.googlesource.com/c/go/+/505455
Reviewed-by: Heschi Kreinick <heschi@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

10 months agocmd/compile/internal/walk: remove un-used func/var
Cuong Manh Le [Tue, 27 Jun 2023 03:05:56 +0000 (10:05 +0700)]
cmd/compile/internal/walk: remove un-used func/var

Change-Id: I0ea1340cbca3dfb8b6bd71df439edd410e452fa3
Reviewed-on: https://go-review.googlesource.com/c/go/+/506478
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
10 months agocmd/compile/internal/typecheck: cleanup code
Cuong Manh Le [Tue, 27 Jun 2023 03:03:55 +0000 (10:03 +0700)]
cmd/compile/internal/typecheck: cleanup code

Removing a lot of functions/variables/constants which are un-unsed
anymore in Unified IR frontend.

Change-Id: Iccf73754196bf4fa40fe701a6468f4c8a1a0c655
Reviewed-on: https://go-review.googlesource.com/c/go/+/506477
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

10 months agocmd/compile: use "pw" as receiver name consistently
Cuong Manh Le [Tue, 27 Jun 2023 02:54:32 +0000 (09:54 +0700)]
cmd/compile: use "pw" as receiver name consistently

Change-Id: I912f1326fa442098065b62b7b0ef9048771e4701
Reviewed-on: https://go-review.googlesource.com/c/go/+/506476
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
10 months agocmd/compile/internal/noder: remove un-used funcs/vars
Cuong Manh Le [Tue, 27 Jun 2023 02:50:57 +0000 (09:50 +0700)]
cmd/compile/internal/noder: remove un-used funcs/vars

Change-Id: I755406e6c5b6a8cdaeeed8cd12d756e3847c8d4f
Reviewed-on: https://go-review.googlesource.com/c/go/+/506475
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>

10 months agogo/types, types2: a min/max value argument must not be untyped
Robert Griesemer [Thu, 20 Jul 2023 22:45:24 +0000 (15:45 -0700)]
go/types, types2: a min/max value argument must not be untyped

Fixes #61486.

Change-Id: I5770e238e44b724816894d914b3ea5dc78bc3ced
Reviewed-on: https://go-review.googlesource.com/c/go/+/511835
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

10 months agoruntime: fix debug non-concurrent sweep mode after activeSweep changes
Michael Anthony Knyszek [Mon, 27 Mar 2023 15:47:18 +0000 (15:47 +0000)]
runtime: fix debug non-concurrent sweep mode after activeSweep changes

Currently the GC creates a sweepLocker before restarting the world at
the end of the mark phase, so that it can safely flush mcaches without
the runtime incorrectly concluding that sweeping is done before that
happens.

However, with GODEBUG=gcstoptheworld=2, where sweeping happens during
that STW phase, creating that sweepLocker will fail, since the runtime
will conclude that sweeping is in fact complete (all the queues will be
drained). The problem however is that gcSweep, which does the
non-concurrent sweeping, doesn't actually flush mcaches.

In essence, this failure to create a sweepLocker is indicating a real
issue: sweeping is marked as complete, but we haven't flush the mcaches
yet!

The fix to this is to flush mcaches in gcSweep when in a non-concurrent
sweep. Now that gcSweep actually completes a full sweep, it's safe to
ignore a failure to create a sweepLocker (and in fact, it *must* fail).

While we're here, let's also remove _ConcurrentSweep, the debug flag.
There's already an alias for it called concurrentSweep, and there's only
one use of it in gcSweep.

Lastly, add a dist test for the GODEBUG=gcstoptheworld=2 mode.

Fixes #53885.

Change-Id: I8a1e5b8f362ed8abd03f76e4950d3211f145ab1f
Reviewed-on: https://go-review.googlesource.com/c/go/+/479517
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

10 months agotime: document that AfterFunc Timer's C field is nil
Ian Lance Taylor [Thu, 15 Jun 2023 23:56:45 +0000 (16:56 -0700)]
time: document that AfterFunc Timer's C field is nil

Fixes #60811

Change-Id: Ica947a4789e71826284f9f6e41c298baa3d033e4
Reviewed-on: https://go-review.googlesource.com/c/go/+/503922
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>

10 months agospec: update section on type inference for Go 1.21
Robert Griesemer [Thu, 15 Jun 2023 23:09:52 +0000 (16:09 -0700)]
spec: update section on type inference for Go 1.21

The new section describes type inference as the problem
of solving a set of type equations for bound type parameters.

The next CL will update the section on unification to match
the new inference approach.

Change-Id: I2cb49bfb588ccc82d645343034096a82b7d602e2
Reviewed-on: https://go-review.googlesource.com/c/go/+/503920
TryBot-Bypass: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>

10 months agoall: update build tags to require/assume Go 1.20
Matthew Dempsky [Thu, 20 Jul 2023 18:41:04 +0000 (11:41 -0700)]
all: update build tags to require/assume Go 1.20

Updates #54265.

Change-Id: Ia1c9486484c73c565bb4f78234dedff6d929ed42
Reviewed-on: https://go-review.googlesource.com/c/go/+/511656
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
10 months agoruntime: print debuglog before sighandler crash
Michael Pratt [Wed, 7 Jun 2023 16:04:44 +0000 (12:04 -0400)]
runtime: print debuglog before sighandler crash

Change-Id: I48e8c314258a033fa0dc5e533e2c5bd06c529a7c
Reviewed-on: https://go-review.googlesource.com/c/go/+/501977
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

10 months agoruntime: call wakep in gosched
Michael Pratt [Wed, 7 Jun 2023 20:57:34 +0000 (16:57 -0400)]
runtime: call wakep in gosched

goschedImpl transitions the current goroutine from _Grunning to
_Grunnable and places it on the global run queue before calling into
schedule.

It does _not_ call wakep after adding the global run queue. I believe
the intuition behind skipping wakep is that since we are immediately
calling the scheduler so we don't need to wake anything to run this
work. Unfortunately, this intuition is not correct, as it breaks
coordination with spinning Ms [1].

Consider this example scenario:

Initial conditions:

M0: Running P0, G0
M1: Spinning, holding P1 and looking for work

Timeline:

M1: Fails to find work; drops P
M0: newproc adds G1 to P0 runq
M0: does not wakep because there is a spinning M
M1: clear mp.spinning, decrement sched.nmspinning (now in "delicate dance")
M1: check sched.runqsize -> no global runq work
M0: gosched preempts G0; adds G0 to global runq
M0: does not wakep because gosched doesn't wakep
M0: schedules G1 from P0 runq
M1: check P0 runq -> no work
M1: no work -> park

G0 is stranded on the global runq with no M/P looking to run it. This is
a loss of work conservation.

As a result, G0 will have unbounded* scheduling delay, only getting
scheduled when G1 yields. Even once G1 yields, we still won't start
another P, so both G0 and G1 will switch back and forth sharing one P
when they should start another.

*The caveat to this is that today sysmon will preempt G1 after 10ms,
effectively capping the scheduling delay to 10ms, but not solving the P
underutilization problem. Sysmon's behavior here is theoretically
unnecessary, as our work conservation guarantee should allow sysmon to
avoid preemption if there are any idle Ps. Issue #60693 tracks changing
this behavior and the challenges involved.

[1] It would be OK if we unconditionally entered the scheduler as a
spinning M ourselves, as that would require schedule to call wakep when
it finds work in case there is more work.

Fixes #55160.

Change-Id: I2f44001239564b56ea30212553ab557051d22588
Reviewed-on: https://go-review.googlesource.com/c/go/+/501976
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>

10 months agoruntime: check global runq during "delicate dance"
Michael Pratt [Wed, 7 Jun 2023 15:38:26 +0000 (11:38 -0400)]
runtime: check global runq during "delicate dance"

When a thread transitions to spinning to non-spinning it must recheck
all sources of work because other threads may submit new work but skip
wakep because they see a spinning thread.

However, since the beginning of time (CL 7314062) we do not check the
global run queue, only the local per-P run queues.

The global run queue is checked just above the spinning checks while
dropping the P. I am unsure what the purpose of this check is. It
appears to simply be opportunistic since sched.lock is already held
there in order to drop the P. It is not sufficient to synchronize with
threads adding work because it occurs before decrementing
sched.nmspinning, which is what threads us to decide to wake a thread.

Resolve this by adding an explicit global run queue check alongside the
local per-P run queue checks.

Almost nothing happens between dropped sched.lock after dropping the P
and relocking sched.lock: just clearing mp.spinning and decrementing
sched.nmspinning. Thus it may be better to just hold sched.lock for this
entire period, but this is a larger change that I would prefer to avoid
in the freeze and backports.

For #55160.

Change-Id: Ifd88b5a4c561c063cedcfcfe1dd8ae04202d9666
Reviewed-on: https://go-review.googlesource.com/c/go/+/501975
Run-TryBot: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

10 months agogo/internal/gcimporter: propagate errors from FindPkg
Bryan C. Mills [Thu, 29 Jun 2023 19:22:32 +0000 (15:22 -0400)]
go/internal/gcimporter: propagate errors from FindPkg

Previously, FindPkg returned the empty string as a sentinel value,
causing Import to collapse all errors to "can't find import".

(See also https://go.dev/wiki/CodeReviewComments#in-band-errors.)

For #61064.

Change-Id: I21f335d206308b44fe585619e00782abb0b65a94
Reviewed-on: https://go-review.googlesource.com/c/go/+/507360
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>

10 months agogo/types, types2: make sure info recording is executed in test runs
Robert Griesemer [Thu, 20 Jul 2023 21:00:20 +0000 (14:00 -0700)]
go/types, types2: make sure info recording is executed in test runs

Issue #61486 causes a compiler crash but is not detected when running
stand-alone type-checker tests because no types are recorded.

Set up Config.Info map with all maps when when running local tests
so that type/object recording code is executed during local tests.

For #61486.

Change-Id: I8eb40c8525dac3da65db0dc7e0e654842713b9a9
Reviewed-on: https://go-review.googlesource.com/c/go/+/511657
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

10 months agocmd/link: pass flags to external linker in deterministic order
Cherry Mui [Wed, 12 Jul 2023 20:54:32 +0000 (16:54 -0400)]
cmd/link: pass flags to external linker in deterministic order

Currently we may pass C linker flags in nondeterministic order,
as on ELf systems we pass --export-dynamic-symbol for symbols from
a map. This is usally not a big problem because even if the flags
are passed in nondeterministic order the resulting binary is
probably still deterministic. This CL makes it pass them in a
deterministic order to be extra sure. This also helps build
systems where e.g. there is a build cache for the C linking action.

Change-Id: I930524dd2c3387f49d62be7ad2cef937cb2c2238
Reviewed-on: https://go-review.googlesource.com/c/go/+/509215
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cherry Mui <cherryyz@google.com>

10 months agogo/ast: add Unparen(Expr) helper
Alan Donovan [Tue, 16 May 2023 17:33:15 +0000 (13:33 -0400)]
go/ast: add Unparen(Expr) helper

Fixes #60061

Change-Id: If1bc03f9367620c9ea8702bfd4648020d5ab52ea
Reviewed-on: https://go-review.googlesource.com/c/go/+/495315
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Run-TryBot: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

10 months agocmd/go: attach PGO profile for test dependencies
Cherry Mui [Tue, 18 Jul 2023 20:23:27 +0000 (16:23 -0400)]
cmd/go: attach PGO profile for test dependencies

When running "go test" including a main package which has a PGO
profile, we currently build the package being tested and its
dependencies with PGO, but we failed to attach the profile to
test-only dependencies. If a package is (transitively) imported
by both the package being tested and the test, the PGO version
and the non-PGO version of the package are both linked into the
binary, causing link-time error.

This CL fixes this by attaching the PGO profile to dependencies of
the test.

Fixes #61376.

Change-Id: I2559db9843c4cdab596b31e2025d8475ffbf58ec
Reviewed-on: https://go-review.googlesource.com/c/go/+/510835
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

10 months agocmd/internal/obj: print relocation type by name in -S output
Cherry Mui [Thu, 8 Jun 2023 02:28:20 +0000 (22:28 -0400)]
cmd/internal/obj: print relocation type by name in -S output

The compiler/assembler's -S output prints relocation type
numerically, which is hard to understand. Every time I need to
count the relocation type constants to figure out which relocation
it actually is. Print the symbolic name instead.

Change-Id: I4866873bbae8b3dc0ee212609cb00280f9164243
Reviewed-on: https://go-review.googlesource.com/c/go/+/501856
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>

10 months agocmd/link: clean up some relocation handling
Cherry Mui [Thu, 8 Jun 2023 17:23:39 +0000 (13:23 -0400)]
cmd/link: clean up some relocation handling

We don't use R_PCREL for calls to dynamic symbols (we use R_CALL
instead). Don't handle R_PCREL as a call.

We don't use R_CALL on ARM64 (we use R_CALLARM64 instead).

Remove those cases, which we don't expect to see.

Change-Id: Idd99022a8eeb65750ffc2936ffdccf8bb0405e30
Reviewed-on: https://go-review.googlesource.com/c/go/+/501859
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
10 months agocmd/link: handle dynamic import variables on Darwin
Cherry Mui [Thu, 8 Jun 2023 16:19:54 +0000 (12:19 -0400)]
cmd/link: handle dynamic import variables on Darwin

Currently, on darwin, we only support cgo_dynamic_import for
functions, but not variables, as we don't need it before.
mach_task_self_ is a variable defined in the system library, which
can be used to e.g. access the process's memory mappings via the
mach API. The C header defines a macro mach_task_self(), which
refers to the variable. To use mach_task_self_ (in pure-Go
programs) we need to access it in Go.

This CL handles cgo_dynamic_import for variables in the linker,
loading its address via the GOT. (Currently only on Darwin, as
we only need it there.)

For #50891.

Change-Id: Idf64fa88ba2f2381443a1ed0b42b14b581843493
Reviewed-on: https://go-review.googlesource.com/c/go/+/501855
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
10 months agoruntime/pprof: use testenv.Command in tests instead of exec.Command
Bryan C. Mills [Fri, 30 Jun 2023 16:47:06 +0000 (12:47 -0400)]
runtime/pprof: use testenv.Command in tests instead of exec.Command

If the test is about to time out, testenv.Command sends SIGQUIT to the
child process. The runtime's SIGQUIT goroutine dump should help us to
determine whether the hangs observed in TestCPUProfileWithFork are a
symptom of #60108 or a separate bug.

For #59995.
Updates #60108.

Change-Id: I26342ca262b2b0772795c8be142cfcad8d90db30
Reviewed-on: https://go-review.googlesource.com/c/go/+/507356
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>

10 months agonet: remove sysSocket fallback for Windows 7
qmuntal [Mon, 26 Jun 2023 13:10:30 +0000 (15:10 +0200)]
net: remove sysSocket fallback for Windows 7

`syscall.ForkLock` is not used in `syscall.StartProcess` since
CL 288297, so using it in `sysSocket` makes no sense. This CL
goes a little bit further and removes the `sysSocket` fallback for
Windows 7, since it is not supported since go 1.21 (#57003).

Updates #60942

Change-Id: If14a0d94742f1b80af994f9f69938701ee41b402
Reviewed-on: https://go-review.googlesource.com/c/go/+/506136
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Quim Muntal <quimmuntal@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
10 months agointernal/fuzz: pass handle to temporary file instead of the path
qmuntal [Tue, 27 Jun 2023 14:54:44 +0000 (16:54 +0200)]
internal/fuzz: pass handle to temporary file instead of the path

This CL partially reverts CL 297034. Inheritable handles are not
inherited by all workers thanks to using AdditionalInheritedHandles,
which explicitly specifies which handles to inherit by each worker.

This CL doesn't fix any bug, it's more of a cleanup, but also makes
the code more robust and more similar to its Unix counterpart.

Change-Id: I24c2d7f69dfb839a1aeb5858088d8f38b022f702
Reviewed-on: https://go-review.googlesource.com/c/go/+/506535
Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
10 months agocmd/go: don't collect package CGOLDFLAGS when using gccgo
Ian Lance Taylor [Tue, 23 May 2023 00:55:43 +0000 (17:55 -0700)]
cmd/go: don't collect package CGOLDFLAGS when using gccgo

They are already collected via cmd/cgo.

The gccgo_link_c test is tweaked to do real linking as with this
change the cgo ldflags are not fully reflected in go build -n output,
since they now only come from the built archive.

Fixes #60287

Change-Id: Id433435fe8aeb9571327bf936e52a37f400cef4c
Reviewed-on: https://go-review.googlesource.com/c/go/+/497117
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Andrey Bokhanko <andreybokhanko@gmail.com>
10 months agoimage/draw: replace deprecated image.ZP and image.ZR in xx_test.go
ryomak [Wed, 28 Jun 2023 13:06:38 +0000 (22:06 +0900)]
image/draw: replace deprecated image.ZP and image.ZR in xx_test.go

Change-Id: I87545a46e5871452075152b4c99ba85089ef86b8
Reviewed-on: https://go-review.googlesource.com/c/go/+/506735
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
10 months agocmp.bash: fix comment grammar
Jes Cok [Fri, 14 Jul 2023 04:07:45 +0000 (04:07 +0000)]
cmp.bash: fix comment grammar

Change-Id: I290806279983b528e35a3b81641c78a4e3424a74
GitHub-Last-Rev: d6f888e7de9d8eb205a1111f37ee1e2f71e04c5c
GitHub-Pull-Request: golang/go#61351
Reviewed-on: https://go-review.googlesource.com/c/go/+/509655
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: Heschi Kreinick <heschi@google.com>
10 months agoruntime: use unsafe.{String,StringData} in arena test
Ian Lance Taylor [Thu, 8 Jun 2023 20:11:31 +0000 (13:11 -0700)]
runtime: use unsafe.{String,StringData} in arena test

Change-Id: Ia567b163efe7b323694c15abcf0cef0effc6ff6a
Reviewed-on: https://go-review.googlesource.com/c/go/+/501995
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.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>
Reviewed-by: Ian Lance Taylor <iant@google.com>
10 months agostrings: add benchmark for Builder.WriteString
Roger Peppe [Tue, 4 Jul 2023 14:25:07 +0000 (15:25 +0100)]
strings: add benchmark for Builder.WriteString

This is in preparation for an optimization.

```
name                                     time/op
BuildString_WriteString/1Write_NoGrow-8  30.8ns ± 0%
BuildString_WriteString/3Write_NoGrow-8   111ns ± 0%
BuildString_WriteString/3Write_Grow-8    44.1ns ± 4%

name                                     alloc/op
BuildString_WriteString/1Write_NoGrow-8   48.0B ± 0%
BuildString_WriteString/3Write_NoGrow-8    336B ± 0%
BuildString_WriteString/3Write_Grow-8      112B ± 0%

name                                     allocs/op
BuildString_WriteString/1Write_NoGrow-8    1.00 ± 0%
BuildString_WriteString/3Write_NoGrow-8    3.00 ± 0%
BuildString_WriteString/3Write_Grow-8      1.00 ± 0%
```

Signed-off-by: Roger Peppe <rogpeppe@gmail.com>
Change-Id: I0e2c82edcdc72f381c5160f315401678ff76f3d9
Reviewed-on: https://go-review.googlesource.com/c/go/+/507777
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

10 months agoslices: refactor DeleteFunc to improve code readability
amdahliu [Mon, 3 Jul 2023 10:09:36 +0000 (10:09 +0000)]
slices: refactor DeleteFunc to improve code readability

Reuse IndexFunc function to avoid confusing subscript indexing, and to reduce code nesting depth.

Change-Id: I309416ebf928071f71054433e078f0fda802fba8
GitHub-Last-Rev: af54738bda7f27afda5f92496363c0a68493c369
GitHub-Pull-Request: golang/go#61154
Reviewed-on: https://go-review.googlesource.com/c/go/+/507635
Run-TryBot: Ian Lance Taylor <iant@golang.org>
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: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

10 months agoos: remove unused containsAny
Tobias Klauser [Thu, 25 May 2023 10:37:52 +0000 (12:37 +0200)]
os: remove unused containsAny

It's unused since CL 455716.

Change-Id: I78bf7ad0e546c7dda8e78b911feb6399e1e6e088
Reviewed-on: https://go-review.googlesource.com/c/go/+/498235
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>

10 months agocrypto/internal/boring,crypto/sha1: remove cmd_go_bootstrap build tag
qmuntal [Tue, 11 Jul 2023 15:56:17 +0000 (17:56 +0200)]
crypto/internal/boring,crypto/sha1: remove cmd_go_bootstrap build tag

Since CL 402595, the Go compiler no longer uses any package under
crypto, so there is no need to explicitly exclude boring from the
go bootstrap build.

Change-Id: Ib71349fffaab151c6e1fb42a9684151439b70cc8
Reviewed-on: https://go-review.googlesource.com/c/go/+/508402
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
10 months agoos: remove executable bits from os.OpenFile example
Rami [Sun, 16 Jul 2023 10:25:40 +0000 (10:25 +0000)]
os: remove executable bits from os.OpenFile example

The mode used in the os.OpenFile example (0755) has all executable bits set.
I suspect that this ill-advised usage propagates to other codebases (by means of people carelessly copying the usage example), which is why I suggest modifying the example.

Change-Id: Ic36c8b41974f3fe00471822c2414e36b4e5dc1bc
GitHub-Last-Rev: 638f3beefe8926c8e5c2c4ab9a1a5899e55de892
GitHub-Pull-Request: golang/go#61384
Reviewed-on: https://go-review.googlesource.com/c/go/+/510135
Reviewed-by: Rob Pike <r@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Rob Pike <r@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>

10 months agointernal/bytealg: use generic IndexByte on plan9/amd64
Philip Silva [Mon, 10 Jul 2023 20:22:15 +0000 (22:22 +0200)]
internal/bytealg: use generic IndexByte on plan9/amd64

Use generic implementation of IndexByte/IndexByteString
on plan9/amd64 since the assembly implementation
uses SSE instructions which are classified as floating
point instructions and cannot be used in a note handler.
A similar issue was fixed in CL 100577.

This fixes runtime.TestBreakpoint.

Fixes #61087.

Change-Id: Id0c085e47da449be405ea04ab9b93518c4e2fde8
Reviewed-on: https://go-review.googlesource.com/c/go/+/508400
Reviewed-by: Heschi Kreinick <heschi@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David du Colombier <0intro@gmail.com>