]> Cypherpunks.ru repositories - gostls13.git/log
gostls13.git
13 months agomisc/swig: move tests to cmd/cgo/internal
Austin Clements [Thu, 4 May 2023 16:13:27 +0000 (12:13 -0400)]
misc/swig: move tests to cmd/cgo/internal

This moves the misc/swig test to cmd/cgo/internal.

This lets these tests access facilities in internal/testenv. It's also
now just a normal test that can run as part of the cmd tests.

For #37486.

Change-Id: Ibe5026219999d175aa0a310b9886bef3f6f9ed17
Reviewed-on: https://go-review.googlesource.com/c/go/+/492722
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
13 months agomisc/swig: restructure as a driver
Austin Clements [Mon, 8 May 2023 18:39:57 +0000 (14:39 -0400)]
misc/swig: restructure as a driver

Currently, the misc/swig tests directly use Swig and C++ and will fail
to build if either Swig or a C++ compiler are not present. Typically,
we hide this fact from users because dist test itself checks for Swig
and a C++ compiler before even attempting to run this test, though
users will see this is they try to go test ./... from misc.

However, we're about to move the misc/swig tests into the cmd module,
where they will be much more visible and much more likely to run
unintentionally. To prevent build errors, this CL restructures these
tests into a single pure Go test plus two test packages hidden in
testdata. This is relatively easy to do for this test because there
are only four test cases total. The pure Go test can check for the
necessary build tools before trying to build and run the tests in
testdata. This also gives us the opportunity to move the LTO variant
of these tests out of dist and into the test itself, simplifying dist.

For #37486.

Change-Id: Ibda089b4069e36866cb31867a7006c790be2d8b1
Reviewed-on: https://go-review.googlesource.com/c/go/+/493599
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
13 months agocmd/go: fix swigOne action with -n
Austin Clements [Sat, 6 May 2023 19:27:02 +0000 (15:27 -0400)]
cmd/go: fix swigOne action with -n

Currently, if cmd/go builds a swig file with the -n (dry run) flag, it
will print the swig command invocation without executing it, but then
attempt to actually rename one of swig's output files, which will
fail. Make this rename conditional on -n. While we're here, we fix the
missing logging of the rename command with -x, too.

Change-Id: I1f6e6efc53dfe4ac5a42d26096679b97bc322827
Reviewed-on: https://go-review.googlesource.com/c/go/+/493255
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

13 months agomisc/cgo: move registerCgoTests tests to cmd/cgo/internal
Austin Clements [Thu, 4 May 2023 18:25:24 +0000 (14:25 -0400)]
misc/cgo: move registerCgoTests tests to cmd/cgo/internal

This moves the remaining cgo tests.

For #37486.

Change-Id: I99dea5a312a1974de338461a8b02242e5c1bae62
Reviewed-on: https://go-review.googlesource.com/c/go/+/492721
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
13 months agomisc/cgo/test: add cgo build constraints
Austin Clements [Sat, 6 May 2023 02:29:11 +0000 (22:29 -0400)]
misc/cgo/test: add cgo build constraints

We're about to move this package to cmd/cgo/internal, where it will
get caught up in the "CGO_ENABLED=0 go install cmd" done by make.bash.
Currently, building this package with CGO_ENABLED=0 fails because it
contains several source files that don't themselves import "C", but do
import a subdirectory where that package imports "C" and thus has no
exported API.

Fix the CGO_ENABLED=0 build of this package by adding the necessary
cgo build tags. Not all source files need it, but this CL makes
"CGO_ENABLED=0 go test -c" work in this package.

For #37486.

Change-Id: Id137cdfbdd950eea802413536d990ab642ebcd7e
Reviewed-on: https://go-review.googlesource.com/c/go/+/493215
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Austin Clements <austin@google.com>

13 months agomisc/cgo/test: fix vet error
Austin Clements [Sat, 6 May 2023 01:38:02 +0000 (21:38 -0400)]
misc/cgo/test: fix vet error

Vet's cgocall check fails on misc/cgo/test with "possibly passing Go
type with embedded pointer to C". This error is confusing, but the
cgocall check is looking for passing pointers to Go slices to C, which
is exactly what this test is doing. Normally we don't notice this
because vet doesn't run on misc, but we're about to move this test to
cmd/cgo/internal, where vet will start failing.

I'm not sure why we're passing a pointer to a slice here. It's
important that we call a C function with an unsafe.Pointer to memory
containing a pointer to test #25941 and that the result is this call
is then passed to another C function for #28540. This CL maintains
these two properties without the use of a slice.

For #37486.

Change-Id: I672a3c35931a59f99363050498d6f0c80fb6cd98
Reviewed-on: https://go-review.googlesource.com/c/go/+/493137
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
13 months agomisc/cgo: move easy tests to cmd/cgo/internal
Austin Clements [Thu, 4 May 2023 16:13:27 +0000 (12:13 -0400)]
misc/cgo: move easy tests to cmd/cgo/internal

This moves most misc/cgo tests to cmd/cgo/internal. This is mostly a
trivial rename and updating dist/test.go for the new paths, plus
excluding these packages from regular dist test registration. A few
tests were sensitive to what path they ran in, so we update those.

This will let these tests access facilities in internal/testenv.

For #37486.

Change-Id: I3ed417c7c22d9b667f2767c0cb1f59118fcd4af6
Reviewed-on: https://go-review.googlesource.com/c/go/+/492720
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

13 months agoruntime: remove crash_cgo_test CgoRaceSignal timeout
Ian Lance Taylor [Thu, 11 May 2023 21:01:02 +0000 (14:01 -0700)]
runtime: remove crash_cgo_test CgoRaceSignal timeout

The test had a 5 second timeout. Running the test on a Darwin system
sometimes took less than 5 seconds but often took up to 8 seconds.
We don't need a timeout anyhow. Instead, use testenv.Command to
run the program, which uses the test timeout.

Fixes #59807

Change-Id: Ibf3eda9702731bf98601782f4abd11c3caa0bf40
Reviewed-on: https://go-review.googlesource.com/c/go/+/494456
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: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
13 months agonet: don't treat unknown sources as dns when there is a dns source
Mateusz Poliwczak [Thu, 11 May 2023 17:27:02 +0000 (17:27 +0000)]
net: don't treat unknown sources as dns when there is a dns source

Change-Id: I3a6c3a804604b1e74a1ea6b66ab2c932a0ac973a
GitHub-Last-Rev: ea5403549a51a29a2799674d74425b480253d2f1
GitHub-Pull-Request: golang/go#60025
Reviewed-on: https://go-review.googlesource.com/c/go/+/493236
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: Cherry Mui <cherryyz@google.com>
Run-TryBot: Mateusz Poliwczak <mpoliwczak34@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

13 months agonet: clear /etc/hosts cache on fs.ErrNotExist and fs.ErrPermission errors
Mateusz Poliwczak [Thu, 11 May 2023 11:54:28 +0000 (11:54 +0000)]
net: clear /etc/hosts cache on fs.ErrNotExist and fs.ErrPermission errors

This was also the cause of my issues in CL 455275

Before:
root@arch:~/aa# $(time sleep 5 && mv /etc/hosts /tmp/hosts) &
[1] 2214
root@arch:~/aa# go run main.go
[232.223.232.123] <nil>
[232.223.232.123] <nil>
[232.223.232.123] <nil>
[232.223.232.123] <nil>
[232.223.232.123] <nil>
[232.223.232.123] <nil>
(....)

After:
root@arch:~/aa# $(time sleep 5 && mv /etc/hosts /tmp/hosts) &
[1] 2284
root@arch:~/aa# go run main.go
[232.223.232.123] <nil>
[232.223.232.123] <nil>
[232.223.232.123] <nil>
[232.223.232.123] <nil>
[232.223.232.123] <nil>
[] lookup sth on 127.0.0.53:53: server misbehaving
[] lookup sth on 127.0.0.53:53: server misbehaving

Change-Id: I3090fd8f3105db8c2d7c3bf5afe7b18ebca61cda
GitHub-Last-Rev: cb0dac6448bbc337cd015ad4b4b3d1da3f14a561
GitHub-Pull-Request: golang/go#59963
Reviewed-on: https://go-review.googlesource.com/c/go/+/492555
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: Mateusz Poliwczak <mpoliwczak34@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
13 months agoruntime: save/fetch g register during VDSO on linux/loong64
Guoqi Chen [Tue, 28 Mar 2023 21:10:45 +0000 (05:10 +0800)]
runtime: save/fetch g register during VDSO on linux/loong64

Like arm64, ppc64 and risv64, on loong64, the G register may be temporarily
broken during a VDSO call. If a signal is received during a VDSO call, an
invalid G may be obtained.

See #34391.

Change-Id: Iaffa8cce4f0ef8ef74225c355ec3c20ed238025f
Reviewed-on: https://go-review.googlesource.com/c/go/+/426355
Reviewed-by: WANG Xuerui <git@xen0n.name>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: WANG Xuerui <git@xen0n.name>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
13 months agonet: return fallbackOrder immediately for some GOOS
Mateusz Poliwczak [Thu, 11 May 2023 07:57:33 +0000 (07:57 +0000)]
net: return fallbackOrder immediately for some GOOS

We don't need to check resolv.conf, nsswitch.conf on these systems.
Seems like this was the behaviour before CL 487196.

Change-Id: I34ef3510891c572772a222fbbe47693aa6c7cf38
GitHub-Last-Rev: 3aace0e6615b79bbf379e05ca3a353e194dc7c0b
GitHub-Pull-Request: golang/go#59946
Reviewed-on: https://go-review.googlesource.com/c/go/+/491995
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Mateusz Poliwczak <mpoliwczak34@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
13 months agosyscall: implement wasip1 SetNonblock and IsNonblock
Chris O'Hara [Mon, 8 May 2023 07:06:08 +0000 (17:06 +1000)]
syscall: implement wasip1 SetNonblock and IsNonblock

Allows for the NONBLOCK file descriptor flag to be set and queried
on wasip1.

syscall.SetNonblock uses the fd_fdstat_set_flags WASI system call
and unix.IsNonblock uses the fd_fdstat_get system call.

This is a prerequisite for non-blocking I/O support.

Change-Id: I2bf79fd57142b2ec53eed3977d9aac8c6337eb80
Reviewed-on: https://go-review.googlesource.com/c/go/+/493356
Auto-Submit: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Run-TryBot: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Reviewed-by: Julien Fabre <ju.pryz@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Achille Roussel <achille.roussel@gmail.com>
13 months agoruntime: remove unused traceFutileWakeup
Michael Anthony Knyszek [Wed, 10 May 2023 01:06:21 +0000 (01:06 +0000)]
runtime: remove unused traceFutileWakeup

Also, document traceEvFutileWakeup as not currently used.

Change-Id: I75831a43d39b6c6ceb5a9b6320c3ae9455681572
Reviewed-on: https://go-review.googlesource.com/c/go/+/494184
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
13 months agoruntime: hide trace.shutdown behind traceShuttingDown
Michael Anthony Knyszek [Tue, 9 May 2023 20:02:24 +0000 (20:02 +0000)]
runtime: hide trace.shutdown behind traceShuttingDown

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

13 months agoruntime: replace trace.enabled with traceEnabled
Michael Anthony Knyszek [Tue, 9 May 2023 19:37:24 +0000 (19:37 +0000)]
runtime: replace trace.enabled with traceEnabled

[git-generate]
cd src/runtime
grep -l 'trace\.enabled' *.go | grep -v "trace.go" | xargs sed -i 's/trace\.enabled/traceEnabled()/g'

Change-Id: I14c7821c1134690b18c8abc0edd27abcdabcad72
Reviewed-on: https://go-review.googlesource.com/c/go/+/494181
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
13 months agocmd/compile/internal/pgo/internal/graph: delete dead code
Michael Pratt [Thu, 11 May 2023 19:27:12 +0000 (15:27 -0400)]
cmd/compile/internal/pgo/internal/graph: delete dead code

We don't use large swaths of this package. Delete the code. We can
always bring it back later if needed.

Change-Id: I6b39a73ed9c48d2d5b37c14763d7bb7956f3ef43
Reviewed-on: https://go-review.googlesource.com/c/go/+/494438
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
13 months agocmd/compile/internal/pgo: move pprof graph to internal package
Michael Pratt [Thu, 11 May 2023 18:27:25 +0000 (14:27 -0400)]
cmd/compile/internal/pgo: move pprof graph to internal package

graph.go is a simplified fork of github.com/google/pprof/internal/graph,
which is used as an intermediate data structure to construct the final
graph exported by package pgo (IRGraph).

Exporting both is a bit confusing as the former is unused outside of the
package. Since the naming is also similar, move graph.go to its own
package entirely.

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

13 months agocmd/link: check DWARF section sizes separately
Cherry Mui [Thu, 11 May 2023 18:31:31 +0000 (14:31 -0400)]
cmd/link: check DWARF section sizes separately

Currently, we check the total size of all data+DWARF sections
doesn't exceed 2 GB, which doesn't make sense. We should check
data and DWARF separately. And for DWARF, check each section
separately, as we use section offset for references.

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

13 months agoruntime: add traceEnabled function
Michael Anthony Knyszek [Tue, 9 May 2023 19:36:13 +0000 (19:36 +0000)]
runtime: add traceEnabled function

This change introduces the trivial traceEnabled function to help tighten
up the execution tracer's API in preparation for the execution trace
redesign GOEXPERIMENT.

A follow-up change will refactor the runtime to use it.

Change-Id: I19c8728e30aefe543b4a826d95446affa14897e3
Reviewed-on: https://go-review.googlesource.com/c/go/+/494180
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
13 months agoruntime: hide trace lock init details
Michael Anthony Knyszek [Tue, 9 May 2023 19:48:29 +0000 (19:48 +0000)]
runtime: hide trace lock init details

This change is in service of hiding more execution trace implementation
details for big changes to come.

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

13 months agocmd/compile: remove "WORK IN PROGRESS" from package pgo
Michael Pratt [Wed, 10 May 2023 21:40:01 +0000 (17:40 -0400)]
cmd/compile: remove "WORK IN PROGRESS" from package pgo

Work continues on PGO, but the existing support is certainly working.

Change-Id: Ic6724b9b3f174f24662468000d771f7651bb18b0
Reviewed-on: https://go-review.googlesource.com/c/go/+/494435
Auto-Submit: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Commit-Queue: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

13 months agoos: make Chtimes accept empty time values to skip file time modification
Constantin Konstantinidis [Mon, 19 Oct 2020 17:19:17 +0000 (19:19 +0200)]
os: make Chtimes accept empty time values to skip file time modification

Empty time value time.Time{} leaves the corresponding time of the file
unchanged.

Fixes #32558

Change-Id: I1aff42f30668ff505ecec2e9509d8f2b8e4b1b6a
Reviewed-on: https://go-review.googlesource.com/c/go/+/219638
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
13 months agoRevert "runtime: rename getcallerfp to getfp"
Michael Pratt [Thu, 11 May 2023 17:01:44 +0000 (17:01 +0000)]
Revert "runtime: rename getcallerfp to getfp"

This reverts CL 481617.

Reason for revert: breaks test build on Windows

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

13 months agonet: force cgo for myhostname and mdns nss modules for LookupAddr on unix
Mateusz Poliwczak [Sun, 7 May 2023 16:46:42 +0000 (16:46 +0000)]
net: force cgo for myhostname and mdns nss modules for LookupAddr on unix

Currently there is a small bug in the LookupAddr for unix systems
that causes the use of go resolver instead of the cgo one.
Example for nss myhostname:

func main() {
        fmt.Println(net.LookupAddr(os.Args[1]))
}

root@arch:~# cat /etc/nsswitch.conf | grep host
hosts:          myhostname dns
root@arch:~# GODEBUG=netdns=+3 go run main.go 192.168.1.200
go package net: confVal.netCgo = false  netGo = false
go package net: dynamic selection of DNS resolver
go package net: hostLookupOrder() = dns
[] lookup 200.1.168.192.in-addr.arpa. on 8.8.8.8:53: no such host
root@arch:~# GODEBUG=netdns=go+3 go run main.go 192.168.1.200
go package net: confVal.netCgo = false  netGo = true
go package net: GODEBUG setting forcing use of Go's resolver
go package net: hostLookupOrder() = dns
[] lookup 200.1.168.192.in-addr.arpa. on 8.8.8.8:53: no such host
root@arch:~# GODEBUG=netdns=cgo+3 go run main.go 192.168.1.200
go package net: confVal.netCgo = true  netGo = false
go package net: using cgo DNS resolver
go package net: hostLookupOrder() = cgo
[arch] <nil>

The problem come from that we are only checking for hostnames that the
myhostname can resolve, but not for the addrs that it can also.

man  nss-myhostname:
       Please keep in mind that nss-myhostname (and nss-resolve) also
       resolve in the other direction — from locally attached IP
       addresses to hostnames.

Change-Id: Ic18a9f99a2214b2938463e9a95f7f3ca5db1c01b
GitHub-Last-Rev: ade40fd3e3057de418b9b6a79f79fb9a53fb6c09
GitHub-Pull-Request: golang/go#59921
Reviewed-on: https://go-review.googlesource.com/c/go/+/491235
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Mateusz Poliwczak <mpoliwczak34@gmail.com>

13 months agonet: use the lookupOrder for go resolver LookupAddr
Mateusz Poliwczak [Sun, 7 May 2023 13:51:15 +0000 (13:51 +0000)]
net: use the lookupOrder for go resolver LookupAddr

To mach the cgo version behaviour and the LookupHost (go resolver).

Change-Id: I7dc3424d508a62e67f20c7810743399c35a9b60c
GitHub-Last-Rev: 29924c13a6c0598bf58b7fc3fae74b10bab0f0ee
GitHub-Pull-Request: golang/go#60024
Reviewed-on: https://go-review.googlesource.com/c/go/+/493235
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
13 months agocmd/compile: remove go:wasmimport restriction
Johan Brandhorst-Satzkorn [Wed, 26 Apr 2023 15:18:10 +0000 (08:18 -0700)]
cmd/compile: remove go:wasmimport restriction

Removes the package restriction on go:wasmimport, allowing the
use of it globally and in user code.

Fixes #59149

Change-Id: Ib26f628dc8dafb31388005b50449e91b47dab447
Reviewed-on: https://go-review.googlesource.com/c/go/+/489255
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Reviewed-by: Eli Bendersky <eliben@google.com>
Auto-Submit: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
13 months agoruntime: rename getcallerfp to getfp
Felix Geisendörfer [Mon, 3 Apr 2023 23:10:55 +0000 (01:10 +0200)]
runtime: rename getcallerfp to getfp

The previous name was wrong due to the mistaken assumption that calling
f->g->getcallerpc and f->g->getcallersp would respectively return the
pc/sp at g. However, they are actually referring to their caller's
caller, i.e. f.

Rename getcallerfp to getfp in order to stay consistent with this
naming convention.

Also see discussion on CL 463835.

For #16638

Change-Id: I07990645da78819efd3db92f643326652ee516f8
Reviewed-on: https://go-review.googlesource.com/c/go/+/481617
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Felix Geisendörfer <felix.geisendoerfer@datadoghq.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

13 months agomisc/wasm: add wasmedge to wasip1 script
Johan Brandhorst-Satzkorn [Wed, 10 May 2023 03:32:19 +0000 (20:32 -0700)]
misc/wasm: add wasmedge to wasip1 script

The wasmedge runtime will be used to test our wasip1
implementation against the WASI runtime from wasmedge.org.

For #60097

Change-Id: Ib0e886de46240b4d43d02ec8a7bc7cea0730c162
Reviewed-on: https://go-review.googlesource.com/c/go/+/494120
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>

13 months agocmd/compile: remove debugging option InlineSCCOnePass from inliner
Than McIntosh [Mon, 1 May 2023 19:23:42 +0000 (15:23 -0400)]
cmd/compile: remove debugging option InlineSCCOnePass from inliner

Delete the "InlineSCCOnePass" debugging flag and the inliner fallback
code that kicks in if it is used. The change it was intended to guard
has been working on tip for some time, no need for the fallback any
more.

Updates #58905.

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

13 months agointernal/reflectlite: common up types, remove code
David Chase [Wed, 26 Apr 2023 19:30:04 +0000 (15:30 -0400)]
internal/reflectlite: common up types, remove code

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

13 months agoruntime: move per-type types to internal/abi
David Chase [Tue, 25 Apr 2023 23:14:05 +0000 (19:14 -0400)]
runtime: move per-type types to internal/abi

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

13 months agoruntime: redefine _type to abi.Type; add rtype for methods.
David Chase [Mon, 24 Apr 2023 19:45:33 +0000 (15:45 -0400)]
runtime: redefine _type to abi.Type; add rtype for methods.

Change-Id: I1c478b704d84811caa209006c657dda82d9c4cf9
Reviewed-on: https://go-review.googlesource.com/c/go/+/488435
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
13 months agointernal/bisect: copy parser changes from CL 494177
Russ Cox [Wed, 10 May 2023 19:51:46 +0000 (15:51 -0400)]
internal/bisect: copy parser changes from CL 494177

x/tools/cmd/bisect is changing to emit hex skips for robustness.
Update this copy of internal/bisect to understand them.

Change-Id: Ie9445714e8e9fb594e656db2f94dcde9b6ce82d1
Reviewed-on: https://go-review.googlesource.com/c/go/+/494178
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

13 months agoreflect: change rtype so that it (not *rtype) implements Type
David Chase [Fri, 21 Apr 2023 17:40:58 +0000 (13:40 -0400)]
reflect: change rtype so that it (not *rtype) implements Type

The abi.Type field was changed to *abi.Type, thus the
bitwise representation is the same, many casts are now
avoided and replace by either rtype{afoo} or rfoo.Type.

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

13 months agoreflect: replacing almost all use of *rtype with *abi.Type
David Chase [Thu, 20 Apr 2023 21:13:11 +0000 (17:13 -0400)]
reflect: replacing almost all use of *rtype with *abi.Type

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

13 months agoreflect: move funcType to abi/type.go
David Chase [Wed, 19 Apr 2023 17:49:04 +0000 (13:49 -0400)]
reflect: move funcType to abi/type.go

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

13 months agoreflect: prepare fieldnames for moving to abi/type.go
David Chase [Wed, 19 Apr 2023 17:47:53 +0000 (13:47 -0400)]
reflect: prepare fieldnames for moving to abi/type.go

Change-Id: Ia8e88029d29a1210dc7a321578e61336e235f35a
Reviewed-on: https://go-review.googlesource.com/c/go/+/487555
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
13 months agointernal/abi,reflectlite,reflect,runtime: common up chan type
David Chase [Fri, 14 Apr 2023 22:18:01 +0000 (18:18 -0400)]
internal/abi,reflectlite,reflect,runtime: common up chan type

Change-Id: I085b61c544b85d70fabb1c0d9fe91207826dd21a
Reviewed-on: https://go-review.googlesource.com/c/go/+/484858
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@google.com>
13 months agoreflect: move more types, constants, functions into internal/abi
David Chase [Fri, 14 Apr 2023 18:11:45 +0000 (14:11 -0400)]
reflect: move more types, constants, functions into internal/abi

Change-Id: Ib9cd15576896225e7c5e6fda11f1a77f6993a91a
Reviewed-on: https://go-review.googlesource.com/c/go/+/484857
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
13 months agointernal/reflectlite, runtime: move more constants and types into internal/abi
David Chase [Fri, 14 Apr 2023 18:09:12 +0000 (14:09 -0400)]
internal/reflectlite, runtime: move more constants and types into internal/abi

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

13 months agointernal/abi: common up ArrayType
David Chase [Tue, 7 Feb 2023 22:43:34 +0000 (17:43 -0500)]
internal/abi: common up ArrayType

This refactoring is more problematic because the client
package wrap abi.Type, thus the self-referential fields
within ArrayType need to be downcast to the client wrappers
in several places.  It's not clear to me this is worthwhile;
this CL is for additional comment, before I attempt similar
changes for other self-referential types.

Change-Id: I41e517e6d851b32560c41676b91b76d7eb17c951
Reviewed-on: https://go-review.googlesource.com/c/go/+/466236
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
13 months agointernal/abi: common up some offset/size functions
David Chase [Mon, 13 Feb 2023 23:52:16 +0000 (18:52 -0500)]
internal/abi: common up some offset/size functions

Change-Id: I92eeed20af35c7dec309457a80b8fd44eb70b57f
Reviewed-on: https://go-review.googlesource.com/c/go/+/467876
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@google.com>
13 months agocmd/link: clean up per-binary slice creation in ld
David Chase [Thu, 19 Jan 2023 18:12:54 +0000 (13:12 -0500)]
cmd/link: clean up per-binary slice creation in ld

A code cleanup opportunity noticed while trying to make slices
be aligned.

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

13 months agointernal/abi: common up Method, Imethod, UncommonType types
David Chase [Mon, 23 Jan 2023 22:34:18 +0000 (17:34 -0500)]
internal/abi: common up Method, Imethod, UncommonType types

was two commits, the first contained a lot of intermediate work,
better this way.

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

13 months agointernal/godebug: make test godebug calls not vary
David Chase [Tue, 9 May 2023 21:23:39 +0000 (17:23 -0400)]
internal/godebug: make test godebug calls not vary

I think there may be an issue in bisect search with
change set elements not actually being independent,
to be explored later.  For now, modify the test to
remove that property.

Change-Id: I4b171bc024795d950cf4663374ad1dfc4e2952fc
Reviewed-on: https://go-review.googlesource.com/c/go/+/494036
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
13 months agohtml: convert fuzz test to native Go fuzzing
Tobias Klauser [Wed, 10 May 2023 15:08:59 +0000 (17:08 +0200)]
html: convert fuzz test to native Go fuzzing

Convert the existing gofuzz based fuzz test to a testing.F based fuzz
test.

Change-Id: Ieae69ba7fb17bd54d95c7bb2f4ed04c323c9f15f
Reviewed-on: https://go-review.googlesource.com/c/go/+/494195
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>

13 months agocmd/compile: add ability to print extra information in bisect output
Russ Cox [Tue, 9 May 2023 16:09:45 +0000 (12:09 -0400)]
cmd/compile: add ability to print extra information in bisect output

Change-Id: I619c21ab9754f67b69215cfed238a3e489c7fbcf
Reviewed-on: https://go-review.googlesource.com/c/go/+/493955
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>

13 months agonet/http: let ErrNotSupported match errors.ErrUnsupported
Ian Lance Taylor [Wed, 10 May 2023 19:47:06 +0000 (12:47 -0700)]
net/http: let ErrNotSupported match errors.ErrUnsupported

For #41198

Change-Id: Ibb030e94618a1f594cfd98ddea214ad7a88d2e73
Reviewed-on: https://go-review.googlesource.com/c/go/+/494122
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

13 months agogo/types, types2: move xlist next to targs in Checker.arguments signature
Robert Griesemer [Wed, 10 May 2023 16:06:33 +0000 (09:06 -0700)]
go/types, types2: move xlist next to targs in Checker.arguments signature

targs and xlist belong together (xlist contains the type expressions for
each of the type arguments).

Also, in builtins.go, rename xlist to alist2 to avoid some confusion.

Preparation for adding more parameters to the Checker.arguments signature.

Change-Id: I960501cfd2b88410ec0d581a6520a4e80fcdc56a
Reviewed-on: https://go-review.googlesource.com/c/go/+/494121
Auto-Submit: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
13 months agocmd/compile: add De Morgan's rewrite rule
Stefan [Wed, 10 May 2023 01:34:47 +0000 (01:34 +0000)]
cmd/compile: add De Morgan's rewrite rule

Adds rules that rewrites statements such as ~P&~Q as ~(P|Q) and ~P|~Q as ~(P&Q), removing an extraneous instruction.

Change-Id: Icedb97df741680ddf9799df79df78657173aa500
GitHub-Last-Rev: f22e2350c95e9052e990b2351c3c2b0af810e381
GitHub-Pull-Request: golang/go#60018
Reviewed-on: https://go-review.googlesource.com/c/go/+/493175
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Stefan M <st3f4nm4d4@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
13 months agogo/types, types2: control type inference in Checker.funcInst via infer argument
Robert Griesemer [Tue, 9 May 2023 22:40:36 +0000 (15:40 -0700)]
go/types, types2: control type inference in Checker.funcInst via infer argument

If the infer argument is true, funcInst behaves as before.
If infer is false and there are not enough type arguments,
rather then inferring the missing arguments and instantiating
the function, funcInst returns the found type arguments.

This permits the use of funcInst (and all the checks it does)
to collect the type arguments for partially instantiated
generic functions used as arguments to other functions.

For #59338.

Change-Id: I049034dfde52bd7ff4ae72964ff1708e154e5042
Reviewed-on: https://go-review.googlesource.com/c/go/+/494118
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
13 months agocmd/go/internal: update documentation of go test and go generate
Shogo Hida [Wed, 10 May 2023 14:41:06 +0000 (14:41 +0000)]
cmd/go/internal: update documentation of go test and go generate

Fixes #57050

Change-Id: I46cac667ff78ac171c878f4366f8f01f58f1d27d
GitHub-Last-Rev: 697c255ece18cd4772b76d62991474a7da2536d8
GitHub-Pull-Request: golang/go#57814
Reviewed-on: https://go-review.googlesource.com/c/go/+/461683
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
13 months agocmd/go/internal/modload: skip reading go.mod files for imports in 'go mod tidy' of...
Bryan C. Mills [Fri, 5 May 2023 20:50:56 +0000 (16:50 -0400)]
cmd/go/internal/modload: skip reading go.mod files for imports in 'go mod tidy' of modules before 'go 1.21'

This eliminate a network access in 'go mod tidy' of an already-tidy
module, which would otherwise be needed to fetch go.mod checksums for
the test dependencies whose go.mod checksums were omitted in Go
releases between Go 1.17 and 1.20 due to bug #56222.

For modules between 'go 1.17' and 'go 1.20' we intentionally preserve
the old 'go mod tidy' output (omitting go.sum entries for the go.mod
files of test dependencies of external packages). We should also avoid
performing extra sumdb lookups for checksums that would be discarded
anyway.

Updates #56222.

Change-Id: I7f0f1c8e902db0e3414c819621c4b99052f503f0
Reviewed-on: https://go-review.googlesource.com/c/go/+/492741
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

13 months agocmd/internal/obj/riscv: regenerate instruction encoding table
Meng Zhuo [Sat, 6 May 2023 09:34:41 +0000 (17:34 +0800)]
cmd/internal/obj/riscv: regenerate instruction encoding table

This CL updates riscv instructions by
https://github.com/riscv/riscv-opcodes

which adds instruction:
APAUSE

And removes the following unused instructions:
AFENCEI
AFMVQX
AFMVXQ
AHFENCEGVMA
AHFENCEVVMA
ASLLIRV32
ASRAIRV32
ASRLIRV32
AURET

Change-Id: I314570c643af3e6bbc9d2cd471b6b39985bcbdff
Reviewed-on: https://go-review.googlesource.com/c/go/+/409415
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Reviewed-by: Joel Sing <joel@sing.id.au>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: M Zhuo <mzh@golangcn.org>

13 months agogo/types, types2: explicitly look for nil type arguments in infer
Robert Griesemer [Tue, 9 May 2023 21:02:07 +0000 (14:02 -0700)]
go/types, types2: explicitly look for nil type arguments in infer

Don't assume we have all type arguments if the number of type arguments
matches the number of type parameters. Instead, look explicitly for nil
type arguments in the provided targs.

Preparation for type inference with type arguments provided for type
parameters of generic function arguments passed to other functions.

For #59338.

Change-Id: I00918cd5ed06ae3277b4e41a3641063e0f53fef0
Reviewed-on: https://go-review.googlesource.com/c/go/+/494115
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

13 months agoencoding/csv: update doc comment of Read method
IvoGoman [Tue, 9 May 2023 20:46:23 +0000 (20:46 +0000)]
encoding/csv: update doc comment of Read method

This updates the doc comment to reflect the behavior of the method.
On error the method returns a partial result.

Fixes #59991

Change-Id: I71e9dfa37e0488c85abd3eeede2a1a34cb74239b
GitHub-Last-Rev: 389488e5364dc939f0cbd11f99eb56001b5237a2
GitHub-Pull-Request: golang/go#60084
Reviewed-on: https://go-review.googlesource.com/c/go/+/494055
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>

13 months agoall: fix a lot of comments
cui fliter [Fri, 5 May 2023 16:11:33 +0000 (00:11 +0800)]
all: fix a lot of comments

Fix comments, including duplicate is, wrong phrases and articles, misspellings, etc.

Change-Id: I8bfea53b9b275e649757cc4bee6a8a026ed9c7a4
Reviewed-on: https://go-review.googlesource.com/c/go/+/493035
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: shuang cui <imcusg@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>

13 months agolog/slog: test built-in handlers with slogtest
Jonathan Amsterdam [Mon, 24 Apr 2023 18:19:20 +0000 (14:19 -0400)]
log/slog: test built-in handlers with slogtest

Test the built-in handlers using the testing/slogtest package.

Change-Id: I6464b6730293461c38b84fb2bf33cdd09173dd6e
Reviewed-on: https://go-review.googlesource.com/c/go/+/488255
Run-TryBot: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

13 months agolog/slog: add json struct tags to Source
Jonathan Amsterdam [Tue, 9 May 2023 20:22:09 +0000 (16:22 -0400)]
log/slog: add json struct tags to Source

Add tags to the fields of Source that lower-cases their names for JSON.
The implementation still treats Source specially for performance, but
now the result would be identical if it did not.

Change-Id: I5fd2e500f1a301db62af87be8b877ecd954a26ec
Reviewed-on: https://go-review.googlesource.com/c/go/+/494035
Run-TryBot: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

13 months agocmd: use slices.Equal to simplify code
cui fliter [Thu, 4 May 2023 11:30:53 +0000 (19:30 +0800)]
cmd: use slices.Equal to simplify code

#57433 added slices.Equal, using it can reduce the amount of code

Change-Id: I70d14b6c4c24da641a34ed36c900d9291033f526
Reviewed-on: https://go-review.googlesource.com/c/go/+/492576
Reviewed-by: Than McIntosh <thanm@google.com>
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>
Run-TryBot: shuang cui <imcusg@gmail.com>

13 months agoruntime: fix misaligned SP for libfuzzer entry
Keith Randall [Tue, 9 May 2023 22:55:45 +0000 (15:55 -0700)]
runtime: fix misaligned SP for libfuzzer entry

libfuzzer is written in C and so requires by the C abi that SP be
aligned correctly mod 16. Normally CALLs need to have SP aligned to 0
mod 16, but because we're simulating a CALL (which pushes a return
address) with a JMP (which doesn't), we need to align to 8 mod 16
before JMPing.

This is not causing any current problems that I know of. All the
functions called from this callsite that I checked don't rely on
correct alignment.  So this CL is just futureproofing.

Update #49075

Change-Id: I13fcbe9aaf2853056a6d44dc3aa64b7db689e144
Reviewed-on: https://go-review.googlesource.com/c/go/+/494117
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>
13 months agosyscall,internal/poll: move pipe check from syscall.Seek to callers
qmuntal [Tue, 9 May 2023 14:16:42 +0000 (16:16 +0200)]
syscall,internal/poll: move pipe check from syscall.Seek to callers

On Windows, syscall.Seek is a thin wrapper over SetFilePointerEx [1],
which does not work on pipes, although it doesn't return an error on
that case. To avoid this undefined behavior, Seek defensively
calls GetFileType and errors if the type is FILE_TYPE_PIPE.

The problem with this approach is that Seek is a low level
foundational function that can be called many times for the same file,
and the additional cgo call (GetFileType) will artificially slow
down seek operations. I've seen GetFileType to account for 10% of cpu
time in seek-intensive workloads.

A better approach, implemented in this CL, would be to move the check
one level up, where many times the file type is already known so the
GetFileType is unnecessary.

The drawback is that syscall.Seek has had this behavior since pipes
where first introduced to Windows in
https://codereview.appspot.com/1715046 and someone could be relying on
it. On the other hand, this behavior is not documented, so we couldn't
be breaking any contract.

[1] https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-setfilepointerex

Change-Id: I7602182f9d08632e22a8a1635bc8ad9ad35a5056
Reviewed-on: https://go-review.googlesource.com/c/go/+/493626
Run-TryBot: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
13 months agointernal/bisect: adjust stack PCs relative to Callers[2]
David Chase [Tue, 9 May 2023 19:03:48 +0000 (15:03 -0400)]
internal/bisect: adjust stack PCs relative to Callers[2]

This is necessary to make hashes be consistent across runs,
otherwise ASLR messes up search.

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

13 months agocmd/go: fix cgo prefix mapping for non-vendored modules
qmuntal [Tue, 9 May 2023 11:02:26 +0000 (13:02 +0200)]
cmd/go: fix cgo prefix mapping for non-vendored modules

Regression introduced in CL 478455.

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

13 months agoruntime: exclude extra M's from debug.SetMaxThreads
Michael Pratt [Fri, 5 May 2023 20:58:43 +0000 (16:58 -0400)]
runtime: exclude extra M's from debug.SetMaxThreads

The purpose of the debug.SetMaxThreads limit is to avoid accidental fork
bomb from something like millions of goroutines blocking on system
calls, causing the runtime to create millions of threads.

By definition we don't create threads created in C, so this isn't a
problem for those threads, and we can exclude them from the limit. If C
wants to create tens of thousands of threads, who are we to say no?

Fixes #60004.

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

13 months agomisc/wasm: add wasmer to wasip1 script
Johan Brandhorst-Satzkorn [Tue, 9 May 2023 05:21:19 +0000 (22:21 -0700)]
misc/wasm: add wasmer to wasip1 script

The wasmer runtime will be used to test our wasip1
implementation against the WASI runtime from wasmer.io.

For #59907

Change-Id: Ie7e48c39e03075815ddca46d996b6ec87009b12a
Reviewed-on: https://go-review.googlesource.com/c/go/+/493775
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
13 months agocmd/compile: remove FS debug hash form
Russ Cox [Tue, 9 May 2023 03:31:00 +0000 (23:31 -0400)]
cmd/compile: remove FS debug hash form

The FS form was only necessary for reliable hashes in tests,
and for that we can use -trimpath.

Another potential concern would be temporary work directory
names leaking into the names of files generated by cgo and the
like, but we already make sure to avoid those to ensure
reproducible builds: the compiler never sees those paths.
So the FS form is not necessary for that either.

Change-Id: Idae2c6acb22ab64dfb33bb053244d23fbe153830
Reviewed-on: https://go-review.googlesource.com/c/go/+/493737
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
13 months agocmd/compile: use more of internal/bisect in HashDebug
Russ Cox [Tue, 9 May 2023 03:18:38 +0000 (23:18 -0400)]
cmd/compile: use more of internal/bisect in HashDebug

Using more of internal/bisect gives us more that will be deleted
from base/hashdebug.go when we have updated the tools that
need the old protocol. It is also cheaper: there is no allocation to
make a decision about whether to enable, and no locking unless
printing is needed.

Change-Id: I43ec398461205a1a9e988512a134ed6b3a3b1587
Reviewed-on: https://go-review.googlesource.com/c/go/+/493736
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
13 months agocmd/compile: standardize on outer-to-inner for pos lists
Russ Cox [Tue, 9 May 2023 00:23:40 +0000 (20:23 -0400)]
cmd/compile: standardize on outer-to-inner for pos lists

The call sites that cared all reversed inner-to-outer to outer-to-inner already.
The ones that didn't care left it alone. No one explicitly wanted inner-to-outer.
Also change to a callback-based interface, so that call sites aren't required
to accumulate the results in a slice (the main reason for that before was to
reverse the slice!).

There were three places where these lists were printed:

1. -d=ssa/genssa/dump, explicitly reversing to outer-to-inner
2. node dumps like -W, leaving the default inner-to-outer
3. file positions for HashDebugs, explicitly reversing to outer-to-inner

It makes no sense that (1) and (2) would differ. The reason they do is that
the code for (2) was too lazy to bother to fix it to be the right way.

Consider this program:

package p

func f() {
g()
}

func g() {
println()
}

Both before and after this change, the ssa dump for f looks like:

# x.go:3
        00000 (3)  TEXT <unlinkable>.f(SB), ABIInternal
        00001 (3)  FUNCDATA $0, gclocals·g2BeySu+wFnoycgXfElmcg==(SB)
        00002 (3)  FUNCDATA $1, gclocals·g2BeySu+wFnoycgXfElmcg==(SB)
 v4     00003 (-4)  XCHGL AX, AX
# x.go:4
# x.go:8
 v5     00004 (+8)  PCDATA $1, $0
 v5     00005 (+8)  CALL runtime.printlock(SB)
 v7     00006 (-8)  CALL runtime.printnl(SB)
 v9     00007 (-8)  CALL runtime.printunlock(SB)
# x.go:5
 b2     00008 (5)  RET
        00009 (?)  END

Note # x.go:4 (f) then # x.go:8 (g, called from f) between v4 and v5.

The -W node dumps used the opposite order:

before walk f
.   AS2 Def tc(1) # x.go:4:3
.   INLMARK # +x.go:4:3
.   PRINTN tc(1) # x.go:8:9,x.go:4:3
.   LABEL p..i0 # x.go:4:3

Now they match the ssa dump order, and they use spaces as separators,
to avoid potential problems with commas in some editors.

before walk f
.   AS2 Def tc(1) # x.go:4:3
.   INLMARK # +x.go:4:3
.   PRINTN tc(1) # x.go:4:3 x.go:8:9
.   LABEL p..i0 # x.go:4:3

I'm unaware of any argument for the old order other than it was easier
to compute without allocation. The new code uses recursion to reverse
the order without allocation.

Now that the callers get the results outer-to-inner, most don't need
any slices at all.

This change is particularly important for HashDebug, which had been
using a locked temporary slice to walk the inline stack without allocation.
Now the temporary slice is gone.

Change-Id: I5cb6d76b2f950db67b248acc928e47a0460569f9
Reviewed-on: https://go-review.googlesource.com/c/go/+/493735
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Russ Cox <rsc@golang.org>

13 months agointernal/godebug: add bisect support
Russ Cox [Wed, 3 May 2023 13:54:46 +0000 (09:54 -0400)]
internal/godebug: add bisect support

CL 491875 introduces a new bisect command, which we plan to
document for use by end users to debug semantic changes in
the compiler and in GODEBUGs.

This CL adds bisect support to GODEBUGs, at least the ones
used via internal/godebug. Support for runtime-internal
GODEBUGs like panicnil will take a bit more work in followup CLs.

The new API in internal/bisect to support stack-based bisecting
should be easily reusable in non-GODEBUG settings as well,
once we finalize and export the API.

Change-Id: I6cf779c775329aceb3f3b2b2b2f221ce8a67deee
Reviewed-on: https://go-review.googlesource.com/c/go/+/491975
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>

13 months agoruntime: calculate nanoseconds in usleep on linux/loong64
Guoqi Chen [Tue, 28 Mar 2023 21:08:28 +0000 (05:08 +0800)]
runtime: calculate nanoseconds in usleep on linux/loong64

Change-Id: Ia4cfdea3df8834e6260527ce8e6e894a0547070f
Reviewed-on: https://go-review.googlesource.com/c/go/+/425299
Reviewed-by: xiaodong liu <teaofmoli@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: WANG Xuerui <git@xen0n.name>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: WANG Xuerui <git@xen0n.name>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
13 months agonet: correct Dialer.ControlContext documentation
Jabar Asadi [Tue, 2 May 2023 17:49:52 +0000 (17:49 +0000)]
net: correct Dialer.ControlContext documentation

Change-Id: I4ec5883fc8713e0f711bb6beff45f426dae8f9f4
GitHub-Last-Rev: 9ea0c1505c2f3974e5d224299db5f888a4cf7618
GitHub-Pull-Request: golang/go#59819
Reviewed-on: https://go-review.googlesource.com/c/go/+/488315
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>

13 months agocmd/link/internal/ppc64: fix export of R_DWARFSECREF to ELF on ppc64
Paul E. Murphy [Thu, 4 May 2023 18:14:52 +0000 (13:14 -0500)]
cmd/link/internal/ppc64: fix export of R_DWARFSECREF to ELF on ppc64

Today, external linking is not supported on any ppc64 ELF target, but
soon openbsd will be enabled with external linking support.

This relocation does not require additional endian specific fixups
like most other PPC64 Go relocation types.

I discovered this during an experiment to support external linking
on ppc64/linux.

Change-Id: I0b12b6172c7ba08df1c8cf024b4aa5e7ee76d0c4
Reviewed-on: https://go-review.googlesource.com/c/go/+/492618
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Paul Murphy <murp@ibm.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
13 months agonet/http: regenerate h2_bundle.go
Bryan C. Mills [Tue, 9 May 2023 13:00:02 +0000 (09:00 -0400)]
net/http: regenerate h2_bundle.go

The x/net version was updated in CL 493596; cmd/internal/moddeps
catches the skew, but only runs on the -longtest builders (because it
requires network access for the bundle tool and x/net dependency).

Change-Id: I48891d51aab23b2ca6f4484215438c60bd8c8c21
Reviewed-on: https://go-review.googlesource.com/c/go/+/493875
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
13 months agocmd/compile/loopvar: adjust logging messages
David Chase [Fri, 5 May 2023 20:29:37 +0000 (16:29 -0400)]
cmd/compile/loopvar: adjust logging messages

Michael Stapelberg thought the former messages had
upside potential, Russ and I agreed.

Also slightly tweaked the json logging, not sure if
anyone will use it but it should at least be okay.

Change-Id: Iaab75114dd5f5d8f011fab22d32b57abc0272815
Reviewed-on: https://go-review.googlesource.com/c/go/+/493135
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: David Chase <drchase@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Michael Stapelberg <stapelberg@google.com>
13 months agocmd: vendor golang.org/x/tools/cmd/bisect
Russ Cox [Mon, 8 May 2023 17:39:27 +0000 (13:39 -0400)]
cmd: vendor golang.org/x/tools/cmd/bisect

Vendoring for use with the internal/godebug test
and eventually the cmd/compile test as well.

Change-Id: I3f7151949cff584705cb32ba39bf5de5cd45c3f2
Reviewed-on: https://go-review.googlesource.com/c/go/+/493597
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

13 months agocmd: go get golang.org/x/tools@8f7fb01dd429 and revendor
Russ Cox [Mon, 8 May 2023 17:38:04 +0000 (13:38 -0400)]
cmd: go get golang.org/x/tools@8f7fb01dd429 and revendor

go get golang.org/x/tools@8f7fb01dd429 # CL 493619
go mod tidy
go mod vendor

The goal is to set up for importing the bisect command,
for use in tests, in a follow-up CL.

This also updates x/sys and x/net, including in std,
because x/tools now depends on newer versions of those.

Change-Id: I24c283cc165464d9c873ba7a9a4e75a9d02919b2
Reviewed-on: https://go-review.googlesource.com/c/go/+/493596
Reviewed-by: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>

13 months agogo/types, types2: infer minimum default type for untyped arguments
Robert Griesemer [Thu, 4 May 2023 17:38:58 +0000 (10:38 -0700)]
go/types, types2: infer minimum default type for untyped arguments

This implements the proposal #58671.
Must be explicitly enabled and requires proposal approval.

For #58671.

Change-Id: I150e78f4f3282d6b7cf9d90feeb5f1c5a36d8c38
Reviewed-on: https://go-review.googlesource.com/c/go/+/492835
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Robert Griesemer <gri@google.com>

13 months agogo/types, types2: move functions for untyped constants into const.go
Robert Griesemer [Mon, 8 May 2023 21:42:19 +0000 (14:42 -0700)]
go/types, types2: move functions for untyped constants into const.go

No changes to the moved functions.
Generate const.go for go/types.

Change-Id: I5ac412cecd9f618676a01138aed36428bbce3311
Reviewed-on: https://go-review.googlesource.com/c/go/+/493715
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

13 months agocmd/compile/internal/types2: pass pos argument to Checker.overflow
Robert Griesemer [Mon, 8 May 2023 21:46:17 +0000 (14:46 -0700)]
cmd/compile/internal/types2: pass pos argument to Checker.overflow

This matches the go/types version of Checker.overflow.
Preparation for generating this function (and others)
for go/types.

Change-Id: I84117203247011bd2e96c9cf53fd5a443e528bbf
Reviewed-on: https://go-review.googlesource.com/c/go/+/493558
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>

13 months agogo/types, types2: remove genericMultiExpr (inline it in genericExprList)
Robert Griesemer [Mon, 8 May 2023 20:01:21 +0000 (13:01 -0700)]
go/types, types2: remove genericMultiExpr (inline it in genericExprList)

Also, remove named return values for exprList, genericExprList.

Change-Id: I099abff4572530dd0c3b39c92d6b9a4662d95c2d
Reviewed-on: https://go-review.googlesource.com/c/go/+/493557
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

13 months agoall: make safe for new vet analyzer
Russ Cox [Mon, 8 May 2023 18:03:02 +0000 (14:03 -0400)]
all: make safe for new vet analyzer

The unused analyzer handles dot imports now, so a few tests
have picked up vet errors. This CL errors like:

context/x_test.go:524:47: result of context.WithValue call not used

Change-Id: I711a62fd7b50381f8ea45ac526bf0c946a171047
Reviewed-on: https://go-review.googlesource.com/c/go/+/493598
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
13 months agocmd/go/internal/envcmd: on unix pass script contents directly to sh -c
Michael Matloob [Mon, 8 May 2023 16:53:37 +0000 (12:53 -0400)]
cmd/go/internal/envcmd: on unix pass script contents directly to sh -c

Instead of writing them to a file and executing that file.

For #59998

Change-Id: I341786926762359f67dccb475295afbbb8ed1054
Reviewed-on: https://go-review.googlesource.com/c/go/+/493555
Run-TryBot: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
13 months agoruntime: remove TestCrashExitCode
qmuntal [Mon, 8 May 2023 11:31:37 +0000 (13:31 +0200)]
runtime: remove TestCrashExitCode

TestCrashExitCode was added in CL 491935 to test that the exit code
is honored when using GOTRACEBACK=crash, which is what normally happens
on a stock Windows. The problem is that some applications (not only WER,
as I incorrectly assumed in CL 491935) can hijack a crashing process
and change its exit code.

There is no way to tell if a crashing process using GOTRACEBACK=crash/
wer will have its error code hijacked, so we better don't test this
behavior, which in fact is not documented by the Go runtime.

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

13 months agotest: add memcombine testcases for ppc64
Lynn Boger [Thu, 4 May 2023 14:42:58 +0000 (09:42 -0500)]
test: add memcombine testcases for ppc64

Thanks to the recent addition of the memcombine pass, the
ppc64 ports now have the memcombine optimizations. Previously
in PPC64.rules, the memcombine rules were only added for
ppc64le targets due to the significant increase in size of
the rewritePPC64.go file when those rules were added. The
ppc64 and ppc64le rules had to be different because of the
byte order due to endianness differences.

This enables the memcombine tests to be run on ppc64 as well
as ppc64le.

Change-Id: I4081e2d94617a1b66541d536c0c2662e266c9c1e
Reviewed-on: https://go-review.googlesource.com/c/go/+/492615
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Lynn Boger <laboger@linux.vnet.ibm.com>

13 months agoruntime: clean up extra M API
Michael Pratt [Fri, 5 May 2023 20:35:10 +0000 (16:35 -0400)]
runtime: clean up extra M API

There are quite a few locations that get/put Ms from the extra M list,
but the API is pretty clumsy to use. Add an easier to use getExtraM /
putExtraM API.

There are only two minor semantic changes:

1. dropm no longer calls setg(nil) inside the lockextra critical
   section. It is important that this thread no longer references the G
   (and in turn M) once it is published to the extra M list and another
   thread could acquire it. But there is no reason that needs to happen
   only after lockextra.

2. extraMLength (renamed from extraMCount) is no longer protected by
   lockextra and is instead simply an atomic (though writes are still in
   the critical section). The previous readers all dropped lockextra
   before using the value they read anyway.

For #60004.

Change-Id: Ifca4d6c84d605423855d89f49af400ca07de56f4
Reviewed-on: https://go-review.googlesource.com/c/go/+/492742
Run-TryBot: Michael Pratt <mpratt@google.com>
Commit-Queue: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>

13 months agomath: optimize math.Abs on mipsx
Junxian Zhu [Fri, 14 Apr 2023 08:06:40 +0000 (16:06 +0800)]
math: optimize math.Abs on mipsx

This commit optimized math.Abs function implementation on mipsx.
Tested on loongson 3A2000.

goos: linux
goarch: mipsle
pkg: math
                      │   oldmath    │              newmath               │
                      │    sec/op    │   sec/op     vs base               │
Acos-4                   282.6n ± 0%   282.3n ± 0%        ~ (p=0.140 n=7)
Acosh-4                  506.1n ± 0%   451.8n ± 0%  -10.73% (p=0.001 n=7)
Asin-4                   272.3n ± 0%   272.2n ± 0%        ~ (p=0.808 n=7)
Asinh-4                  529.7n ± 0%   475.3n ± 0%  -10.27% (p=0.001 n=7)
Atan-4                   208.2n ± 0%   207.9n ± 0%        ~ (p=0.134 n=7)
Atanh-4                  503.4n ± 1%   449.7n ± 0%  -10.67% (p=0.001 n=7)
Atan2-4                  310.5n ± 0%   310.5n ± 0%        ~ (p=0.928 n=7)
Cbrt-4                   359.3n ± 0%   358.8n ± 0%        ~ (p=0.121 n=7)
Ceil-4                   203.9n ± 0%   204.0n ± 0%        ~ (p=0.600 n=7)
Compare-4                23.11n ± 0%   23.11n ± 0%        ~ (p=0.702 n=7)
Compare32-4              19.09n ± 0%   19.12n ± 0%        ~ (p=0.070 n=7)
Copysign-4               33.20n ± 0%   34.02n ± 0%   +2.47% (p=0.001 n=7)
Cos-4                    422.5n ± 0%   385.4n ± 1%   -8.78% (p=0.001 n=7)
Cosh-4                   628.0n ± 0%   545.5n ± 0%  -13.14% (p=0.001 n=7)
Erf-4                    193.7n ± 2%   192.7n ± 1%        ~ (p=0.430 n=7)
Erfc-4                   192.8n ± 1%   193.0n ± 0%        ~ (p=0.245 n=7)
Erfinv-4                 220.7n ± 1%   221.5n ± 2%        ~ (p=0.272 n=7)
Erfcinv-4                221.3n ± 1%   220.4n ± 2%        ~ (p=0.738 n=7)
Exp-4                    471.4n ± 0%   435.1n ± 0%   -7.70% (p=0.001 n=7)
ExpGo-4                  470.6n ± 0%   434.0n ± 0%   -7.78% (p=0.001 n=7)
Expm1-4                  243.1n ± 0%   243.4n ± 0%        ~ (p=0.417 n=7)
Exp2-4                   463.1n ± 0%   427.0n ± 0%   -7.80% (p=0.001 n=7)
Exp2Go-4                 462.4n ± 0%   426.2n ± 5%   -7.83% (p=0.001 n=7)
Abs-4                   37.000n ± 0%   8.039n ± 9%  -78.27% (p=0.001 n=7)
Dim-4                    18.09n ± 0%   18.11n ± 0%        ~ (p=0.094 n=7)
Floor-4                  151.9n ± 0%   151.8n ± 0%        ~ (p=0.190 n=7)
Max-4                    116.7n ± 1%   116.7n ± 1%        ~ (p=0.842 n=7)
Min-4                    116.6n ± 1%   116.6n ± 0%        ~ (p=0.464 n=7)
Mod-4                   1244.0n ± 0%   980.9n ± 0%  -21.15% (p=0.001 n=7)
Frexp-4                  199.0n ± 0%   146.7n ± 0%  -26.28% (p=0.001 n=7)
Gamma-4                  516.4n ± 0%   479.3n ± 1%   -7.18% (p=0.001 n=7)
Hypot-4                  169.8n ± 0%   117.8n ± 2%  -30.62% (p=0.001 n=7)
HypotGo-4                170.8n ± 0%   117.5n ± 0%  -31.21% (p=0.001 n=7)
Ilogb-4                  160.8n ± 0%   109.5n ± 0%  -31.90% (p=0.001 n=7)
J0-4                     1.359µ ± 0%   1.305µ ± 0%   -3.97% (p=0.001 n=7)
J1-4                     1.386µ ± 0%   1.334µ ± 0%   -3.75% (p=0.001 n=7)
Jn-4                     2.864µ ± 0%   2.758µ ± 0%   -3.70% (p=0.001 n=7)
Ldexp-4                  202.9n ± 0%   151.7n ± 0%  -25.23% (p=0.001 n=7)
Lgamma-4                 234.0n ± 0%   234.3n ± 0%        ~ (p=0.199 n=7)
Log-4                    444.1n ± 0%   407.9n ± 0%   -8.15% (p=0.001 n=7)
Logb-4                   157.8n ± 0%   121.6n ± 0%  -22.94% (p=0.001 n=7)
Log1p-4                  354.8n ± 0%   315.4n ± 0%  -11.10% (p=0.001 n=7)
Log10-4                  453.9n ± 0%   417.9n ± 0%   -7.93% (p=0.001 n=7)
Log2-4                   245.3n ± 0%   209.1n ± 0%  -14.76% (p=0.001 n=7)
Modf-4                   126.6n ± 0%   126.6n ± 0%        ~ (p=0.126 n=7)
Nextafter32-4            112.5n ± 0%   112.5n ± 0%        ~ (p=0.853 n=7)
Nextafter64-4            141.7n ± 0%   141.6n ± 0%        ~ (p=0.331 n=7)
PowInt-4                 878.8n ± 1%   758.3n ± 1%  -13.71% (p=0.001 n=7)
PowFrac-4                1.809µ ± 0%   1.615µ ± 0%  -10.72% (p=0.001 n=7)
Pow10Pos-4               18.10n ± 0%   18.12n ± 0%        ~ (p=0.464 n=7)
Pow10Neg-4               17.09n ± 0%   17.09n ± 0%        ~ (p=0.263 n=7)
Round-4                  68.36n ± 0%   68.33n ± 0%        ~ (p=0.325 n=7)
RoundToEven-4            78.40n ± 0%   78.40n ± 0%        ~ (p=0.934 n=7)
Remainder-4              894.0n ± 1%   753.4n ± 1%  -15.73% (p=0.001 n=7)
Signbit-4                18.09n ± 0%   18.09n ± 0%        ~ (p=0.761 n=7)
Sin-4                    389.8n ± 1%   389.8n ± 0%        ~ (p=0.995 n=7)
Sincos-4                 416.0n ± 0%   415.9n ± 0%        ~ (p=0.361 n=7)
Sinh-4                   634.6n ± 4%   585.6n ± 1%   -7.72% (p=0.001 n=7)
SqrtIndirect-4           8.035n ± 0%   8.036n ± 0%        ~ (p=0.523 n=7)
SqrtLatency-4            8.039n ± 0%   8.037n ± 0%        ~ (p=0.218 n=7)
SqrtIndirectLatency-4    8.040n ± 0%   8.040n ± 0%        ~ (p=0.652 n=7)
SqrtGoLatency-4          895.7n ± 0%   896.6n ± 0%   +0.10% (p=0.004 n=7)
SqrtPrime-4              5.406µ ± 0%   5.407µ ± 0%        ~ (p=0.592 n=7)
Tan-4                    406.1n ± 0%   405.8n ± 1%        ~ (p=0.435 n=7)
Tanh-4                   627.6n ± 0%   545.5n ± 0%  -13.08% (p=0.001 n=7)
Trunc-4                  146.7n ± 1%   146.7n ± 0%        ~ (p=0.755 n=7)
Y0-4                     1.359µ ± 0%   1.310µ ± 0%   -3.61% (p=0.001 n=7)
Y1-4                     1.351µ ± 0%   1.301µ ± 0%   -3.70% (p=0.001 n=7)
Yn-4                     2.829µ ± 0%   2.729µ ± 0%   -3.53% (p=0.001 n=7)
Float64bits-4            14.08n ± 0%   14.07n ± 0%        ~ (p=0.069 n=7)
Float64frombits-4        19.09n ± 0%   19.10n ± 0%        ~ (p=0.755 n=7)
Float32bits-4            13.06n ± 0%   13.07n ± 1%        ~ (p=0.586 n=7)
Float32frombits-4        13.06n ± 0%   13.06n ± 0%        ~ (p=0.853 n=7)
FMA-4                    606.9n ± 0%   606.8n ± 0%        ~ (p=0.393 n=7)
geomean                  201.1n        185.4n        -7.81%

Change-Id: I6d41a97ad3789ed5731588588859ac0b8b13b664
Reviewed-on: https://go-review.googlesource.com/c/go/+/484675
Reviewed-by: Rong Zhang <rongrong@oss.cipunited.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>

13 months agocmd/go/internal/modfetch/codehost: explicitly specify GIT_DIR
Emily Shaffer [Wed, 26 Apr 2023 21:51:31 +0000 (14:51 -0700)]
cmd/go/internal/modfetch/codehost: explicitly specify GIT_DIR

When Git has safe.bareRepository=explicit set, operations on bare Git
repositories will fail unless --git-dir or GIT_DIR is set. The rest of
the time, specifying the gitdir makes repository discovery at the
beginning of a Git command ever-so-slightly faster. So, there is no
downside to ensuring that users with this stricter security config set
can still use 'go mod' commands easily.

See
https://lore.kernel.org/git/pull.1261.v8.git.git.1657834081.gitgitgadget@gmail.com/
for a more detailed description of security concerns around embedded
bare repositories without an explicitly specified GIT_DIR.

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

13 months agointernal/testenv: reduce init-time work for MustHaveExec
Bryan C. Mills [Fri, 5 May 2023 13:29:34 +0000 (09:29 -0400)]
internal/testenv: reduce init-time work for MustHaveExec

In CL 486275 I added a somewhat complex init function that sets up a
callback to probe for exec support. A lot of the complexity was simply
to avoid an unnecessary call to os.Environ during init.

In CL 491660, I made the os.Environ call unconditional on all
platforms anyway in order to make HasGoBuild more robust.

Since the init-function indirection no longer serves a useful purpose,
I would like to simplify it to a package-level function, avoiding the
complexity of changing package variables at init time.

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

13 months agogo/types, types2: factor out maximum type computation
Robert Griesemer [Thu, 4 May 2023 21:09:27 +0000 (14:09 -0700)]
go/types, types2: factor out maximum type computation

For untyped constant binary operations we need to determine the
"maximum" (untyped) type which includes both constant types.
Factor out this functionality.

Change-Id: If42bd793d38423322885a3063a4321bd56443b36
Reviewed-on: https://go-review.googlesource.com/c/go/+/492619
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

13 months agocmd/compile: allow more inlining of functions that construct closures
Than McIntosh [Tue, 4 Apr 2023 22:31:46 +0000 (18:31 -0400)]
cmd/compile: allow more inlining of functions that construct closures

[This is a roll-forward of CL 479095, which was reverted due to a bad
interaction between inlining and escape analysis, then later fixed
first with an attempt in CL 482355, then again in CL 484859, and then
one more time with CL 492135.]

Currently, when the inliner is determining if a function is
inlineable, it descends into the bodies of closures constructed by
that function. This has several unfortunate consequences:

- If the closure contains a disallowed operation (e.g., a defer), then
  the outer function can't be inlined. It makes sense that the
  *closure* can't be inlined in this case, but it doesn't make sense
  to punish the function that constructs the closure.

- The hairiness of the closure counts against the inlining budget of
  the outer function. Since we currently copy the closure body when
  inlining the outer function, this makes sense from the perspective
  of export data size and binary size, but ultimately doesn't make
  much sense from the perspective of what should be inlineable.

- Since the inliner walks into every closure created by an outer
  function in addition to starting a walk at every closure, this adds
  an n^2 factor to inlinability analysis.

This CL simply drops this behavior.

In std, this makes 57 more functions inlinable, and disallows inlining
for 10 (due to the basic instability of our bottom-up inlining
approach), for an net increase of 47 inlinable functions (+0.6%).

This will help significantly with the performance of the functions to
be added for #56102, which have a somewhat complicated nesting of
closures with a performance-critical fast path.

The downside of this seems to be a potential increase in export data
and text size, but the practical impact of this seems to be
negligible:

       │    before    │           after            │
       │    bytes     │    bytes      vs base      │
Go/binary        15.12Mi ± 0%   15.14Mi ± 0%  +0.16% (n=1)
Go/text          5.220Mi ± 0%   5.237Mi ± 0%  +0.32% (n=1)
Compile/binary   22.92Mi ± 0%   22.94Mi ± 0%  +0.07% (n=1)
Compile/text     8.428Mi ± 0%   8.435Mi ± 0%  +0.08% (n=1)

Change-Id: I5f75fcceb177f05853996b75184a486528eafe96
Reviewed-on: https://go-review.googlesource.com/c/go/+/492017
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
13 months agocmd/compile: un-hide closure func if parent expr moved to staticinit
Than McIntosh [Wed, 3 May 2023 16:38:50 +0000 (12:38 -0400)]
cmd/compile: un-hide closure func if parent expr moved to staticinit

If the function referenced by a closure expression is incorporated
into a static init, be sure to mark it as non-hidden, since otherwise
it will be live but no longer reachable from the init func, hence it
will be skipped during escape analysis, which can lead to
miscompilations.

Fixes #59680.

Change-Id: Ib858aee296efcc0b7655d25c23ab8a6a8dbdc5f9
Reviewed-on: https://go-review.googlesource.com/c/go/+/492135
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
13 months agocmd/compile: rework marking of dead hidden closure functions
Than McIntosh [Fri, 14 Apr 2023 18:07:37 +0000 (14:07 -0400)]
cmd/compile: rework marking of dead hidden closure functions

[This is a roll-forward of CL 484859, this time including a fix for
issue #59709. The call to do dead function marking was taking place in
the wrong spot, causing it to run more than once if generics were
instantiated.]

This patch generalizes the code in the inliner that marks unreferenced
hidden closure functions as dead. Rather than doing the marking on the
fly (previous approach), this new approach does a single pass at the
end of inlining, which catches more dead functions.

Change-Id: I0e079ad755c21295477201acbd7e1a732a98fffd
Reviewed-on: https://go-review.googlesource.com/c/go/+/492016
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
13 months agoruntime, runtime/pprof: record instantiated symbol name in CPU profile
Cherry Mui [Tue, 2 May 2023 21:15:10 +0000 (17:15 -0400)]
runtime, runtime/pprof: record instantiated symbol name in CPU profile

For generic functions, the previous CL makes it record the full
instantiated symbol name in the runtime func table. This CL
changes the pprof package to use that name in CPU profile. This
way, it matches the symbol name the compiler sees, so it can apply
PGO.

TODO: add a test.

Fixes #58712.

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

13 months agocmd/link, runtime: include full symbol name for generic functions in runtime table
Cherry Mui [Tue, 2 May 2023 20:46:20 +0000 (16:46 -0400)]
cmd/link, runtime: include full symbol name for generic functions in runtime table

For generic functions and methods, we replace the instantiated
shape type parameter name to "...", to make the function name
printed in stack traces looks more user friendly. Currently, this
is done in the binary's runtime func table at link time, and the
runtime has no way to access the full symbol name. This causes
the profile to also contain the replaced name. For PGO, this also
cause the compiler to not be able to find out the original fully
instantiated function name from the profile.

With this CL, we change the linker to record the full name, and
do the name substitution at run time when a printing a function's
name in traceback.

For #58712.

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

13 months agocmd/link: remove zdebug from ELF section header table
Cherry Mui [Thu, 4 May 2023 21:11:46 +0000 (17:11 -0400)]
cmd/link: remove zdebug from ELF section header table

We now use SHF_COMPRESSED sections for DWARF compression, and no
longer generate zdebug sections on ELF platforms. No need to
generate them in the section header string table.

Updates #50796.

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

13 months agocmd/link: remove elfsetstring out of the loader
Cherry Mui [Thu, 4 May 2023 21:09:49 +0000 (17:09 -0400)]
cmd/link: remove elfsetstring out of the loader

Currently, we pass elfsetstring to the loader as a callback, for
a special case of Addstring. This is only used for ELF when adding
strings to the section header string table. Move the logic to the
caller instead, so the loader would not have this special case.

Change-Id: Icfb91f380fe4ba435985c3019681597932f58242
Reviewed-on: https://go-review.googlesource.com/c/go/+/492718
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
13 months agogo/types, types2: better error message for bad assignment
Robert Griesemer [Fri, 5 May 2023 00:01:53 +0000 (17:01 -0700)]
go/types, types2: better error message for bad assignment

If the LHS of an assignment is neither addressable nor a map expression
(and not the blank identifier), explicitly say so for a better error
message.

For #3117.

Change-Id: I4bffc35574fe390a0567e89182b23585eb5a90de
Reviewed-on: https://go-review.googlesource.com/c/go/+/492875
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>

13 months agogo/types, types2: exclude untyped nil arguments early in type inference
Robert Griesemer [Thu, 4 May 2023 17:54:12 +0000 (10:54 -0700)]
go/types, types2: exclude untyped nil arguments early in type inference

An untyped nil argument cannot be used to infer any type information.
We don't need to include it in the untyped arguments.

Change-Id: Ied44738ff1b135e65a3acfa19223cd3889b7fa7d
Reviewed-on: https://go-review.googlesource.com/c/go/+/492695
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>