]> Cypherpunks.ru repositories - gostls13.git/log
gostls13.git
2 years ago[dev.typeparams] all: merge master (296ddf2) into dev.typeparams
Matthew Dempsky [Thu, 8 Jul 2021 20:04:25 +0000 (13:04 -0700)]
[dev.typeparams] all: merge master (296ddf2) into dev.typeparams

Conflicts:

- src/runtime/runtime2.go

  On master, CL 317191 fixed the mentions of gc/reflect.go in comments
  to reflectdata/reflect.go; but on dev.typeparams, CL 325921 fixed
  that the same comment to reflect that deferstruct actually ended up
  in ssagen/ssa.go.

Merge List:

+ 2021-07-08 296ddf2a93 net: filter bad names from Lookup functions instead of hard failing
+ 2021-07-08 ce76298ee7 Update oudated comment
+ 2021-07-08 2ca44fe221 doc/go1.17: linkify time.UnixMilli and time.UnixMicro
+ 2021-07-07 5c59e11f5e cmd/compile: remove special-casing of blank in types.sconv{,2}
+ 2021-07-07 b003a8b1ae cmd/compile: optimize types.sconv
+ 2021-07-07 11f5df2d67 cmd/compile: extract pkgqual from symfmt
+ 2021-07-07 991fd381d5 cmd/go: don't lock .mod and .sum files for read in overlay
+ 2021-07-07 186a3bb4b0 cmd/go/internal/modfetch/codehost: skip hg tests if no hg binary is present
+ 2021-07-07 00c00558e1 cmd/go/internal/modload: remove unused functions
+ 2021-07-07 f264879f74 cmd/go/internal/modload: fix an apparent typo in the AutoRoot comment
+ 2021-07-07 c96833e5ba doc: remove stale comment about arm64 port

Change-Id: I849046b6d8f7421f60323549f3f763ef418bf9e7

2 years ago[dev.typeparams] cmd/compile: cleanup ABI utils tests
Matthew Dempsky [Wed, 7 Jul 2021 23:15:53 +0000 (16:15 -0700)]
[dev.typeparams] cmd/compile: cleanup ABI utils tests

This CL cleans a few minor nits with the ABI utils tests that are now
necessary because of cleanups that happened on master:

1. Initialize types.LocalPkg; this needs to be set for selector names
to be handled correctly.

2. In TestABIUtilsInterfaces, switch to using an exported identifier,
so it doesn't need to be package qualified.

3. While here, change the method result type from "untyped string" to
just "string". Constants are the only declared object that can ever
have an untyped type.

Change-Id: Iabed46594361a516317a1c2d20c3d59bdb519844
Reviewed-on: https://go-review.googlesource.com/c/go/+/333189
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2 years ago[dev.typeparams] cmd/compile: fix bunch of -G=3 bugs for test cases in test/typeparam...
Dan Scales [Wed, 7 Jul 2021 18:49:57 +0000 (11:49 -0700)]
[dev.typeparams] cmd/compile: fix bunch of -G=3 bugs for test cases in test/typeparams/mdempsky

1.go, 12.go: similar to calculating type sizes, we delay computing
instantiations during import until we get up to a top-level type, in
order to make sure recursive types are complete. But we should always
delay calculating sizes when we delay instantiating types, since
otherwise we may try to calculate the size of an incomplete type. So,
needed to add Defer/ResumeCheckSize in (*importReader).typ where we also
defer instantiations. (iimport.go)

2.go: when doing type substition, we have to handle named, parameterized
basic types i.e. the type has a type parameter even though the
underlying type is a basic type that doesn't depend on the parameter.
(subr.go)

3.go: for go 1.18, we allow arbitrary types in interfaces. We had
already allowed union types and tilde types, but didn't allow regular
non-interface types in Go 1.17 for compatibility.  Just skip an error
in the case of 1.18. (size.go)

5.go: types2 and types1 differ in how they print out interfaces. types1
puts a space between "interface" and "{", types2 does not. So, since
some typenames come from types2 and some from types1, we need to remove
the space when printing out type arguments. (iimport.go/subr.go)

9.go: in subst.node(), we were missing the KeyExpr case where a node has
no type. The assertion is just there, to make sure we understand all the
cases where there is no type to translate. We could just remove the
whole error check. (stencil.go)

13.go: in subst.node(), missed handling the case where a method
expression is immediate called (which of course, is quite unusual, since
then there's no real reason to have used the method expression syntax in
that case). Just needed to add ir.OMETHEXPR in the OCALL switch
statement.  (stencil.go)

Change-Id: I202cbe9541dfafe740e3b84b44982d6181738ea0
Reviewed-on: https://go-review.googlesource.com/c/go/+/333165
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2 years agonet: filter bad names from Lookup functions instead of hard failing
Roland Shoemaker [Fri, 2 Jul 2021 17:25:49 +0000 (10:25 -0700)]
net: filter bad names from Lookup functions instead of hard failing

Instead of hard failing on a single bad record, filter the bad records
and return anything valid. This only applies to the methods which can
return multiple records, LookupMX, LookupNS, LookupSRV, and LookupAddr.

When bad results are filtered out, also return an error, indicating
that this filtering has happened.

Updates #46241
Fixes #46979

Change-Id: I6493e0002beaf89f5a9795333a93605abd30d171
Reviewed-on: https://go-review.googlesource.com/c/go/+/332549
Trust: Roland Shoemaker <roland@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
2 years agoUpdate oudated comment
makdon [Mon, 17 May 2021 16:27:11 +0000 (16:27 +0000)]
Update oudated comment

Update comment cause gc/select.go has been moved to walk/select.go and gc/reflect.go has been moved to reflectdata/reflect.go

Change-Id: I6894527e1e9dbca50ace92a51bf942f9495ce88c
GitHub-Last-Rev: 6d6a4471440403218b68ba32d4038ca41eae2901
GitHub-Pull-Request: golang/go#45976
Reviewed-on: https://go-review.googlesource.com/c/go/+/317191
Reviewed-by: Keith Randall <khr@golang.org>
Trust: Michael Pratt <mpratt@google.com>

2 years agodoc/go1.17: linkify time.UnixMilli and time.UnixMicro
Tobias Klauser [Mon, 5 Jul 2021 08:35:53 +0000 (10:35 +0200)]
doc/go1.17: linkify time.UnixMilli and time.UnixMicro

Change-Id: I8503c4649fc42670f13d981f98af480467d6a3e8
Reviewed-on: https://go-review.googlesource.com/c/go/+/332829
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2 years ago[dev.typeparams] cmd/compile/internal/types2: don't permit method calls on ptr to...
Robert Griesemer [Sat, 3 Jul 2021 01:12:02 +0000 (18:12 -0700)]
[dev.typeparams] cmd/compile/internal/types2: don't permit method calls on ptr to type parameter receivers

Simplify the implementation of asInterface while at it.

For #47031.

Change-Id: Ie7d4fbbab898d961ed3c0b7772ba9604641be13f
Reviewed-on: https://go-review.googlesource.com/c/go/+/332609
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2 years ago[dev.typeparams] cmd/compile/internal/types2: replace optype() with under() in variou...
Robert Griesemer [Fri, 2 Jul 2021 23:54:14 +0000 (16:54 -0700)]
[dev.typeparams] cmd/compile/internal/types2: replace optype() with under() in various cases (cleanup)

This makes the behavior for type parameter operands explicit
in those cases.

Change-Id: I38438af67de4432f1a691dc4947e4576445f031b
Reviewed-on: https://go-review.googlesource.com/c/go/+/332555
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2 years ago[dev.typeparams] cmd/compile/internal/types2: clean up index expr implementation...
Robert Griesemer [Fri, 2 Jul 2021 22:41:28 +0000 (15:41 -0700)]
[dev.typeparams] cmd/compile/internal/types2: clean up index expr implementation for type parameters

This makes the implementation match the intended spec behavior:

Given an index expression a[x] where a is a type parameter, the
index expression is valid if the constraint for a satisfies the
following criteria:

- Either all types in the constraint type set are maps, or none
  of them are.

- If the (type set) types are maps, they must all have the same
  key type. (This may be too strict, perhaps it's sufficient to
  ensure assignability, but we can always relax that later.)

- All (type set) types must have the same element types.

- If there are any arrays, a constant index must be in range for
  the shortest array.

Change-Id: I8c094c11e6fc9496c293871ccf93e3814c881e6f
Reviewed-on: https://go-review.googlesource.com/c/go/+/332553
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2 years ago[dev.typeparams] cmd/compile/internal/types2: disallow "free" type parameter as RHS...
Robert Griesemer [Fri, 2 Jul 2021 05:10:01 +0000 (22:10 -0700)]
[dev.typeparams] cmd/compile/internal/types2: disallow "free" type parameter as RHS of a type declaration

For #45639.

Change-Id: I20e331b04f464db81e916af75f70ec8ae73eb989
Reviewed-on: https://go-review.googlesource.com/c/go/+/332411
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2 years ago[dev.typeparams] cmd/compile: fix bug with types2.Instantiate with interface type...
Dan Scales [Wed, 7 Jul 2021 19:03:41 +0000 (12:03 -0700)]
[dev.typeparams] cmd/compile: fix bug with types2.Instantiate with interface type param

types2.subst has an assertion that check is non-nil, but which breaks
Instantiate() with an interface type param (used when re-importing
instatiated type to types2). But this check was added when Instantiate()
was added, and things seem to work fine when the assertion is removed.

Fixes test/typeparam/mdempsky/7.go.

Change-Id: I4980f0b202a0b310a3c91a7a87f97576f54911de
Reviewed-on: https://go-review.googlesource.com/c/go/+/333155
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Trust: Dan Scales <danscales@google.com>

2 years ago[dev.typeparams] cmd/compile: move def of comparable to end of predeclared slices
Dan Scales [Wed, 7 Jul 2021 21:42:26 +0000 (14:42 -0700)]
[dev.typeparams] cmd/compile: move def of comparable to end of predeclared slices

This avoids changing the export ABI.

Change-Id: I58950c1f4c21859d91d66d352b88e8c0972b5b8c
Reviewed-on: https://go-review.googlesource.com/c/go/+/333164
Trust: Dan Scales <danscales@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
2 years agocmd/compile: remove special-casing of blank in types.sconv{,2}
Matthew Dempsky [Wed, 7 Jul 2021 20:18:42 +0000 (13:18 -0700)]
cmd/compile: remove special-casing of blank in types.sconv{,2}

I'm not sure why blank was special-cased here before, but it's
wrong. Blank is a non-exported identifier, and writing it out without
package-qualification can result in linker symbol collisions.

Fixes #47087.

Change-Id: Ie600037c8e54e3d4fdaeec21e2ca212badbd830b
Reviewed-on: https://go-review.googlesource.com/c/go/+/333163
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>
2 years agocmd/compile: optimize types.sconv
Matthew Dempsky [Wed, 7 Jul 2021 19:33:40 +0000 (12:33 -0700)]
cmd/compile: optimize types.sconv

Now that symfmt is simpler, we can simply manually inline it into
sconv. Importantly, this allows us to avoid allocating a buffer +
writing a string + re-interning it when we don't need to qualify the
identifier.

Passes toolstash -cmp.

Updates #47087.

Change-Id: I47b57aef22301ba242556a645346f478f0c1a7d1
Reviewed-on: https://go-review.googlesource.com/c/go/+/333162
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>
2 years agocmd/compile: extract pkgqual from symfmt
Matthew Dempsky [Wed, 7 Jul 2021 19:11:37 +0000 (12:11 -0700)]
cmd/compile: extract pkgqual from symfmt

The logic in symfmt for deciding how to package-qualify an identifier
is easily refactored into a separate function, loosely similar to
go/types.Qualifier's API.

Passes toolstash -cmp.

Updates #47087.

Change-Id: Ib3e7cc35a6577dc28df8eca79ba3457c48168e86
Reviewed-on: https://go-review.googlesource.com/c/go/+/333161
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>
2 years agocmd/go: don't lock .mod and .sum files for read in overlay
Jay Conrod [Tue, 6 Jul 2021 17:38:18 +0000 (10:38 -0700)]
cmd/go: don't lock .mod and .sum files for read in overlay

On Plan 9, locking a file requires a chmod call. In general, the go
command should not modify files in the overlay, even metadata. With
this change, we won't lock these files for reading.

The go command already reported errors when attempting to write these
files if they were in the overlay, but this change moves those checks
to the point of access for clearer error
messages. cmd/go/internal/lockedfile no longer imports
cmd/go/internal/fsys.

Fixes #44700

Change-Id: Ib544459dd6cf56ca0f7a27b3285f045f08040d7e
Reviewed-on: https://go-review.googlesource.com/c/go/+/333012
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2 years agocmd/go/internal/modfetch/codehost: skip hg tests if no hg binary is present
Bryan C. Mills [Fri, 25 Jun 2021 16:49:51 +0000 (12:49 -0400)]
cmd/go/internal/modfetch/codehost: skip hg tests if no hg binary is present

Change-Id: I5cf57bf1153eb662bcab71e3d2c04848212559a6
Reviewed-on: https://go-review.googlesource.com/c/go/+/330989
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>
2 years agocmd/go/internal/modload: remove unused functions
Bryan C. Mills [Fri, 2 Jul 2021 15:27:37 +0000 (11:27 -0400)]
cmd/go/internal/modload: remove unused functions

Also unexport functions that are not used outside the modload package.

Change-Id: I0de187cbb673cadafce95a27f5ccff934ae21104
Reviewed-on: https://go-review.googlesource.com/c/go/+/332570
Trust: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2 years agocmd/go/internal/modload: fix an apparent typo in the AutoRoot comment
Bryan C. Mills [Fri, 2 Jul 2021 18:00:49 +0000 (14:00 -0400)]
cmd/go/internal/modload: fix an apparent typo in the AutoRoot comment

Updates #40276

Change-Id: Ic192d51f9f0306e5c206c550ef02f6d4495d0851
Reviewed-on: https://go-review.googlesource.com/c/go/+/332569
Trust: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2 years ago[dev.typeparams] cmd/compile: fix windows longtest builder
Matthew Dempsky [Wed, 7 Jul 2021 11:03:24 +0000 (04:03 -0700)]
[dev.typeparams] cmd/compile: fix windows longtest builder

CL 332469 broke the Windows longtest builders, because it changed the
names assigned to autotmp variables that end up in export data.

The naming of autotmps doesn't actually matter, so instead we can just
hack iexport to write out "$autotmp" as a magic marker, and let the
reader replace it with an appropriate unique name. This is a little
hacky, but so is iexport's handling of autotmps already, and this
should also go away eventually with unified IR.

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

2 years ago[dev.typeparams] cmd/compile: handle derived types that are converted to interfaces
Dan Scales [Tue, 6 Jul 2021 16:38:58 +0000 (09:38 -0700)]
[dev.typeparams] cmd/compile: handle derived types that are converted to interfaces

Up to this point, we were only handling typeparams that were converted
to empty or non-empty interfaces. But we have a dictionary entry for
each derived type (i.e. type derived from typeparams) as well. So, when
doing a conversion, look for the source type in both the type params and
derived types of the generic info, and then use the appropriate
dictionary entry.

Added some cases to ifaceconv.go (e.g. converting []T to an empty
interface).

Change-Id: I7bbad0128bec20ccccd93ae1d65c1ffd44ca79a0
Reviewed-on: https://go-review.googlesource.com/c/go/+/333011
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2 years ago[dev.typeparams] cmd/compile: add built-in name/type "comparable".
Dan Scales [Tue, 6 Jul 2021 03:58:56 +0000 (20:58 -0700)]
[dev.typeparams] cmd/compile: add built-in name/type "comparable".

This allows exporting comparable type bounds, and importing back into
types2 for typechecking.

Fixes typeparam/mdempsky/8.go

Change-Id: I3ee12433df2ed68ac6ef4cad24be9fcdfaaca4e3
Reviewed-on: https://go-review.googlesource.com/c/go/+/333129
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Trust: Dan Scales <danscales@google.com>

2 years ago[dev.typeparams] cmd/compile: handle the (*T).M method expression with dictionaries
Dan Scales [Tue, 6 Jul 2021 17:53:00 +0000 (10:53 -0700)]
[dev.typeparams] cmd/compile: handle the (*T).M method expression with dictionaries

The (*T).M method expression is where M is a value method, but the type
(*T) is a pointer to the main type. In this case, after following any
embedded fields, we need to add an extra star operator when using the
receiver arg in the closure call.

Thanks to Cuong for finding/pointing out an example for this case
(typeparam/mdempsky/14.go) This example also shows that we now need the
ability to export/import OEFACE and OIDATA, which I added.

Change-Id: Ida0f81ce757fff78fec6276c60052ed71d207454
Reviewed-on: https://go-review.googlesource.com/c/go/+/333014
Run-TryBot: Dan Scales <danscales@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Dan Scales <danscales@google.com>

2 years agodoc: remove stale comment about arm64 port
Michael Anthony Knyszek [Wed, 7 Jul 2021 14:58:36 +0000 (14:58 +0000)]
doc: remove stale comment about arm64 port

Fixes #47079.

Change-Id: I8a671e3fdc13083e44e8d89064a5e7621e53bc4c
Reviewed-on: https://go-review.googlesource.com/c/go/+/333075
Trust: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>

2 years ago[dev.typeparams] cmd/compile: rename PartialCallType -> MethodValueType
Cuong Manh Le [Sun, 4 Jul 2021 05:06:39 +0000 (12:06 +0700)]
[dev.typeparams] cmd/compile: rename PartialCallType -> MethodValueType

CL 330837 rename OCALLPART to OMETHVALUE, so do the same thing for
PartialCallType for consistency.

Change-Id: Id40eb35bbcee7719acfb41fce0e2b968879f9fef
Reviewed-on: https://go-review.googlesource.com/c/go/+/332769
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>
2 years ago[dev.typeparams] test: add regress tests that fail(ed) with -G=3
Matthew Dempsky [Tue, 8 Jun 2021 18:57:11 +0000 (11:57 -0700)]
[dev.typeparams] test: add regress tests that fail(ed) with -G=3

This CL includes multiple test cases that exercise unique failures
with -G=3 mode that did not affect unified IR mode. Most of these were
found over a period of about 3 hours of manual experimentation.

Thanks to Cuong Manh Le for test cases 11 and 12.

Updates #46704.

Change-Id: Ia2fa619536732b121b6c929329065c85b9384511
Reviewed-on: https://go-review.googlesource.com/c/go/+/326169
Trust: Matthew Dempsky <mdempsky@google.com>
Trust: Dan Scales <danscales@google.com>
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
2 years ago[dev.typeparams] test: add expected failure mechanism
Matthew Dempsky [Fri, 2 Jul 2021 20:18:03 +0000 (13:18 -0700)]
[dev.typeparams] test: add expected failure mechanism

This CL changes the existing excluded-test mechanism into a
known-failure mechanism instead. That is, it runs the test regardless,
but only reports if it failed (or succeeded) unexpectedly.

It also splits the known failures list into fine-grain failure lists
for types2, types2 w/ 32-bit target, -G=3, and unified.

Updates #46704.

Change-Id: I1213cbccf1bab6a92d9bfcf0d971a2554249bbff
Reviewed-on: https://go-review.googlesource.com/c/go/+/332551
Trust: Matthew Dempsky <mdempsky@google.com>
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
2 years ago[dev.typeparams] cmd/compile: better Call constructor
Matthew Dempsky [Sat, 3 Jul 2021 18:55:31 +0000 (11:55 -0700)]
[dev.typeparams] cmd/compile: better Call constructor

Historically, it's been tedious to create and typecheck ir.OCALL
nodes, except by handing them off entirely to typecheck. This is
because typecheck needed context on whether the call is an expression
or statement, and to set flags like Func.ClosureCalled and
CallExpr.Use.

However, those flags have now been removed entirely by recent CLs, so
we can instead just provide a better typecheck.Call function for
constructing and typechecking arbitrary call nodes. Notably, this
simplifies things for unified IR, which can now incrementally
typecheck call expressions as it goes without worrying about context.

Change-Id: Icbdc55c3bd8be84a242323bc45006f9dec09fdcd
Reviewed-on: https://go-review.googlesource.com/c/go/+/332692
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>
2 years ago[dev.typeparams] cmd/compile: set Func.ClosureCalled in escape analysis
Matthew Dempsky [Sat, 3 Jul 2021 18:22:26 +0000 (11:22 -0700)]
[dev.typeparams] cmd/compile: set Func.ClosureCalled in escape analysis

The Func.ClosureCalled flag is an optimization used by escape analysis
to detect closures that were directly called, so we know we have
visibility of the result flows. It's not needed by any other phases of
the compiler, so we might as well calculate it within escape analysis
too.

This saves some trouble during IR construction and trying to maintain
the ClosureCalled flag through inlining and copying.

Passes toolstash -cmp.

Change-Id: Ic53cecb7ac439745c0dfba2cd202b9cc40f1e47c
Reviewed-on: https://go-review.googlesource.com/c/go/+/332691
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>
2 years ago[dev.typeparams] cmd/compile: remove ir.CallUse
Matthew Dempsky [Sat, 3 Jul 2021 12:27:54 +0000 (05:27 -0700)]
[dev.typeparams] cmd/compile: remove ir.CallUse

Unneeded after the previous CL changed inlining to leave OINLCALL
nodes in place.

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

2 years ago[dev.typeparams] cmd/compile: flatten OINLCALL in walk
Matthew Dempsky [Sat, 3 Jul 2021 11:53:25 +0000 (04:53 -0700)]
[dev.typeparams] cmd/compile: flatten OINLCALL in walk

Inlining replaces inlined calls with OINLCALL nodes, and then somewhat
clumsily tries to rewrite these in place without messing up
order-of-evaluation rules.

But handling these rules cleanly is much easier to do during order,
and escape analysis is the only major pass between inlining and
order. It's simpler to teach escape analysis how to analyze OINLCALL
nodes than to try to hide them from escape analysis.

Does not pass toolstash -cmp, but seems to just be line number
changes.

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

2 years ago[dev.typeparams] src,cmd: run 'go mod tidy'
Matthew Dempsky [Sat, 3 Jul 2021 12:50:05 +0000 (05:50 -0700)]
[dev.typeparams] src,cmd: run 'go mod tidy'

Run 'go mod tidy' to satisfy the longtest builders.

Change-Id: I5b31b63d0f273fca0833e44b826edfd726a1a958
Reviewed-on: https://go-review.googlesource.com/c/go/+/332669
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>
2 years ago[dev.typeparams] cmd/compile: formalize "hidden parameters" idea
Matthew Dempsky [Fri, 2 Jul 2021 23:29:42 +0000 (16:29 -0700)]
[dev.typeparams] cmd/compile: formalize "hidden parameters" idea

This CL formalizes the closure-var trick used for method-value
wrappers to be reusable for defining other functions that take hidden
parameters via the closure-context register. In particular, it:

1. Adds a new ir.NewHiddenParam function for creating hidden
parameters.

2. Changes ir.NewClosureVar to copy Type/Typecheck from the closure
variable, so that callers can needing to manually copy these.

3. Updates existing code accordingly (i.e., method-value wrappers to
start using ir.NewHiddenParam, and closure builders to stop copying
types).

Longer term, I anticipate using this to pass dictionaries to stenciled
functions within unified IR.

Change-Id: I9da3ffdb2a26d15c6e89a21b4e080686d6dc872c
Reviewed-on: https://go-review.googlesource.com/c/go/+/332612
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>
2 years agoMerge "[dev.typeparams] all: merge master (912f075) into dev.typeparams" into dev...
Gerrit Code Review [Sat, 3 Jul 2021 02:00:21 +0000 (02:00 +0000)]
Merge "[dev.typeparams] all: merge master (912f075) into dev.typeparams" into dev.typeparams

2 years ago[dev.typeparams] src,cmd: bump go.mod to 'go 1.18'
Matthew Dempsky [Fri, 2 Jul 2021 23:39:49 +0000 (16:39 -0700)]
[dev.typeparams] src,cmd: bump go.mod to 'go 1.18'

Necessary for building/testing generics code within src/ or src/cmd/
since CL 332373, and we'll need to do this eventually anyway.

Change-Id: Ia8c658c92d861fd3803fa18bfc80407c3381b411
Reviewed-on: https://go-review.googlesource.com/c/go/+/332554
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>

2 years ago[dev.typeparams] all: merge master (912f075) into dev.typeparams
Matthew Dempsky [Fri, 2 Jul 2021 22:46:51 +0000 (15:46 -0700)]
[dev.typeparams] all: merge master (912f075) into dev.typeparams

Conflicts:

- src/cmd/compile/internal/escape/escape.go

  On master, CL 332230 changed the ">=" in HeapAllocReason to ">"; but
  on dev.typeparams, CL 329989 moved HeapAllocReason into utils.go.

Merge List:

+ 2021-07-02 912f075047 net/http: mention socks5 support in proxy
+ 2021-07-02 287c5e8066 cmd/compile: fix stack growing algorithm
+ 2021-07-02 743f03eeb0 spec, unsafe: clarify unsafe.Slice docs
+ 2021-07-02 6125d0c426 cmd/dist: correct comment: SysProcAttri -> SysProcAttr
+ 2021-07-01 03761ede02 net: don't reject null mx records
+ 2021-07-01 877688c838 testing: add TB.Setenv
+ 2021-07-01 ef8ae82b37 cmd/compile: fix bug in dwarf-gen var location generation
+ 2021-07-01 770899f7e1 cmd/go: add a regression test for 'go mod vendor' path traversal
+ 2021-07-01 835d86a17e cmd/go: use path.Dir instead of filepath.Dir for package paths in 'go mod vendor'
+ 2021-07-01 eb437ba92c cmd/compile: make stack value size threshold comparisons consistent
+ 2021-07-01 9d65578b83 cmd/compile: fix typos in document

Change-Id: I08aa852441af0f070aa32dd2f99b6fa4e9d79cfa

2 years ago[dev.typeparams] cmd/compile: separate out creating instantiations from creating...
Dan Scales [Fri, 2 Jul 2021 19:32:38 +0000 (12:32 -0700)]
[dev.typeparams] cmd/compile:  separate out creating instantiations from creating dictionaries

We often need to create a function/method instantiation, but not a
dictionary, because the call to the instantiation will be using a
sub-dictionary. Also, main dictionaries are only need for concrete,
non-gcshape types, whereas instantiations will be for gcshape types (or
concrete types, for strict stenciling).

Created a helper function getDictOrSubdict() to reduce duplicated code.
Also, moved gfGetGfInfo() call in getDictionarySym() inside conditional
where it is needed, to avoid extra work when dictionary has already been
created.

Change-Id: I06587cb2ddc77de2f991e9f9eaf462d2c5a5d45e
Reviewed-on: https://go-review.googlesource.com/c/go/+/332550
Trust: Dan Scales <danscales@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2 years agonet/http: mention socks5 support in proxy
Sean Liao [Tue, 8 Jun 2021 18:13:23 +0000 (20:13 +0200)]
net/http: mention socks5 support in proxy

Change-Id: I55b6d5c77221569eeafea625379affd476a65772
Reviewed-on: https://go-review.googlesource.com/c/go/+/326011
Reviewed-by: Damien Neil <dneil@google.com>
Trust: Dmitri Shuralyov <dmitshur@golang.org>

2 years agocmd/compile: fix stack growing algorithm
go101 [Fri, 2 Jul 2021 08:01:20 +0000 (08:01 +0000)]
cmd/compile: fix stack growing algorithm

The current stack growing implementation looks not right.
Specially, the line runtime/stack.go#L1068 never gets executed,
which causes many unnecessary copystack calls.

This PR is trying to correct the implementation.
As I'm not familiar with the code, the fix is just a guess.

Change-Id: I0bea1148175fad34f74f19d455c240c94d3cb78b
GitHub-Last-Rev: 57205f91fe6f7cecbf0b7aad0d90d2f81270b1e8
GitHub-Pull-Request: golang/go#47010
Reviewed-on: https://go-review.googlesource.com/c/go/+/332229
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Dmitri Shuralyov <dmitshur@golang.org>

2 years agospec, unsafe: clarify unsafe.Slice docs
Ian Lance Taylor [Thu, 1 Jul 2021 23:52:59 +0000 (16:52 -0700)]
spec, unsafe: clarify unsafe.Slice docs

For #19367

Change-Id: If0ff8ddba3b6b48e2e198cf3653e73284c7572a3
Reviewed-on: https://go-review.googlesource.com/c/go/+/332409
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2 years ago[dev.typeparams] cmd/compile: start using sub-dictionary entries where needed
Dan Scales [Tue, 29 Jun 2021 01:04:58 +0000 (18:04 -0700)]
[dev.typeparams] cmd/compile: start using sub-dictionary entries where needed

Added new struct instInfo for information about an instantiation (of a
generic function/method with gcshapes or concrete types). We use this to
remember the dictionary param node, the nodes where sub-dictionaries
need to be used, etc. The instInfo map replaces the Stencil map in
Package.

Added code to access sub-dictionary entries at the appropriate call
sites. We are currently still calculating the corresponding main
dictionary, even when we really only need a sub-dictionary. I'll clean
that up in a follow-up CL.

Added code to deal with "generic" closures (closures that reference some
generic variables/types). We decided that closures will share the same
dictionary as the containing function (accessing the dictionary via a
closure variable). So, the getGfInfo function now traverses all the
nodes of each closure in a function that it is analyzing, so that a
function's dictionary has all the entries needed for all its closures as
well. Also, the instInfo of a closure is largely shared with its
containing function. A good test for generic closures already exists
with orderedmap.go.

Other improvements:
 - Only create sub-dictionary entries when the function/method
   call/value or closure actually has type params in it. Added new test
   file subdict.go with an example where a generic method has an
   instantiated method call that does not depend not have type params.

Change-Id: I691b9dc024a89d2305fcf1d8ba8540e53c9d103f
Reviewed-on: https://go-review.googlesource.com/c/go/+/331516
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2 years agocmd/dist: correct comment: SysProcAttri -> SysProcAttr
komisan19 [Fri, 2 Jul 2021 05:41:10 +0000 (05:41 +0000)]
cmd/dist: correct comment: SysProcAttri -> SysProcAttr

Fixes #46982

Change-Id: I07a18507b7aad828714b187f296fa7268f32b1c4
GitHub-Last-Rev: f498febffdae0bc93ae1794d1ee62b2ef3ecf1bb
GitHub-Pull-Request: golang/go#46983
Reviewed-on: https://go-review.googlesource.com/c/go/+/331869
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>

2 years ago[dev.typeparams] cmd/compile: incremental typecheck during unified IR
Matthew Dempsky [Thu, 1 Jul 2021 22:23:41 +0000 (15:23 -0700)]
[dev.typeparams] cmd/compile: incremental typecheck during unified IR

This CL changes unified IR to incrementally typecheck the IR as it's
constructed. This is significant, because it means reader can now use
typecheck.Expr to typecheck sub-expressions when it's needed. This
should be helpful for construction and insertion of dictionaries.

This CL does introduce two quirks outside of unified IR itself,
which simplify preserving binary output:

1. Top-level declarations are sorted after they're constructed, to
avoid worrying about the order that closures are added.

2. Zero-padding autotmp_N variable names. Interleaving typechecking
means autotmp variables are sometimes named differently (since their
naming depends on the number of variables declared so far), and this
ensures that code that sorts variables by names doesn't suddenly sort
autotmp_8/autotmp_9 differently than it would have sorted
autotmp_9/autotmp_10.

While at it, this CL also updated reader to use ir.WithFunc instead of
manually setting and restoring ir.CurFunc. There's now only one
remaining direct use of ir.CurFunc.

Change-Id: I6233b4c059596e471c53166f94750917d710462f
Reviewed-on: https://go-review.googlesource.com/c/go/+/332469
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>
2 years ago[dev.typeparams] cmd/compile: enable generics syntax with -lang=go1.18
Matthew Dempsky [Thu, 1 Jul 2021 19:47:58 +0000 (12:47 -0700)]
[dev.typeparams] cmd/compile: enable generics syntax with -lang=go1.18

We already use -lang=go1.18 to control the types2 type checker
behavior. This CL does the same for the parser.

Also, disable an assertion in the unified IR linker that depended on
the -G flag. This assertion was more useful during initial
bootstrapping of that code, but it's less critical now.

With these two changes, "GOEXPERIMENT=unified ./make.bash" is enough
to get a fully functional generics-enabled toolchain. There's no need
to continue specifying custom compiler flags later on.

Change-Id: I7766381926f3bb17eee2e5fcc182a38a39e937e1
Reviewed-on: https://go-review.googlesource.com/c/go/+/332373
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2 years ago[dev.typeparams] cmd/compile/internal/types2: move (remaining) type decls into their...
Robert Griesemer [Wed, 30 Jun 2021 20:26:11 +0000 (13:26 -0700)]
[dev.typeparams] cmd/compile/internal/types2: move (remaining) type decls into their own files (cleanup)

This change moves the type declarations and associated methods for
each of the remaining Type types into their respective files. Except
for import and comment adjustments, and receiver name adjustments for
the Underlying and String methods, no functional changes are made.

Change-Id: I3b9ccab3c85abea4852bacd28c2e47cec05c0bac
Reviewed-on: https://go-review.googlesource.com/c/go/+/332093
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2 years ago[dev.typeparams] cmd/compile/internal/types2: move Interface type decl into interface...
Robert Griesemer [Wed, 30 Jun 2021 20:03:57 +0000 (13:03 -0700)]
[dev.typeparams] cmd/compile/internal/types2: move Interface type decl into interface.go (cleanup)

Change-Id: Ie1ba50c82afb7409f9495a19b8629c61c6a8d4dc
Reviewed-on: https://go-review.googlesource.com/c/go/+/332092
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2 years ago[dev.typeparams] cmd/internal/dwarf: remove putInlinedFunc's callersym param
Matthew Dempsky [Thu, 1 Jul 2021 18:44:43 +0000 (11:44 -0700)]
[dev.typeparams] cmd/internal/dwarf: remove putInlinedFunc's callersym param

This parameter is only used for debugging, and all of putInlinedFunc's
callers were actually passing the callee symbol instead.

Change-Id: I964825a514cc42a1b0bcbce4ef11a1a47084d882
Reviewed-on: https://go-review.googlesource.com/c/go/+/332370
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2 years agonet: don't reject null mx records
Roland Shoemaker [Wed, 30 Jun 2021 21:28:18 +0000 (14:28 -0700)]
net: don't reject null mx records

Bypass hostname validity checking when a null mx record is returned as,
defined in RFC 7505.

Updates #46979

Change-Id: Ibe683bd6b47333a8ff30909fb2680ec8e10696ef
Reviewed-on: https://go-review.googlesource.com/c/go/+/332094
Trust: Roland Shoemaker <roland@golang.org>
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Roland Shoemaker <roland@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
2 years agotesting: add TB.Setenv
Russ Cox [Thu, 10 Jun 2021 19:17:17 +0000 (15:17 -0400)]
testing: add TB.Setenv

For #41260 and #46688.

Change-Id: I6f42742cc3234a90003136ae8798a6b0e1291788
Reviewed-on: https://go-review.googlesource.com/c/go/+/326790
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2 years agocmd/compile: fix bug in dwarf-gen var location generation
Than McIntosh [Thu, 1 Jul 2021 15:22:02 +0000 (11:22 -0400)]
cmd/compile: fix bug in dwarf-gen var location generation

This patch fixes a bug in the SSA back end's DWARF generation code
that determines variable locations / lifetimes.

The code in question was written to handle sequences of initial
pseudo-ops (zero width instructions such as OpPhi, OpArg, etc) in a
basic block, detecting these ops at the start of a block and then
treating the values specially when emitting ranges for the variables
in those values.  The logic in this code wasn't quite correct, meaning
that a flag variable wasn't being set properly to record the presence
of a block of zero-width value-bearing ops, leading to incorrect or
missing DWARF locations for register params.

Also in this patch is a tweak to some sanity-checking code intended to
catch scheduling problems with OpArg/OpPhi etc. The checks need to
allow for the possibility of an Arg op scheduled after a spill of an
incoming register param inserted by the register allocator. Example:

    b1:
      v13 = ArgIntReg <int> {p1+16} [2] : CX
      v14 = ArgIntReg <int> {p2+16} [5] : R8
      v38 = ArgIntReg <int> {p3+16} [8] : R11
      v35 = ArgIntReg <int> {p1+0} [0] : AX
      v15 = StoreReg <int> v35 : .autotmp_4[int]
      v40  = Arg <int> {p4} [16] : p4+16[int]
      v1 = InitMem <mem>
      v3 = SB <uintptr> : SB
      v18 = CMPQ <flags> v14 v13
      NE v18 → b3 b2 (unlikely) (18)

Here the register allocator has decided to spill v35, meaning that the
OpArg v40 is no longer going to be positioned prior to all other
non-zero-width ops; this is a valid scenario and needs to be handled
properly by the debug code.

Fixes #46425.

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

2 years ago[dev.typeparams] cmd/compile: fix getDictionarySym for methods references, write...
Dan Scales [Wed, 30 Jun 2021 22:38:56 +0000 (15:38 -0700)]
[dev.typeparams] cmd/compile: fix getDictionarySym for methods references, write out sub-dictionaries

For method references (only), selectorExpr() now computes n.Selection,
which is the generic method that is selected. This allows us to compute
as needed the proper sub-dictionary for method reference. Also cleans up
some code for distinguishing method references from references to a
field that has a function value (especially in the presence of embedded
fields).

Change-Id: I9c5b789c15537ff48c70ca7a6444aa0420178a3a
Reviewed-on: https://go-review.googlesource.com/c/go/+/332095
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2 years agocmd/go: add a regression test for 'go mod vendor' path traversal
Bryan C. Mills [Thu, 1 Jul 2021 16:32:05 +0000 (12:32 -0400)]
cmd/go: add a regression test for 'go mod vendor' path traversal

For #46867

Change-Id: I1547ebf7b91e9ddd7b67fd2f20e91391d79fa35d
Reviewed-on: https://go-review.googlesource.com/c/go/+/332250
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>
2 years agocmd/go: use path.Dir instead of filepath.Dir for package paths in 'go mod vendor'
Yasuhiro Matsumoto [Tue, 22 Jun 2021 16:02:33 +0000 (01:02 +0900)]
cmd/go: use path.Dir instead of filepath.Dir for package paths in 'go mod vendor'

copyMetadata walk-up to parent directory until the pkg become modPath.
But pkg should be slash-separated paths. It have to use path.Dir instead of
filepath.Dir.

Fixes #46867

Change-Id: I44cf1429fe52379a7415b94cc30ae3275cc430e8
Reviewed-on: https://go-review.googlesource.com/c/go/+/330149
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Trust: Bryan C. Mills <bcmills@google.com>
Trust: Alexander Rakoczy <alex@golang.org>
Trust: Carlos Amedee <carlos@golang.org>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>

2 years agocmd/compile: make stack value size threshold comparisons consistent
go101 [Thu, 1 Jul 2021 14:25:45 +0000 (14:25 +0000)]
cmd/compile: make stack value size threshold comparisons consistent

Consistency is beautiful.

Change-Id: Ib110dcff0ce2fa87b5576c79cd79c83aab385a7c
GitHub-Last-Rev: b8758f8ae02cb025267aa87ebc5c2f9b4c32e742
GitHub-Pull-Request: golang/go#47011
Reviewed-on: https://go-review.googlesource.com/c/go/+/332230
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>

2 years ago[dev.typeparams] cmd/compile/internal/types2: move Signature type decl into signature...
Robert Griesemer [Wed, 30 Jun 2021 20:00:14 +0000 (13:00 -0700)]
[dev.typeparams] cmd/compile/internal/types2: move Signature type decl into signature.go (cleanup)

Change-Id: I68c9da6a87cdc15bde8bffa8cb86fb8705eb1f8e
Reviewed-on: https://go-review.googlesource.com/c/go/+/332091
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2 years ago[dev.typeparams] cmd/compile/internal/types2: move Struct type decl into struct.go...
Robert Griesemer [Wed, 30 Jun 2021 19:56:50 +0000 (12:56 -0700)]
[dev.typeparams] cmd/compile/internal/types2: move Struct type decl into struct.go (cleanup)

Change-Id: I074550236785091d2f79dd5de73c3462614c5c0e
Reviewed-on: https://go-review.googlesource.com/c/go/+/332090
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2 years ago[dev.typeparams] cmd/compile/internal/types2: rename newTypeSet -> computeTypeSet
Robert Griesemer [Wed, 30 Jun 2021 19:45:51 +0000 (12:45 -0700)]
[dev.typeparams] cmd/compile/internal/types2: rename newTypeSet -> computeTypeSet

Follow-up on comment in https://golang.org/cl/329309.

Change-Id: I31f746180237b916c1825fa1688641849478ba41
Reviewed-on: https://go-review.googlesource.com/c/go/+/332089
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2 years ago[dev.typeparams] cmd/compile/internal/types2: make Interface.obj a *TypeName
Robert Griesemer [Wed, 30 Jun 2021 18:21:32 +0000 (11:21 -0700)]
[dev.typeparams] cmd/compile/internal/types2: make Interface.obj a *TypeName

We know the exact type, so make it that. This saves some code
and a word of space with each Interface.

Follow-up on a comment in https://golang.org/cl/329309.

Change-Id: I827e39d17aae159a52ac563544c5e6d017bc05ec
Reviewed-on: https://go-review.googlesource.com/c/go/+/332011
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2 years ago[dev.typeparams] cmd/compile/internal/types2: delay interface check for type bounds
Robert Griesemer [Tue, 29 Jun 2021 19:22:21 +0000 (12:22 -0700)]
[dev.typeparams] cmd/compile/internal/types2: delay interface check for type bounds

While at it, clean up code for collecting/declaring type parameters.

For #40789.

Change-Id: I0855137d5ee85c0ae2fa60d33b28c24a33132fbc
Reviewed-on: https://go-review.googlesource.com/c/go/+/331690
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2 years ago[dev.typeparams] cmd/compile/internal/types2: "comparable" must not be visible before...
Robert Griesemer [Tue, 29 Jun 2021 02:41:29 +0000 (19:41 -0700)]
[dev.typeparams] cmd/compile/internal/types2: "comparable" must not be visible before Go 1.18

While at it, clean up the setup of comparable in universe.go.

Fixes #46090

Change-Id: I9655b3e137a03763d677d9a2a730c5570ccff6dc
Reviewed-on: https://go-review.googlesource.com/c/go/+/331517
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2 years ago[dev.typeparams] cmd/compile: simplify autotmpname
Matthew Dempsky [Thu, 1 Jul 2021 07:28:05 +0000 (00:28 -0700)]
[dev.typeparams] cmd/compile: simplify autotmpname

Rather than manually formatting a byte-string and then using a map
lookup to convert it to string, we can just use a slice. This avoids
both the overhead of formatting the byte slice and the map lookup.

Change-Id: Ia7b883632ea990ce9ee848dd4b4e4cdfbd611212
Reviewed-on: https://go-review.googlesource.com/c/go/+/332191
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>
2 years ago[dev.typeparams] cmd/compile: refactor top-level typechecking in unified IR
Matthew Dempsky [Thu, 1 Jul 2021 02:20:28 +0000 (19:20 -0700)]
[dev.typeparams] cmd/compile: refactor top-level typechecking in unified IR

This CL is a first step towards incremental typechecking during IR
construction within unified IR. Namely, all top-level declarations are
now typechecked as they're constructed, except for assignments (which
aren't really declarations anyway).

Change-Id: I65763a7659bf2e0f5e89dfe9e709d60e0fa4c631
Reviewed-on: https://go-review.googlesource.com/c/go/+/332097
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>
2 years agocmd/compile: fix typos in document
fanzha02 [Wed, 30 Jun 2021 02:51:54 +0000 (10:51 +0800)]
cmd/compile: fix typos in document

Correct "a2Spill" to "a3Spill"

Change-Id: I6ac4c45973dfaeb16d3a90d835589b6af1aefe1d
Reviewed-on: https://go-review.googlesource.com/c/go/+/331850
Trust: fannie zhang <Fannie.Zhang@arm.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2 years ago[dev.typeparams] all: merge master (4711bf3) into dev.typeparams
Matthew Dempsky [Thu, 1 Jul 2021 01:19:26 +0000 (18:19 -0700)]
[dev.typeparams] all: merge master (4711bf3) into dev.typeparams

Conflicts:

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

  On dev.typeparams, CL 330194 changed OCHECKNIL to not require manual
  SetTypecheck(1) anymore; while on master, CL 331070 got rid of the
  OCHECKNIL altogether by moving the check into the runtime support
  functions.

- src/internal/buildcfg/exp.go

  On master, CL 331109 refactored the logic for parsing the
  GOEXPERIMENT string, so that it could be more easily reused by
  cmd/go; while on dev.typeparams, several CLs tweaked the regabi
  experiment defaults.

Merge List:

+ 2021-06-30 4711bf30e5 doc/go1.17: linkify "language changes" in the runtime section
+ 2021-06-30 ed56ea73e8 path/filepath: deflake TestEvalSymlinksAboveRoot on darwin
+ 2021-06-30 c080d0323b cmd/dist: pass -Wno-unknown-warning-option in swig_callback_lto
+ 2021-06-30 7d0e9e6e74 image/gif: fix typo in the comment (io.ReadByte -> io.ByteReader)
+ 2021-06-30 0fa3265fe1 os: change example to avoid deprecated function
+ 2021-06-30 d19a53338f image: add Uniform.RGBA64At and Rectangle.RGBA64At
+ 2021-06-30 c45e800e0c crypto/x509: don't fail on optional auth key id fields
+ 2021-06-29 f9d50953b9 net: fix failure of TestCVE202133195
+ 2021-06-29 e294b8a49e doc/go1.17: fix typo "MacOS" -> "macOS"
+ 2021-06-29 3463852b76 math/big: fix typo of comment (`BytesScanner` to `ByteScanner`)
+ 2021-06-29 fd4b587da3 cmd/compile: suppress details error for invalid variadic argument type
+ 2021-06-29 e2e05af6e1 cmd/internal/obj/arm64: fix an encoding error of CMPW instruction
+ 2021-06-28 4bb0847b08 cmd/compile,runtime: change unsafe.Slice((*T)(nil), 0) to return []T(nil)
+ 2021-06-28 1519271a93 spec: change unsafe.Slice((*T)(nil), 0) to return []T(nil)
+ 2021-06-28 5385e2386b runtime/internal/atomic: drop Cas64 pointer indirection in comments
+ 2021-06-28 956c81bfe6 cmd/go: add GOEXPERIMENT to `go env` output
+ 2021-06-28 a1d27269d6 cmd/go: prep for 'go env' refactoring
+ 2021-06-28 901510ed4e cmd/link/internal/ld: skip the windows ASLR test when CGO_ENABLED=0
+ 2021-06-28 361159c055 cmd/cgo: fix 'see gmp.go' to 'see doc.go'
+ 2021-06-27 c95464f0ea internal/buildcfg: refactor GOEXPERIMENT parsing code somewhat
+ 2021-06-25 ed01ceaf48 runtime/race: use race build tag on syso_test.go
+ 2021-06-25 d1916e5e84 go/types: in TestCheck/issues.src, import regexp/syntax instead of cmd/compile/internal/syntax
+ 2021-06-25 5160896c69 go/types: in TestStdlib, import from source instead of export data
+ 2021-06-25 d01bc571f7 runtime: make ncgocall a global counter

Change-Id: I1ce4a3b3ff7c824c67ad66dd27d9d5f1d25c0023

2 years agodoc/go1.17: linkify "language changes" in the runtime section
Bryan C. Mills [Wed, 30 Jun 2021 15:54:46 +0000 (11:54 -0400)]
doc/go1.17: linkify "language changes" in the runtime section

Change-Id: I82bd3954bfc5da59c7952eba2a28ff0e3b41427f
Reviewed-on: https://go-review.googlesource.com/c/go/+/331969
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>
2 years ago[dev.typeparams] cmd/compile: functions to create GC shape types/names for a concrete...
Dan Scales [Tue, 22 Jun 2021 00:04:59 +0000 (17:04 -0700)]
[dev.typeparams] cmd/compile: functions to create GC shape types/names for a concrete type

Created functions to create GC shape type and names, based on a proposal
from Keith. Kept unsigned and signed integer types as different, since
they have different shift operations.

Included adding in alignment fields where padding is
required between fields, even though that seems like it will be fairly
uncommon to use.

Added some extra unusual struct typeparams (for testing the gcshape
names/types) in index.go test.

Change-Id: I8132bbd28098bd933435b8972ac5cc0b39f4c0df
Reviewed-on: https://go-review.googlesource.com/c/go/+/329921
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2 years agopath/filepath: deflake TestEvalSymlinksAboveRoot on darwin
Josh Bleecher Snyder [Wed, 30 Jun 2021 16:44:30 +0000 (09:44 -0700)]
path/filepath: deflake TestEvalSymlinksAboveRoot on darwin

On darwin, under load, it appears that the system occasionally
deletes the temp dir mid-test. Don't fail the test when that happens.

It would be nice to fix this in a deeper way.
See golang.org/cl/332009 for some discussion.

In the meantime, this will at least stop the flakiness.

Updates #37910

Change-Id: I6669e466fed9abda4a87ca88345c04cd7986b41e
Reviewed-on: https://go-review.googlesource.com/c/go/+/332009
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2 years ago[dev.typeparams] cmd/compile/internal/types2: move newTypeSet function into typeset.go
Robert Griesemer [Tue, 29 Jun 2021 00:37:41 +0000 (17:37 -0700)]
[dev.typeparams] cmd/compile/internal/types2: move newTypeSet function into typeset.go

No functional changes except for import declaration and comment
adjustments.

Change-Id: I75fb5edba8b89a5aad7c9b4ddb427c201265def0
Reviewed-on: https://go-review.googlesource.com/c/go/+/331515
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2 years ago[dev.typeparams] cmd/compile/internal/types2: move embedding positions from Checker...
Robert Griesemer [Tue, 29 Jun 2021 00:21:26 +0000 (17:21 -0700)]
[dev.typeparams] cmd/compile/internal/types2: move embedding positions from Checker to Interface

This change moves the position information to the place where it
is actually used. It also simplifies getting rid of it after use.

In the process, fixed a latent bug: Before this CL, embedded types
were sorted, but the corresponding embedding positions were not.
Removed the sorting altogether as it is not needed for type-checking.

Change-Id: I48003f317196d814326424430336b6cb222fdee6
Reviewed-on: https://go-review.googlesource.com/c/go/+/331514
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2 years ago[dev.typeparams] cmd/compile/internal/types2: remove unused *Checker arguments (cleanup)
Robert Griesemer [Mon, 28 Jun 2021 23:00:26 +0000 (16:00 -0700)]
[dev.typeparams] cmd/compile/internal/types2: remove unused *Checker arguments (cleanup)

Simplified names and unnecessary function indirections where possible.

Change-Id: I1c7a386393d086fd7ad29f892e03f048781f3547
Reviewed-on: https://go-review.googlesource.com/c/go/+/331512
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2 years ago[dev.typeparams] cmd/compile/internal/types2: introduce type set abstraction for...
Robert Griesemer [Fri, 18 Jun 2021 00:49:15 +0000 (17:49 -0700)]
[dev.typeparams] cmd/compile/internal/types2: introduce type set abstraction for interfaces

With this change, interfaces are "completed" on-demand, when needed,
and the respective information (set of all methods, type constraints)
is recorded in a new typeSet data structure.

As a consequence, interfaces don't need to be explicitly completed
anymore and (internal) uses of interfaces have become much simpler.

This change also introduces a new field Interface.complete to indicate
that all methods and embedded elements have been set up. This prevent
the computation and recording (!) of a partial type set for erroneous
programs (if we compute the partial type set and store it, subsequent
type set accesses use the wrong type set which may lead to follow-on
errors).

Change-Id: I1ffc907f7d0fb93b3e987fe5ff9c6fa5cae00d7f
Reviewed-on: https://go-review.googlesource.com/c/go/+/329309
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>
2 years agocmd/dist: pass -Wno-unknown-warning-option in swig_callback_lto
Ian Lance Taylor [Wed, 30 Jun 2021 17:19:02 +0000 (10:19 -0700)]
cmd/dist: pass -Wno-unknown-warning-option in swig_callback_lto

For #46557
Fixes #46991

Change-Id: Ic88ebaa13d3edf904657dc19ada4fd4ff7f44a8f
Reviewed-on: https://go-review.googlesource.com/c/go/+/332010
Trust: Ian Lance Taylor <iant@golang.org>
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2 years agoimage/gif: fix typo in the comment (io.ReadByte -> io.ByteReader)
uji [Tue, 29 Jun 2021 15:06:23 +0000 (00:06 +0900)]
image/gif: fix typo in the comment (io.ReadByte -> io.ByteReader)

Fixes #46967

Change-Id: I66e69c70b74e904623e8ca854562d255692b2143
Reviewed-on: https://go-review.googlesource.com/c/go/+/331649
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Carlos Amedee <carlos@golang.org>

2 years agoos: change example to avoid deprecated function
Eli Bendersky [Tue, 29 Jun 2021 23:31:18 +0000 (16:31 -0700)]
os: change example to avoid deprecated function

The IsNotExist function is deprecated; change package example to avoid
it and use the recommended way instead.

Fixes #46976

Change-Id: I3c301d0a89b6bda42184df314ba8418062ca39ee
Reviewed-on: https://go-review.googlesource.com/c/go/+/331692
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2 years ago[dev.typeparams] cmd/compile: add derived-type dictionaries to unified IR
Matthew Dempsky [Tue, 29 Jun 2021 05:41:50 +0000 (22:41 -0700)]
[dev.typeparams] cmd/compile: add derived-type dictionaries to unified IR

This CL updates the unified IR export data serialization to explicitly
and separately record the derived types used by a declaration. The
readers currently just use this data to construct types/IR the same as
before, but eventually we can use it for emitting GC-shape
dictionaries.

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

2 years agoimage: add Uniform.RGBA64At and Rectangle.RGBA64At
Nigel Tao [Tue, 29 Jun 2021 06:53:44 +0000 (16:53 +1000)]
image: add Uniform.RGBA64At and Rectangle.RGBA64At

These types already implemented the Image interface. They should also
implement the RGBA64Image interface (new in Go 1.17)

Updates #44808

Change-Id: I9a2b13e305997088ae874efb95ad9e1648f94812
Reviewed-on: https://go-review.googlesource.com/c/go/+/331570
Trust: Nigel Tao <nigeltao@golang.org>
Run-TryBot: Nigel Tao <nigeltao@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2 years agocrypto/x509: don't fail on optional auth key id fields
Roland Shoemaker [Tue, 29 Jun 2021 16:20:04 +0000 (09:20 -0700)]
crypto/x509: don't fail on optional auth key id fields

If a certificate contains an AuthorityKeyIdentifier extension that
lacks the keyIdentifier field, but contains the authorityCertIssuer
and/or the authorityCertSerialNumber fields, don't return an error and
continue parsing.

Fixes #46854

Change-Id: I82739b415441f639a722755cc1f449d73078adfc
Reviewed-on: https://go-review.googlesource.com/c/go/+/331689
Trust: Roland Shoemaker <roland@golang.org>
Run-TryBot: Roland Shoemaker <roland@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
2 years agonet: fix failure of TestCVE202133195
Xiangdong Ji [Mon, 28 Jun 2021 12:27:30 +0000 (20:27 +0800)]
net: fix failure of TestCVE202133195

TestCVE202133195 fails in testing LookupSRV if /etc/resolv.conf sets the option
'ndots' larger than the number of dots in the domain name under query.

Fix the issue by making the input domain name in test codes 'rooted' to skip search
list qualifying.

Fixes #46955

Change-Id: I1909fa7e54e9c9af57623e57cafc905729ff99fa
Reviewed-on: https://go-review.googlesource.com/c/go/+/330842
Reviewed-by: Damien Neil <dneil@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Dmitri Shuralyov <dmitshur@golang.org>

2 years ago[dev.typeparams] cmd/compile: use dictionary entries for more conversion cases
Keith Randall [Tue, 8 Jun 2021 22:58:16 +0000 (15:58 -0700)]
[dev.typeparams] cmd/compile: use dictionary entries for more conversion cases

This CL handles I(x) where I is an interface type and x has
typeparam type.

Change-Id: Ib99de2b741d588947f5e0164255f6365e98acd8a
Reviewed-on: https://go-review.googlesource.com/c/go/+/326189
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>
2 years ago[dev.typeparams] cmd/compile: clean up instantiation and dictionary naming
Keith Randall [Sun, 27 Jun 2021 01:18:16 +0000 (18:18 -0700)]
[dev.typeparams] cmd/compile: clean up instantiation and dictionary naming

Separate generation of instantiation and dictionary name generation.

Add code to add subdictionaries to a dictionary. Not quite working
yet, as we need to trigger generation of the subdictionaries for methods.

Change-Id: I0d46053eba695b217630b06ef2f990f6a0b52d83
Reviewed-on: https://go-review.googlesource.com/c/go/+/331209
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
2 years agodoc/go1.17: fix typo "MacOS" -> "macOS"
Levi(リーバイ) [Tue, 29 Jun 2021 12:45:52 +0000 (12:45 +0000)]
doc/go1.17: fix typo "MacOS" -> "macOS"

Change-Id: Ie2ada2bf875a93b1cc9e86a81c8a25de39ce4752
GitHub-Last-Rev: 462753db015949eb88c6c4e64b6aae1a49ac89b4
GitHub-Pull-Request: golang/go#46962
Reviewed-on: https://go-review.googlesource.com/c/go/+/331589
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2 years agomath/big: fix typo of comment (`BytesScanner` to `ByteScanner`)
tkawakita [Tue, 29 Jun 2021 15:46:05 +0000 (00:46 +0900)]
math/big: fix typo of comment (`BytesScanner` to `ByteScanner`)

Change-Id: I0c2d26d6ede1452008992efbea7392162da65014
Reviewed-on: https://go-review.googlesource.com/c/go/+/331651
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2 years agocmd/compile: suppress details error for invalid variadic argument type
Cuong Manh Le [Tue, 29 Jun 2021 03:11:31 +0000 (10:11 +0700)]
cmd/compile: suppress details error for invalid variadic argument type

CL 255241 made error message involving variadic calls clearer. To do it,
we added a check that the type of variadic argument must be a slice.
That's why the compiler crashes for invalid variadic argument type.

Instead, we can just omit the details error message, and report not
enough arguments error, which matches the behavior of go/types and types2.

Fixes #46957

Change-Id: I638d7e8f031f0ee344d5d802104fd93a60aae00a
Reviewed-on: https://go-review.googlesource.com/c/go/+/331569
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>
2 years agocmd/internal/obj/arm64: fix an encoding error of CMPW instruction
eric fang [Mon, 21 Jun 2021 02:11:25 +0000 (02:11 +0000)]
cmd/internal/obj/arm64: fix an encoding error of CMPW instruction

For arm64 CMP, ADD and other similar extended register instructions,
if there is no extension, the default extion is LSL<<0, but the default
encoding value (the value of 'option' field) of 32-bit instruction and
64-bit instruction is different, 32-bit is 2 and 64-bit is 3. But the
current assembler incorrectly encodes the value of 32-bit instruction
to 3. This CL fixes this error.

Change-Id: I0e09af2c9c5047a4ed2db7d1183290283db9c31c
Reviewed-on: https://go-review.googlesource.com/c/go/+/329749
Reviewed-by: eric fang <eric.fang@arm.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: eric fang <eric.fang@arm.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Trust: Dmitri Shuralyov <dmitshur@golang.org>

2 years ago[dev.typeparams] cmd/compile: add a field (method) name for function in TestABIUtilsI...
Dan Scales [Mon, 28 Jun 2021 17:57:26 +0000 (10:57 -0700)]
[dev.typeparams] cmd/compile: add a field (method) name for function in TestABIUtilsInterfaces

Not having a field name for the method is not really correct, and makes
it look like an embedded field. In fact, currently types.CalcSize() in
abitest() is creating an error that is not actually reported.

Change-Id: I98c3a4abf5b6d610d9c3c56ce1042078374b5417
Reviewed-on: https://go-review.googlesource.com/c/go/+/331469
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Dan Scales <danscales@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2 years agocmd/compile,runtime: change unsafe.Slice((*T)(nil), 0) to return []T(nil)
Matthew Dempsky [Fri, 25 Jun 2021 18:07:28 +0000 (11:07 -0700)]
cmd/compile,runtime: change unsafe.Slice((*T)(nil), 0) to return []T(nil)

This CL removes the unconditional OCHECKNIL check added in
walkUnsafeSlice by instead passing it as a pointer to
runtime.unsafeslice, and hiding the check behind a `len == 0` check.

While here, this CL also implements checkptr functionality for
unsafe.Slice and disallows use of unsafe.Slice with //go:notinheap
types.

Updates #46742.

Change-Id: I743a445ac124304a4d7322a7fe089c4a21b9a655
Reviewed-on: https://go-review.googlesource.com/c/go/+/331070
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2 years agospec: change unsafe.Slice((*T)(nil), 0) to return []T(nil)
Matthew Dempsky [Fri, 25 Jun 2021 18:17:43 +0000 (11:17 -0700)]
spec: change unsafe.Slice((*T)(nil), 0) to return []T(nil)

Updates #46742.

Change-Id: I044933a657cd1a5cdb29863e49751df5fe9c258a
Reviewed-on: https://go-review.googlesource.com/c/go/+/331069
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>
2 years agoruntime/internal/atomic: drop Cas64 pointer indirection in comments
Mia Zhu [Mon, 28 Jun 2021 17:10:56 +0000 (17:10 +0000)]
runtime/internal/atomic: drop Cas64 pointer indirection in comments

Change-Id: Ieff0065cbd81e045594ce12e10338b0666816d70
GitHub-Last-Rev: d842f5cb3e5d75f87957c068f6accc9d4a4ac224
GitHub-Pull-Request: golang/go#46949
Reviewed-on: https://go-review.googlesource.com/c/go/+/331309
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2 years ago[dev.typeparams] cmd/compile: port fix for issue46725 to transform.go
Dan Scales [Mon, 28 Jun 2021 18:50:26 +0000 (11:50 -0700)]
[dev.typeparams] cmd/compile: port fix for issue46725 to transform.go

Allow fix for issue46725 to work for -G=3 mode.

Change-Id: Id522fbc2278cf878cb3f95b3205a2122c164ae29
Reviewed-on: https://go-review.googlesource.com/c/go/+/331470
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2 years agocmd/go: add GOEXPERIMENT to `go env` output
Matthew Dempsky [Wed, 16 Jun 2021 22:10:57 +0000 (15:10 -0700)]
cmd/go: add GOEXPERIMENT to `go env` output

This CL adds GOEXPERIMENT to `go env` output, and also makes it
configurable via `GOENV`. Thanks to Baokun Lee's CL 304350 for the
test and initial work on this.

Fixes #45226.

Change-Id: Ie7f92a8a503b6a2a4df3f6598f0b2bf2915e2e7d
Reviewed-on: https://go-review.googlesource.com/c/go/+/328751
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Trust: Bryan C. Mills <bcmills@google.com>
Trust: Matthew Dempsky <mdempsky@google.com>

2 years agocmd/go: prep for 'go env' refactoring
Matthew Dempsky [Sat, 19 Jun 2021 10:35:15 +0000 (03:35 -0700)]
cmd/go: prep for 'go env' refactoring

This CL refactors code a little to make it easier to add GOEXPERIMENT
support in the future.

Change-Id: I87903056f7863049e58be72047b2b8a60a213baf
Reviewed-on: https://go-review.googlesource.com/c/go/+/329654
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Trust: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2 years agocmd/link/internal/ld: skip the windows ASLR test when CGO_ENABLED=0
hao [Fri, 28 May 2021 03:40:12 +0000 (03:40 +0000)]
cmd/link/internal/ld: skip the windows ASLR test when CGO_ENABLED=0

the test case is still using gcc when CGO is disabled.

Change-Id: I2d255bfaeb92816c8343ab72fd7984b6632d421d
GitHub-Last-Rev: de14748bd54c7db8687263a7c37080ec884d982a
GitHub-Pull-Request: golang/go#46120
Reviewed-on: https://go-review.googlesource.com/c/go/+/319169
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Dmitri Shuralyov <dmitshur@golang.org>

2 years agocmd/cgo: fix 'see gmp.go' to 'see doc.go'
Koichi Shiraishi [Sun, 27 Jun 2021 02:50:17 +0000 (11:50 +0900)]
cmd/cgo: fix 'see gmp.go' to 'see doc.go'

Change-Id: I303edc9dfbf4185b5b461b121ab504f6ed9f8630
Reviewed-on: https://go-review.googlesource.com/c/go/+/330839
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Dmitri Shuralyov <dmitshur@golang.org>

2 years ago[dev.typeparams] cmd/compile: move MethodValueWrapper to walk
Cuong Manh Le [Sun, 27 Jun 2021 15:25:21 +0000 (22:25 +0700)]
[dev.typeparams] cmd/compile: move MethodValueWrapper to walk

walk is the only pass that use the function, so un-export it, too.

Change-Id: I32ec64d1c15fda7bb54bd8efa528ed32c102876d
Reviewed-on: https://go-review.googlesource.com/c/go/+/330841
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>
2 years ago[dev.typeparams] cmd/compile: port CL 330838 for -G=3
Cuong Manh Le [Sun, 27 Jun 2021 15:10:03 +0000 (22:10 +0700)]
[dev.typeparams] cmd/compile: port CL 330838 for -G=3

So next CL can move MethodValueWrapper to walk, since when walk is now
the only place which uses this function.

Change-Id: Id3be359bfc38efb022451cb7f9e53c2868fe7e12
Reviewed-on: https://go-review.googlesource.com/c/go/+/330840
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>
2 years ago[dev.typeparams] cmd/compile: delay method value wrapper generation until walk
Cuong Manh Le [Sat, 26 Jun 2021 18:31:03 +0000 (01:31 +0700)]
[dev.typeparams] cmd/compile: delay method value wrapper generation until walk

As walk already create the wrapper if necessary.

With this change, test/inline.go need to be changed to use
errorcheckwithauto, for matching "inlining call to ..." in autogenerated
position for method value wrapper, since when we don't generate the
wrapper immediately during typecheck.

Change-Id: I9ffbec9ad3c2b7295546976e2fa517336c13c89b
Reviewed-on: https://go-review.googlesource.com/c/go/+/330838
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>
2 years ago[dev.typeparams] cmd/compile: rename OCALLPART to OMETHVALUE
Cuong Manh Le [Sat, 26 Jun 2021 18:28:38 +0000 (01:28 +0700)]
[dev.typeparams] cmd/compile: rename OCALLPART to OMETHVALUE

Go spec call them "method values", not "partial calls". Note that
we use "OMETHVALUE" (as opposed to "OMETHODVALUE") to be consistent
with "OMETHEXPR".

Change-Id: I1efd985d4b567a1b4b20aeb603eb82db579edbd5
Reviewed-on: https://go-review.googlesource.com/c/go/+/330837
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>
2 years agointernal/buildcfg: refactor GOEXPERIMENT parsing code somewhat
Matthew Dempsky [Fri, 25 Jun 2021 20:24:10 +0000 (13:24 -0700)]
internal/buildcfg: refactor GOEXPERIMENT parsing code somewhat

This CL extracts out a ParseGOEXPERIMENT helper function that parses
GOOS/GOARCH/GOEXPERIMENT values and returns active and baseline
experiment flag sets and an error value, without affecting any global
state. This will be used in the subsequent CL for 'go env' support for
GOEXPERIMENT to validate configuration changes.

The existing package initialization for Experiment and
experimentBaseline and also UpdateExperiments are updated to use it as
well.

Change-Id: Ic2ed3fd36d2a6f7f3d8172fccb865e02505c0052
Reviewed-on: https://go-review.googlesource.com/c/go/+/331109
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>

2 years ago[dev.typeparams] cmd/compile: add method value wrappers to unified IR
Matthew Dempsky [Sat, 26 Jun 2021 19:44:53 +0000 (12:44 -0700)]
[dev.typeparams] cmd/compile: add method value wrappers to unified IR

Method value wrappers will need dictionary support too, so bring them
under the unified IR umbrella as well.

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

2 years ago[dev.typeparams] cmd/compile: do not skip TestUnifiedCompare in short mode
Cuong Manh Le [Sat, 26 Jun 2021 17:51:16 +0000 (00:51 +0700)]
[dev.typeparams] cmd/compile: do not skip TestUnifiedCompare in short mode

Instead, just testing the runtime package in short mode instead of std.
So trybot can help catching any mistake earlier.

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