]> Cypherpunks.ru repositories - gostls13.git/log
gostls13.git
3 years ago[dev.typeparams] merge master (2f0da6d) into dev.typeparams
Rob Findley [Wed, 17 Feb 2021 21:34:00 +0000 (16:34 -0500)]
[dev.typeparams] merge master (2f0da6d) into dev.typeparams

This was a mostly clean merge, with the exception of codereview.cfg and
changes in src/go/types.

codereview.cfg for dev.typeparams is preserved in this CL. It should be
deleted before merging back to master.

The go/types changes were merged manually. For the most part this
involved taking the union of patches, with the following exceptions:
 + declInfo.aliasPos is removed, as it is not necessary in
   dev.typeparams where we have access to the full TypeSpec.
 + Checker.overflow is updated to use the asBasic converter.
 + A TODO is added to errorcodes.go to ensure that go1.16 error codes
   are preserved.

Change-Id: If9595196852e2163e27a9478df1e7b2c3704947d

3 years ago[dev.typeparams] cmd/dist: disable -G=3 on the std go tests for now
Dan Scales [Wed, 17 Feb 2021 02:24:48 +0000 (18:24 -0800)]
[dev.typeparams] cmd/dist:  disable -G=3 on the std go tests for now

Disable -G=3 tests on the std go tests, in order to see if -G=3 is
causing the flakiness for the dev.typeparams builder, as opposed to
other changes in typeparams branch. It's possible that -G=3 is using
more CPU/RAM that causes flakiness, as opposed to more specific bugs.

Change-Id: I610bce2aabd26b2b1fddc5e63f85ffe4e958e0d8
Reviewed-on: https://go-review.googlesource.com/c/go/+/292850
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Dan Scales <danscales@google.com>
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Dan Scales <danscales@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
3 years agogo/types: revert "no 'declared but not used' errors for invalid var decls"
Rob Findley [Wed, 17 Feb 2021 01:01:32 +0000 (20:01 -0500)]
go/types: revert "no 'declared but not used' errors for invalid var decls"

This reverts commit CL 289712 (afd67f3). It breaks x/tools tests, and
those tests highlight that perhaps I didn't think through the
repercussions of this change as much as I should have.

Fixes #44316

Change-Id: I5db39b4e2a3714131aa22423abfe0f34a0376192
Reviewed-on: https://go-review.googlesource.com/c/go/+/292751
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>

3 years agocmd/compile/internal/test: gofmt abiutils_test.go
Cherry Zhang [Tue, 16 Feb 2021 22:55:27 +0000 (17:55 -0500)]
cmd/compile/internal/test: gofmt abiutils_test.go

Turns out that file is not formatted properly in the dev.regabi
branch.

Change-Id: I93125e65d5d3e8448c6ec1f077332c9bf7f0dd26
Reviewed-on: https://go-review.googlesource.com/c/go/+/292594
Trust: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
3 years agoall: merge branch dev.regabi (d3cd4830ad) into master
Cherry Zhang [Tue, 16 Feb 2021 21:55:30 +0000 (16:55 -0500)]
all: merge branch dev.regabi (d3cd4830ad) into master

This CL merges the dev.regabi branch to the master branch.

In the dev.regabi branch we have refactored the compiler, and laid
some preliminary work for enabling a register-based ABI (issue #40724),
including improved late call/return lowering, improved ABI wrapper
generation, reflect call prepared for the new ABI, and reserving
special registers in the internal ABI. The actual register-based ABI
has not been enabled for the moment. The ABI-related changes are behind
GOEXPERIMENT=regabi and currently off by default.

Updates #40724, #44222.
Fixes #44224.

Change-Id: Id5de9f734d14099267ab717167aaaeef31fdba70

3 years ago[dev.regabi] test: run abi/regabipragma test with -c=1
Cherry Zhang [Fri, 12 Feb 2021 00:55:07 +0000 (19:55 -0500)]
[dev.regabi] test: run abi/regabipragma test with -c=1

Currently, we call Warnl in SSA backend when we see a function
(defined or called) with regparams pragma. Calling Warnl in
concurrent environment is racy. As the debugging output is
temporary, for testing purposes we just pass -c=1. We'll remove
the pragma and the debugging print some time soon.

Change-Id: I6f925a665b953259453fc458490c5ff91f67c91a
Reviewed-on: https://go-review.googlesource.com/c/go/+/291710
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>

3 years ago[dev.regabi] all: merge master (5faf941) into dev.regabi
Cherry Zhang [Tue, 16 Feb 2021 21:18:18 +0000 (16:18 -0500)]
[dev.regabi] all: merge master (5faf941) into dev.regabi

Merge List:

+ 2021-02-16 5faf941df0 internal/goversion: update Version to 1.17
+ 2021-02-16 6f3da9d2f6 README: pull gopher image from website
+ 2021-02-16 098504c73f cmd/link: generate trampoline for inter-dependent packages
+ 2021-02-16 1004a7cb31 runtime/metrics: update documentation to current interface
+ 2021-02-16 6530f2617f doc/go1.16: remove draft notice
+ 2021-02-16 353e111455 doc/go1.16: fix mismatched id attribute
+ 2021-02-16 f0d23c9dbb internal/poll: netpollcheckerr before sendfile
+ 2021-02-16 0cb3415154 doc: remove all docs not tied to distribution
+ 2021-02-16 626ef08127 doc: remove install.html and install-source.html
+ 2021-02-16 30641e36aa internal/poll: if copy_file_range returns 0, assume it failed
+ 2021-02-15 33d72fd412 doc/faq: update generics entry to reflect accepted proposal
+ 2021-02-15 852ce7c212 cmd/go: provide a more helpful suggestion for "go vet -?"
+ 2021-02-13 66c27093d0 cmd/link: fix typo in link_test.go

Change-Id: I98f047b79b93c5ceb344dd43408bcb919b23aeb3

3 years ago[dev.regabi] cmd/go: copy internal/abi in TestNewReleaseRebuildsStalePackagesInGOPATH
Cherry Zhang [Tue, 16 Feb 2021 20:55:54 +0000 (15:55 -0500)]
[dev.regabi] cmd/go: copy internal/abi in TestNewReleaseRebuildsStalePackagesInGOPATH

The internal/abi package is used by runtime and needs to be
copied.

Fix longtest builders.

Change-Id: I7a962df3db2c6bf68cc6a7da74b579f381920009
Reviewed-on: https://go-review.googlesource.com/c/go/+/292592
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>

3 years agointernal/goversion: update Version to 1.17
Bryan C. Mills [Thu, 3 Dec 2020 18:39:30 +0000 (13:39 -0500)]
internal/goversion: update Version to 1.17

(The corresponding update for the last release cycle was CL 248038.)

For #40705.

Change-Id: I13becdc4c3718a1c6986876ec56879cce3bcb34f
Reviewed-on: https://go-review.googlesource.com/c/go/+/275297
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
3 years ago[dev.regabi] go/types: overlapping embedded interfaces requires go1.14
Rob Findley [Thu, 11 Feb 2021 15:51:52 +0000 (10:51 -0500)]
[dev.regabi] go/types: overlapping embedded interfaces requires go1.14

This is an exact port of CL 290911 to go/types.

For #31793

Change-Id: I28c42727735f467a5984594b455ca58ab3375591
Reviewed-on: https://go-review.googlesource.com/c/go/+/291319
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>
3 years ago[dev.regabi] go/types: type alias decl requires go1.9
Rob Findley [Thu, 11 Feb 2021 15:45:49 +0000 (10:45 -0500)]
[dev.regabi] go/types: type alias decl requires go1.9

This is a port of CL 289570 to go/types. It has some notable differences
with that CL:
 + A new _BadDecl error code is added, to indicate declarations with bad
   syntax.
 + declInfo is updated hold not an 'alias' bool, but an aliasPos
   token.Pos to identify the location of the type aliasing '=' token.
   This allows for error messages to be accurately placed on the '='

For #31793

Change-Id: Ib15969f9cd5be30228b7a4c6406f978d6fc58018
Reviewed-on: https://go-review.googlesource.com/c/go/+/291318
Trust: Robert Findley <rfindley@google.com>
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
3 years ago[dev.regabi] runtime: stub out spillArgs and unspillArgs
Michael Anthony Knyszek [Tue, 16 Feb 2021 20:15:13 +0000 (20:15 +0000)]
[dev.regabi] runtime: stub out spillArgs and unspillArgs

Currently these two functions assume that constants in internal/abi are
set correctly, but we actually just made them zero if
GOEXPERIMENT_REGABI is set. This means reflectcall is broken. Fix it by
stubbing out these routines even if GOEXPERIMENT_REGABI is set.

Change-Id: I4c8df6d6af28562c5bb7b85f48c03d37daa9ee0d
Reviewed-on: https://go-review.googlesource.com/c/go/+/292650
Reviewed-by: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>

3 years agointernal/abi: set register count constants to zero for regabi experiment
Michael Anthony Knyszek [Tue, 16 Feb 2021 18:29:18 +0000 (18:29 +0000)]
internal/abi: set register count constants to zero for regabi experiment

This change sets the register count constants to zero for the
GOEXPERIMENT regabi because currently the users of it (i.e. reflect)
will be broken, since they expect Go functions that implement the new
ABI.

Change-Id: Id3e874c61821a36605eb4e1cccdee36a2759f303
Reviewed-on: https://go-review.googlesource.com/c/go/+/292649
Reviewed-by: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>

3 years agoREADME: pull gopher image from website
Ian Lance Taylor [Tue, 16 Feb 2021 18:16:06 +0000 (10:16 -0800)]
README: pull gopher image from website

Fixes breakage accidentally introduced by https://golang.org/cl/291711.

Fixes #44295

Change-Id: I76f3e5577d1d24027d4ed2a725b5b749ab2d059c
Reviewed-on: https://go-review.googlesource.com/c/go/+/292629
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
3 years ago[dev.regabi] cmd/link: recognize internal/abi as runtime package
Cherry Zhang [Tue, 16 Feb 2021 17:58:48 +0000 (12:58 -0500)]
[dev.regabi] cmd/link: recognize internal/abi as runtime package

The runtime imports the internal/abi package. Recognize
internal/abi as a runtime dependent, to make trampoline generation
algorithm work.

Fix ARM build.

Change-Id: I26b6778aa41dcb959bc226ff04abe08a5a82c4f6
Reviewed-on: https://go-review.googlesource.com/c/go/+/292610
Reviewed-by: Than McIntosh <thanm@google.com>
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>

3 years agocmd/link: generate trampoline for inter-dependent packages
Cherry Zhang [Tue, 16 Feb 2021 15:20:58 +0000 (10:20 -0500)]
cmd/link: generate trampoline for inter-dependent packages

Currently, in the trampoline generation pass we expect packages
are laid out in dependency order, so a cross-package jump always
has a known target address so we can check if a trampoline is
needed. With linknames, there can be cycles in the package
dependency graph, making this algorithm no longer work. For them,
as the target address is unkown we conservatively generate a
trampoline. This may generate unnecessary trampolines (if the
packages turn out laid together), but package cycles are extremely
rare so this is fine.

Updates #44073.

Change-Id: I2dc2998edacbda27d726fc79452313a21d07787a
Reviewed-on: https://go-review.googlesource.com/c/go/+/292490
Trust: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
3 years agoruntime/metrics: update documentation to current interface
Branden J Brown [Tue, 16 Feb 2021 04:12:15 +0000 (23:12 -0500)]
runtime/metrics: update documentation to current interface

The package documentation referenced sample metadata that was removed in CL 282632. Update this documentation to be less specific
about what metadata is available.

Additionally, the documentation on the Sample type referred to Descriptions instead of All as the source of metrics names.

Fixes #44280.

Change-Id: I24fc63a744bf498cb4cd5bda56c1599f6dd75929
Reviewed-on: https://go-review.googlesource.com/c/go/+/292309
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Trust: Michael Knyszek <mknyszek@google.com>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>

3 years agodoc/go1.16: remove draft notice
Dmitri Shuralyov [Sat, 13 Feb 2021 02:44:11 +0000 (02:44 +0000)]
doc/go1.16: remove draft notice

Fixes #40700.

Change-Id: I99ed479d1bb3cdf469c0209720c728276182a7a9
Reviewed-on: https://go-review.googlesource.com/c/go/+/291809
Reviewed-by: Alexander Rakoczy <alex@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Trust: Alexander Rakoczy <alex@golang.org>
Run-TryBot: Alexander Rakoczy <alex@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>

3 years agodoc/go1.16: fix mismatched id attribute
KimMachineGun [Tue, 16 Feb 2021 15:51:32 +0000 (15:51 +0000)]
doc/go1.16: fix mismatched id attribute

For #40700.

Change-Id: I186a21899404bfb79c08bfa8623caf9da74b6b0d
GitHub-Last-Rev: 25d240db3c0e2a923720bb9667ef0599ec06819e
GitHub-Pull-Request: golang/go#44145
Reviewed-on: https://go-review.googlesource.com/c/go/+/290329
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
3 years ago[dev.regabi] reflect: support for register ABI on amd64 for reflect.(Value).Call
Michael Anthony Knyszek [Thu, 22 Oct 2020 16:29:04 +0000 (16:29 +0000)]
[dev.regabi] reflect: support for register ABI on amd64 for reflect.(Value).Call

This change adds support for the new register ABI on amd64 to
reflect.(Value).Call. If internal/abi's register counts are non-zero,
reflect will try to set up arguments in registers on the Call path.

Note that because the register ABI becomes ABI0 with zero registers
available, this should keep working as it did before.

This change does not add any tests for the register ABI case because
there's no way to do so at the moment.

For #40724.

Change-Id: I8aa089a5aa5a31b72e56b3d9388dd3f82203985b
Reviewed-on: https://go-review.googlesource.com/c/go/+/272568
Trust: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
3 years agointernal/poll: netpollcheckerr before sendfile
Wei Fu [Sun, 24 Jan 2021 10:21:06 +0000 (18:21 +0800)]
internal/poll: netpollcheckerr before sendfile

In net/http package, the ServeContent/ServeFile doesn't check the I/O
timeout error from chunkWriter or *net.TCPConn, which means that both
HTTP status and headers might be missing when WriteTimeout happens. If
the poll.SendFile() doesn't check the *poll.FD state before sending
data, the client will only receive the response body with status and
report "malformed http response/status code".

This patch is to enable netpollcheckerr before sendfile, which should
align with normal *poll.FD.Write() and Splice().

Fixes #43822

Change-Id: I32517e3f261bab883a58b577b813ef189214b954
Reviewed-on: https://go-review.googlesource.com/c/go/+/285914
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>

3 years agodoc: remove all docs not tied to distribution
Russ Cox [Fri, 12 Feb 2021 21:16:25 +0000 (16:16 -0500)]
doc: remove all docs not tied to distribution

They have moved to x/website in CL 291693.
The docs that are left are the ones that are edited at the same time
as development in this repository and are tied to the specific version
of Go being developed. Those are:

 - the language spec
 - the memory model
 - the assembler manual
 - the current release's release notes

Change-Id: I437c4d33ada1b1716b1919c3c939c2cacf407e83
Reviewed-on: https://go-review.googlesource.com/c/go/+/291711
Trust: Russ Cox <rsc@golang.org>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
3 years agodoc: remove install.html and install-source.html
Russ Cox [Fri, 12 Feb 2021 21:02:12 +0000 (16:02 -0500)]
doc: remove install.html and install-source.html

These live in x/website/content/doc now.
The copies here just attract edits that have no actual effect.

For #40496.
For #41861.

Change-Id: I2fdd7375e373949eb9a88f4cdca440b6a5d45eea
Reviewed-on: https://go-review.googlesource.com/c/go/+/291709
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
3 years agointernal/poll: if copy_file_range returns 0, assume it failed
Ian Lance Taylor [Mon, 15 Feb 2021 01:14:41 +0000 (17:14 -0800)]
internal/poll: if copy_file_range returns 0, assume it failed

On current Linux kernels copy_file_range does not correctly handle
files in certain special file systems, such as /proc. For those file
systems it fails to copy any data and returns zero. This breaks Go's
io.Copy for those files.

Fix the problem by assuming that if copy_file_range returns 0 the
first time it is called on a file, that that file is not supported.
In that case fall back to just using read. This will force an extra
system call when using io.Copy to copy a zero-sized normal file,
but at least it will work correctly.

For #36817
Fixes #44272

Change-Id: I02e81872cb70fda0ce5485e2ea712f219132e614
Reviewed-on: https://go-review.googlesource.com/c/go/+/291989
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
3 years agodoc/faq: update generics entry to reflect accepted proposal
Ian Lance Taylor [Mon, 15 Feb 2021 01:21:56 +0000 (17:21 -0800)]
doc/faq: update generics entry to reflect accepted proposal

For #43651

Change-Id: Idb511f4c759d9a77de289938c19c2c1d4a542a17
Reviewed-on: https://go-review.googlesource.com/c/go/+/291990
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
3 years agocmd/go: provide a more helpful suggestion for "go vet -?"
Rob Pike [Sun, 14 Feb 2021 02:22:15 +0000 (13:22 +1100)]
cmd/go: provide a more helpful suggestion for "go vet -?"

For the command

go vet -?

the output was,

usage: go vet [-n] [-x] [-vettool prog] [build flags] [vet flags] [packages]
Run 'go help vet' for details.
Run 'go tool vet -help' for the vet tool's flags.

but "go help vet" is perfunctory at best. (That's another issue I'm
working on—see https://go-review.googlesource.com/c/tools/+/291909—
but vendoring is required to sort that out.) Add another line and rewrite
a bit to make it actually helpful:

usage: go vet [-n] [-x] [-vettool prog] [build flags] [vet flags] [packages]
Run 'go help vet' for details.
Run 'go tool vet help' for a full list of flags and analyzers.
Run 'go tool vet -help' for an overview.

Change-Id: I9d8580f0573321a57d55875ac3185988ce3eaf64
Reviewed-on: https://go-review.googlesource.com/c/go/+/291929
Trust: Rob Pike <r@golang.org>
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
3 years agocmd/link: fix typo in link_test.go
Ikko Ashimine [Sat, 13 Feb 2021 02:45:51 +0000 (02:45 +0000)]
cmd/link: fix typo in link_test.go

specfic -> specific

Change-Id: Icad0f70c77c866a1031a2929b90fef61fe92aaee
GitHub-Last-Rev: f66b56491c0125f58c47f7f39410e0aeef2539be
GitHub-Pull-Request: golang/go#44246
Reviewed-on: https://go-review.googlesource.com/c/go/+/291829
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>

3 years ago[dev.regabi] go/types: add support for language version checking
Rob Findley [Thu, 11 Feb 2021 15:23:41 +0000 (10:23 -0500)]
[dev.regabi] go/types: add support for language version checking

This is a port of CL 289509 to go/types. It differs from that CL in
codes added to errors, to fit the new factoring of check_test.go, and to
allow go/types to import regexp in deps_test.go

For #31793

Change-Id: Ia9e4c7f5aac1493001189184227c2ebc79a76e77
Reviewed-on: https://go-review.googlesource.com/c/go/+/291317
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>
3 years ago[dev.regabi] go/types: untyped shift counts must fit into uint
Rob Findley [Thu, 11 Feb 2021 15:17:39 +0000 (10:17 -0500)]
[dev.regabi] go/types: untyped shift counts must fit into uint

This is a port of CL 283872 to go/types. It differs from that CL only in
added error codes.

For #43697

Change-Id: I62277834cef1c0359bcf2c6ee4388731babbc855
Reviewed-on: https://go-review.googlesource.com/c/go/+/291316
Trust: Robert Findley <rfindley@google.com>
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
3 years ago[dev.regabi] go/types: refuse excessively long constants
Rob Findley [Wed, 10 Feb 2021 17:04:31 +0000 (12:04 -0500)]
[dev.regabi] go/types: refuse excessively long constants

This is a port of CL 289049 to go/types. In that CL, tests were written
using the ability of tests/run.go to generate test packages dynamically.
For this CL, similar functionality is added to the go/types errmap
tests: tests are refactored to decouple the loading of source code from
the filesystem, so that tests for long constants may be generated
dynamically rather than checked-in as a large testdata file.

Change-Id: I92c7cb61a8d42c6593570ef7ae0af86b501fa34e
Reviewed-on: https://go-review.googlesource.com/c/go/+/290949
Trust: Robert Findley <rfindley@google.com>
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
3 years ago[dev.typeparams] cmd/compile/internal/types: review of resolver_test.go
Robert Griesemer [Thu, 11 Feb 2021 02:06:10 +0000 (18:06 -0800)]
[dev.typeparams] cmd/compile/internal/types: review of resolver_test.go

The changes between (equivalent, and reviewed) go/types/resolver_test.go
and resolver_test.go can be seen by comparing patchset 1 and 2. The actual
change is just removing the "// UNREVIEWED" marker.

Change-Id: Ibd5850f0d68e393d81e55651bffc886d71665545
Reviewed-on: https://go-review.googlesource.com/c/go/+/291180
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
3 years ago[dev.typeparams] cmd/compile/internal/types: review of errors_test.go
Robert Griesemer [Thu, 11 Feb 2021 01:59:13 +0000 (17:59 -0800)]
[dev.typeparams] cmd/compile/internal/types: review of errors_test.go

The changes between (equivalent, and reviewed) go/types/errors_test.go
and errors_test.go can be seen by comparing patchset 1 and 2. The actual
change is just removing the "// UNREVIEWED" marker.

Change-Id: I74de039b9e655445f0407a0203ac52a95c6c8a40
Reviewed-on: https://go-review.googlesource.com/c/go/+/291179
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
3 years ago[dev.typeparams] cmd/compile/internal/types: review of universe.go
Robert Griesemer [Thu, 11 Feb 2021 01:54:01 +0000 (17:54 -0800)]
[dev.typeparams] cmd/compile/internal/types: review of universe.go

The changes between (equivalent, and reviewed) go/types/universe.go
and universe.go can be seen by comparing patchset 1 and 2. The actual
change is just removing the "// UNREVIEWED" marker.

Change-Id: I217a4ace016129e661b4a43821c6b306812850b8
Reviewed-on: https://go-review.googlesource.com/c/go/+/291178
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
3 years ago[dev.typeparams] cmd/compile/internal/types: review of sizes_test.go
Robert Griesemer [Thu, 11 Feb 2021 01:51:35 +0000 (17:51 -0800)]
[dev.typeparams] cmd/compile/internal/types: review of sizes_test.go

The changes between (equivalent, and reviewed) go/types/sizes_test.go
and sizes_test.go can be seen by comparing patchset 1 and 2. The actual
change is just removing the "// UNREVIEWED" marker.

Change-Id: I36a9a8a9e0e5a869af392a6d04b50c166c8dbedf
Reviewed-on: https://go-review.googlesource.com/c/go/+/291177
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
3 years ago[dev.typeparams] cmd/compile/internal/types: review of sizes.go
Robert Griesemer [Thu, 11 Feb 2021 01:48:27 +0000 (17:48 -0800)]
[dev.typeparams] cmd/compile/internal/types: review of sizes.go

The changes between (equivalent, and reviewed) go/types/sizes.go
and sizes.go can be seen by comparing patchset 1 and 2. The actual
change is just removing the "// UNREVIEWED" marker.

Change-Id: Iacdcffe56023ec53bfaaac8fb112f813a7de0a95
Reviewed-on: https://go-review.googlesource.com/c/go/+/291176
Reviewed-by: Robert Findley <rfindley@google.com>
Trust: Robert Griesemer <gri@golang.org>

3 years ago[dev.typeparams] cmd/compile/internal/types: review of return.go
Robert Griesemer [Thu, 11 Feb 2021 01:40:59 +0000 (17:40 -0800)]
[dev.typeparams] cmd/compile/internal/types: review of return.go

The changes between (equivalent, and reviewed) go/types/return.go
and return.go can be seen by comparing patchset 1 and 2. The actual
change is just removing the "// UNREVIEWED" marker.

Change-Id: I7bb3201abec75043804296d6c37307fd243d58f8
Reviewed-on: https://go-review.googlesource.com/c/go/+/291175
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
3 years ago[dev.typeparams] cmd/compile/internal/types: review of object_test.go
Robert Griesemer [Thu, 11 Feb 2021 01:38:11 +0000 (17:38 -0800)]
[dev.typeparams] cmd/compile/internal/types: review of object_test.go

The changes between (equivalent, and reviewed) go/types/object_test.go
and object_test.go can be seen by comparing patchset 1 and 2. The actual
change is just removing the "// UNREVIEWED" marker.

Change-Id: I0ebc564fb8edf42c901bf3bf3bae242760aa7c0c
Reviewed-on: https://go-review.googlesource.com/c/go/+/291174
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
3 years ago[dev.typeparams] cmd/compile/internal/types: review of object.go
Robert Griesemer [Thu, 11 Feb 2021 01:34:46 +0000 (17:34 -0800)]
[dev.typeparams] cmd/compile/internal/types: review of object.go

The changes between (equivalent, and reviewed) go/types/object.go
and object.go can be seen by comparing patchset 1 and 2. The actual
change is just removing the "// UNREVIEWED" marker.

Change-Id: I0fcc08c19c94a60f642036697ccd12f0667d22cc
Reviewed-on: https://go-review.googlesource.com/c/go/+/291173
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
3 years ago[dev.typeparams] cmd/compile/internal/types: review of labels.go
Robert Griesemer [Thu, 11 Feb 2021 01:28:44 +0000 (17:28 -0800)]
[dev.typeparams] cmd/compile/internal/types: review of labels.go

The changes between (equivalent, and reviewed) go/types/labels.go
and labels.go can be seen by comparing patchset 1 and 2. The actual
change is just removing the "// UNREVIEWED" marker.

Change-Id: I8f1a9927beadff7ac851681739902c13300b6c39
Reviewed-on: https://go-review.googlesource.com/c/go/+/291172
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
3 years ago[dev.typeparams] cmd/compile/internal/types: review of infer.go
Robert Griesemer [Thu, 11 Feb 2021 01:21:23 +0000 (17:21 -0800)]
[dev.typeparams] cmd/compile/internal/types: review of infer.go

The changes between (equivalent, and reviewed) go/types/infer.go
and infer.go can be seen by comparing patchset 1 and 2. The actual
change is just removing the "// UNREVIEWED" marker and fixing a
few comments.

Change-Id: Ieb0c07c325a2e446550f85b159f99d4dfe5f1d5a
Reviewed-on: https://go-review.googlesource.com/c/go/+/291171
Reviewed-by: Robert Findley <rfindley@google.com>
Trust: Robert Griesemer <gri@golang.org>

3 years ago[dev.typeparams] cmd/compile/internal/types: review of builtin_test.go
Robert Griesemer [Thu, 11 Feb 2021 01:17:45 +0000 (17:17 -0800)]
[dev.typeparams] cmd/compile/internal/types: review of builtin_test.go

The changes between (equivalent, and reviewed) go/types/builtin_test.go
and builtin_test.go can be seen by comparing patchset 1 and 2. The actual
change is just removing the "// UNREVIEWED" marker.

Change-Id: Ic40d1a9b2f1465c5335bd69e9a0b265ab694c3ef
Reviewed-on: https://go-review.googlesource.com/c/go/+/291170
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
3 years ago[dev.typeparams] cmd/compile/internal/types: review of builtin.go
Robert Griesemer [Thu, 11 Feb 2021 01:06:33 +0000 (17:06 -0800)]
[dev.typeparams] cmd/compile/internal/types: review of builtin.go

The changes between (equivalent, and reviewed) go/types/builtin.go
and builtin.go can be seen by comparing patchset 1 and 2. The actual
change is just removing the "// UNREVIEWED" marker.

Change-Id: Ibecf2b5bc982f6bf92310267b9f06b588b7148a9
Reviewed-on: https://go-review.googlesource.com/c/go/+/291169
Reviewed-by: Robert Findley <rfindley@google.com>
Trust: Robert Griesemer <gri@golang.org>

3 years ago[dev.regabi] internal/abi: add new internal/abi package for ABI constants
Michael Anthony Knyszek [Thu, 22 Oct 2020 16:02:14 +0000 (16:02 +0000)]
[dev.regabi] internal/abi: add new internal/abi package for ABI constants

This change creates a new internal std package internal/abi which is
intended to hold constants with platform-specific values related to
our ABI that is useful to different std packages, such as runtime and
reflect.

For #40724.

Change-Id: Ie7ae7f687629cd3d613ba603e9371f0887601fe6
Reviewed-on: https://go-review.googlesource.com/c/go/+/272567
Trust: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Austin Clements <austin@google.com>
3 years ago[dev.regabi] all: merge master (ff0e93e) into dev.regabi
Cherry Zhang [Fri, 12 Feb 2021 21:30:51 +0000 (16:30 -0500)]
[dev.regabi] all: merge master (ff0e93e) into dev.regabi

Conflicts:

- src/cmd/compile/internal/gc/walk.go

  gc/walk.go is changed in CL 290950 on the master branch but
  deleted in the dev.regabi branch and moved over to the walk
  package. This CL includes porting CL 290950 over to the new
  walk.

Merge List:

+ 2021-02-12 ff0e93ea31 doc/go1.16: note that package path elements beginning with '.' are disallowed
+ 2021-02-11 249da7ec02 CONTRIBUTORS: update for the Go 1.16 release
+ 2021-02-11 864d4f1c6b cmd/go: multiple small 'go help' fixes
+ 2021-02-11 26ceae85a8 spec: More precise wording in section on function calls.
+ 2021-02-11 930c2c9a68 cmd/go: reject embedded files that can't be packed into modules
+ 2021-02-11 e5b08e6d5c io/fs: allow backslash in ValidPath, reject in os.DirFS.Open
+ 2021-02-10 ed8079096f cmd/compile: mark concrete call of reflect.(*rtype).Method as REFLECTMETHOD
+ 2021-02-09 e9c9683597 cmd/go: suppress errors from 'go get -d' for packages that only conditionally exist
+ 2021-02-09 e0ac989cf3 archive/tar: detect out of bounds accesses in PAX records resulting from padded lengths
+ 2021-02-09 c9d6f45fec runtime/metrics: fix a couple of documentation typpos
+ 2021-02-09 cea4e21b52 io/fs: backslash is always a glob meta character
+ 2021-02-08 dc725bfb3c doc/go1.16: mention new vet check for asn1.Unmarshal

Change-Id: Ib28fffa7dfbff7f6cdbfaf4a304757fead7bbf19

3 years agodoc/go1.16: note that package path elements beginning with '.' are disallowed
Bryan C. Mills [Thu, 11 Feb 2021 21:24:26 +0000 (16:24 -0500)]
doc/go1.16: note that package path elements beginning with '.' are disallowed

For #43985

Change-Id: I1a16f66800c5c648703f0a0d2ad75024525a710f
Reviewed-on: https://go-review.googlesource.com/c/go/+/291389
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
3 years ago[dev.typeparams] go/types: make predeclared "any" alias for interface{}
Rob Findley [Thu, 11 Feb 2021 16:50:31 +0000 (11:50 -0500)]
[dev.typeparams] go/types: make predeclared "any" alias for interface{}

This is a direct port of CL 285132 to go/types.

Change-Id: I35486d8ea1fa6c0c6a32ece199a6ccfd55d44d29
Reviewed-on: https://go-review.googlesource.com/c/go/+/291322
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>
3 years ago[dev.typeparams] go/types: better error message for invalid ... use
Rob Findley [Thu, 11 Feb 2021 16:46:24 +0000 (11:46 -0500)]
[dev.typeparams] go/types: better error message for invalid ... use

This is a port of CL 283475 to go/types.

For #43680

Change-Id: Ida630651247a40e28d405594394476e346354866
Reviewed-on: https://go-review.googlesource.com/c/go/+/291321
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
3 years ago[dev.typeparams] cmd/compile: small fixes for stenciling
Dan Scales [Wed, 10 Feb 2021 23:26:40 +0000 (15:26 -0800)]
[dev.typeparams] cmd/compile: small fixes for stenciling

 - Create the stencil name using targ.Type.String(), which handles cases
   where, for example, a type argument is a pointer to a named type,
   etc. *obj.

 - Set name.Def properly for a new stenciled func (have the symbol point
   back to the associated function node).  Will be required when exporting.

 - Add missing copying of Func field when making copies of Name nodes.
   (On purpose (it seems), Name nodes don't have a copy() function, so
   we have to copy all the needed fields explicitly.)

 - Deal with nil type in subster.node(), which is the type of the return
   value for a function that doesn't return anything.

 - Fix min to match standard want/go form, and add in float tests.  Changed
   Got -> got in bunch of other typeparam tests.

 - Add new tests index.go, settable.go, and smallest.go (similar to
   examples in the type param proposal), some of which need the above
   changes.

Change-Id: I09a72302bc1fd3635a326da92405222afa222e85
Reviewed-on: https://go-review.googlesource.com/c/go/+/291109
Trust: Dan Scales <danscales@google.com>
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
3 years agoCONTRIBUTORS: update for the Go 1.16 release
Carlos Amedee [Thu, 11 Feb 2021 01:29:50 +0000 (20:29 -0500)]
CONTRIBUTORS: update for the Go 1.16 release

This update was created using the updatecontrib command:

go get golang.org/x/build/cmd/updatecontrib
cd gotip
updatecontrib

With manual changes based on publicly available information
to canonicalize letter case and formatting for a few names.

For #12042.

Change-Id: I030b77e8ebcc7fe02106f0f264acdfb0b56e20d9
Reviewed-on: https://go-review.googlesource.com/c/go/+/291189
Trust: Carlos Amedee <carlos@golang.org>
Run-TryBot: Carlos Amedee <carlos@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Alexander Rakoczy <alex@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
3 years agocmd/go: multiple small 'go help' fixes
Jay Conrod [Thu, 11 Feb 2021 15:27:55 +0000 (10:27 -0500)]
cmd/go: multiple small 'go help' fixes

* Link to privacy policies for proxy.golang.org and sum.golang.org in
  'go help modules'. It's important that both policies are linked from
  the go command's documentation.
* Fix wording and typo in 'go help vcs' following comments in CL 290992,
  which adds reference documentation for GOVCS.
* Fix whitespace on GOVCS in 'go help environment'.

For #41730

Change-Id: I86abceacd4962b748361244026f219157c9285e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/291230
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>

3 years agospec: More precise wording in section on function calls.
DQNEO [Wed, 10 Feb 2021 05:46:54 +0000 (14:46 +0900)]
spec: More precise wording in section on function calls.

A caller is not always in a function.

For example, a call can appear in top level declarations.

e.g. var x = f()

Change-Id: I29c4c3b7663249434fb2b8a6d0003267c77268cf
Reviewed-on: https://go-review.googlesource.com/c/go/+/290849
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Trust: Robert Griesemer <gri@golang.org>

3 years agocmd/go: reject embedded files that can't be packed into modules
Russ Cox [Tue, 9 Feb 2021 22:34:09 +0000 (17:34 -0500)]
cmd/go: reject embedded files that can't be packed into modules

If the file won't be packed into a module,
don't put those files into embeds.
Otherwise people will be surprised when things work
locally but not when imported by another module.

Observed on CL 290709

Change-Id: Ia0ef7d0e0f5e42473c2b774e57c843e68a365bc7
Reviewed-on: https://go-review.googlesource.com/c/go/+/290809
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
3 years agoio/fs: allow backslash in ValidPath, reject in os.DirFS.Open
Russ Cox [Tue, 9 Feb 2021 18:46:53 +0000 (13:46 -0500)]
io/fs: allow backslash in ValidPath, reject in os.DirFS.Open

Rejecting backslash introduces problems with presenting
underlying OS file systems that contain names with backslash.
Rejecting backslash also does not Windows-proof the syntax,
because colon can also be a path separator. And we are not
going to reject colon from all names. So don't reject backslash
either.

There is a similar problem on Windows with names containing
slashes, but those are more difficult (though not impossible)
to create.

Also document and enforce that paths must be UTF-8.

Fixes #44166.

Change-Id: Iac7a9a268025c1fd31010dbaf3f51e1660c7ae2a
Reviewed-on: https://go-review.googlesource.com/c/go/+/290709
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>

3 years ago[dev.typeparams] cmd/gofmt: add the -G flag to allow generic code
Rob Findley [Wed, 10 Feb 2021 22:41:26 +0000 (17:41 -0500)]
[dev.typeparams] cmd/gofmt: add the -G flag to allow generic code

Add support for type parameters to cmd/gofmt, gated behind the -G flag.

The test was based on a test from go/printer, slightly modified to
exercise more formatting.

Change-Id: I489bcb3ad06e1ed4e6d9f5bc79825e60dcfe9953
Reviewed-on: https://go-review.googlesource.com/c/go/+/291011
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>

3 years agocmd/compile: mark concrete call of reflect.(*rtype).Method as REFLECTMETHOD
Cherry Zhang [Wed, 10 Feb 2021 17:43:18 +0000 (12:43 -0500)]
cmd/compile: mark concrete call of reflect.(*rtype).Method as REFLECTMETHOD

For functions that call reflect.Type.Method (or MethodByName), we
mark it as REFLECTMETHOD, which tells the linker that methods
can be retrieved via reflection and the linker keeps all exported
methods live. Currently, this marking expects exactly the
interface call reflect.Type.Method (or MethodByName). But now the
compiler can devirtualize that call to a concrete call
reflect.(*rtype).Method (or MethodByName), which is not handled
and causing the linker to discard methods too aggressively.
Handle the latter in this CL.

Fixes #44207.

Change-Id: Ia4060472dbff6ab6a83d2ca8e60a3e3f180ee832
Reviewed-on: https://go-review.googlesource.com/c/go/+/290950
Trust: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
3 years ago[dev.typeparams] cmd/compile/internal/types2: overlapping embedded interfaces require...
Robert Griesemer [Wed, 10 Feb 2021 20:32:59 +0000 (12:32 -0800)]
[dev.typeparams] cmd/compile/internal/types2: overlapping embedded interfaces requires go1.14

Add respective check to type checker.
Enables another excluded test in test/run.go.

This CL completes the currently required checks for
language compatibility in types2.

Updates #31793.

Change-Id: Icececff9e6023d38f600c93bcb54cdcafcf501b9
Reviewed-on: https://go-review.googlesource.com/c/go/+/290911
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
3 years ago[dev.regabi] cmd/link: stop using ABI aliases if wrapper is enabled
Cherry Zhang [Fri, 5 Feb 2021 23:07:46 +0000 (18:07 -0500)]
[dev.regabi] cmd/link: stop using ABI aliases if wrapper is enabled

If ABI wrappers are enabled, we should not see ABI aliases at
link time. Stop resolving them. One exception is shared linkage,
where we still use ABI aliases as we don't always know the ABI
for symbols from shared libraries.

Change-Id: Ia89a788094382adeb4c4ef9b0312aa6e8c2f79ef
Reviewed-on: https://go-review.googlesource.com/c/go/+/290032
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>

3 years ago[dev.typeparams] cmd/compile: make type conversions by type parameters work
Dan Scales [Tue, 9 Feb 2021 23:13:19 +0000 (15:13 -0800)]
[dev.typeparams] cmd/compile:  make type conversions by type parameters work

When doing a type conversion using a type param, delay the
transformation to OCONV/OCONVNOP until stenciling, since the nodes
created depend on the actual type.

Re-enable the fact.go test.

Change-Id: I3d5861aab3dd0e781d767f67435afaf951dfe451
Reviewed-on: https://go-review.googlesource.com/c/go/+/290752
Trust: Dan Scales <danscales@google.com>
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
3 years ago[dev.typeparams] cmd/compile: handle calling a method on a type param in stenciling
Dan Scales [Mon, 8 Feb 2021 22:33:51 +0000 (14:33 -0800)]
[dev.typeparams] cmd/compile: handle calling a method on a type param in stenciling

 - Have to delay the extra transformation on methods invoked on a type
   param, since the actual transformation (including path through
   embedded fields) will depend on the instantiated type. I am currently
   doing the transformation during the stencil substitution phase. We
   probably should have a separate pass after noder2 and stenciling,
   which drives the extra transformations that were in the old
   typechecker.

 - We handle method values (that are not called) and method calls. We
   don't currently handle method expressions.

 - Handle type substitution in function types, which is needed for
   function args in generic functions.

 - Added stringer.go and map.go tests, testing the above changes
   (including constraints with embedded interfaces).

Change-Id: I3831a937d2b8814150f75bebf9f23ab10b93fa00
Reviewed-on: https://go-review.googlesource.com/c/go/+/290550
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Dan Scales <danscales@google.com>
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Dan Scales <danscales@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
3 years agocmd/go: suppress errors from 'go get -d' for packages that only conditionally exist
Bryan C. Mills [Thu, 4 Feb 2021 20:26:52 +0000 (15:26 -0500)]
cmd/go: suppress errors from 'go get -d' for packages that only conditionally exist

Fixes #44106
Fixes #29268

Change-Id: Id113f2ced274d43fbf66cb804581448218996f81
Reviewed-on: https://go-review.googlesource.com/c/go/+/289769
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>

3 years ago[dev.regabi] go/types: use 512 bits as max. integer precision
Rob Findley [Tue, 9 Feb 2021 03:37:48 +0000 (22:37 -0500)]
[dev.regabi] go/types: use 512 bits as max. integer precision

This is a port of CL 288633 to go/types. It differs from that CL
in the implementation of opName, which now uses ast Exprs.

Additionally, a couple tests had to be updated:
 + TestEvalArith is updated to not overflow.
 + stmt0.src is updated to have an error positioned on the '<<'
   operator.

Change-Id: I628357c33a1e7b0bb5bb7de5736f1fb10ce404e4
Reviewed-on: https://go-review.googlesource.com/c/go/+/290630
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>
3 years ago[dev.regabi] go/types: adjust importer to match compiler importer
Rob Findley [Tue, 9 Feb 2021 02:53:29 +0000 (21:53 -0500)]
[dev.regabi] go/types: adjust importer to match compiler importer

This is an exact port of CL 288632 to go/types.

Change-Id: Ie46e13355bdd0713b392e042844bab8491a16504
Reviewed-on: https://go-review.googlesource.com/c/go/+/290629
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>
3 years ago[dev.regabi] go/types: handle untyped constant arithmetic overflow
Rob Findley [Mon, 8 Feb 2021 23:04:58 +0000 (18:04 -0500)]
[dev.regabi] go/types: handle untyped constant arithmetic overflow

This is a port of CL 287832 for go/types. It differs from that CL in its
handling of position data. Unlike the syntax package, which has a
unified Operation node, go/types checks operations for ast.UnaryExpr,
IncDecStmt, and BinaryExpr. It was simpler to keep the existing position
logic. Notably, this correctly puts the errors on the operator.

Change-Id: Id1e3aefe863da225eb0a9b3628cfc8a5684c0c4f
Reviewed-on: https://go-review.googlesource.com/c/go/+/290569
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Trust: Robert Findley <rfindley@google.com>

3 years ago[dev.regabi] go/types: must not import a package called "init"
Rob Findley [Mon, 8 Feb 2021 23:24:13 +0000 (18:24 -0500)]
[dev.regabi] go/types: must not import a package called "init"

This is a port of CL 287494 to go/types. The additional checks in
test/fixedbugs are included, though they won't be executed by go/types.
Support for errorcheckdir checks will be added to go/types in a later
CL.

Change-Id: I37e202ea5daf7d7b8fc6ae93a4c4dbd11762480f
Reviewed-on: https://go-review.googlesource.com/c/go/+/290570
Reviewed-by: Robert Griesemer <gri@golang.org>
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>

3 years agoarchive/tar: detect out of bounds accesses in PAX records resulting from padded lengths
Emmanuel T Odeke [Thu, 4 Feb 2021 09:39:18 +0000 (01:39 -0800)]
archive/tar: detect out of bounds accesses in PAX records resulting from padded lengths

Handles the case in which padding of a PAX record's length field
violates invariants about the formatting of record, whereby it no
longer matches the prescribed format:

    "%d %s=%s\n", <length>, <keyword>, <value>

as per:

    https://pubs.opengroup.org/onlinepubs/9699919799/utilities/pax.html#tag_20_92_13_03

0-padding, and paddings of other sorts weren't handled and we assumed
that only non-padded decimal lengths would be passed in.
Added test cases to ensure that the parsing still proceeds as expected.

The prior crashing repro:

    0000000000000000000000000000000030 mtime=1432668921.098285006\n30 ctime=2147483649.15163319

exposed the fallacy in the code, that assumed that the length would ALWAYS be a
non-padded decimal length string.

This bug has existed since Go1.1 as per CL 6700047.

Thanks to Josh Bleecher Snyder for fuzzing this package, and thanks to Tom
Thorogood for advocacy, raising parity with GNU Tar, but for providing more test cases.

Fixes #40196

Change-Id: I32e0af4887bc9221481bd9e8a5120a79f177f08c
Reviewed-on: https://go-review.googlesource.com/c/go/+/289629
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
Trust: Joe Tsai <thebrokentoaster@gmail.com>
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
3 years ago[dev.regabi] go/types: report unused packages in source order
Rob Findley [Thu, 4 Feb 2021 17:24:10 +0000 (12:24 -0500)]
[dev.regabi] go/types: report unused packages in source order

This is a port of CL 287072 to go/types.

Change-Id: I08f56995f0323c1f238d1b44703a481d393471d5
Reviewed-on: https://go-review.googlesource.com/c/go/+/289720
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Robert Findley <rfindley@google.com>
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
3 years ago[dev.regabi] go/types: factor out sorting of methods
Rob Findley [Thu, 4 Feb 2021 17:10:02 +0000 (12:10 -0500)]
[dev.regabi] go/types: factor out sorting of methods

This is a port of CL 285993 to go/types.

Change-Id: I7560cf1176fea5de2c54786a086e547c73294a60
Reviewed-on: https://go-review.googlesource.com/c/go/+/289717
Trust: Robert Findley <rfindley@google.com>
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
3 years ago[dev.regabi] go/types: convert untyped arguments to delete
Rob Findley [Thu, 4 Feb 2021 17:03:53 +0000 (12:03 -0500)]
[dev.regabi] go/types: convert untyped arguments to delete

This is a port of CL 285059 to go/types. The error assertion is updated
to match go/types error for assignment, which has been improved.

Change-Id: Icdd2751edea0abef7c84feadcbf9265d71239ade
Reviewed-on: https://go-review.googlesource.com/c/go/+/289716
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
3 years ago[dev.typeparams] merge dev.regabi (618e3c1) into dev.typeparams
Rob Findley [Tue, 9 Feb 2021 02:22:01 +0000 (21:22 -0500)]
[dev.typeparams] merge dev.regabi (618e3c1) into dev.typeparams

This involved a couple non-trivial fixes in go/types:
 - move the check for main function signature to resolver.go, to be
   consistent with init. Also, update uses of _InvalidInitSig to
   _InvalidInitDecl, consistent with what we decided for dev.regabi.
 - Update some tests in api_test.go which newly fail after CL 289715
   (fixing reporting of untyped nil) In all cases but one, these updates
   were consistent with types2. However, in one case types2 seems to be
   able to resolve more type information than go/types for a broken
   package. I left a TODO to investigate this further.

Change-Id: I8244b7c81654194edd5af8de689a13c262117dff

3 years agoruntime/metrics: fix a couple of documentation typpos
Ian Lance Taylor [Sun, 7 Feb 2021 23:25:39 +0000 (15:25 -0800)]
runtime/metrics: fix a couple of documentation typpos

Fixes #44150

Change-Id: Ibe5bfba01491dd8c2f0696fab40a1673230d76e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/290349
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
3 years agoio/fs: backslash is always a glob meta character
Ian Lance Taylor [Tue, 9 Feb 2021 00:32:39 +0000 (16:32 -0800)]
io/fs: backslash is always a glob meta character

Fixes #44171

Change-Id: I2d3437a2f5b9fa0358e4664e1a8eacebed975eed
Reviewed-on: https://go-review.googlesource.com/c/go/+/290512
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
3 years agodoc/go1.16: mention new vet check for asn1.Unmarshal
KimMachineGun [Mon, 8 Feb 2021 23:27:52 +0000 (23:27 +0000)]
doc/go1.16: mention new vet check for asn1.Unmarshal

This vet check was added in CL 243397.

For #40700.

Change-Id: Ibff6df9395d37bb2b84a791443578009f23af4fb
GitHub-Last-Rev: e47c38f6309f31a6de48d4ffc82078d7ad45b171
GitHub-Pull-Request: golang/go#44147
Reviewed-on: https://go-review.googlesource.com/c/go/+/290330
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
3 years ago[dev.regabi] go/types: consistently report nil type as "untyped nil"
Rob Findley [Thu, 4 Feb 2021 16:44:21 +0000 (11:44 -0500)]
[dev.regabi] go/types: consistently report nil type as "untyped nil"

This is a port of CL 284052 to go/types. The port is not entirely
faithful, as untyped conversion has been refactored in go/types.
Additionally, a comment was added to reference issue #13061 in the
implicitType method.

For #13061

Change-Id: Iec17611f6432c988624023d1d74121ff34eb0c83
Reviewed-on: https://go-review.googlesource.com/c/go/+/289715
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Robert Findley <rfindley@google.com>
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
3 years ago[dev.typeparams] cmd/compile/internal/types2: conversions to type parameters are...
Robert Griesemer [Fri, 5 Feb 2021 01:40:18 +0000 (17:40 -0800)]
[dev.typeparams] cmd/compile/internal/types2: conversions to type parameters are not constant

Disabled test/typeparam/fact.go for now as there's an issue
with stenciling.

Change-Id: Ie328a217de6d7b6695737f08ef5c944bcdaabd39
Reviewed-on: https://go-review.googlesource.com/c/go/+/290471
Trust: Robert Griesemer <gri@golang.org>
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
3 years ago[dev.typeparams] cmd/compile: allow generic funcs to call other generic funcs for...
Dan Scales [Mon, 8 Feb 2021 18:23:05 +0000 (10:23 -0800)]
[dev.typeparams] cmd/compile: allow generic funcs to call other generic funcs for stenciling

 - Handle generic function calling itself or another generic function in
   stenciling. This is easy - after it is created, just scan an
   instantiated generic function for function instantiations (that may
   needed to be stenciled), just like non-generic functions. The types
   in the function instantiation will already have been set by the
   stenciling.

 - Handle OTYPE nodes in subster.node() (allows for generic type
   conversions).

 - Eliminated some duplicated work in subster.typ().

 - Added new test case fact.go that tests a generic function calling
   itself, and simple generic type conversions.

 - Cause an error if a generic function is to be exported (which we
   don't handle yet).

 - Fixed some suggested changes in the add.go test case that I missed in
   the last review.

Change-Id: I5d61704254c27962f358d5a3d2e0c62a5099f148
Reviewed-on: https://go-review.googlesource.com/c/go/+/290469
Trust: Dan Scales <danscales@google.com>
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
3 years ago[dev.regabi] all: merge master (1901853) into dev.regabi
Cherry Zhang [Mon, 8 Feb 2021 19:01:08 +0000 (14:01 -0500)]
[dev.regabi] all: merge master (1901853) into dev.regabi

Merge List:

+ 2021-02-08 1901853098 runtime/metrics: fix panic in readingAllMetric example
+ 2021-02-08 ed3e4afa12 syscall/plan9: remove spooky fd action at a distance
+ 2021-02-05 724d0720b3 doc/go1.16: add missed heading tag in vet section
+ 2021-02-05 b54cd94d47 embed, io/fs: clarify that leading and trailing slashes are disallowed
+ 2021-02-05 4516afebed testing/fstest: avoid symlink-induced failures in tester
+ 2021-02-04 8869086d8f runtime: fix typo in histogram.go
+ 2021-02-03 e491c6eea9 math/big: fix comment in divRecursiveStep

Change-Id: I5e2bd18f42251eeb4ad0bf5c93a08c6a9b873d7b

3 years ago[dev.regabi] runtime: use g register in some assembly functions on AMD64
Cherry Zhang [Thu, 4 Feb 2021 17:40:04 +0000 (12:40 -0500)]
[dev.regabi] runtime: use g register in some assembly functions on AMD64

Now that we have a g register, just use it.

Note: functions that can be called from ABI0 context (e.g.
morestack) is unchanged. Functions that switch g is also
unchanged, because we need to set the new g in both the register
and TLS.

TODO: other OSes.

Change-Id: I692a82a7caa8417ff620a59676a6275f56747b94
Reviewed-on: https://go-review.googlesource.com/c/go/+/289718
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
3 years ago[dev.regabi] cmd/internal/obj/x86: use g register in stack bounds check
Cherry Zhang [Thu, 4 Feb 2021 16:43:24 +0000 (11:43 -0500)]
[dev.regabi] cmd/internal/obj/x86: use g register in stack bounds check

In ABIInternal context, we can directly use the g register for
stack bounds check.

Change-Id: I8b1073a3343984a6cd76cf5734ddc4a8cd5dc73f
Reviewed-on: https://go-review.googlesource.com/c/go/+/289711
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
3 years ago[dev.regabi] runtime: initialize special registers before sigpanic
Cherry Zhang [Thu, 4 Feb 2021 16:41:34 +0000 (11:41 -0500)]
[dev.regabi] runtime: initialize special registers before sigpanic

In case that we are panicking in ABI0 context or external code,
special registers are not initialized. Initialized them in
injected code before calling sigpanic.

TODO: Windows, Plan 9.

Change-Id: I0919b80e7cc55463f3dd94f1f63cba305717270a
Reviewed-on: https://go-review.googlesource.com/c/go/+/289710
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
3 years ago[dev.regabi] cmd/compile, runtime: reserve R14 as g registers on AMD64
Cherry Zhang [Tue, 2 Feb 2021 23:20:16 +0000 (18:20 -0500)]
[dev.regabi] cmd/compile, runtime: reserve R14 as g registers on AMD64

This is a proof-of-concept change for using the g register on
AMD64. getg is now lowered to R14 in the new ABI. The g register
is not yet used in all places where it can be used (e.g. stack
bounds check, runtime assembly code).

Change-Id: I10123ddf38e31782cf58bafcdff170aee0ff0d1b
Reviewed-on: https://go-review.googlesource.com/c/go/+/289196
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: David Chase <drchase@google.com>
3 years agoruntime/metrics: fix panic in readingAllMetric example
Changkun Ou [Sun, 7 Feb 2021 16:31:12 +0000 (17:31 +0100)]
runtime/metrics: fix panic in readingAllMetric example

medianBucket can return if the total is greater than thresh.
However, if a histogram has no counts, total and thresh
will both be zero and cause panic.

Adding an equal sign to prevent the potential panic.

Fixes #44148

Change-Id: Ifb8a781990f490d142ae7c035b4e01d6a07ae04d
Reviewed-on: https://go-review.googlesource.com/c/go/+/290171
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>

3 years agosyscall/plan9: remove spooky fd action at a distance
Ori Bernstein [Wed, 6 Jan 2021 02:40:05 +0000 (02:40 +0000)]
syscall/plan9: remove spooky fd action at a distance

Change Plan 9 fork/exec to use the O_CLOEXEC file
descriptor, instead of relying on spooky at a
distance.

Historically, Plan 9 has set the O_CLOEXEC flag on
the underlying channels in the kernel, rather
than the file descriptors -- if two fds pointed
at a single channel, as with dup, changing the
flags on one of them would be observable on the
other.

The per-Chan semantics are ok, if unexpected,
when a chan is only handled within a single
process, but this isn't always the case.

Forked processes share Chans, but even more of
a problem is the interaction between /srv and
OCEXEC, which can lead to unexectedly closed
file descriptors in completely unrelated
proceses. For example:

func exists() bool {
// If some other thread execs here,
// we don't want to leak the fd, so
// open it O_CLOEXEC
fd := Open("/srv/foo", O_CLOEXEC)
if fd != -1 {
Close(fd)
return true
}
return false
}

would close the connection to any file descriptor
(maybe even for the root fs) in ALL other processes
that have it open if an exec were to happen(!),
which is quite undesriable.

As a result, 9front will be changing this behavior
for the next release.

Go is the only code observed so far that relies on
this behavior on purpose, and  It's easy to make the
code work with both semantics: simply using the file
descriptor that was opened with O_CEXEC instead of
throwing it away.

So we do that here.

Fixes #43524

Change-Id: I4887f5c934a5e63e5e6c1bb59878a325abc928d3
GitHub-Last-Rev: 96bb21bd1e8f64dc7e082a56928748a7d54c9272
GitHub-Pull-Request: golang/go#43533
Reviewed-on: https://go-review.googlesource.com/c/go/+/281833
Reviewed-by: David du Colombier <0intro@gmail.com>
Reviewed-by: Richard Miller <millerresearch@gmail.com>
Reviewed-by: Jacob Moody <j4kem00dy@gmail.com>
Run-TryBot: David du Colombier <0intro@gmail.com>
Trust: Ian Lance Taylor <iant@golang.org>

3 years ago[dev.regabi] cmd/link: resolve symbol ABI in shared linkage
Cherry Zhang [Wed, 3 Feb 2021 20:07:33 +0000 (15:07 -0500)]
[dev.regabi] cmd/link: resolve symbol ABI in shared linkage

In shared build mode and linkage, currently we assume all
function symbols are ABI0 (except for generated type algorithm
functions), and alias them to ABIInternal. When the two ABIs
actually differ (as it is now), this is not actually correct.
This CL resolves symbol ABI based on their mangled names.
If the symbol's name has a ".abi0" or ".abiinternal" suffix, it
is of the corresponding ABI. The symbol without the suffix is
the other ABI. For functions without ABI wrapper generated,
only one ABI exists but we don't know what it is, so we still
use alias (for now).

Change-Id: I2165f149bc83d513e81eb1eb4ee95464335b0e75
Reviewed-on: https://go-review.googlesource.com/c/go/+/289289
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
3 years agodoc/go1.16: add missed heading tag in vet section
KimMachineGun [Fri, 5 Feb 2021 05:47:46 +0000 (05:47 +0000)]
doc/go1.16: add missed heading tag in vet section

Add missed heading tag in CL 276373.

For #40700

Change-Id: Ida9e8861589bbc296a5a1cecbf9fe33fa09ed0ca
GitHub-Last-Rev: d218f8d4b70b20c30422863db7bed3683e3218e6
GitHub-Pull-Request: golang/go#44111
Reviewed-on: https://go-review.googlesource.com/c/go/+/289869
Reviewed-by: Tim King <taking@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Trust: Tim King <taking@google.com>
Trust: Dmitri Shuralyov <dmitshur@golang.org>

3 years agoembed, io/fs: clarify that leading and trailing slashes are disallowed
Jay Conrod [Fri, 5 Feb 2021 21:45:40 +0000 (16:45 -0500)]
embed, io/fs: clarify that leading and trailing slashes are disallowed

Fixes #44012

Change-Id: I5782cea301a65ae12ba870ff1e6b2e0a2651dc09
Reviewed-on: https://go-review.googlesource.com/c/go/+/290071
Run-TryBot: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Jay Conrod <jayconrod@google.com>

3 years agotesting/fstest: avoid symlink-induced failures in tester
Russ Cox [Fri, 5 Feb 2021 15:55:12 +0000 (10:55 -0500)]
testing/fstest: avoid symlink-induced failures in tester

Do not require directory entry and Stat result to match for symlinks,
because they won't (Stat dereferences the symlink).

Fixes #44113.

Change-Id: Ifc6dbce5719906e2f42254a7172f1ef787464a9e
Reviewed-on: https://go-review.googlesource.com/c/go/+/290009
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
3 years ago[dev.regabi] runtime: delete gosave function
Cherry Zhang [Thu, 4 Feb 2021 17:59:06 +0000 (12:59 -0500)]
[dev.regabi] runtime: delete gosave function

The runtime.gosave function is not used anywhere. Delete.

Note: there is also a gosave<> function, which is actually used
and not deleted.

Change-Id: I64149a7afdd217de26d1e6396233f2becfad7153
Reviewed-on: https://go-review.googlesource.com/c/go/+/289719
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
3 years ago[dev.regabi] runtime: zero X15 in racecall
Cherry Zhang [Tue, 2 Feb 2021 23:25:39 +0000 (18:25 -0500)]
[dev.regabi] runtime: zero X15 in racecall

racecall can be called in ABIInternal context (e.g. raceread
calling racecalladdr calling racecall) without wrapper. racecall
calls C code, which doesn't preserve our special registers. Set
them explicitly in racecall upon returning from C.

Change-Id: Ic990479c1fca6bb8a3b151325c7a89be8331a530
Reviewed-on: https://go-review.googlesource.com/c/go/+/289709
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
3 years ago[dev.regabi] cmd/asm: define g register on AMD64
Cherry Zhang [Wed, 3 Feb 2021 17:09:53 +0000 (12:09 -0500)]
[dev.regabi] cmd/asm: define g register on AMD64

Define g register as R14 on AMD64. It is not used now, but will
be in later CLs.

The name "R14" is still recognized.

Change-Id: I9a066b15bf1051113db8c6640605e350cea397b9
Reviewed-on: https://go-review.googlesource.com/c/go/+/289195
Trust: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
3 years ago[dev.regabi] runtime: mark racecallbackthunk as ABIInternal
Cherry Zhang [Tue, 2 Feb 2021 23:09:03 +0000 (18:09 -0500)]
[dev.regabi] runtime: mark racecallbackthunk as ABIInternal

racecallbackthunk is called from C, and it needs to follow C ABI.
The assembly code preserves C callee-save registers. It must not
be called via wrappers, which may not preserve those registers.

Change-Id: Icd72c399f4424d73c4882860d85057fe2671f6aa
Reviewed-on: https://go-review.googlesource.com/c/go/+/289194
Trust: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
3 years ago[dev.regabi] runtime: don't mark rt0_go ABIInternal
Cherry Zhang [Wed, 3 Feb 2021 16:53:35 +0000 (11:53 -0500)]
[dev.regabi] runtime: don't mark rt0_go ABIInternal

rt0_go is not actually ABIInternal, and it actually has callers
(e.g. _rt0_amd64).

Change-Id: Id730176e620ad9f443e6bfca6ded81a1367531ba
Reviewed-on: https://go-review.googlesource.com/c/go/+/289193
Trust: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
3 years ago[dev.typeparams] cmd/compile: add stenciling of simple generic functions
Dan Scales [Wed, 3 Feb 2021 23:45:26 +0000 (15:45 -0800)]
[dev.typeparams] cmd/compile: add stenciling of simple generic functions

Allow full compilation and running of simple programs with generic
functions by stenciling on the fly the needed generic functions. Deal
with some simple derived types based on type params.

Include a few new typeparam tests min.go and add.go which involve
fully compiling and running simple generic code.

Change-Id: Ifc2a64ecacdbd860faaeee800e2ef49ffef9df5e
Reviewed-on: https://go-review.googlesource.com/c/go/+/289630
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Dan Scales <danscales@google.com>
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
3 years ago[dev.regabi] runtime/cgo: call setg_gcc in crosscall_amd64
Cherry Zhang [Tue, 2 Feb 2021 22:26:57 +0000 (17:26 -0500)]
[dev.regabi] runtime/cgo: call setg_gcc in crosscall_amd64

Currently, when using cgo, the g pointer is set via a separate
call to setg_gcc or with inline assembly in threadentry. This CL
changes it to call setg_gcc in crosscall_amd64, like other g-
register platforms. When we have an actual g register on AMD64,
we'll need to set the register immediately before calling into
Go.

Change-Id: Ib1171e05cd0dabba3b7d12e072084d141051cf3d
Reviewed-on: https://go-review.googlesource.com/c/go/+/289192
Trust: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
3 years ago[dev.typeparams] cmd/compile/internal/types2: type alias decl requires go1.9
Robert Griesemer [Thu, 4 Feb 2021 06:34:34 +0000 (22:34 -0800)]
[dev.typeparams] cmd/compile/internal/types2: type alias decl requires go1.9

Add respective check to type checker.
Remove respective check from the compiler's new type2-based noder.

Updates #31793.

Change-Id: I907e3acab4c136027a8c3db1e9bac301d209c2e1
Reviewed-on: https://go-review.googlesource.com/c/go/+/289570
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
3 years ago[dev.typeparams] cmd/compile: pass -lang flag value to new type checker
Robert Griesemer [Thu, 4 Feb 2021 06:14:04 +0000 (22:14 -0800)]
[dev.typeparams] cmd/compile: pass -lang flag value to new type checker

This enables another test.

Change-Id: I80763b97d939e225158a083299b2e0d189268bc7
Reviewed-on: https://go-review.googlesource.com/c/go/+/289569
Trust: Robert Griesemer <gri@golang.org>
Trust: Dan Scales <danscales@google.com>
Reviewed-by: Dan Scales <danscales@google.com>
3 years ago[dev.typeparams] cmd/compile/internal/types2: add support for language version checking
Robert Griesemer [Wed, 3 Feb 2021 22:56:13 +0000 (14:56 -0800)]
[dev.typeparams] cmd/compile/internal/types2: add support for language version checking

Add the Config.Lang field which may be set to a Go version string,
such as "go1.12". This is a string rather than explicit semantic
version numbers (such as {1, 12}) for API robustness; a string
is more flexible should we need more or different information.

Add -lang flag to types2 package for use with (manual) testing
when running "go test -run Check$ -lang=... -files=...".

While changing flags, look for comma-separated (rather than space-
separated) files when providing the -file flag.

Check that numeric constant literals, signed shift counts are
accepted according to the selected language version.

Type alias declarations and overlapping embedded interfaces are
not yet checked.

Updates #31793.

Change-Id: I9ff238ed38a88f377eb2267dc3e8816b89a40635
Reviewed-on: https://go-review.googlesource.com/c/go/+/289509
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
3 years ago[dev.typeparams] cmd/compile/internal/types2: use 512 bits as max. integer precision
Robert Griesemer [Fri, 29 Jan 2021 23:29:36 +0000 (15:29 -0800)]
[dev.typeparams] cmd/compile/internal/types2: use 512 bits as max. integer precision

This matches the compiler's existing limitations and thus ensures
that types2 reports the same errors for oversize integer constants.

Change-Id: I4fb7c83f3af69098d96f7b6c53dbe3eaf6ea9ee4
Reviewed-on: https://go-review.googlesource.com/c/go/+/288633
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
3 years ago[dev.regabi] go/types: report error for invalid main function signature
Rob Findley [Thu, 4 Feb 2021 16:16:25 +0000 (11:16 -0500)]
[dev.regabi] go/types: report error for invalid main function signature

This is a port of CL 279424, which didn't make it into master in time
for go1.16. Move it to dev.regabi so that it may be merged.

Notably, this port no longer removes the _InvalidInitSig error code,
instead opting to deprecate it. Now that error codes are 'locked in' for
go1.16, even if their API may not yet be exposed, we should follow the
practice of not changing their values. In the future, code generation
can make it easier to keep error code values constant.

For #43308

Change-Id: I5260b93fd063393d38d6458e45a67e7f9b7426ed
Reviewed-on: https://go-review.googlesource.com/c/go/+/289714
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>
3 years ago[dev.regabi] cmd/internal/obj: access Attribute atomically
Cherry Zhang [Wed, 3 Feb 2021 23:10:04 +0000 (18:10 -0500)]
[dev.regabi] cmd/internal/obj: access Attribute atomically

Symbol's Attributes and ABI are in the same word. In the
concurrent backend, we may read one symbol's ABI (the callee)
while setting its attributes in another goroutine.

Fix racecompile build.

Change-Id: I500e869bafdd72080119ab243db94eee3afcf926
Reviewed-on: https://go-review.googlesource.com/c/go/+/289290
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
3 years ago[dev.regabi] go/types: port check_test.go ergonomics from dev.typeparams
Rob Findley [Thu, 4 Feb 2021 16:06:15 +0000 (11:06 -0500)]
[dev.regabi] go/types: port check_test.go ergonomics from dev.typeparams

On the dev.typeparams and dev.go2go branches, check_test.go has been
updated to automatically discover test data. This is convenient, so port
it to dev.regabi.

Change-Id: I5da9a9a5139c35a2693e64364eb9928ece1cd7c6
Reviewed-on: https://go-review.googlesource.com/c/go/+/289713
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>