Commit graph

45706 commits

Author SHA1 Message Date
Matthew Dempsky 6dae48fb0b [dev.regabi] cmd/compile: refactor type/value assertions
Small refactoring to make subsequent CLs clearer.

Passes toolstash-check.

Change-Id: I1a6ae599f491220d44aaabae0b7bed4aff46ee92
Reviewed-on: https://go-review.googlesource.com/c/go/+/272651
Reviewed-by: Robert Griesemer <gri@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>
2020-11-24 19:35:46 +00:00
Matthew Dempsky 88a9e2f9ad [dev.regabi] cmd/compile: replace CTNIL with ONIL
Properly speaking, "nil" is a zero value, not a constant. So
go/constant does not have a representation for it. To allow replacing
Val with constant.Value, we split out ONIL separately from OLITERAL so
we can get rid of CTNIL.

Passes toolstash-check.

Change-Id: I4c8e60cae3b3c91bbac43b3b0cf2a4ade028d6cb
Reviewed-on: https://go-review.googlesource.com/c/go/+/272650
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>
2020-11-24 19:34:23 +00:00
Matthew Dempsky 4af2decf30 [dev.regabi] cmd/compile: add (unused) ONIL constant
Subsequent CL will make use of ONIL. Split out separately so that the
next CL can pass toolstash-check.

Change-Id: I49d77bedbe2cac4a5da149c925cda969e50b0b2d
Reviewed-on: https://go-review.googlesource.com/c/go/+/272649
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>
2020-11-24 19:33:02 +00:00
Matthew Dempsky 668e3a598f [dev.regabi] cmd/compile: cleanup type switch typechecking
Address outstanding TODO, which simplifies subsequent CLs.

Now the compiler always type checks type-switch case clauses (like
gccgo), but it treats clause variables as broken if an appropriate
type cannot be determined for it (like go/types).

Passes toolstash-check.

Change-Id: Iedfe9cdf38c6865211e4b93391f1cf72c1bed136
Reviewed-on: https://go-review.googlesource.com/c/go/+/272648
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>
2020-11-24 19:32:42 +00:00
Matthew Dempsky 96f3fb7244 [dev.regabi] go/constant: avoid heap allocations in match
When type switching from interface{} to T, and then returning the T as
interface{} again, it's better to return the original interface{}
value. This avoids needing to heap allocate the T for
non-pointer-shaped types (i.e., int64Val, complexVal, stringVal).

Change-Id: I25c83b3f9ec9bd2ffeec5a65279b68f4fcef8a19
Reviewed-on: https://go-review.googlesource.com/c/go/+/272647
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
2020-11-24 19:17:49 +00:00
Matthew Dempsky 1abb12fc97 [dev.regabi] go/constant: optimize BitLen
Avoids an unnecessary heap allocation when computing the bit length of
int64 values.

Change-Id: I69dfc510e461daf3e83b0b7b6c0707f6526a32d0
Reviewed-on: https://go-review.googlesource.com/c/go/+/272646
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
2020-11-24 19:17:41 +00:00
Russ Cox 228b732ad9 [dev.regabi] cmd/compile: prepare for package ir
The next CL will introduce a package ir to hold the IR definitions.
This CL adjusts a few names and makes a few other minor changes
to make the next CL - an automated one - smoother.

Change-Id: Ie787a34732efd5b3d171bf0c1220b6dd91994ce3
Reviewed-on: https://go-review.googlesource.com/c/go/+/272251
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2020-11-24 15:07:48 +00:00
Russ Cox e37597f7f0 [dev.regabi] cmd/compile: rename a few 'base' identifiers
We want to introduce a package cmd/compile/internal/base,
and these will shadow it at points where it is needed.

Change-Id: Ic936733fba1ccba8c2ca1fdedbd4d2989df4bbf4
Reviewed-on: https://go-review.googlesource.com/c/go/+/272249
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2020-11-24 15:07:30 +00:00
Russ Cox 357c576878 [dev.regabi] cmd/compile: clean up error API
Prepare for factoring the error API out of this package by
cleaning it up. The doc comments use the intended new names,
which will be introduced in the next CL.

Change-Id: Ie4c8d4262422da32a9a9f750fda42c225b6b42a8
Reviewed-on: https://go-review.googlesource.com/c/go/+/272248
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2020-11-24 15:07:09 +00:00
Russ Cox 5fd949e4bd [dev.regabi] cmd/compile: initialize importMap lazily
This sets up the next CL, moving importMap to a global zeroed struct.

Change-Id: I1acc91b440d3da6e28fb32bd275fb3cd36db4e97
Reviewed-on: https://go-review.googlesource.com/c/go/+/272046
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2020-11-24 14:58:20 +00:00
Russ Cox 7b144ed4f7 [dev.regabi] cmd/compile: rewrite concurrentFlagOk to be clearer
The current implementation copies Debug, clears a bunch of flags
that are meant to be considered OK, and then checks the result
against the zero value. But more flags are cleared than remain:
it's easier to write and to understand to just check the ones that
need checking.

This phrasing also makes it safe to move more flags into the struct.

It turns out that some of the flags being checked should probably
not be checked, but this CL is meant to be a strict semantic no-op,
so left a TODO to clean up the function a bit more later.

Change-Id: I7afe6d7b32b5b889c40dd339568e8602e02df9bc
Reviewed-on: https://go-review.googlesource.com/c/go/+/271666
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2020-11-24 14:58:10 +00:00
Alex Brainman 6965b01ea2 runtime: allow for usleep2HighRes to run without TLS setup
This change adjusts usleep2HighRes so it does not crash when TLS is
not configured. When g is not available, usleep2HighRes just calls
usleep2 instead.

Updates #8687

Change-Id: Idbb80f7b71d1da350a6a7df7c49154eb1ffe29a8
Reviewed-on: https://go-review.googlesource.com/c/go/+/271907
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Simon Rozman <simon@rozman.si>
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Trust: Alex Brainman <alex.brainman@gmail.com>
2020-11-24 07:07:06 +00:00
Cuong Manh Le 7dc5d909fb cmd/compile: set OpLoad argument type interface{} correctly
CL 271906 allows loading single field of typed-interface{} OpIData, but
it does not update the corresponding selector type. So the generated
OpLoad has the named type instead, prevent it from being lowered by
lower pass.

Fixes #42784

Change-Id: Idf32e4f711731be09d508dd712b60bc8c58309bd
Reviewed-on: https://go-review.googlesource.com/c/go/+/272466
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: Cherry Zhang <cherryyz@google.com>
2020-11-24 03:06:15 +00:00
Matthew Dempsky c754f25241 [dev.regabi] cmd/compile/internal/types: remove Func.Nname
Now that there's no code remaining that uses Func.Nname, we can get
rid of it along with the remaining code that uselessly assigns to it.

Passes toolstash-check.

Change-Id: I104ab3bb5122fb824c741bc6e4d9d54fefe5646e
Reviewed-on: https://go-review.googlesource.com/c/go/+/272390
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
2020-11-24 01:34:39 +00:00
Matthew Dempsky c50c7a8c06 [dev.regabi] cmd/compile/internal/gc: refactor to use stop using Func.Nname
Automated factoring produced by rf script below to replace uses of
Func.Nname with Field.Nname or Node.MethodName as appropriate.

Some dead assignments to Func.Nname are left behind; these will be
removed in a subequent remove-only CL.

Passes toolstash-check.

[git-generate]
cd src/cmd/compile/internal/gc
rf '
ex \
  import "cmd/compile/internal/types"; \
  var f *types.Field; \
  var n *types.Node; \
  f.Type.Nname() -> f.Nname; \
  f.Type.SetNname(n) -> f.Nname = n; \
  f.Type.FuncType().Nname -> f.Nname

ex \
  var n *Node; \
  asNode(n.Type.Nname()) -> n.MethodName(); \
  asNode(n.Type.FuncType().Nname) -> n.MethodName(); \
  asNode(callpartMethod(n).Type.Nname()) -> n.MethodName()
'

Change-Id: Iaae054324dfe7da6f5d8b8d57a1e05b58cc5968c
Reviewed-on: https://go-review.googlesource.com/c/go/+/272389
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>
2020-11-24 01:34:32 +00:00
Matthew Dempsky d5928847de [dev.regabi] cmd/compile/internal/gc: prep for Func.Nname removal refactoring
There are three bits of method-handling code where we separately go
from Field->Type and then Type->Node. By shuffling the code around a
little to go Field->Type->Node in a single statement, we're able to
more easily remove Type from the operation.

Passes toolstash-check.

Change-Id: Ife98216d70d3b867fa153449abef0e56a4fb242a
Reviewed-on: https://go-review.googlesource.com/c/go/+/272388
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>
2020-11-24 01:34:20 +00:00
Robert Griesemer a324aebb7d [dev.typeparams] go/types, cmd/compile/internal/types2: fix incorrect string(int) conversion (regression)
This is a 1:1 port of the go/types changes in
https://golang.org/cl/272666 (master branch).

Updates #42790.

Change-Id: I5da372961df48129b25777ed705b84d7201393ec
Reviewed-on: https://go-review.googlesource.com/c/go/+/272669
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2020-11-24 01:34:16 +00:00
Matthew Dempsky b30c7a8044 [dev.regabi] cmd/compile/internal/gc: add MethodName for getting referenced method
A common operation throughout the front end is getting the ONAME for a
method used in a method selector, method expression, or method value.
This CL adds MethodName as a uniform API for doing this for all of
these kinds of nodes.

For method selectors (ODOTMETH) and method expressions (ONAMEs where
isMethodExpression reports true), we take advantage of the Node.Opt
field to save the types.Field. This is the approach we already started
taking in golang.org/cl/271217 (caching types.Field in Node.Opt for
ODOT).

For method values (OCALLPART), we continue using the existing
callpartMethod helper function. Escape analysis already uses Node.Opt
for tracking the method value's closure's data flow.

A subsequent, automated refactoring CL will make more use of this
method. For now, we just address a few cases in inl.go that aren't
easily automated.

Passes toolstash-check.

Change-Id: Ic92b288b2d8b2fa7e18e3b68634326b8ef0d869b
Reviewed-on: https://go-review.googlesource.com/c/go/+/272387
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>
2020-11-24 01:34:13 +00:00
Matthew Dempsky e1047302bd [dev.regabi] cmd/compile/internal/types: add pos/sym/typ params to NewField
These are almost always set, so might as well expect callers to
provide them. They're also all required by go/types's corresponding
New{Field,Func,Param,Var} functions, so this eases API compatibility.

Passes toolstash-check.

Change-Id: Ib3fa355d4961243cd285b41915e87652ae2c22f6
Reviewed-on: https://go-review.googlesource.com/c/go/+/272386
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
2020-11-24 01:33:25 +00:00
Robert Griesemer 762eda346a go/types: fix incorrect string(int) conversion (regression)
The bug was introduced by https://golang.org/cl/220844.

Fixes #42790.

Change-Id: I44d619a1a4d3f2aee1c5575d5cfddcc4ba10895f
Reviewed-on: https://go-review.googlesource.com/c/go/+/272666
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>
2020-11-24 00:50:11 +00:00
Michael Anthony Knyszek 48a1a51898 runtime/metrics: tweak wording of stack and unused memory metrics
This change tweaks and simplifies the descriptions of a couple metrics
to make them easier to parse (for humans).

Change-Id: I852654c7e7042c662ebdfa6334e3baf49ca4b33c
Reviewed-on: https://go-review.googlesource.com/c/go/+/272566
Trust: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2020-11-23 19:58:25 +00:00
Martin Möhrmann d902791b50 sync: use 386 instead of x86-32 to refer to the 32 bit x86 architecture
This aligns the naming with GOARCH using 386 as a build target for
this architecture and makes it more easily found when searching
for documentation related to the build target.

Change-Id: I393bb89dd2f71e568124107b13e1b288fbd0c76a
Reviewed-on: https://go-review.googlesource.com/c/go/+/271988
Trust: Martin Möhrmann <moehrmann@google.com>
Run-TryBot: Martin Möhrmann <martisch@uos.de>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-11-23 05:57:35 +00:00
Keith Randall 9ea6364a5e cmd/compile: add test for 42753
This issue was already fixed at tip. Just adding the test that
failed on 1.14/1.15.

Update #42753

Change-Id: I00d13ade476b9c17190d762d7fdcb30cf6c83954
Reviewed-on: https://go-review.googlesource.com/c/go/+/272029
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2020-11-21 16:46:05 +00:00
Jason A. Donenfeld f7342596da syscall: add DLLError.Unwrap function
Because we're expecting for future functions to be unavailable, we
should add an Unwrap() function to the DLLError struct, so that people
can test for this situation easily via:

    if errors.Is(err, syscall.ERROR_PROC_NOT_FOUND) { ... }

DLLError already was wrapping the underlying Errno error, but never got
the Go 1.13 helper method.

Fixes golang/go#42584

Change-Id: I0f32a5146946b1b37a30897ba825a56faefc792c
Reviewed-on: https://go-review.googlesource.com/c/go/+/269761
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Trust: Alex Brainman <alex.brainman@gmail.com>
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
2020-11-21 07:37:02 +00:00
Bryan C. Mills f93ef07b11 cmd/go/internal/modload: remove the Reqs function
The Reqs function returns an mvs.Reqs implemention for the global
build list. The API that it presents assumes that the build list is
globally consistent (problematic for #40775) and readily available
(problematic for #36460).

Fortunately, it is no longer used outside of the modload package.
We can instead use individual instances of the unexported mvsReqs
struct, making the dependency on the global build list more explicit.

For #36460
For #40775

Change-Id: I8674442f2a86416b0bf9c3395cb591c1e724c9d2
Reviewed-on: https://go-review.googlesource.com/c/go/+/272129
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>
2020-11-21 03:29:37 +00:00
Bryan C. Mills 3f5a97514b cmd/go/internal/modload: remove a stale comment for EditBuildList
For #36460
Updates #37438

Change-Id: I1626d40e78b110035a893b1b80dbd2279bf50ffe
Reviewed-on: https://go-review.googlesource.com/c/go/+/272128
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>
2020-11-21 03:28:08 +00:00
Michael Matloob 78e59bb1f7 cmd/go: support the -overlay flag for go mod commands
Move the declaration of the -overlay flag to base.AddModCommonFlags,
where other flags that are needed for go mod commands and for builds
are declared. The flag's already initialized in modload.Init so
there's no additional work needed to be done to support it in the go
mod commands.

For #39958

Change-Id: I70725d620cc69cb820f6ed923d626f4fe041b1c5
Reviewed-on: https://go-review.googlesource.com/c/go/+/272126
Trust: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2020-11-20 23:58:48 +00:00
Ian Lance Taylor c47eac7db0 cmd/cgo, cmd/internal/pkgpath: support gofrontend mangler v3
The gofrontend mangling scheme used by gccgo and GoLLVM has changed again.
Support the new version. This is a port of the relevant parts of
https://golang.org/cl/271726.

For #41862

Change-Id: I9c961c8e17ec960a83a23e1d49ea900962b63393
Reviewed-on: https://go-review.googlesource.com/c/go/+/272127
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2020-11-20 21:45:57 +00:00
Hollow Man 3fd4917472 doc: fix misspelling of “initialization” in diagnostics.html
initilization -> initialization

Change-Id: Ie5edd30559941f2d044280d8d586c2c2692d5b69
GitHub-Last-Rev: 7495a8c722
GitHub-Pull-Request: golang/go#42749
Reviewed-on: https://go-review.googlesource.com/c/go/+/272026
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Trust: Ian Lance Taylor <iant@golang.org>
2020-11-20 20:02:47 +00:00
Michael Matloob 676f0a45ed cmd/go: support overlaying go.mod files
This change updates the lockedfile package to open files using the
new fsys.OpenFile function. The logic of fsys.Open has been moved into
fsys.OpenFile, and fsys.Open is now just a light wrapper around it.

For #39958

Change-Id: I552f1a45ac00ac06b5812008d17a61e610b4b113
Reviewed-on: https://go-review.googlesource.com/c/go/+/266797
Trust: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2020-11-20 18:29:46 +00:00
Jay Conrod a19c925eda cmd/go: recommend 'go get' command to switch from retracted versions
This CL restores a message unintentionally removed in CL 270858.

For #24031

Change-Id: I957c5c59e624df98e72dfff351298bfc5bf9a9e7
Reviewed-on: https://go-review.googlesource.com/c/go/+/272066
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>
2020-11-20 17:35:55 +00:00
Cuong Manh Le c306fd6d0b cmd/compile: allow loading single field of typed-interface{} OpIData
Same reason as CL 270057, but for OpLoad.

Fixes #42727

Change-Id: Iebb1a8110f29427a0aed3b5e3e84f0540de3d1b7
Reviewed-on: https://go-review.googlesource.com/c/go/+/271906
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: David Chase <drchase@google.com>
2020-11-20 17:31:50 +00:00
Jay Conrod 5e58ae43be cmd/go: report changes and resolved versions in 'go get'
Fixes #33284

Change-Id: I33daa5eb518985bc7308f29655e04c57e244b479
Reviewed-on: https://go-review.googlesource.com/c/go/+/269018
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2020-11-20 16:42:46 +00:00
Jay Conrod 012efc67f2 cmd/go/internal/modload: ignore selected version in checkRetractions
Fixes #42601

Change-Id: I58d817ed34ccbd39591326c4bc23569f94028412
Reviewed-on: https://go-review.googlesource.com/c/go/+/272006
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>
2020-11-20 16:23:19 +00:00
Jay Conrod 9264067a41 cmd/go: remove ListModules call in runGet
ListModules was used to download .info files so that 'go list -m all'
would succeed later when offline. However, 'go list -m all' may
already fail when offline after 'go mod tidy', so it doesn't make
sense to add complexity to 'go get'.

Instead, remove the ListModules call and fix the test that
accidentally depended on it.

For #42723

Change-Id: I692597cf5ca15c23fa6fc9d2bac4b6e044299482
Reviewed-on: https://go-review.googlesource.com/c/go/+/271577
Trust: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2020-11-20 15:37:42 +00:00
Bryan C. Mills cb3f84ad25 cmd/go/internal/modload: eliminate LoadedModules
As of CL 271646, all external callers have been eliminated. Replace
the remaining internal caller with a direct reference to the buildList
variable and remove the exported function to prevent backsliding.

For #36460

Change-Id: Iea82df1e3e604ada602dda3e830c06d441eee2a7
Reviewed-on: https://go-review.googlesource.com/c/go/+/271647
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2020-11-20 15:19:17 +00:00
Bryan C. Mills 8bbd8294d0 cmd/go/internal/work: remove a redundant call to modload.LoadedModules
The modload.EditBuildList call added in CL 270980 already ensures that
installMod does not require a newer version of itself, so the condition
that this loop is checking for is redundant.

(I had meant for this change to be included in CL 270980, but
apparently somehow reverted it prior to mailing.)

For #36460

Change-Id: I4dd746b927f7012d950187cac9c510cd6fec8fd9
Reviewed-on: https://go-review.googlesource.com/c/go/+/271646
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Trust: Bryan C. Mills <bcmills@google.com>
2020-11-20 15:19:09 +00:00
Ian Lance Taylor 66c0264506 net, internal/poll: reset value before adding in minor kernel version
Fixes #42733

Change-Id: I5446aeb5de13cd70212755fb12c9bc484f343c74
Reviewed-on: https://go-review.googlesource.com/c/go/+/271846
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
2020-11-20 04:21:00 +00:00
Robert Griesemer 8fbdacf64c [dev.typeparams] cmd/compile/internal/types2: report constant overflow in binary ops
This is the go.types changes of https://golang.org/cl/271706
ported to types2.

Also: Fixed a bug in the go/types version (was using the
wrong position in the error message).

Change-Id: I798b80243a66f0be5b943a6951d7a1ff769abca2
Reviewed-on: https://go-review.googlesource.com/c/go/+/271806
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2020-11-20 02:39:33 +00:00
Robert Griesemer 0dcc7d6ea8 go/types: use correct error position
Follow-up on https://golang.org/cl/271706 .

Change-Id: I90339987aed88b0de3ee7ebe7d413282055c260c
Reviewed-on: https://go-review.googlesource.com/c/go/+/271789
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2020-11-20 02:27:53 +00:00
Robert Griesemer b1ae0a0646 [dev.typeparams] Merge branch 'master' into dev.typeparams
Change-Id: Ie8e697895b1d04ab79d35ef5a886f005be209756
2020-11-19 17:01:31 -08:00
Robert Griesemer c72a448881 go/types: fix error message for consistency
Follow-up on https://golang.org/cl/271706 .
(Missed a review comment.)

Change-Id: Ibff542f43d721600a2452907c0a20941961e793f
Reviewed-on: https://go-review.googlesource.com/c/go/+/271766
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2020-11-20 00:54:43 +00:00
Robert Griesemer 7eed73f36f go/types, go/constant: handle infinities as unknown values
With this change, constant literals (and results of constant
operations) that internally become infinities are represented
externally (to go/constant) as "unknown" values.

The language has no provisions to deal with infinite constants,
and producing unknown values allows the typechecker to report
errors and avoid invalid operations (such as multiplication of
zero with infinity).

Fixes #20583.

Change-Id: I12f36a17d262ff7957b0d3880241b5a8b2984777
Reviewed-on: https://go-review.googlesource.com/c/go/+/271706
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2020-11-20 00:09:05 +00:00
fzipp f3ce010b33 io/fs: make WalkDirFunc parameter name consistent with doc comment
The the DirEntry parameter of WalkDirFunc is referred to as `d` in the doc comment.

Change-Id: Ibfcf7908eaa0ef1309898150e8fd71101e7de09b
GitHub-Last-Rev: e858c52d81
GitHub-Pull-Request: golang/go#42447
Reviewed-on: https://go-review.googlesource.com/c/go/+/268277
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Russ Cox <rsc@golang.org>
2020-11-19 21:51:34 +00:00
Michael Anthony Knyszek 59f5fdac5d runtime/metrics: clarify Read's documentation
Change-Id: Idbcbc304f1568399a82af9dcd51e511393ed5ee0
Reviewed-on: https://go-review.googlesource.com/c/go/+/271558
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2020-11-19 20:37:38 +00:00
Michael Anthony Knyszek add45938b5 runtime/metrics: clarify memory and GC metrics documentation
Change-Id: I8940990a591a808ddd4b8613531f52453f85bde1
Reviewed-on: https://go-review.googlesource.com/c/go/+/271557
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2020-11-19 19:35:35 +00:00
Bryan C. Mills 498d8d5371 cmd/go/internal/work: avoid modload.Selected in 'go install pkg@version'
At this point in installOutsideModule the build list is empty, so
Selected trivially returns "none" for all modules.

(This change could have been made in CL 266657, but it was a bit
simpler to update the QueryPattern call sites mechanically to ensure
that there would be no unintentional semantic drift.)

For #36460

Change-Id: I44fb73794985bfeebb1dde0c092313f319c2945a
Reviewed-on: https://go-review.googlesource.com/c/go/+/271419
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>
2020-11-19 19:31:07 +00:00
Bryan C. Mills e73697b710 cmd/go: fix failing gccgo cases in TestScript/build_overlay
The 'go install' command does not support the -gccgo flag.
(I'm not sure why, but it doesn't.)

gccgo also uses system-native assembly syntax instead of cmd/compile's
Plan 9 derivative. I've added an assembly file that seems to work on
Linux, but I haven't tested it on other platforms; if it fails on
other platforms, we can refine the test as needed.

Fixes #42688

Change-Id: I0693a6a9eb58975f20cdc4160ef5f9a948563c88
Reviewed-on: https://go-review.googlesource.com/c/go/+/270978
Trust: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2020-11-19 19:30:38 +00:00
Robert Griesemer 0123c9b321 [dev.typeparams] cmd/compile/internal/types2: report an error for invalid constant values
This is https://golang.org/cl/271377 ported to types2.

Updates #42695.

Change-Id: I475bdcaeace5b0e87d4476a6d660996534289666
Reviewed-on: https://go-review.googlesource.com/c/go/+/271520
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>
2020-11-19 18:46:33 +00:00
Paul E. Murphy cb674b5c13 cmd/compile,cmd/asm: fix function pointer call perf regression on ppc64
by inserting hint when using bclrl.

Using this instruction as subroutine call is not the expected
default behavior, and as a result confuses the branch predictor.

The default expected behavior is a conditional return from a
subroutine.

We can change this assumption by encoding a hint this is not a
subroutine return.

The regex benchmarks are a pretty good example of how much this
hint can help generic ppc64le code on a power9 machine:

name                          old time/op    new time/op     delta
Find                             606ns ± 0%      447ns ± 0%  -26.27%
FindAllNoMatches                 309ns ± 0%      205ns ± 0%  -33.72%
FindString                       609ns ± 0%      451ns ± 0%  -26.04%
FindSubmatch                     734ns ± 0%      594ns ± 0%  -19.07%
FindStringSubmatch               706ns ± 0%      574ns ± 0%  -18.83%
Literal                          177ns ± 0%      136ns ± 0%  -22.89%
NotLiteral                      4.69µs ± 0%     2.34µs ± 0%  -50.14%
MatchClass                      6.05µs ± 0%     3.26µs ± 0%  -46.08%
MatchClass_InRange              5.93µs ± 0%     3.15µs ± 0%  -46.86%
ReplaceAll                      3.15µs ± 0%     2.18µs ± 0%  -30.77%
AnchoredLiteralShortNonMatch     156ns ± 0%      109ns ± 0%  -30.61%
AnchoredLiteralLongNonMatch      192ns ± 0%      136ns ± 0%  -29.34%
AnchoredShortMatch               268ns ± 0%      209ns ± 0%  -22.00%
AnchoredLongMatch                472ns ± 0%      357ns ± 0%  -24.30%
OnePassShortA                   1.16µs ± 0%     0.87µs ± 0%  -25.03%
NotOnePassShortA                1.34µs ± 0%     1.20µs ± 0%  -10.63%
OnePassShortB                    940ns ± 0%      655ns ± 0%  -30.29%
NotOnePassShortB                 873ns ± 0%      703ns ± 0%  -19.52%
OnePassLongPrefix                258ns ± 0%      155ns ± 0%  -40.13%
OnePassLongNotPrefix             943ns ± 0%      529ns ± 0%  -43.89%
MatchParallelShared              591ns ± 0%      436ns ± 0%  -26.31%
MatchParallelCopied              596ns ± 0%      435ns ± 0%  -27.10%
QuoteMetaAll                     186ns ± 0%      186ns ± 0%   -0.16%
QuoteMetaNone                   55.9ns ± 0%     55.9ns ± 0%   +0.02%
Compile/Onepass                 9.64µs ± 0%     9.26µs ± 0%   -3.97%
Compile/Medium                  21.7µs ± 0%     20.6µs ± 0%   -4.90%
Compile/Hard                     174µs ± 0%      174µs ± 0%   +0.07%
Match/Easy0/16                  7.35ns ± 0%     7.34ns ± 0%   -0.11%
Match/Easy0/32                   116ns ± 0%       97ns ± 0%  -16.27%
Match/Easy0/1K                   592ns ± 0%      562ns ± 0%   -5.04%
Match/Easy0/32K                 12.6µs ± 0%     12.5µs ± 0%   -0.64%
Match/Easy0/1M                   556µs ± 0%      556µs ± 0%   -0.00%
Match/Easy0/32M                 17.7ms ± 0%     17.7ms ± 0%   +0.05%
Match/Easy0i/16                 7.34ns ± 0%     7.35ns ± 0%   +0.10%
Match/Easy0i/32                 2.82µs ± 0%     1.64µs ± 0%  -41.71%
Match/Easy0i/1K                 83.2µs ± 0%     48.2µs ± 0%  -42.06%
Match/Easy0i/32K                2.13ms ± 0%     1.80ms ± 0%  -15.34%
Match/Easy0i/1M                 68.1ms ± 0%     57.6ms ± 0%  -15.31%
Match/Easy0i/32M                 2.18s ± 0%      1.80s ± 0%  -17.52%
Match/Easy1/16                  7.36ns ± 0%     7.34ns ± 0%   -0.24%
Match/Easy1/32                   118ns ± 0%       96ns ± 0%  -18.72%
Match/Easy1/1K                  2.46µs ± 0%     1.58µs ± 0%  -35.65%
Match/Easy1/32K                 80.2µs ± 0%     54.6µs ± 0%  -31.92%
Match/Easy1/1M                  2.75ms ± 0%     1.88ms ± 0%  -31.66%
Match/Easy1/32M                 87.5ms ± 0%     59.8ms ± 0%  -31.62%
Match/Medium/16                 7.34ns ± 0%     7.34ns ± 0%   +0.01%
Match/Medium/32                 2.60µs ± 0%     1.50µs ± 0%  -42.61%
Match/Medium/1K                 78.1µs ± 0%     43.7µs ± 0%  -44.06%
Match/Medium/32K                2.08ms ± 0%     1.52ms ± 0%  -27.11%
Match/Medium/1M                 66.5ms ± 0%     48.6ms ± 0%  -26.96%
Match/Medium/32M                 2.14s ± 0%      1.60s ± 0%  -25.18%
Match/Hard/16                   7.35ns ± 0%     7.35ns ± 0%   +0.03%
Match/Hard/32                   3.58µs ± 0%     2.44µs ± 0%  -31.82%
Match/Hard/1K                    108µs ± 0%       75µs ± 0%  -31.04%
Match/Hard/32K                  2.79ms ± 0%     2.25ms ± 0%  -19.30%
Match/Hard/1M                   89.4ms ± 0%     72.2ms ± 0%  -19.26%
Match/Hard/32M                   2.91s ± 0%      2.37s ± 0%  -18.60%
Match/Hard1/16                  11.1µs ± 0%      8.3µs ± 0%  -25.07%
Match/Hard1/32                  21.4µs ± 0%     16.1µs ± 0%  -24.85%
Match/Hard1/1K                   658µs ± 0%      498µs ± 0%  -24.27%
Match/Hard1/32K                 12.2ms ± 0%     11.7ms ± 0%   -4.60%
Match/Hard1/1M                   391ms ± 0%      374ms ± 0%   -4.40%
Match/Hard1/32M                  12.6s ± 0%      12.0s ± 0%   -4.68%
Match_onepass_regex/16           870ns ± 0%      611ns ± 0%  -29.79%
Match_onepass_regex/32          1.58µs ± 0%     1.08µs ± 0%  -31.48%
Match_onepass_regex/1K          45.7µs ± 0%     30.3µs ± 0%  -33.58%
Match_onepass_regex/32K         1.45ms ± 0%     0.97ms ± 0%  -33.20%
Match_onepass_regex/1M          46.2ms ± 0%     30.9ms ± 0%  -33.01%
Match_onepass_regex/32M          1.46s ± 0%      0.99s ± 0%  -32.02%

name                          old alloc/op   new alloc/op    delta
Find                             0.00B           0.00B         0.00%
FindAllNoMatches                 0.00B           0.00B         0.00%
FindString                       0.00B           0.00B         0.00%
FindSubmatch                     48.0B ± 0%      48.0B ± 0%    0.00%
FindStringSubmatch               32.0B ± 0%      32.0B ± 0%    0.00%
Compile/Onepass                 4.02kB ± 0%     4.02kB ± 0%    0.00%
Compile/Medium                  9.39kB ± 0%     9.39kB ± 0%    0.00%
Compile/Hard                    84.7kB ± 0%     84.7kB ± 0%    0.00%
Match_onepass_regex/16           0.00B           0.00B         0.00%
Match_onepass_regex/32           0.00B           0.00B         0.00%
Match_onepass_regex/1K           0.00B           0.00B         0.00%
Match_onepass_regex/32K          0.00B           0.00B         0.00%
Match_onepass_regex/1M           5.00B ± 0%      3.00B ± 0%  -40.00%
Match_onepass_regex/32M           136B ± 0%        68B ± 0%  -50.00%

name                          old allocs/op  new allocs/op   delta
Find                              0.00            0.00         0.00%
FindAllNoMatches                  0.00            0.00         0.00%
FindString                        0.00            0.00         0.00%
FindSubmatch                      1.00 ± 0%       1.00 ± 0%    0.00%
FindStringSubmatch                1.00 ± 0%       1.00 ± 0%    0.00%
Compile/Onepass                   52.0 ± 0%       52.0 ± 0%    0.00%
Compile/Medium                     112 ± 0%        112 ± 0%    0.00%
Compile/Hard                       424 ± 0%        424 ± 0%    0.00%
Match_onepass_regex/16            0.00            0.00         0.00%
Match_onepass_regex/32            0.00            0.00         0.00%
Match_onepass_regex/1K            0.00            0.00         0.00%
Match_onepass_regex/32K           0.00            0.00         0.00%
Match_onepass_regex/1M            0.00            0.00         0.00%
Match_onepass_regex/32M           2.00 ± 0%       1.00 ± 0%  -50.00%

name                          old speed      new speed       delta
QuoteMetaAll                  75.2MB/s ± 0%   75.3MB/s ± 0%   +0.15%
QuoteMetaNone                  465MB/s ± 0%    465MB/s ± 0%   -0.02%
Match/Easy0/16                2.18GB/s ± 0%   2.18GB/s ± 0%   +0.10%
Match/Easy0/32                 276MB/s ± 0%    330MB/s ± 0%  +19.46%
Match/Easy0/1K                1.73GB/s ± 0%   1.82GB/s ± 0%   +5.29%
Match/Easy0/32K               2.60GB/s ± 0%   2.62GB/s ± 0%   +0.64%
Match/Easy0/1M                1.89GB/s ± 0%   1.89GB/s ± 0%   +0.00%
Match/Easy0/32M               1.89GB/s ± 0%   1.89GB/s ± 0%   -0.05%
Match/Easy0i/16               2.18GB/s ± 0%   2.18GB/s ± 0%   -0.10%
Match/Easy0i/32               11.4MB/s ± 0%   19.5MB/s ± 0%  +71.48%
Match/Easy0i/1K               12.3MB/s ± 0%   21.2MB/s ± 0%  +72.62%
Match/Easy0i/32K              15.4MB/s ± 0%   18.2MB/s ± 0%  +18.12%
Match/Easy0i/1M               15.4MB/s ± 0%   18.2MB/s ± 0%  +18.12%
Match/Easy0i/32M              15.4MB/s ± 0%   18.6MB/s ± 0%  +21.21%
Match/Easy1/16                2.17GB/s ± 0%   2.18GB/s ± 0%   +0.24%
Match/Easy1/32                 271MB/s ± 0%    333MB/s ± 0%  +23.07%
Match/Easy1/1K                 417MB/s ± 0%    648MB/s ± 0%  +55.38%
Match/Easy1/32K                409MB/s ± 0%    600MB/s ± 0%  +46.88%
Match/Easy1/1M                 381MB/s ± 0%    558MB/s ± 0%  +46.33%
Match/Easy1/32M                383MB/s ± 0%    561MB/s ± 0%  +46.25%
Match/Medium/16               2.18GB/s ± 0%   2.18GB/s ± 0%   -0.01%
Match/Medium/32               12.3MB/s ± 0%   21.4MB/s ± 0%  +74.13%
Match/Medium/1K               13.1MB/s ± 0%   23.4MB/s ± 0%  +78.73%
Match/Medium/32K              15.7MB/s ± 0%   21.6MB/s ± 0%  +37.23%
Match/Medium/1M               15.8MB/s ± 0%   21.6MB/s ± 0%  +36.93%
Match/Medium/32M              15.7MB/s ± 0%   21.0MB/s ± 0%  +33.67%
Match/Hard/16                 2.18GB/s ± 0%   2.18GB/s ± 0%   -0.03%
Match/Hard/32                 8.93MB/s ± 0%  13.10MB/s ± 0%  +46.70%
Match/Hard/1K                 9.48MB/s ± 0%  13.74MB/s ± 0%  +44.94%
Match/Hard/32K                11.7MB/s ± 0%   14.5MB/s ± 0%  +23.87%
Match/Hard/1M                 11.7MB/s ± 0%   14.5MB/s ± 0%  +23.87%
Match/Hard/32M                11.6MB/s ± 0%   14.2MB/s ± 0%  +22.86%
Match/Hard1/16                1.44MB/s ± 0%   1.93MB/s ± 0%  +34.03%
Match/Hard1/32                1.49MB/s ± 0%   1.99MB/s ± 0%  +33.56%
Match/Hard1/1K                1.56MB/s ± 0%   2.05MB/s ± 0%  +31.41%
Match/Hard1/32K               2.68MB/s ± 0%   2.80MB/s ± 0%   +4.48%
Match/Hard1/1M                2.68MB/s ± 0%   2.80MB/s ± 0%   +4.48%
Match/Hard1/32M               2.66MB/s ± 0%   2.79MB/s ± 0%   +4.89%
Match_onepass_regex/16        18.4MB/s ± 0%   26.2MB/s ± 0%  +42.41%
Match_onepass_regex/32        20.2MB/s ± 0%   29.5MB/s ± 0%  +45.92%
Match_onepass_regex/1K        22.4MB/s ± 0%   33.8MB/s ± 0%  +50.54%
Match_onepass_regex/32K       22.6MB/s ± 0%   33.9MB/s ± 0%  +49.67%
Match_onepass_regex/1M        22.7MB/s ± 0%   33.9MB/s ± 0%  +49.27%
Match_onepass_regex/32M       23.0MB/s ± 0%   33.9MB/s ± 0%  +47.14%

Fixes #42709

Change-Id: Ice07fec2de4c5b1302febf8c2978ae8c1e4fd3e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/271337
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Trust: Lynn Boger <laboger@linux.vnet.ibm.com>
Trust: Carlos Eduardo Seo <carlos.seo@linaro.org>
2020-11-19 18:23:23 +00:00