Commit graph

48487 commits

Author SHA1 Message Date
Cherry Mui
dc2cb529a8 [dev.typeparams] runtime: mark assembly functions called directly from compiler ABIInternal
For functions such as gcWriteBarrier and panicIndexXXX, the
compiler generates ABIInternal calls directly. And they must not
use wrappers because it follows a special calling convention or
the caller's PC is used. Mark them as ABIInternal.

Note that even though they are marked as ABIInternal, they don't
actually use the internal ABI, i.e. regabiargs is not honored for
now.

Now all.bash passes with GOEXPERIMENT=regabiwrappers (at least on
macOS).

Change-Id: I87e41964e6dc4efae03e8eb636ae9fa1d99285bb
Reviewed-on: https://go-review.googlesource.com/c/go/+/323934
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2021-06-02 16:49:25 +00:00
Ian Lance Taylor
6e189afd3e doc/go1.17: mention SYS_WAIT6/WEXITED on NetBSD
For #13987
For #16028
For #44513

Change-Id: I7a73446fcc80a01fa6de24eec1e5b993e543be37
Reviewed-on: https://go-review.googlesource.com/c/go/+/323489
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
2021-06-02 16:25:20 +00:00
Ian Lance Taylor
ff9f5fb859 cmd/link: recognize clang linker error in testCGOLTO
Also recognize a case in which GCC does not run (from
https://build.golang.org/log/7f6d8b35c905b9829f05906beccca44f208aa569).

Fixes #46517

Change-Id: I4fe4164a5df92b2dec08fd767f65a4d5479f3f36
Reviewed-on: https://go-review.googlesource.com/c/go/+/324169
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2021-06-02 15:45:31 +00:00
Uddeshya Singh
1c6a2ea2ea doc/go1.17: document time changes for Go1.17
Documents the newly implemented changes of
- Time.IsDST() method
- Addition of Time.UnixMilli, Time.UnixMicro and to-Time helpers UnixMicro, UnixMilli methods
- Addition of comma "," support as separator for fraction seconds

For #44513
Fixes #46026

Change-Id: Ib8d3449d3b061f013112d33362b50e68ad6ddffa
Reviewed-on: https://go-review.googlesource.com/c/go/+/317913
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-06-02 14:51:05 +00:00
KimMachineGun
d743e67e06 doc/go1.17: document flag changes for Go 1.17
For #44513
Fixes #46010

Change-Id: I1fe638e5db0b4f3b64dbfbd948154a7c7a80afc9
GitHub-Last-Rev: d5bd53b1df
GitHub-Pull-Request: golang/go#46150
Reviewed-on: https://go-review.googlesource.com/c/go/+/319273
Reviewed-by: Heschi Kreinick <heschi@google.com>
Trust: Robert Findley <rfindley@google.com>
2021-06-02 14:28:15 +00:00
Tobias Klauser
dc8f87b749 runtime/internal/sys: generate //go:build lines in gengoos.go
For #41184

Change-Id: If7a1c3980f47bc28d0a13fe497eaba6178c65c91
Reviewed-on: https://go-review.googlesource.com/c/go/+/323750
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2021-06-02 08:17:59 +00:00
Zachary Burkett
d2b435117d test: fix error check messages for 2 types2 tests
Many compiler tests fail with -G=3 due to changes in error message format.
This commit fixes two of these tests, to ensure I am on the right track in review.

Updates #46447

Change-Id: I138956d536a1d48ca9198e6ddbfde13865bb5dd5
GitHub-Last-Rev: 0ed904b9fa
GitHub-Pull-Request: golang/go#46445
Reviewed-on: https://go-review.googlesource.com/c/go/+/323314
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-06-02 05:14:45 +00:00
Ian Lance Taylor
84c0e5d47f cmd/link: move issue 43830 tests out of TestScript
These tests pass or fail depending on the exact compiler version,
which the TestScript tests don't support. Rewrite into Go.

For #43830
For #46295

Change-Id: I91b61dfe329d518e461ee56f186f0e9b42858e77
Reviewed-on: https://go-review.googlesource.com/c/go/+/324049
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2021-06-02 00:36:24 +00:00
Keith Randall
cae68700cc runtime: fix formatting
Fix up a gofmt complaint from CL 310591.

Change-Id: I73534ef064a4cfc53539e5e65a8653e2cd684c64
Reviewed-on: https://go-review.googlesource.com/c/go/+/324090
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-06-02 00:20:16 +00:00
Keith Randall
b1f48e8add [dev.typeparams] cmd/compile: fix formatting
Looks like CL 322850 didn't have the change to ARM64Ops.go
properly gofmt'ed.

Change-Id: I1a080bc13ea27b897fbb91f18ded754ce440994b
Reviewed-on: https://go-review.googlesource.com/c/go/+/324109
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2021-06-02 00:19:52 +00:00
Cherry Mui
58ad36b359 [dev.typeparams] internal/buildcfg: allow regabi GOEXPERIMENTs on ARM64
It is not working yet, but allow enabling the experiments so we
can develop.

Change-Id: I957eb05acb4d80b2858ff1f8c16bbfb24e0f6e56
Reviewed-on: https://go-review.googlesource.com/c/go/+/323933
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2021-06-01 22:33:58 +00:00
Cherry Mui
c3639918d1 [dev.typeparams] internal/abi: define ARM64 register ABI constants
Change-Id: I9cdf0f2b6c1739f13a859a8e37351f8ecd77804a
Reviewed-on: https://go-review.googlesource.com/c/go/+/323932
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2021-06-01 22:33:44 +00:00
Cherry Mui
6633dc8b09 [dev.typeparams] reflect: call ABI0 spill/unspill functions on AMD64
CL 321950 changed runtime.spillArgs and unspillArgs to ABI0.
References to those functions should have been updated to ABI0,
but this one was missed.

Change-Id: I99238e4a96c945a47bec0981a415037578c73de4
Reviewed-on: https://go-review.googlesource.com/c/go/+/323931
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: David Chase <drchase@google.com>
2021-06-01 22:33:29 +00:00
Cherry Mui
e4003463ff [dev.typeparams] cmd/compile: match register-ABI version of memmove call on ARM64
Update the rule to match register-ABI version of the call for
inlining memmove.

Change-Id: Ic6da810e4d7ac391ffb766fcdc943985f0739624
Reviewed-on: https://go-review.googlesource.com/c/go/+/323930
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2021-06-01 22:33:10 +00:00
Cherry Mui
8e7abefdaa [dev.typeparams] cmd/compile: update ARM64 CALL* ops for register ABI
Now they take variable number of args.

Change-Id: I49c8bce9c3a403947eac03e397ae264a8f4fdd2c
Reviewed-on: https://go-review.googlesource.com/c/go/+/323929
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2021-06-01 22:33:00 +00:00
Ian Lance Taylor
567ee865f6 cmd/go: add declaration to cgo_lto_issue43830 test
This permits the test to work in C99 mode.

For #43830

Change-Id: Ide54bd62239cfe602e2664300f04e472df5daf43
Reviewed-on: https://go-review.googlesource.com/c/go/+/324009
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-06-01 21:14:02 +00:00
Ian Lance Taylor
24e9707cbf cmd/link, cmd/cgo: support -flto in CFLAGS
The linker now accepts unrecognized object files in external linking mode.
These objects will simply be passed to the external linker.
This permits using -flto which can generate pure byte code objects,
whose symbol table the linker does not know how to read.

The cgo tool now passes -fno-lto when generating objects whose symbols
it needs to read. The cgo tool now emits matching types in different
objects, so that the lto linker does not report a mismatch.

This is based on https://golang.org/cl/293290 by Derek Parker.

For #43505
Fixes #43830
Fixes #46295

Change-Id: I6787de213417466784ddef5af8899e453b4ae1ad
Reviewed-on: https://go-review.googlesource.com/c/go/+/322614
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
2021-06-01 19:59:18 +00:00
Cherry Mui
c9d1a2bdd2 [dev.typeparams] all: merge master (2725522) into dev.typeparams
Merge List:

+ 2021-06-01 272552275f A+C: update name
+ 2021-06-01 2bec019fb5 doc/go1.17: add release notes for register ABI
+ 2021-06-01 2e59cc5fb4 cmd/go: add [-src] to documentation
+ 2021-06-01 0b80cf1136 cmd/go: make 'go get' save sums for incidentally updated modules
+ 2021-05-30 3b770f2ccb go/types: don't declare 'comparable' when typeparams are disabled
+ 2021-05-30 1607c28172 go/types: unexport the GoVersion configuration option for Go 1.17
+ 2021-05-29 79bda65041 doc/go1.17: mention time.Layout
+ 2021-05-29 f6cc392d1d doc/go1.17: document text/template/parse.SkipFuncCheck
+ 2021-05-28 1419ca7cea doc/go1.17: mention new definitions of MSG_CMSG_CLOEXEC
+ 2021-05-28 6624771c83 doc/go1.17: mention testing.[TB].Setenv methods
+ 2021-05-28 bbda923592 doc/go1.17: mention new Windows SysProcAttr fields
+ 2021-05-28 6f58088bd8 doc/go1.17: document new go/build/BuildContext.ToolTags field
+ 2021-05-28 c295107708 doc/go1.17: mention new encoding/csv/Reader.FieldPos method
+ 2021-05-28 ccd9784edf doc/go1.17: document new debug/elf constant
+ 2021-05-28 3de3440fb9 go/ast: remove FuncDecl.IsMethod for Go 1.17
+ 2021-05-27 639acdc833 doc/go1.17: clarify that compress/lzw Reader and Writer types are new
+ 2021-05-27 193d514131 net/http: correct Client.Do doc about context cancelation
+ 2021-05-27 ab2ef4aaa7 doc/go1.17: document reflect changes
+ 2021-05-27 0ece95a0fe cmd/go: don't let 'go mod download' save sums for inconsistent requirements
+ 2021-05-27 cdcd02842d net: verify results from Lookup* are valid domain names
+ 2021-05-27 8bf5bf5173 cmd/compile: improve debug locations for partially live in-params
+ 2021-05-27 56af34f875 cmd/compile: place reg spills after OpArg{Int,Float}Reg ops
+ 2021-05-27 db66e9e15d cmd/link: accept Windows line-ending in TestTrampolineCgo
+ 2021-05-27 6b8c94b6c5 go/types: guard against check==nil in newNamed
+ 2021-05-27 fca7b8f3e6 Revert "net: verify results from Lookup* are valid domain names"
+ 2021-05-27 950fa11c4c net/http/httputil: always remove hop-by-hop headers
+ 2021-05-27 9bc52686da cmd/go,cmd/link: do not check for staleness in most tests
+ 2021-05-27 6ff0ae2aa4 crypto/elliptic: fix typo in p521Point type name
+ 2021-05-26 3075ffc93e os: deflake TestFdReadRace
+ 2021-05-26 a62c08734f src/os: revert accidentally submitted change
+ 2021-05-26 1d5298d46a doc/go1.17: document net/... changes
+ 2021-05-26 0fbecece98 doc/go1.17: document syscall changes
+ 2021-05-26 02beecb397 mime: document use of the Shared MIME-Info Database
+ 2021-05-26 a92460fd2f doc/go1.17: add release notes for runtime/metrics package
+ 2021-05-26 55aefbb268 doc/go1.17: mention enabling frame pointer on all ARM64
+ 2021-05-26 39da9ae513 go/types: ensure that Named.check is nilled out once it is expanded
+ 2021-05-26 bfd7798a6c runtime,cmd/link/internal/ld: fix typos
+ 2021-05-26 e4615ad74d math/big: move division into natdiv.go
+ 2021-05-26 d050238bb6 doc/go1.17: fix formatting for time changes
+ 2021-05-25 74242baa41 archive/zip: only preallocate File slice if reasonably sized

Change-Id: I8a02edee1a6889547c52aa28c53cf8250766ab2c
2021-06-01 14:58:52 -04:00
Matthew Dempsky
2580e9a160 [dev.typeparams] cmd/compile: refactor noder/irgen helpers
This CL refactors the code for invoking the types2 checker and for
validating //go:embed directives to be easier to reuse separately.
No functional change.

Change-Id: I706f4ea4a26b1f1d2f4064befcc0777a1067383d
Reviewed-on: https://go-review.googlesource.com/c/go/+/323310
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
Trust: Matthew Dempsky <mdempsky@google.com>
2021-06-01 18:03:44 +00:00
Cuong Manh Le
4b10e4c547 [dev.typeparams] cmd/compile: handle ONONAME in subster.node
Fixes #46472

Change-Id: I27802978fa0c3bb32a29e452165a6fcac93473bb
Reviewed-on: https://go-review.googlesource.com/c/go/+/323731
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
2021-06-01 17:10:20 +00:00
OneOfOne
272552275f A+C: update name
Change-Id: I1f88304858da5147bfd082c2fc2b7d24ed371cd8
Reviewed-on: https://go-review.googlesource.com/c/go/+/321955
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-06-01 17:08:12 +00:00
Cherry Mui
2bec019fb5 doc/go1.17: add release notes for register ABI
Also delete the TODO for the linker section.

Updates #44513.
Updates #40724.

Change-Id: I4d62a907e8c3070831a052cdfe1e21648698df12
Reviewed-on: https://go-review.googlesource.com/c/go/+/323289
Trust: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2021-06-01 16:26:24 +00:00
Vitaly Zdanevich
2e59cc5fb4 cmd/go: add [-src] to documentation
Change-Id: I554b5021386575af6ff44571a95bb31b38a0547f
GitHub-Last-Rev: 20aaec3aa0
GitHub-Pull-Request: golang/go#45956
Reviewed-on: https://go-review.googlesource.com/c/go/+/317109
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Trust: Bryan C. Mills <bcmills@google.com>
2021-06-01 13:23:26 +00:00
Jay Conrod
0b80cf1136 cmd/go: make 'go get' save sums for incidentally updated modules
When 'go get' updates a module, it may update another module in the
build list that provides a package in 'all' that wasn't loaded as part
of the 'go get' command. If 'go get' doesn't add a sum for that
module, builds may fail later.

With this change, 'go get' will fetch a sum for the content of an
updated module if we had a sum for the version before the update.

'go get' won't load the complete package graph, so there are still
cases where the build may be broken, like when an updated (but not
loaded) package imports a package from a new module.

Fixes #44129

Change-Id: I62eba3df4137a3e84e2ca8d549c36eec3670f08c
Reviewed-on: https://go-review.googlesource.com/c/go/+/322832
Trust: Jay Conrod <jayconrod@google.com>
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-06-01 12:20:06 +00:00
Matthew Dempsky
f32f4f58d9 [dev.typeparams] cmd/compile: simplify formatting of defined types
The existing code for deciding how to format defined type names is
incredibly convoluted and difficult to follow. In particular, I'm
looking at changing how Vargen works, and I couldn't tell from the
existing code whether my idea was viable.

This CL overhauls the logic to be much simpler with fewer special
cases, while overall behaving the same. A few notable intentional
differences from how the current code works:

1. The old code replaced the 'S' verb for fmtTypeGo and fmtTypeDebug
to 'v', whereas the new code leaves it alone. There's currently no
code that actually uses 'S' with these modes anyway, so it doesn't
seem important to maintain this special case. If future code wants 'v'
formatting, it should just use 'v' instead of 'S'.

2. The old code included Vargen for fmtTypeIDName mode with the 'S'
verb; but again, this functionality isn't actually used. I think it
would make sense for fmtTypeIDName to include Vargen like fmtTypeID
does (Vargen is logically part of the type's identity after all), but
that breaks tests and toolstash -cmp. So for now, this is left as a
TODO to investigate in the future.

3. The old code only added Vargen for fmtTypeID in 'v' mode when
printing types from the local package. But because we don't currently
support exporting function-scoped defined types anyway, this is again
irrelevant. In fact, once we *do* support exporting function-scoped
defined types, we'll need to include Vargen to generate the linker
symbols correctly.

Passes toolstash -cmp.

Change-Id: I4e481276bc4dc8d5b17eebf597b612737f26be5b
Reviewed-on: https://go-review.googlesource.com/c/go/+/323709
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2021-05-31 03:22:58 +00:00
Rob Findley
3b770f2ccb go/types: don't declare 'comparable' when typeparams are disabled
Fixes #46453

Change-Id: I92b9b1e43ec5182162b2eeeb667f1f548ea373a5
Reviewed-on: https://go-review.googlesource.com/c/go/+/323609
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2021-05-30 17:47:50 +00:00
Rob Findley
1607c28172 go/types: unexport the GoVersion configuration option for Go 1.17
The GoVersion field was added to types.Config as part of the work on
type parameters. Specifically, it was added to be consistent with
cmd/compile/internal/types2, which requires such an option.

This configuration option is useful, but is also non-trivial and did not
go through the proposal process. Unexport it for Go 1.17; we can create
a proposal to export it for Go 1.18.

Fixes #46296

Change-Id: Id82d8a7096887dcfc404c4d6d8da9c761b316609
Reviewed-on: https://go-review.googlesource.com/c/go/+/323430
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2021-05-30 02:37:38 +00:00
Ian Lance Taylor
79bda65041 doc/go1.17: mention time.Layout
For #44513

Change-Id: Id4624e977654f7e8c489508a9dce98c9fab621a6
Reviewed-on: https://go-review.googlesource.com/c/go/+/323490
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2021-05-29 01:59:17 +00:00
Ariel Mashraki
f6cc392d1d doc/go1.17: document text/template/parse.SkipFuncCheck
Documents the newly added mode that skips type checking
functions as per CL 301493.

Fixes #46025
For #34652
For #44513
For #38627

Change-Id: I56c4f65924702a931944796e39f43cfeb66abc8a
Reviewed-on: https://go-review.googlesource.com/c/go/+/311569
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Trust: Michael Knyszek <mknyszek@google.com>
2021-05-29 00:16:11 +00:00
Ian Lance Taylor
1419ca7cea doc/go1.17: mention new definitions of MSG_CMSG_CLOEXEC
For #44513

Change-Id: I8c0070b116ee520a76726eb9d3dcbdd489a1fb1f
Reviewed-on: https://go-review.googlesource.com/c/go/+/323351
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-05-28 18:41:07 +00:00
Ian Lance Taylor
6624771c83 doc/go1.17: mention testing.[TB].Setenv methods
For #41260
For #44513

Change-Id: I47ac0c751dafeb05abfe66fdf77938774164915f
Reviewed-on: https://go-review.googlesource.com/c/go/+/323353
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: roger peppe <rogpeppe@gmail.com>
2021-05-28 18:36:54 +00:00
Ian Lance Taylor
bbda923592 doc/go1.17: mention new Windows SysProcAttr fields
For #44011
For #44513

Change-Id: I512466f2e775e36098eb36ca7ef82333cd9e632a
Reviewed-on: https://go-review.googlesource.com/c/go/+/323352
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-05-28 18:35:37 +00:00
Ian Lance Taylor
6f58088bd8 doc/go1.17: document new go/build/BuildContext.ToolTags field
For #44513

Change-Id: Ib21af742e574fcaa7e38bb437d42dbeed9d01f0b
Reviewed-on: https://go-review.googlesource.com/c/go/+/323350
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-05-28 18:34:18 +00:00
Ian Lance Taylor
c295107708 doc/go1.17: mention new encoding/csv/Reader.FieldPos method
For #44221
For #44513

Change-Id: I2d2d1c55255f4411c11fd51f0f3ae726cbf4d136
Reviewed-on: https://go-review.googlesource.com/c/go/+/323349
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: roger peppe <rogpeppe@gmail.com>
2021-05-28 18:33:29 +00:00
Ian Lance Taylor
ccd9784edf doc/go1.17: document new debug/elf constant
For #39677
For #44513

Change-Id: I8c4193fd4359b83e6739e7e30a3a42b5f21b0f1a
Reviewed-on: https://go-review.googlesource.com/c/go/+/323275
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-05-28 04:09:07 +00:00
Rob Findley
3de3440fb9 go/ast: remove FuncDecl.IsMethod for Go 1.17
The IsMethod method was added to FuncDecl in the process of working on
support for type parameters, but is now only used in one place. It also
didn't go through the proposal process. Remove it for 1.17.

Also clean up a doc comment that mentioned type parameters.

Fixes #46297

Change-Id: I432bdd626324f613baf059540b7c5436985b2b16
Reviewed-on: https://go-review.googlesource.com/c/go/+/323369
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2021-05-28 03:34:02 +00:00
Matthew Dempsky
22f5ece3b1 [dev.typeparams] cmd/compile/internal/noder: refactor irgen import handling
Rather than re-parsing and re-resolving the import path string, use
the PkgName object provided by types2 to determine what package path
it refers to.

Also, decompose importfile into smaller functions, so that we can
directly pass the already-resolved package path to the importer.

Finally, switch to simply using height as calculated by types2 rather
than redoing the calculations.

Change-Id: I3338f4e68387b2835b2e58d6df65d740d6a648cb
Reviewed-on: https://go-review.googlesource.com/c/go/+/323309
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
Trust: Dan Scales <danscales@google.com>
Trust: Matthew Dempsky <mdempsky@google.com>
2021-05-27 23:54:29 +00:00
Ian Lance Taylor
639acdc833 doc/go1.17: clarify that compress/lzw Reader and Writer types are new
For #26535
For #44513
For #46005

Change-Id: I70d3711ab6451a61b526abb3da8e91243f637656
Reviewed-on: https://go-review.googlesource.com/c/go/+/323273
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
2021-05-27 23:51:57 +00:00
Matthew Dempsky
417955d151 [dev.typeparams] cmd/compile/internal/inline: refactor mkinlcall
This CL refactors mkinlcall by extracting the core InlinedCallExpr
construction code into a new "oldInline" function, and adds a new
"NewInline" hook point that can be overriden with a new inliner
implementation that only needs to worry about the details of
constructing the InlinedCallExpr.

It also moves the delayretvars optimization check into CanInline, so
it's performed just once per inlinable function rather than once for
each inlined call.

Finally, it skips printing the function body about to be inlined (and
updates the couple of regress tests that expected this output). We
already report the inline body as it was saved, and this diagnostic is
only applicable to the current inliner, which clones existing function
body instances. In the unified IR inliner, we'll directly construct
inline bodies from the serialized representation.

Change-Id: Ibdbe617da83c07665dcbda402cc8d4d4431dde2f
Reviewed-on: https://go-review.googlesource.com/c/go/+/323290
Trust: Matthew Dempsky <mdempsky@google.com>
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
2021-05-27 23:40:56 +00:00
Matthew Dempsky
88583a2a66 [dev.typeparams] test: trim list of expected -G=3 failures
15 more tests are passing from recent changes. 83 still to go.

Change-Id: I155b3e3db966d604ccec8bf3a7c182421f3d26c4
Reviewed-on: https://go-review.googlesource.com/c/go/+/323211
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2021-05-27 22:13:53 +00:00
Matthew Dempsky
ea522bc546 [dev.typeparams] cmd/compile: add and use ir.RawOrigExpr
This CL adds ir.RawOrigExpr, which can be used to represent arbitrary
constant expressions without needing to build and carry around an
entire IR representation of the original expression. It also allows
distinguishing how the constant was originally written by the
user (e.g., "0xff" vs "255").

This CL then also updates irgen to make use of this functionality for
expressions that were constant folded by types2.

Change-Id: I41e04e228e715ae2735c357b75633a2d08ee7021
Reviewed-on: https://go-review.googlesource.com/c/go/+/323210
Trust: Matthew Dempsky <mdempsky@google.com>
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
2021-05-27 22:13:46 +00:00
Matthew Dempsky
de5d1aca5e [dev.typeparams] cmd/compile: tweaks to match types2
This CL makes a handful of changes to either bring existing compiler
output consistent with what types2 produces or to make it easier to
reproduce with types2:

1. The position for embedded fields is corrected to the position of
the syntax.Field, rather than the syntax.Type.

2. Methods and embedded types are sorted in export data the same way
that types2 sorts them.

3. Don't write out position information for OLITERALs that don't have
their own position (i.e., references to named constants).

Change-Id: Ic3979215ae9ef280cfbba7b44c236e03fc12a2ef
Reviewed-on: https://go-review.googlesource.com/c/go/+/323209
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
Trust: Matthew Dempsky <mdempsky@google.com>
2021-05-27 22:13:38 +00:00
Manlio Perillo
193d514131 net/http: correct Client.Do doc about context cancelation
The documentation of the Client.Do method and Get function incorrectly
stated that, in case of context cancelation, the returned url.Error
Timeout method returns true.

Update the documentation to correctly match the implementation.
See also CL 200798 that, due to an oversight, corrected only the
documentation of the Client.Get method.

Remove a TODO note added in CL 125575 (net/http: document that Client
methods always return *url.Error), since it is no longer applicable
after CL 200798 (net/http: fix and lock-in Client.Do docs on request
cancelation).

Fixes #46402

Change-Id: Ied2ee971ba22b61777762dbb19f16e08686634ca
Reviewed-on: https://go-review.googlesource.com/c/go/+/323089
Reviewed-by: Damien Neil <dneil@google.com>
Trust: Michael Knyszek <mknyszek@google.com>
2021-05-27 21:41:58 +00:00
Damien Neil
ab2ef4aaa7 doc/go1.17: document reflect changes
For #44513.
Fixes #46019.

Change-Id: Ica84edd5703a4ccf343ff01e10483f8d51d1c79f
Reviewed-on: https://go-review.googlesource.com/c/go/+/323069
Trust: Damien Neil <dneil@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-05-27 20:59:35 +00:00
Jay Conrod
0ece95a0fe cmd/go: don't let 'go mod download' save sums for inconsistent requirements
'go mod download' calls modload.LoadModFile early to find the main
module path in order to validate arguments. LoadModFile may write
go.mod and go.sum to fix formatting and add a go directive. This calls
keepSums, which, in eager mode, loaded the complete module graph in
order to find out what sums are needed to load the complete module
graph. If go.mod requires a lower version of a module than will be
selected later, keepSums causes the sum for that version's go.mod to
be retained, even though it isn't needed later after a consistent
go.mod is written.

This CL fixes keepSums not to load the graph if it hasn't already been
loaded (whether eager or lazy), addressing comments from CL 318629.

For #45332

Change-Id: I20d4404004e4ad335450fd0fd753e7bc0060f702
Reviewed-on: https://go-review.googlesource.com/c/go/+/322369
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-05-27 20:38:20 +00:00
Roland Shoemaker
cdcd02842d net: verify results from Lookup* are valid domain names
For the methods LookupCNAME, LookupSRV, LookupMX, LookupNS, and
LookupAddr check that the returned domain names are in fact valid DNS
names using the existing isDomainName function.

Thanks to Philipp Jeitner and Haya Shulman from Fraunhofer SIT for
reporting this issue.

Fixes #46241
Fixes CVE-2021-33195

Change-Id: I47a4f58c031cb752f732e88bbdae7f819f0af4f3
Reviewed-on: https://go-review.googlesource.com/c/go/+/323131
Trust: Roland Shoemaker <roland@golang.org>
Run-TryBot: Roland Shoemaker <roland@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
2021-05-27 19:55:46 +00:00
Dan Scales
c2c1b53b39 [dev.typeparams] cmd/compile: use old export format if not compiling with generics
Write out export data with the old export format (iexportVersionPosCol)
if not compiling with generics (-G=0, the default value). This helps
ensure we don't break tests involving x/tools/go/gcexportdata (since we
can't modify that tool yet to use the new format).

Change-Id: I5f9bce44ed1e0696fc65fead6bab9e30de88461d
Reviewed-on: https://go-review.googlesource.com/c/go/+/323189
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Trust: Robert Griesemer <gri@golang.org>
2021-05-27 19:21:48 +00:00
Than McIntosh
8bf5bf5173 cmd/compile: improve debug locations for partially live in-params
During DWARF debug location generation, as a preamble to the main data
flow analysis, examine the function entry block to look for in-params
arriving in registers that are partially or completely dead, and
insert new OpArg{Int,Float}Reg values for the dead or partially-dead
pieces. In addition, add entries to the f.NamedValues table for
incoming live register-resident params that don't already have
entries. This helps create better/saner DWARF location expressions for
params. Example:

  func foo(s string, used int, notused int) int {
      return len(s) + used
  }

When optimization is complete for this function, the parameter
"notused" is completely dead, meaning that there is no entry for it in
the f.NamedValues table (which then means we don't emit a DWARF
variable location expression for it in the function enty block). In
addition, since only the length field of "s" is used, there is no
DWARF location expression for the other component of "s", leading to
degraded DWARF.

There are still problems/issues with DWARF location generation, but
this does improve things with respect to being able to print the
values of incoming parameters when stopped in the debugger at the
entry point of a function (when optimization is enabled).

Updates #40724.

Change-Id: I5bb5253648942f9fd33b081fe1a5a36208e75785
Reviewed-on: https://go-review.googlesource.com/c/go/+/322631
Trust: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2021-05-27 18:49:23 +00:00
Than McIntosh
56af34f875 cmd/compile: place reg spills after OpArg{Int,Float}Reg ops
Tweak the register allocator to maintain the invariant that
OpArg{Int,Float}Reg values are placed together at the start of the
entry block, before any other non-pseudo-op values. Without this
change, when the register allocator adds spills we can wind up with an
interleaving of OpArg*Reg and stores, which complicates debug location
analysis.

Updates #40724.

Change-Id: Icf30dd814a9e25263ecbea2e48feb840a6e7f2bd
Reviewed-on: https://go-review.googlesource.com/c/go/+/322630
Trust: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2021-05-27 18:47:37 +00:00
Cherry Mui
db66e9e15d cmd/link: accept Windows line-ending in TestTrampolineCgo
Apparently C printf emits "\r\n" on Windows. Accept that.

Change-Id: If87ba41435e3147d3892cfc3fe3a105b066ff0aa
Reviewed-on: https://go-review.googlesource.com/c/go/+/322973
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2021-05-27 18:01:11 +00:00