1
0
mirror of https://github.com/golang/go synced 2024-09-29 05:14:29 -06:00
Commit Graph

56651 Commits

Author SHA1 Message Date
Michael Anthony Knyszek
7024712641 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>
2023-05-11 21:27:11 +00:00
Michael Anthony Knyszek
62bf7a4809 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>
2023-05-11 21:27:10 +00:00
Michael Anthony Knyszek
8992bb19ad 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>
2023-05-11 21:27:08 +00:00
Michael Pratt
7484dd30fd 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>
2023-05-11 20:54:05 +00:00
Michael Pratt
d740b365b7 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>
2023-05-11 20:54:03 +00:00
Cherry Mui
c2becd70c5 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>
2023-05-11 20:14:54 +00:00
Michael Anthony Knyszek
3e9876cd3a 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>
2023-05-11 19:07:33 +00:00
Michael Anthony Knyszek
a2737b1aab 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>
2023-05-11 19:07:04 +00:00
Michael Pratt
446ad131f6 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>
2023-05-11 18:32:33 +00:00
Constantin Konstantinidis
5a9b6432ec 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>
2023-05-11 18:19:17 +00:00
Michael Pratt
96add980ad 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>
2023-05-11 17:15:06 +00:00
Mateusz Poliwczak
472f623482 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: ade40fd3e3
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>
2023-05-11 16:17:04 +00:00
Mateusz Poliwczak
2e7d864f43 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: 29924c13a6
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>
2023-05-11 16:11:07 +00:00
Johan Brandhorst-Satzkorn
aff2f4a724 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>
2023-05-11 15:21:09 +00:00
Felix Geisendörfer
bc9e21351c 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>
2023-05-11 15:18:52 +00:00
Johan Brandhorst-Satzkorn
dc076eaf2e 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>
2023-05-11 14:42:30 +00:00
Than McIntosh
6b2ad9ef50 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>
2023-05-11 14:25:23 +00:00
David Chase
3ee12d5702 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>
2023-05-11 13:45:58 +00:00
David Chase
2e93fe0a9f 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>
2023-05-11 13:45:40 +00:00
David Chase
a2838ec5f2 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>
2023-05-11 04:50:30 +00:00
Russ Cox
48f8c5c037 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>
2023-05-11 01:52:24 +00:00
David Chase
1d92e0e3fa 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>
2023-05-11 01:43:28 +00:00
David Chase
6cf7602b71 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>
2023-05-11 01:43:04 +00:00
David Chase
b768a1fbb5 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>
2023-05-10 22:56:31 +00:00
David Chase
3d80d57c31 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>
2023-05-10 22:55:30 +00:00
David Chase
5deeca38c2 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>
2023-05-10 22:45:24 +00:00
David Chase
acba24ff8c 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>
2023-05-10 22:43:51 +00:00
David Chase
639957eb66 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>
2023-05-10 22:43:30 +00:00
David Chase
a851511947 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>
2023-05-10 21:44:37 +00:00
David Chase
3f9521b2f0 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>
2023-05-10 21:44:05 +00:00
David Chase
8e8f4be3f4 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>
2023-05-10 21:43:25 +00:00
David Chase
d9a61be73f 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>
2023-05-10 21:41:14 +00:00
David Chase
623ebad685 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>
2023-05-10 20:40:05 +00:00
Tobias Klauser
200a01ff55 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>
2023-05-10 20:35:20 +00:00
Russ Cox
1099644f52 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>
2023-05-10 20:31:24 +00:00
Ian Lance Taylor
3d33532d1c 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>
2023-05-10 20:13:04 +00:00
Robert Griesemer
945a2b17f3 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>
2023-05-10 16:34:03 +00:00
Stefan
95c4f320d5 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: f22e2350c9
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>
2023-05-10 16:32:25 +00:00
Robert Griesemer
f30cd52051 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>
2023-05-10 15:42:07 +00:00
Shogo Hida
93d9035c9e cmd/go/internal: update documentation of go test and go generate
Fixes #57050

Change-Id: I46cac667ff78ac171c878f4366f8f01f58f1d27d
GitHub-Last-Rev: 697c255ece
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>
2023-05-10 15:11:42 +00:00
Bryan C. Mills
46847c639b 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>
2023-05-10 14:36:26 +00:00
Meng Zhuo
8e8303e1d0 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>
2023-05-10 14:30:10 +00:00
Robert Griesemer
d9dce0cd26 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>
2023-05-10 13:59:32 +00:00
IvoGoman
607a045888 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: 389488e536
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>
2023-05-10 13:00:20 +00:00
cui fliter
57e3189821 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>
2023-05-10 12:59:20 +00:00
Jonathan Amsterdam
dc0179bfa8 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>
2023-05-10 12:50:22 +00:00
Jonathan Amsterdam
a3efb96aaf 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>
2023-05-10 11:51:03 +00:00
cui fliter
2ca4104f05 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>
2023-05-10 10:18:37 +00:00
Keith Randall
5d76600cc0 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>
2023-05-10 04:57:07 +00:00
qmuntal
aa4d5e739f 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>
2023-05-09 20:48:02 +00:00