]> Cypherpunks.ru repositories - gostls13.git/log
gostls13.git
3 years ago[dev.typeparams] all: merge master (fdab5be) into dev.typeparams
Matthew Dempsky [Mon, 14 Jun 2021 19:26:41 +0000 (12:26 -0700)]
[dev.typeparams] all: merge master (fdab5be) into dev.typeparams

Two non-conflict changes included because they're needed for all.bash:

1. Bump internal/goversion.Version to 18. This will happen eventually
anyway (dev.typeparams will not be merged back to Go 1.17), and is
needed for cmd/api to allow new API additions.

2. Add fixedbugs/issue46725.go (new test added on master) to the list
of known failures for -G=3. This test exercises a bug that was fixed
in typecheck, but -G=3 mode has duplicated that code and will need to
be fixed as well. That's outside of the scope of a merge.

Conflicts:

- src/runtime/traceback.go

  Nearby lines were removed on both master and dev.typeparams.

Merge List:

+ 2021-06-14 fdab5be159 doc/go1.17: further revise OpenBSD release notes
+ 2021-06-14 326ea438bb cmd/compile: rewrite a, b = f() to use temporaries when type not identical
+ 2021-06-14 3249b645c9 cmd/compile: factor out rewrite multi-valued f()
+ 2021-06-13 14305bf0b9 misc/cgo: generate Windows import libraries for clang
+ 2021-06-13 24cff0f044 cmd/go, misc/cgo: skip test if no .edata
+ 2021-06-13 67b1b6a2e3 cmd/compile: allow ir.OSLICE2ARRPTR in mayCall
+ 2021-06-12 1ed0d129e9 runtime: testprogcgo: don't call exported Go functions directly from Go
+ 2021-06-12 9d46ee5ac4 reflect: handle stack-to-register translation in callMethod
+ 2021-06-11 e552a6d312 cmd/go: remove hint when no module is suggested
+ 2021-06-11 16b5d766d8 syscall: do not load native libraries on non-native powershell on arm
+ 2021-06-11 77aa209b38 runtime: loop on EINTR in macOS sigNoteSleep
+ 2021-06-11 e2dc6dd5c9 doc/go1.17: clean up formatting of gofmt section
+ 2021-06-11 2f1128461d cmd/go: match Windows paths in TestScript/mod_invalid_version
+ 2021-06-11 2721da2608 doc/go1.17: fix formatting near httptest
+ 2021-06-10 770f1de8c5 net/http: remove test-only private key from production binaries
+ 2021-06-10 8d11b1d117 cmd/go: report the imports of CompiledGoFiles in ImportMap
+ 2021-06-10 dc00dc6c6b crypto/tls: let HTTP/1.1 clients connect to servers with NextProtos "h2"
+ 2021-06-09 27f83723e9 api: promote next to go1.17
+ 2021-06-09 182157c81a doc/go1.17: remove lingering TODO
+ 2021-06-09 a5bc060b42 doc/go1.17: document strconv changes for Go 1.17
+ 2021-06-09 1402b27d46 strconv: document parsing of leading +/-
+ 2021-06-09 df35ade067 doc/go1.17: document //go:build lines
+ 2021-06-09 e4e7807d24 net/http: add AllowQuerySemicolons
+ 2021-06-09 ec3026d032 doc/go1.17: remove TODO for ports section
+ 2021-06-09 e6dda19888 net/url: reject query values with semicolons
+ 2021-06-09 139e935d3c math/big: comment division
+ 2021-06-09 aa5540cd82 cmd/compile: make map.zero symbol content-addressable
+ 2021-06-09 07ca28d529 cmd/link: fix bug in -strictdups checking of BSS symbols
+ 2021-06-08 bcecae2af6 doc/go1.17: mention new possibility of type conversion panicking
+ 2021-06-08 63dcab2e91 doc/go1.17: mention new vet checks sigchanyzer and stdmethods.
+ 2021-06-08 6551763a60 doc/go1.17: mention block profile bias fix
+ 2021-06-08 cb80937bf6 Revert "doc/go1.17: mention block profile bias fix"
+ 2021-06-08 d3e3d03666 net: reject leading zeros in IP address parsers
+ 2021-06-08 da4a640141 doc/go1.17: revise OpenBSD release notes
+ 2021-06-08 689f4c7415 doc/go1.17: mention block profile bias fix
+ 2021-06-08 9afe071c60 doc/go1.17: remove TODO for Tools section
+ 2021-06-08 f753d7223e doc/go1.17: resolve TODO for cmd/cover
+ 2021-06-08 9498b0155d cmd/go: in Go 1.17+ modules, add indirect go.mod dependencies separately from direct ones
+ 2021-06-08 949f00cebe doc/go1.17: add release notes for crypto packages
+ 2021-06-08 0fb3e2c184 doc/go1.17: add a release note for the '-compat' flag to 'go mod tidy'
+ 2021-06-08 2169deb352 cmd/compile: use t.AllMethods when sorting typesByString
+ 2021-06-08 c20bcb6488 runtime: remove out-of-date comments about frame skipping
+ 2021-06-07 39c39ae52f doc: document Go 1.17 language changes
+ 2021-06-07 dc8b558951 cmd/dist: pass -Wno-lto-type-mismatch in swig_callback_lto
+ 2021-06-07 909dd5e010 strconv: ParseFloat: always return ErrSyntax for bad syntax

Change-Id: Iffdf379d0275bbd12d50149ce38634773ced481d

3 years agodoc/go1.17: further revise OpenBSD release notes
Joel Sing [Mon, 14 Jun 2021 13:47:10 +0000 (23:47 +1000)]
doc/go1.17: further revise OpenBSD release notes

Simplify and remove forward-compatibility reference, as OpenBSD 6.9 has
already been released (1st of May 2021).

Updates #44513

Change-Id: I0a1abbb397f31d15c80a970edaa9723f894cafa9
Reviewed-on: https://go-review.googlesource.com/c/go/+/327652
Trust: Joel Sing <joel@sing.id.au>
Reviewed-by: Cherry Mui <cherryyz@google.com>
3 years agocmd/compile: rewrite a, b = f() to use temporaries when type not identical
Cuong Manh Le [Sun, 13 Jun 2021 15:28:44 +0000 (22:28 +0700)]
cmd/compile: rewrite a, b = f() to use temporaries when type not identical

If any of the LHS expressions of an OAS2FUNC are not identical to the
respective function call results, escape analysis mishandles the
implicit conversion, causes memory corruption.

Instead, we should insert autotmps like we already do for f(g()) calls
and return g() statements.

Fixes #46725

Change-Id: I71a08da0bf1a03d09a023da5b6f78fb37a4a4690
Reviewed-on: https://go-review.googlesource.com/c/go/+/327651
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: Matthew Dempsky <mdempsky@google.com>
3 years agocmd/compile: factor out rewrite multi-valued f()
Cuong Manh Le [Sun, 13 Jun 2021 15:26:21 +0000 (22:26 +0700)]
cmd/compile: factor out rewrite multi-valued f()

So next CL can reuse code to rewrite OAS2FUNC.

Passes toolstash -cmp.

For #46725

Change-Id: I1113ed615b6d6b9494dd87000ce342d7a46d9e7b
Reviewed-on: https://go-review.googlesource.com/c/go/+/327650
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: Matthew Dempsky <mdempsky@google.com>
3 years agomisc/cgo: generate Windows import libraries for clang
Jason A. Donenfeld [Fri, 11 Jun 2021 15:53:29 +0000 (17:53 +0200)]
misc/cgo: generate Windows import libraries for clang

LLD won't import a .dll directly and instead requires an import library.
So generate these using -out-implib, the same way as was done in CL
312046, where it makes sense, and elsewhere build the import library
using a def file. We can't use -out-implib all the time, because the
output file gets overwritten each time the linker is called, rather than
merged.

Updates #46502.

Change-Id: Iefe54cb6c576004b83b1039ba673881b8640423d
Reviewed-on: https://go-review.googlesource.com/c/go/+/327211
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
3 years agocmd/go, misc/cgo: skip test if no .edata
Jason A. Donenfeld [Sat, 12 Jun 2021 10:34:40 +0000 (12:34 +0200)]
cmd/go, misc/cgo: skip test if no .edata

Clang does not produce binaries with an .edata section, even when it
exports symbols properly, so just skip this binutils-specific test for
that case. Later we can rewrite these tests entirely to do something
more robust.

Updates #46719.

Change-Id: I864b3c2d91e66800c55454ae11d4ab1623693d14
Reviewed-on: https://go-review.googlesource.com/c/go/+/327549
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
3 years agocmd/compile: allow ir.OSLICE2ARRPTR in mayCall
Cuong Manh Le [Sun, 13 Jun 2021 03:55:19 +0000 (10:55 +0700)]
cmd/compile: allow ir.OSLICE2ARRPTR in mayCall

CL 301650 adds conversion from slice to array ptr. The conversion
expression may appear as argument to a function call, so it will be
tested by mayCall. But ir.OSLICE2ARRPTR  op is not handled by mayCall,
causes the compiler crashes.

Updates #395
Fixes #46720

Change-Id: I39e1b3e38e224a31f3dec46dbbdc855ff3b2c6a5
Reviewed-on: https://go-review.googlesource.com/c/go/+/327649
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>

3 years ago[dev.typeparams] cmd/compile: move //go:embed -lang check to noder
Matthew Dempsky [Sun, 13 Jun 2021 01:44:51 +0000 (18:44 -0700)]
[dev.typeparams] cmd/compile: move //go:embed -lang check to noder

User errors should be reported in noder and/or typecheck, we already
know the -lang flag's value during noding, and checking it then works
better for unified IR.

The "multiple files for type" and "cannot apply to var of type" errors
should also be moved to typecheck, but then they'd have to be
duplicated for -G=3 mode (because it avoids typecheck). So those are
left behind for now.

Change-Id: I7caf16163c9faf975784acacdb8147514d2e698e
Reviewed-on: https://go-review.googlesource.com/c/go/+/327609
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>
3 years agoruntime: testprogcgo: don't call exported Go functions directly from Go
Ian Lance Taylor [Fri, 11 Jun 2021 18:50:42 +0000 (11:50 -0700)]
runtime: testprogcgo: don't call exported Go functions directly from Go

Instead route through a C function, to avoid declaration conflicts
between the declaration needed in the cgo comment and the declaration
generated by cgo in _cgo_export.h.

This is not something user code will ever do, so no need to make it
work in cgo.

Fixes #46502

Change-Id: I1bfffdc76ef8ea63e3829871298d0774157957a5
Reviewed-on: https://go-review.googlesource.com/c/go/+/327309
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>
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
3 years ago[dev.typeparams] cmd/compile: simplify NewClosureFunc
Matthew Dempsky [Sat, 12 Jun 2021 14:33:18 +0000 (07:33 -0700)]
[dev.typeparams] cmd/compile: simplify NewClosureFunc

I initially made NewClosureFunc take an "outerfn *Func" parameter
because I was planning on having it handle closure naming, until
remembering that naming needs to wait until typecheck for noder.

We don't actually need the *Func yet, just to know whether it's
non-nil. So change the parameter to a bool, which simplifies callers a
little.

Change-Id: Ie83ee4a1ed0571ac6d3879ffd8474c6c3c1a9ff9
Reviewed-on: https://go-review.googlesource.com/c/go/+/327450
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>

3 years ago[dev.typeparams] test: add string quoting support to test/run.go
Matthew Dempsky [Fri, 11 Jun 2021 16:54:40 +0000 (09:54 -0700)]
[dev.typeparams] test: add string quoting support to test/run.go

This CL copies go/build's splitQuoted function (used for parsing #cgo
directives within `import "C"` preambles) to parse test recipe
commands. In particular, this now allows writing "build" and "run"
tests that use -gcflags to pass multiple compiler flags.

Change-Id: I0d18a9c13a4ce24bbdfa1da8662c0498c93a6762
Reviewed-on: https://go-review.googlesource.com/c/go/+/327275
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>
3 years ago[dev.typeparams] cmd/compile: refactor closure construction
Matthew Dempsky [Fri, 11 Jun 2021 10:09:26 +0000 (03:09 -0700)]
[dev.typeparams] cmd/compile: refactor closure construction

typecheck.tcClosure is complicated with many code flows because all of
its callers setup the closure funcs in slightly different ways. E.g.,
it's non-obvious who's responsible for setting the underlying func's
Sym or adding it to target.Decls, or how to write new code that
constructs a closure without interfering with existing code.

This CL refactors everything to use three common functions in package
ir: NewClosureFunc (which handle creating the Func, Name, and
ClosureExpr and wiring them together), NameClosure (which generates
and assigns its unique Sym), and UseClosure (which handles adding the
Func to target.Decls).

Most IR builders can actually name the closure right away, but the
legacy noder+typecheck path may not yet know the name of the enclosing
function. In particular, for methods declared with aliased receiver
parameters, we need to wait until after typechecking top-level
declarations to know the method's true name. So they're left anonymous
until typecheck.

UseClosure does relatively little work today, but it serves as a
useful spot to check that the code setting up closures got it right.
It may also eventually serve as an optimization point for early
lifting of trivial closures, which may or may not ultimately be
beneficial.

Change-Id: I7da1e93c70d268f575b12d6aaeb2336eb910a6f1
Reviewed-on: https://go-review.googlesource.com/c/go/+/327051
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>
3 years ago[dev.typeparams] cmd/compile: avoid ir.DeepCopy in noder.constDecl
Matthew Dempsky [Sat, 12 Jun 2021 01:51:56 +0000 (18:51 -0700)]
[dev.typeparams] cmd/compile: avoid ir.DeepCopy in noder.constDecl

Instead of using ir.DeepCopy to copy the IR from the previous constant
declaration, just call exprList again and then fix up the position
information. This is equivalent in practice, but has cleaner semantics
for tricky corner cases like constant declarations that contain
function literals.

In particular, this refactoring is necessary for the next CL that
cleans up function literal construction, because it adds extra
consistency checks that weren't satisfied by DeepCopy'd OCLOSUREs.

Change-Id: I0372bde5d6613695ee572cc8bf8fb4ff9aef4cb4
Reviewed-on: https://go-review.googlesource.com/c/go/+/327449
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>
3 years agoreflect: handle stack-to-register translation in callMethod
Michael Anthony Knyszek [Fri, 11 Jun 2021 13:58:05 +0000 (13:58 +0000)]
reflect: handle stack-to-register translation in callMethod

callMethod previously assumed erroneously that between the "value" and
"method" ABIs (that is, the ABI the caller is following to call this
method value and the actual ABI of the method), it could never happen
that an argument passed on the stack in the former could be passed in
registers in the latter. The cited reason was that the latter always
uses strictly more registers.

However, there are situations where the value ABI could pass a value on
the stack, but later is passed in a register. For instance, if the
receiver pushes a value passed in registers that uses multiple registers
to be passed on the stack, later arguments which were passed on the
stack may now be passed in registers.

This change fixes callMethod to no longer makes this assumption, and
handles the stack-to-register translation explicitly.

Fixes #46696.

Change-Id: I7100a664d97bbe401302cc893b3a98b28cdcdfc0
Reviewed-on: https://go-review.googlesource.com/c/go/+/327089
Trust: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
3 years ago[dev.typeparams] cmd/compile: scaffolding for export data experiments
Matthew Dempsky [Fri, 11 Jun 2021 13:33:30 +0000 (06:33 -0700)]
[dev.typeparams] cmd/compile: scaffolding for export data experiments

This CL adds a simple framework for augmenting the current export data
format by writing out additional data *after* the existing data, with
an extra header before it that current readers ignore.

In particular, this is used by unified IR to be able to experiment and
iterate on export data designs without having to keep the
go/internal/gcimporter and x/tools/go/gcexportdata importers in
sync. Instead, they simply continue reading the existing data written
out by typecheck/iexport.go.

Change-Id: I883211c2892e2c7dec758b85ff6bc31b244440a0
Reviewed-on: https://go-review.googlesource.com/c/go/+/327169
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Trust: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
3 years agocmd/go: remove hint when no module is suggested
Constantin Konstantinidis [Sat, 5 Jun 2021 05:48:30 +0000 (07:48 +0200)]
cmd/go: remove hint when no module is suggested

Fixes #46528

Change-Id: I2453d321ece878ea7823865758aa4a16b3ed7fe8
Reviewed-on: https://go-review.googlesource.com/c/go/+/325430
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Trust: Heschi Kreinick <heschi@google.com>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>

3 years ago[dev.typeparams] all: always enable regabig on AMD64
Cherry Mui [Wed, 9 Jun 2021 18:29:20 +0000 (14:29 -0400)]
[dev.typeparams] all: always enable regabig on AMD64

Always enable regabig on AMD64, which enables the G register and
the X15 zero register. Remove the fallback path.

Also remove the regabig GOEXPERIMENT. On AMD64 it is always
enabled (this CL). Other architectures already have a G register,
except for 386, where there are too few registers and it is
unlikely that we will reserve one. (If we really do, we can just
add a new experiment).

Change-Id: I229cac0060f48fe58c9fdaabd38d6fa16b8a0855
Reviewed-on: https://go-review.googlesource.com/c/go/+/327272
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Go Bot <gobot@golang.org>

3 years agosyscall: do not load native libraries on non-native powershell on arm
Jason A. Donenfeld [Fri, 11 Jun 2021 15:36:50 +0000 (17:36 +0200)]
syscall: do not load native libraries on non-native powershell on arm

The powershell that currently ships on ARM Windows isn't native, so it
won't load native DLLs. So just skip the tests for now, and reenable it
if this ever changes.

Updates #46701.

Change-Id: I2559fdf13cb65d3ecdc4c6f6df7dec1b490b9651
Reviewed-on: https://go-review.googlesource.com/c/go/+/327210
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>

3 years ago[dev.typeparams] internal/buildcfg: always enable regabiwrappers on AMD64
Cherry Mui [Wed, 9 Jun 2021 17:51:59 +0000 (13:51 -0400)]
[dev.typeparams] internal/buildcfg: always enable regabiwrappers on AMD64

Always enable regabiwrappers on AMD64. GOEXPERIMENT=none will not
turn it off.

Change-Id: I0aa208c02157661ac3676b753bcfbfa050b99e41
Reviewed-on: https://go-review.googlesource.com/c/go/+/327271
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>

3 years agoruntime: loop on EINTR in macOS sigNoteSleep
Ian Lance Taylor [Thu, 10 Jun 2021 22:35:05 +0000 (15:35 -0700)]
runtime: loop on EINTR in macOS sigNoteSleep

Fixes #46466

Change-Id: I8fb15d0c8ef7ef6e6fc1b9e0e033d213255fe0df
Reviewed-on: https://go-review.googlesource.com/c/go/+/326778
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 Knyszek <mknyszek@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
3 years ago[dev.typeparams] runtime: simplify defer record allocation
Cherry Mui [Tue, 8 Jun 2021 22:45:18 +0000 (18:45 -0400)]
[dev.typeparams] runtime: simplify defer record allocation

Now that deferred functions are always argumentless and defer
records are no longer with arguments, defer record can be fixed
size (just the _defer struct). This allows us to simplify the
allocation of defer records, specifically, remove the defer
classes and the pools of different sized defers.

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

3 years ago[dev.typeparams] runtime: allow newproc split stack
Cherry Mui [Sat, 5 Jun 2021 00:04:57 +0000 (20:04 -0400)]
[dev.typeparams] runtime: allow newproc split stack

newproc was not allowed to split stack because it had a special
stack layout, where the go'd function's arguments were passed on
stack but not included in the signature (therefore the stack map).
Now it no longer has argument, so it does not need to be nosplit.

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

3 years ago[dev.typeparams] cmd/compile: fix wrapper generation for imported generics
Matthew Dempsky [Fri, 11 Jun 2021 09:44:16 +0000 (02:44 -0700)]
[dev.typeparams] cmd/compile: fix wrapper generation for imported generics

This CL fixes reflectdata.methodWrapper to compile wrapper functions
for method expressions involving imported, instantiated interface
types. CL 322193 fixed a similar issue for generating wrappers for
imported, instantiated concrete types, but missed this case.

This is necessary to fix CL 326169's test case 10. However, that test
case is not included currently, because -G=3 mode crashes on method
expressions involving *any* instantiated interface type. Adding a test
will have to wait until either this issue is fixed in -G=3 mode, or
unified IR is merged.

Updates #46704.

Change-Id: Ib02d3c20e7c69d16288f1286cd1c98e7cbbba114
Reviewed-on: https://go-review.googlesource.com/c/go/+/327055
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Dan Scales <danscales@google.com>
Trust: Dan Scales <danscales@google.com>
Trust: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>

3 years agodoc/go1.17: clean up formatting of gofmt section
Brad Fitzpatrick [Thu, 10 Jun 2021 21:40:58 +0000 (14:40 -0700)]
doc/go1.17: clean up formatting of gofmt section

It was the only h3 in <code>, and it lacked <p> around its content.

It looked like it was part of the prior section:

    https://tip.golang.org/doc/go1.17#gofmt

Change-Id: I7e9ef70e9a03474225833f44420aabd70dab3cd5
Reviewed-on: https://go-review.googlesource.com/c/go/+/326774
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Trust: Brad Fitzpatrick <bradfitz@golang.org>

3 years agocmd/go: match Windows paths in TestScript/mod_invalid_version
Bryan C. Mills [Thu, 10 Jun 2021 20:54:53 +0000 (16:54 -0400)]
cmd/go: match Windows paths in TestScript/mod_invalid_version

Fixes #46691

Change-Id: I3bef9a773be640bed96eb2dc395cb11671a0767a
Reviewed-on: https://go-review.googlesource.com/c/go/+/326869
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
3 years ago[dev.typeparams] cmd/compile: add "check" field to noder.gcimports
Matthew Dempsky [Fri, 11 Jun 2021 08:45:24 +0000 (01:45 -0700)]
[dev.typeparams] cmd/compile: add "check" field to noder.gcimports

The unified IR importer needs access to the *types2.Checker instance
to lazily construct objects and types. Eventually, maybe the
types2.Importer API can be extended to add the Checker as another
parameter (or more likely something like an ImportConfig struct), but
right now we can handle this ourselves as long as we forgo the
types2.(*Config).Check convenience wrapper.

Updates #46449.

Change-Id: I89c41d5d47c224a58841247cd236cd9f701a23a1
Reviewed-on: https://go-review.googlesource.com/c/go/+/327053
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>
3 years agodoc/go1.17: fix formatting near httptest
Rhys Hiltner [Thu, 10 Jun 2021 22:05:07 +0000 (15:05 -0700)]
doc/go1.17: fix formatting near httptest

Change-Id: Ic1a0add3a1e137ca5cd0f3e9ce3266191b0b55cd
Reviewed-on: https://go-review.googlesource.com/c/go/+/326777
Trust: Alberto Donizetti <alb.donizetti@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
3 years ago[dev.typeparams] cmd/compile: allow embedding Type.Vargen into Sym.Name
Matthew Dempsky [Fri, 11 Jun 2021 10:47:07 +0000 (03:47 -0700)]
[dev.typeparams] cmd/compile: allow embedding Type.Vargen into Sym.Name

Unified IR currently works by hoisting local type definitions to
package scope, which requires giving them a unique name. Its current
solution is to directly embed the ·N suffix in Sym.Name, rather than
set Type.Vargen. This CL extends types/fmt.go to support trimming this
suffix again when appropriate.

Longer term, I want to revisit this hack, but this seemed like the
least invasive solution while also handling generics and local types.

Change-Id: If99fcdcc1e19e37d5887de3b021c256a3fe46b98
Reviewed-on: https://go-review.googlesource.com/c/go/+/327052
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>
3 years ago[dev.typeparams] cmd/compile: extract SetBaseTypeIndex function
Matthew Dempsky [Fri, 11 Jun 2021 08:10:56 +0000 (01:10 -0700)]
[dev.typeparams] cmd/compile: extract SetBaseTypeIndex function

The unified IR importer requires a way to set symbol indices for
imported types, so provide an exported API for this.

Change-Id: I2f088628f56d5b9f1097196dc1aa23f0a8b8d496
Reviewed-on: https://go-review.googlesource.com/c/go/+/327050
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>
3 years ago[dev.typeparams] cmd/compile: add ir.TypeNodeAt
Matthew Dempsky [Fri, 11 Jun 2021 08:10:10 +0000 (01:10 -0700)]
[dev.typeparams] cmd/compile: add ir.TypeNodeAt

This CL adds a variant of ir.TypeNode that allows specifying position
information. This shouldn't normally be needed/used, but it's
occasionally helpful for writing code that passes toolstash -cmp.

Change-Id: I2be5da0339fd1ec2bee01d6c5310bd2ef58c46b4
Reviewed-on: https://go-review.googlesource.com/c/go/+/327049
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
3 years agonet/http: remove test-only private key from production binaries
Damien Neil [Thu, 10 Jun 2021 17:50:37 +0000 (10:50 -0700)]
net/http: remove test-only private key from production binaries

The net/http/internal package contains a PEM-encoded private key used in
tests. This key is initialized at init time, which prevents it from
being stripped by the linker in non-test binaries.

Move the certificate and key to a new net/http/internal/testcert
package to ensure it is only included in binaries that reference it.

Fixes #46677.

Change-Id: Ie98bda529169314cc791063e7ce4d99ef99113c8
Reviewed-on: https://go-review.googlesource.com/c/go/+/326771
Trust: Damien Neil <dneil@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
3 years agocmd/go: report the imports of CompiledGoFiles in ImportMap
Bryan C. Mills [Tue, 8 Jun 2021 19:53:08 +0000 (15:53 -0400)]
cmd/go: report the imports of CompiledGoFiles in ImportMap

Ideally we should encode the load.PackageInternal data in a way that
doesn't rely on 1:1 correlations of slices, but this is a minimal fix
to unblock Go 1.17.

Fixes #46462

Change-Id: I6e029c69f757aadc54d4be02c01d6b294c217542
Reviewed-on: https://go-review.googlesource.com/c/go/+/326610
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>

3 years agocrypto/tls: let HTTP/1.1 clients connect to servers with NextProtos "h2" go1.17beta1
Filippo Valsorda [Mon, 7 Jun 2021 12:24:22 +0000 (08:24 -0400)]
crypto/tls: let HTTP/1.1 clients connect to servers with NextProtos "h2"

Fixes #46310

Change-Id: Idd5e30f05c439f736ae6f3904cbb9cc2ba772315
Reviewed-on: https://go-review.googlesource.com/c/go/+/325432
Trust: Filippo Valsorda <filippo@golang.org>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
3 years agoapi: promote next to go1.17
Heschi Kreinick [Wed, 9 Jun 2021 19:21:39 +0000 (15:21 -0400)]
api: promote next to go1.17

Change-Id: If631878a2f6ec0317b4fad614f98ab102810ed47
Reviewed-on: https://go-review.googlesource.com/c/go/+/326410
Trust: Heschi Kreinick <heschi@google.com>
Run-TryBot: Heschi Kreinick <heschi@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
3 years agodoc/go1.17: remove lingering TODO
Heschi Kreinick [Wed, 9 Jun 2021 16:59:30 +0000 (12:59 -0400)]
doc/go1.17: remove lingering TODO

As far as I can tell the Core Library section is complete. Remove its
TODO.

Change-Id: Ia84c6656fac045e25fae1a7ce8b488a3a26fd250
Reviewed-on: https://go-review.googlesource.com/c/go/+/326469
Trust: Heschi Kreinick <heschi@google.com>
Run-TryBot: Heschi Kreinick <heschi@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
3 years agodoc/go1.17: document strconv changes for Go 1.17
Damien Neil [Tue, 8 Jun 2021 21:26:13 +0000 (14:26 -0700)]
doc/go1.17: document strconv changes for Go 1.17

For #44513.
Fixes #46021.

Change-Id: I40a4645fedfae24f67e249743c6a143e71b9f507
Reviewed-on: https://go-review.googlesource.com/c/go/+/326150
Trust: Damien Neil <dneil@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
3 years agostrconv: document parsing of leading +/-
Damien Neil [Mon, 7 Jun 2021 23:30:03 +0000 (16:30 -0700)]
strconv: document parsing of leading +/-

Explicitly document the handling of a sign prefix, and the interaction
between the sign and base prefixes.

Fixes #46641.

Change-Id: I3cd6773e3f074fe671a944a05a79d2408137fcd4
Reviewed-on: https://go-review.googlesource.com/c/go/+/325875
Trust: Damien Neil <dneil@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
3 years agodoc/go1.17: document //go:build lines
Heschi Kreinick [Wed, 9 Jun 2021 00:34:16 +0000 (20:34 -0400)]
doc/go1.17: document //go:build lines

In 1.17, //go:build lines are fully supported. This entails changes to
the go command, vet, and gofmt. Document all of them.

I'm not Russ, but this is a significant change, it slipped under the
radar, and we're trying to get the release out. So here's what I got.

I wasn't sure where to put the go command change. On the one hand,
it's pretty significant. On the other, it certainly affects fewer
people than lazy loading. So it probably shouldn't be first, but I also
didn't want to bury it the middle of all the other module changes. Open
to suggestions.

Change-Id: Ia1a96bcfb1977973c5b0b0a6b18a9242a745af12
Reviewed-on: https://go-review.googlesource.com/c/go/+/326209
Trust: Heschi Kreinick <heschi@google.com>
Run-TryBot: Heschi Kreinick <heschi@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
3 years agonet/http: add AllowQuerySemicolons
Filippo Valsorda [Wed, 9 Jun 2021 11:43:57 +0000 (07:43 -0400)]
net/http: add AllowQuerySemicolons

Fixes #45973

Change-Id: I6cbe05f5d1d3c324900c74314b0ea0e12524d7f2
Reviewed-on: https://go-review.googlesource.com/c/go/+/326309
Run-TryBot: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
Trust: Katie Hockman <katie@golang.org>
Trust: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>

3 years agodoc/go1.17: remove TODO for ports section
Cherry Mui [Wed, 9 Jun 2021 15:04:58 +0000 (11:04 -0400)]
doc/go1.17: remove TODO for ports section

I'm not aware of anything more to mention for ports.

Change-Id: I686df8a230a55ad7f4c5eae43ca27f85fad9dd84
Reviewed-on: https://go-review.googlesource.com/c/go/+/326409
Trust: Cherry Mui <cherryyz@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
3 years agonet/url: reject query values with semicolons
Katie Hockman [Mon, 7 Jun 2021 18:29:43 +0000 (14:29 -0400)]
net/url: reject query values with semicolons

Semicolons are no longer valid separators, so
net/url.ParseQuery will now return an error
if any part of the query contains a semicolon.

net/http.(*Request).ParseMultipartForm has been
changed to fall through and continue parsing
even if the call to (*Request).ParseForm fails.

This change also includes a few minor refactors
to existing tests.

Fixes #25192

Change-Id: Iba3f108950fb99b9288e402c41fe71ca3a2ababd
Reviewed-on: https://go-review.googlesource.com/c/go/+/325697
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
3 years agomath/big: comment division
Russ Cox [Thu, 13 May 2021 14:46:58 +0000 (10:46 -0400)]
math/big: comment division

The comments in the code refer to Knuth and to Burnikel and Ziegler,
but Knuth's presentation is inscrutable, and our recursive division
code does not bear much resemblance to Burnikel and Ziegler's paper
(which is fine, ours is nicer).

Add a standalone explanation of division instead of referring to
difficult or not-directly-used references.

Change-Id: Ic1b35dc167fb29a69ee00e0b4a768ac9cc9e1324
Reviewed-on: https://go-review.googlesource.com/c/go/+/321078
Trust: Russ Cox <rsc@golang.org>
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
3 years agocmd/compile: make map.zero symbol content-addressable
Than McIntosh [Wed, 9 Jun 2021 00:09:49 +0000 (20:09 -0400)]
cmd/compile: make map.zero symbol content-addressable

The compiler machinery that generates "map.zero" symbols marks them as
RODATA and DUPOK, which is problematic when a given application has
multiple map zero symbols (from different packages) with varying
sizes: the dupok path in the loader assumes that if two symbols have
the same name, it is safe to pick any of the versions. In the case of
map.zero, the link needs to select the largest symbol, not an
arbitrary sym.

To fix this problem, mark map.zero symbols as content-addressable,
since the loader's content addressability processing path already
supports selection of the larger symbol in cases where there are dups.

Fixes #46653.

Change-Id: Iabd2feef01d448670ba795c7eaddc48c191ea276
Reviewed-on: https://go-review.googlesource.com/c/go/+/326211
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>
3 years agocmd/link: fix bug in -strictdups checking of BSS symbols
Than McIntosh [Tue, 8 Jun 2021 23:45:41 +0000 (19:45 -0400)]
cmd/link: fix bug in -strictdups checking of BSS symbols

The linker's -strictdups debugging option was not properly checking
for cases where you have two dupok BSS symbols with different length
(the check examined data length and content, but not symbol size).

Updates #46653.

Change-Id: I3844f25ef76dd6e4a84ffd5caed5d19a1b1a57c9
Reviewed-on: https://go-review.googlesource.com/c/go/+/326210
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>
3 years ago[dev.typeparams] cmd/compile, runtime: simplify opendefer metadata
Cherry Mui [Tue, 8 Jun 2021 22:07:16 +0000 (18:07 -0400)]
[dev.typeparams] cmd/compile, runtime: simplify opendefer metadata

Now that deferred functions are always argumentless, we don't
need the metadata for the frame size, number of arguments, and
the information about each argument.

Change-Id: I99e75248a22bda6efbdf2012a2f35beca4c18fd7
Reviewed-on: https://go-review.googlesource.com/c/go/+/326061
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>
3 years ago[dev.typeparams] cmd/compile: simplify openDeferSave
Cherry Mui [Tue, 8 Jun 2021 20:55:36 +0000 (16:55 -0400)]
[dev.typeparams] cmd/compile: simplify openDeferSave

Now it is only used to save the deferred the function (closure),
which must be a function type. Simplify the code.

Change-Id: Id4b8f2760fbf39a95883df2327f97378e7edab88
Reviewed-on: https://go-review.googlesource.com/c/go/+/326060
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>
3 years agodoc/go1.17: mention new possibility of type conversion panicking
Ian Lance Taylor [Tue, 8 Jun 2021 19:42:02 +0000 (12:42 -0700)]
doc/go1.17: mention new possibility of type conversion panicking

For #44513
For #46020

Change-Id: I07c7a4268465c536d1866cc6bb1fad76b2b88b15
Reviewed-on: https://go-review.googlesource.com/c/go/+/326149
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
3 years agodoc/go1.17: mention new vet checks sigchanyzer and stdmethods.
Tim King [Wed, 26 May 2021 02:23:02 +0000 (19:23 -0700)]
doc/go1.17: mention new vet checks sigchanyzer and stdmethods.

These vet checks were added in CL 299532 and CL 321389.

Also adds a TODO for buildtags.

Change-Id: I516dc77729f6d2dc147318260fe452831b115dfa
Reviewed-on: https://go-review.googlesource.com/c/go/+/322769
Trust: Tim King <taking@google.com>
Run-TryBot: Tim King <taking@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
3 years ago[dev.typeparams] cmd/compile, runtime: remove _defer.siz field
Cherry Mui [Mon, 7 Jun 2021 22:18:00 +0000 (18:18 -0400)]
[dev.typeparams] cmd/compile, runtime: remove _defer.siz field

As deferred function now always has zero arguments, _defer.siz is
always 0 and can be removed.

Change-Id: Ibb89f65b2f9d2ba4aeabe50438cc3d4b6a88320b
Reviewed-on: https://go-review.googlesource.com/c/go/+/325921
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>
3 years ago[dev.typeparams] runtime: allow deferproc split stack
Cherry Mui [Sat, 5 Jun 2021 00:07:50 +0000 (20:07 -0400)]
[dev.typeparams] runtime: allow deferproc split stack

deferproc was not allowed to split stack because it had a special
stack layout, where the go'd function's arguments were passed on
stack but not included in the signature (therefore the stack map).
Now it no longer has argument, so it does not need to be nosplit.

Change-Id: I6d4b5302bd6fea6642bb4202984d86e3ebbc9054
Reviewed-on: https://go-review.googlesource.com/c/go/+/325920
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>
3 years ago[dev.typeparams] runtime: make deferproc take a func() argument
Cherry Mui [Fri, 4 Jun 2021 22:30:51 +0000 (18:30 -0400)]
[dev.typeparams] runtime: make deferproc take a func() argument

Previously it takes a *funcval, as it can be any function types.
Now it must be func(). Make it so.

Change-Id: I04273047b024386f55dbbd5fbda4767cbee7ac93
Reviewed-on: https://go-review.googlesource.com/c/go/+/325918
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>
3 years ago[dev.typeparams] cmd/compile, runtime: remove the siz argument of newproc/deferproc
Cherry Mui [Fri, 4 Jun 2021 22:11:59 +0000 (18:11 -0400)]
[dev.typeparams] cmd/compile, runtime: remove the siz argument of newproc/deferproc

newproc/deferproc takes a siz argument for the go'd/deferred
function's argument size. Now it is always zero. Remove the
argument.

Change-Id: If1bb8d427e34015ccec0ba10dbccaae96757fa8c
Reviewed-on: https://go-review.googlesource.com/c/go/+/325917
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>
3 years agodoc/go1.17: mention block profile bias fix
Cherry Mui [Tue, 8 Jun 2021 20:42:02 +0000 (16:42 -0400)]
doc/go1.17: mention block profile bias fix

Re-apply the doc part of CL 324471, originally written by Felix Geisendörfer.

Change-Id: I831bead9a385bc5a5eed3058649a25ef17373bc6
Reviewed-on: https://go-review.googlesource.com/c/go/+/326171
Trust: Cherry Mui <cherryyz@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
3 years agoRevert "doc/go1.17: mention block profile bias fix"
Cherry Mui [Tue, 8 Jun 2021 20:38:30 +0000 (20:38 +0000)]
Revert "doc/go1.17: mention block profile bias fix"

This reverts CL 324471 (commit 689f4c7415acc8a135440574a483e0eeabba8b87).

Reason for revert: break ~all builders. And it is not a doc-only change.

Change-Id: Iadbdda34d2ca476a9f5e6c2d3a28592ed7ccb067
Reviewed-on: https://go-review.googlesource.com/c/go/+/326170
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
3 years agonet: reject leading zeros in IP address parsers
Roland Shoemaker [Mon, 7 Jun 2021 17:21:29 +0000 (10:21 -0700)]
net: reject leading zeros in IP address parsers

In both net.ParseIP and net.ParseCIDR reject leading zeros in the
dot-decimal notation of IPv4 addresses.

Fixes #30999
Fixes #43389

Change-Id: I2b6a31fe84db89ac828cf5ed03eaa586ee96ab68
Reviewed-on: https://go-review.googlesource.com/c/go/+/325829
Trust: Roland Shoemaker <roland@golang.org>
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Roland Shoemaker <roland@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>

3 years agodoc/go1.17: revise OpenBSD release notes
Cherry Mui [Wed, 26 May 2021 16:14:19 +0000 (12:14 -0400)]
doc/go1.17: revise OpenBSD release notes

Updates #44513.

Change-Id: I64077859fa3061fee8327599875ad3870d603a81
Reviewed-on: https://go-review.googlesource.com/c/go/+/322856
Trust: Cherry Mui <cherryyz@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
3 years agodoc/go1.17: mention block profile bias fix
Felix Geisendörfer [Thu, 3 Jun 2021 13:33:08 +0000 (15:33 +0200)]
doc/go1.17: mention block profile bias fix

Change-Id: I76fd872b2d74704396f0683ffa9cec40b7027247
Reviewed-on: https://go-review.googlesource.com/c/go/+/324471
Reviewed-by: Heschi Kreinick <heschi@google.com>
Trust: Dmitri Shuralyov <dmitshur@golang.org>

3 years agodoc/go1.17: remove TODO for Tools section
Bryan C. Mills [Mon, 7 Jun 2021 21:11:32 +0000 (17:11 -0400)]
doc/go1.17: remove TODO for Tools section

Change-Id: I6cd7376bd051222a830cbf18cf7e887072b61f3b
Reviewed-on: https://go-review.googlesource.com/c/go/+/325911
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.typeparams] runtime: remove tracebackdefers
Cherry Mui [Fri, 4 Jun 2021 21:18:09 +0000 (17:18 -0400)]
[dev.typeparams] runtime: remove tracebackdefers

tracebackdefers is used for scanning/copying deferred functions'
arguments. Now that deferred functions are always argumentless,
it does nothing. Remove.

Change-Id: I55bedabe5584ea41a12cdb03d55ec9692a5aacd9
Reviewed-on: https://go-review.googlesource.com/c/go/+/325916
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>
3 years ago[dev.typeparams] runtime: remove variadic defer/go calls
Cherry Mui [Fri, 4 Jun 2021 21:04:46 +0000 (17:04 -0400)]
[dev.typeparams] runtime: remove variadic defer/go calls

Now that defer/go wrapping is used, deferred/go'd functions are
always argumentless. Remove the code handling arguments.

This CL is mostly removing the fallback code path. There are more
cleanups to be done, in later CLs.

Change-Id: I87bfd3fb2d759fbeb6487b8125c0f6992863d6e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/325915
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>
3 years agodoc/go1.17: resolve TODO for cmd/cover
Bryan C. Mills [Mon, 7 Jun 2021 17:43:55 +0000 (13:43 -0400)]
doc/go1.17: resolve TODO for cmd/cover

Updates #32211

Change-Id: Ie38e831fcf557534023afd552d9394fe9e055caa
Reviewed-on: https://go-review.googlesource.com/c/go/+/325909
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>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
3 years ago[dev.typeparams] cmd/compile: remove variadic defer calls
Cherry Mui [Fri, 4 Jun 2021 20:32:03 +0000 (16:32 -0400)]
[dev.typeparams] cmd/compile: remove variadic defer calls

Now that defer wrapping is used, deferred function is always
argumentless. Remove the code handling arguments.

This CL is mostly removing the fallback code path. There are more
cleanups to be done, in later CLs.

Change-Id: If6c729d3055c7a507cb1f1a000f5bbd3ad7ff235
Reviewed-on: https://go-review.googlesource.com/c/go/+/325914
Trust: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
3 years agocmd/go: in Go 1.17+ modules, add indirect go.mod dependencies separately from direct...
Bryan C. Mills [Tue, 8 Jun 2021 03:04:16 +0000 (23:04 -0400)]
cmd/go: in Go 1.17+ modules, add indirect go.mod dependencies separately from direct ones

Fixes #45965

Change-Id: If5c0d7b29e9f81be0763f3fa68051d4ef5419990
Reviewed-on: https://go-review.googlesource.com/c/go/+/325922
Trust: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
3 years agodoc/go1.17: add release notes for crypto packages
Filippo Valsorda [Mon, 7 Jun 2021 14:20:38 +0000 (10:20 -0400)]
doc/go1.17: add release notes for crypto packages

For #44513

Change-Id: I459b3a4f9936eaa2c09888177f91176140d04280
Reviewed-on: https://go-review.googlesource.com/c/go/+/325649
Trust: Filippo Valsorda <filippo@golang.org>
Trust: Katie Hockman <katie@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
3 years agodoc/go1.17: add a release note for the '-compat' flag to 'go mod tidy'
Bryan C. Mills [Mon, 7 Jun 2021 21:04:32 +0000 (17:04 -0400)]
doc/go1.17: add a release note for the '-compat' flag to 'go mod tidy'

Updates #46141

Change-Id: I7a6a84f816e3db19bb492f862366a29dc46ed2ee
Reviewed-on: https://go-review.googlesource.com/c/go/+/325910
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
3 years ago[dev.typeparams] cmd/compile, runtime: always enable defer/go wrapping
Cherry Mui [Fri, 4 Jun 2021 17:53:18 +0000 (13:53 -0400)]
[dev.typeparams] cmd/compile, runtime: always enable defer/go wrapping

Hardwire regabidefers to true. Remove it from GOEXPERIMENTs.

Fallback paths are not cleaned up in this CL. That will be done
in later CLs.

Change-Id: Iec1112a1e55d5f6ef70232a5ff6e702f649071c4
Reviewed-on: https://go-review.googlesource.com/c/go/+/325913
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: Than McIntosh <thanm@google.com>
3 years ago[dev.typeparams] internal/goexperiment: regenerate generated files
Cherry Mui [Mon, 7 Jun 2021 22:22:14 +0000 (18:22 -0400)]
[dev.typeparams] internal/goexperiment: regenerate generated files

Rerun the generator. exp_regabi_{on,off}.go are gone, as "regabi"
itself is not a goexperiment that we test at run time (the
sub-experiments are).

Change-Id: Ic1f31b4ef2769a143f768e1b3dc7221041aafca9
Reviewed-on: https://go-review.googlesource.com/c/go/+/325912
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>
3 years agocmd/compile: use t.AllMethods when sorting typesByString
Cuong Manh Le [Sun, 30 May 2021 08:35:06 +0000 (15:35 +0700)]
cmd/compile: use t.AllMethods when sorting typesByString

For interface types, t.Methods contains only unexpanded method set, i.e
exclusive of interface embedding. Thus, we can't use it to detect an
interface contains embedding empty interface, like in:

type EI interface{}

func f() interface{ EI } {
return nil
}

At the time we generate runtime types, we want to check against the full
method set of interface instead.

Fixes #46386

Change-Id: Idff53ad39276be6632eb5932b76e855c15cbdd2e
Reviewed-on: https://go-review.googlesource.com/c/go/+/323649
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: Matthew Dempsky <mdempsky@google.com>
3 years agoruntime: remove out-of-date comments about frame skipping
Matthew Dempsky [Mon, 7 Jun 2021 23:24:40 +0000 (16:24 -0700)]
runtime: remove out-of-date comments about frame skipping

skipPleaseUseCallersFrames was removed in CL 152537.

Change-Id: Ide47feec85a33a6fb6882e16baf9e21492521640
Reviewed-on: https://go-review.googlesource.com/c/go/+/325949
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
3 years ago[dev.typeparams] cmd/compile/internal/types2: provide valid signature in errors invol...
Robert Griesemer [Sat, 5 Jun 2021 04:38:40 +0000 (21:38 -0700)]
[dev.typeparams] cmd/compile/internal/types2: provide valid signature in errors involving method expressions

This is an adjusted port of a similar fix in https://golang.org/cl/324733.

Fixes #46583.

Change-Id: Ica1410e4de561e64e58b753e3da04b32156cbaf6
Reviewed-on: https://go-review.googlesource.com/c/go/+/325369
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
3 years agodoc: document Go 1.17 language changes
Matthew Dempsky [Mon, 7 Jun 2021 21:28:14 +0000 (14:28 -0700)]
doc: document Go 1.17 language changes

Fixes #46020.

Change-Id: Iadf9a0ac4a8863e17155d6ba1af2cc497634a634
Reviewed-on: https://go-review.googlesource.com/c/go/+/325870
Trust: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
3 years ago[dev.typeparams] cmd/compile: do extra markObjects during iexport to deal with generics
Dan Scales [Fri, 4 Jun 2021 22:22:55 +0000 (15:22 -0700)]
[dev.typeparams] cmd/compile: do extra markObjects during iexport to deal with generics

markInlBody/markObject/markType don't fully work as they stand for
generic functions/methods, since markInlBody can't understand method
calls on generic types. Those method calls will be resolved to concrete
methods in a full instantiation, but markInlBody on a generic
function/method can't understand those method calls. So, we won't
necessarily cause export of the appropriate extra method/function bodies
needed for inlining in an instantiated function.

One way to do this is just to make sure that we call markType
on all generic types that are exported (whether explicitly exported via
a capitalized name or unexported types that are referenced by a generic
function body). That way, we will call markInlBody on all possible
generic methods that might be called.

Fixes the current problem for i386-softfloat builds on dev.typeparams.

Change-Id: I2d3625d26042296731bd3c44ba1938aa194d527e
Reviewed-on: https://go-review.googlesource.com/c/go/+/325329
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Trust: Dan Scales <danscales@google.com>

3 years agocmd/dist: pass -Wno-lto-type-mismatch in swig_callback_lto
Ian Lance Taylor [Thu, 3 Jun 2021 21:15:12 +0000 (14:15 -0700)]
cmd/dist: pass -Wno-lto-type-mismatch in swig_callback_lto

Fixes #46557

Change-Id: I95200ddd60e2879db15dd7353c2152b515c89020
Reviewed-on: https://go-review.googlesource.com/c/go/+/324909
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
3 years agostrconv: ParseFloat: always return ErrSyntax for bad syntax
Ian Lance Taylor [Mon, 7 Jun 2021 17:51:33 +0000 (10:51 -0700)]
strconv: ParseFloat: always return ErrSyntax for bad syntax

Previously we would sometimes return ErrRange if the parseable part of
the floating point number was out of range.

Fixes #46628

Change-Id: I15bbbb1e2a56fa27c19fe25ab5554d988cbfd9d2
Reviewed-on: https://go-review.googlesource.com/c/go/+/325750
Trust: Ian Lance Taylor <iant@golang.org>
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
3 years ago[dev.typeparams] cmd/compile: convert generic values to interface type using dictionary
Keith Randall [Sat, 5 Jun 2021 00:19:09 +0000 (17:19 -0700)]
[dev.typeparams] cmd/compile: convert generic values to interface type using dictionary

When converting a variable of generic type to an interface, use the
entry in the dictionary for the type field instead of using the
compile-time type (which we only have when fully stenciling).

Note: this isn't all the conversions. Conversions often get processed
in the ir.OCALL case. Those aren't handled yet.

Change-Id: I9a6a4c572e3c54a8e8efad98365184dbb94c4487
Reviewed-on: https://go-review.googlesource.com/c/go/+/325330
Trust: Keith Randall <khr@golang.org>
Trust: Dan Scales <danscales@google.com>
Reviewed-by: Dan Scales <danscales@google.com>
3 years ago[dev.typeparams] cmd/compile: allow conversions from type parameter to interface
Keith Randall [Sat, 5 Jun 2021 05:54:08 +0000 (22:54 -0700)]
[dev.typeparams] cmd/compile: allow conversions from type parameter to interface

When converting from a type param to an interface, allow it if
the type bound implements that interface.

Query: some conversions go through this path, some use another path?
The test does

   var i interface{foo()int} = x

but

   i := (interface{foo()int})(x)

works at tip.

Change-Id: I84d497e5228c0e1d1c9d76ffebaedce09dc45e8e
Reviewed-on: https://go-review.googlesource.com/c/go/+/325409
Trust: Keith Randall <khr@golang.org>
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
3 years ago[dev.typeparams] cmd/compile: introduce IsTypeParam() helper
Keith Randall [Sat, 5 Jun 2021 06:01:13 +0000 (23:01 -0700)]
[dev.typeparams] cmd/compile: introduce IsTypeParam() helper

better than Kind() == types.TTYPEPARAM

Change-Id: I4f35a177cd0cda3be615a92b7b2af1b5a60a3bbc
Reviewed-on: https://go-review.googlesource.com/c/go/+/325410
Trust: Keith Randall <khr@golang.org>
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
3 years agoMerge "[dev.typeparams] all: merge master (8212707) into dev.typeparams" into dev...
Gerrit Code Review [Mon, 7 Jun 2021 19:48:09 +0000 (19:48 +0000)]
Merge "[dev.typeparams] all: merge master (8212707) into dev.typeparams" into dev.typeparams

3 years ago[dev.typeparams] cmd/compile: create .dict Param in the package of the instantiated...
Dan Scales [Sat, 5 Jun 2021 01:17:49 +0000 (18:17 -0700)]
[dev.typeparams] cmd/compile: create .dict Param in the package of the instantiated function

The instantiated functions are created in the source package of the
generic function, so all lookups of symbols should be relative to that
package, so all symbols are consistently in the source package.

Fixes #46575

Change-Id: Iba67b2ba8014a630c5d4e032c0f2f2fbaaedce65
Reviewed-on: https://go-review.googlesource.com/c/go/+/325529
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
3 years ago[dev.typeparams] all: merge master (8212707) into dev.typeparams
Matthew Dempsky [Mon, 7 Jun 2021 19:27:24 +0000 (12:27 -0700)]
[dev.typeparams] all: merge master (8212707) into dev.typeparams

Conflicts:

- src/go/internal/gcimporter/iimport.go

  CL 325429 and CL 319931 made unrelated changes to adjacent lines

Merge List:

+ 2021-06-07 8212707871 crypto/elliptic: update P-521 docs to say it's constant-time
+ 2021-06-07 7406180012 fmt: split package documentation into more sections
+ 2021-06-07 e3176bbc3e crypto/tls: fix typo in Config.NextProtos docs
+ 2021-06-05 e1fa26026d spec: improve wording consistency by eliminating "specifier"
+ 2021-06-05 f490134126 spec: improve wording by choosing an official term "keyword"
+ 2021-06-05 e3cb381704 go/internal/gcimporter: don't waste CPU copying bytes in `io.ReadAll`
+ 2021-06-05 9d669ed47a misc/cgo/errors: use expected column numbers
+ 2021-06-04 95939e8de7 cmd/compile/internal/abi: fix typo in comment
+ 2021-06-04 831f9376d8 net/http: fix ResponseWriter.ReadFrom with short reads
+ 2021-06-04 3a9d906edc os: avoid finalizer race in windows process object
+ 2021-06-04 105c5b50e0 os: terminate windows processes via handle directly
+ 2021-06-04 79cd407f88 syscall: regenerate zsyscall_windows.go
+ 2021-06-04 c6b6211229 doc/go1.17: document testing changes for Go 1.17
+ 2021-06-04 0214440075 syscall: do not pass console handles to PROC_THREAD_ATTRIBUTE_HANDLE_LIST on Windows 7
+ 2021-06-04 962d5c997a cmd/compile,go/types: restrict use of unsafe.{Add,Slice} to go1.17 or newer
+ 2021-06-04 b29b123e07 cmd/compile: remove spurious ir.Dump
+ 2021-06-03 6d98301114 cmd/link: use correct alignment in PE DWARF sections
+ 2021-06-03 e0d029f758 runtime: avoid gp.lockedm race in exitsyscall0
+ 2021-06-02 dd7ba3ba2c net: don't rely on system hosts in TestCVE202133195
+ 2021-06-02 4f572d7076 io/fs: minor corrections to Sub docs
+ 2021-06-02 e11d14225c doc/go1.17: remove runtime section
+ 2021-06-02 6e189afd3e doc/go1.17: mention SYS_WAIT6/WEXITED on NetBSD
+ 2021-06-02 ff9f5fb859 cmd/link: recognize clang linker error in testCGOLTO
+ 2021-06-02 1c6a2ea2ea doc/go1.17: document time changes for Go1.17
+ 2021-06-02 d743e67e06 doc/go1.17: document flag changes for Go 1.17
+ 2021-06-02 dc8f87b749 runtime/internal/sys: generate //go:build lines in gengoos.go
+ 2021-06-02 84c0e5d47f cmd/link: move issue 43830 tests out of TestScript
+ 2021-06-02 cae68700cc runtime: fix formatting
+ 2021-06-01 567ee865f6 cmd/go: add declaration to cgo_lto_issue43830 test
+ 2021-06-01 24e9707cbf cmd/link, cmd/cgo: support -flto in CFLAGS

Change-Id: I9ef88e7de0f8b1841ed9604b613b41672df67e71

3 years ago[dev.typeparams] go/types: factor out constraint satisfaction check
Rob Findley [Thu, 3 Jun 2021 16:14:16 +0000 (12:14 -0400)]
[dev.typeparams] go/types: factor out constraint satisfaction check

This is a port of CL 322070 to go/types, adjusted for the different
error reporting API.

Change-Id: I75eafe015b5b00554116527ea021e7a5f9e0343b
Reviewed-on: https://go-review.googlesource.com/c/go/+/324759
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: simplify Interface accessors
Rob Findley [Thu, 3 Jun 2021 15:55:11 +0000 (11:55 -0400)]
[dev.typeparams] go/types: simplify Interface accessors

This is a straightforward port of CL 321850 to go/types.

Change-Id: I719c19b8839390fdfa961255c6f1e79561cda6e6
Reviewed-on: https://go-review.googlesource.com/c/go/+/324757
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: re-use existing code for Interface.Complete
Rob Findley [Thu, 3 Jun 2021 15:49:52 +0000 (11:49 -0400)]
[dev.typeparams] go/types: re-use existing code for Interface.Complete

This is a port of CL 321751 to go/types, adjusted to use token.Pos, and
to exclude a missing position from a panic message (an unresolved
comment on the original CL).

Change-Id: I5814067aecb67aca9d73f2093fb6004b769924f3
Reviewed-on: https://go-review.googlesource.com/c/go/+/324756
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: add Named.SetTParams and Named.Orig methods
Rob Findley [Thu, 3 Jun 2021 15:37:26 +0000 (11:37 -0400)]
[dev.typeparams] go/types: add Named.SetTParams and Named.Orig methods

This is a port of CL 309832 to go/types, adjusted to not export the new
API and to amend TestSizeof.

Change-Id: I67efd3ba9b921c8431528eba1cd88ec1f41898bb
Reviewed-on: https://go-review.googlesource.com/c/go/+/324755
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: move signature checking into separate file
Rob Findley [Thu, 3 Jun 2021 15:13:38 +0000 (11:13 -0400)]
[dev.typeparams] go/types: move signature checking into separate file

This is a port of CL 321590 to go/types. Specifically, the same checker
methods were moved.

Change-Id: If4522d316f29c6b6f887580aa037e6b6dedbb6ac
Reviewed-on: https://go-review.googlesource.com/c/go/+/324754
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 agocrypto/elliptic: update P-521 docs to say it's constant-time
Filippo Valsorda [Mon, 7 Jun 2021 14:22:05 +0000 (10:22 -0400)]
crypto/elliptic: update P-521 docs to say it's constant-time

This is true since CL 315274.

Also adjust the P-256 note, since Add, Double, and IsOnCurve use the
generic, non-constant-time implementation.

Change-Id: I4b3b340f65bce91dcca30bcf86456cc8ce4dd4bb
Reviewed-on: https://go-review.googlesource.com/c/go/+/325650
Trust: Filippo Valsorda <filippo@golang.org>
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>

3 years agofmt: split package documentation into more sections
Branden J Brown [Wed, 2 Jun 2021 18:55:34 +0000 (14:55 -0400)]
fmt: split package documentation into more sections

The package-level documentation on fmt previously had only two formal
sections, for printing and scanning. Because of this, the section on
printing was very long, including some pseudo-sections describing
particular features. This feature makes those pseudo-sections into
proper sections, both to improve readability and so that those sections
have hyperlinks on documentation sites.

Fixes #46522

Change-Id: I38b7bc3447610faca446051da235edcbbd063f61
Reviewed-on: https://go-review.googlesource.com/c/go/+/324349
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Tobias Klauser <tobias.klauser@gmail.com>

3 years agocrypto/tls: fix typo in Config.NextProtos docs
Filippo Valsorda [Mon, 7 Jun 2021 14:24:11 +0000 (10:24 -0400)]
crypto/tls: fix typo in Config.NextProtos docs

Change-Id: I916df584859595067e5e86c35607869397dbbd8c
Reviewed-on: https://go-review.googlesource.com/c/go/+/325651
Trust: Filippo Valsorda <filippo@golang.org>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
3 years ago[dev.typeparams] cmd/compile/internal/types2: return Universe for ((*Package)(nil...
Robert Griesemer [Sun, 6 Jun 2021 04:23:48 +0000 (21:23 -0700)]
[dev.typeparams] cmd/compile/internal/types2: return Universe for ((*Package)(nil)).Scope()

For #46594.

Change-Id: I53776cbdc1b8f6da511abe2c6659a7313d7a163a
Reviewed-on: https://go-review.googlesource.com/c/go/+/325469
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
3 years ago[dev.typeparams] cmd/compile: refactor export writing
Matthew Dempsky [Fri, 4 Jun 2021 20:14:32 +0000 (13:14 -0700)]
[dev.typeparams] cmd/compile: refactor export writing

This CL reorganizes export writing in preparation for unified IR:

1. It moves dumpexport into noder as noder.WriteExports so that it can
be extended to include unified IR's export data.

2. Adds an "extensions" flag to typecheck.WriteExports to control
whether the compiler-only extension data (e.g., function bodies and
linker symbol info) is included in the exports.

3. It moves the gc.exporter type into typecheck and renames it to
"crawler". The type originated as the implementation of
the (pre-iexport) binary exporter, but since the removal of bexport
it's been relegated to simply crawling the exported functions/bodies
graph to identify which inline bodies need to be included.

4. It changes inline.Inline_Flood into the method crawler.markInlBody.
Inline_Flood doesn't actually have anything to do with the rest of
inlining; its current name and location are just historical quirks.

Passes toolstash -cmp.

Change-Id: I6445e2de9d3ce500a3aded5a8e20b09f46d23dbc
Reviewed-on: https://go-review.googlesource.com/c/go/+/325212
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Trust: Matthew Dempsky <mdempsky@google.com>
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
3 years ago[dev.typeparams] cmd/compile: refactor import reading
Matthew Dempsky [Fri, 4 Jun 2021 17:26:40 +0000 (10:26 -0700)]
[dev.typeparams] cmd/compile: refactor import reading

This CL restructures the gcimports importer to mmap the export data
into memory as a string, and then pass that same string to both the
typecheck and types2 importers.

This is primarily motivated by preparation for unified IR; but it
should also improve performance (fewer string copies) and reduces
divergance between the two importers.

Passes toolstash -cmp.

Change-Id: I397f720693e9e6360bfcb5acb12609ab339d251f
Reviewed-on: https://go-review.googlesource.com/c/go/+/325210
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Trust: Matthew Dempsky <mdempsky@google.com>
Trust: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
3 years agospec: improve wording consistency by eliminating "specifier"
DQNEO [Mon, 31 May 2021 03:33:28 +0000 (12:33 +0900)]
spec: improve wording consistency by eliminating "specifier"

The word "specifier" is used once only here and technically not defined.

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

3 years agospec: improve wording by choosing an official term "keyword"
DQNEO [Mon, 31 May 2021 03:15:12 +0000 (12:15 +0900)]
spec: improve wording by choosing an official term "keyword"

Replace "reserved word" by "keyword" as the latter is the official term.

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

3 years agogo/internal/gcimporter: don't waste CPU copying bytes in `io.ReadAll`
Sergey Zagursky [Fri, 4 Jun 2021 09:25:51 +0000 (12:25 +0300)]
go/internal/gcimporter: don't waste CPU copying bytes in `io.ReadAll`

`io.ReadAll` dynamically reallocates byte slice because it doesn't know
its size in advance. We don't need to read an entire file into memory
and therefore may use `bufio.Reader` to read its contents.

Fixes #46564

Change-Id: Id504b1512662b6dea4775d523455896fa4162ab3
Reviewed-on: https://go-review.googlesource.com/c/go/+/325429
Reviewed-by: Dominik Honnef <dominik@honnef.co>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Trust: Matthew Dempsky <mdempsky@google.com>
Trust: Dominik Honnef <dominik@honnef.co>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>

3 years agomisc/cgo/errors: use expected column numbers
Ian Lance Taylor [Fri, 4 Jun 2021 15:16:58 +0000 (08:16 -0700)]
misc/cgo/errors: use expected column numbers

The test was using the wrong column numbers, and was erroneously
passing because there happened to be line numbers that matched those
column numbers. Change the test harness to require the expected line
number for the ERROR HERE regexp case, so that this doesn't happen again.

Also rename a couple of variables in the test to avoid useless
redeclaration errors.

Fixes #46534

Change-Id: I2fcbf5e379c346de5346035c73d174a3980c0927
Reviewed-on: https://go-review.googlesource.com/c/go/+/324970
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
3 years ago[dev.typeparams] runtime/race: make test compatible with types2
Matthew Dempsky [Fri, 4 Jun 2021 06:52:34 +0000 (23:52 -0700)]
[dev.typeparams] runtime/race: make test compatible with types2

types2 correctly distinguishes variable assignment from use even
within function literals. Whatever the outcome of #3059, the test
cases in runtime/race need to be fixed to accomodate that.

Change-Id: Ibe3547f07b681ff41225caabaf050872a48c98d1
Reviewed-on: https://go-review.googlesource.com/c/go/+/325030
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>
3 years ago[dev.typeparams] cmd/compile: rename (types2.Inferred.)Targs to TArgs
Robert Griesemer [Fri, 4 Jun 2021 04:58:32 +0000 (21:58 -0700)]
[dev.typeparams] cmd/compile: rename (types2.Inferred.)Targs to TArgs

This is consistent with Named.TArgs.

This is a straight-forward port of https://golang.org/cl/321289
plus the necessary compiler noder changes.

Change-Id: I50791e5abe0d7f294293bed65cebc8dde8bf8c06
Reviewed-on: https://go-review.googlesource.com/c/go/+/325010
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
3 years ago[dev.typeparams] cmd/compile/internal/syntax: not all index expressions can be instan...
Robert Griesemer [Fri, 4 Jun 2021 03:53:08 +0000 (20:53 -0700)]
[dev.typeparams] cmd/compile/internal/syntax: not all index expressions can be instantiated types

An index expression followed by an opening "{" may indicate
a composite literal but only if the index expression can be
a type. Exclude cases where the index expression cannot be
a type (e.g. s[0], a[i+j], etc.).

This leads to a better error message in code that is erroneous.

Fixes #46558.

Change-Id: Ida9291ca30683c211812dfb95abe4969f44c474f
Reviewed-on: https://go-review.googlesource.com/c/go/+/325009
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
3 years ago[dev.typeparams] cmd/compile: point StructKeyExpr at the types.Field
Matthew Dempsky [Fri, 4 Jun 2021 07:01:22 +0000 (00:01 -0700)]
[dev.typeparams] cmd/compile: point StructKeyExpr at the types.Field

When constructing struct literals, importers need a way to specify
precisely which field to initialize without worrying about visibility
or those fields being blank. (A blank field doesn't actually need to
be initialized, but the expression needs to be evaluated still, and
with the right order-of-operations.)

This CL changes StructKeyExpr's Field field to point directly to the
corresponding types.Field, rather than merely holding a copy of its
Sym and Offset. This is akin to past changes to add
SelectorExpr.Selection.

Change-Id: I95b72b1788f73206fcebc22b456cf6b1186db6a7
Reviewed-on: https://go-review.googlesource.com/c/go/+/325031
Trust: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>

3 years agocmd/compile/internal/abi: fix typo in comment
sryoya [Fri, 4 Jun 2021 18:12:03 +0000 (03:12 +0900)]
cmd/compile/internal/abi: fix typo in comment

Change-Id: I196045314b2b0e908d7b31ac0cea5b25404f3ee0
Reviewed-on: https://go-review.googlesource.com/c/go/+/325249
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Trust: Keith Randall <khr@golang.org>