1
0
mirror of https://github.com/golang/go synced 2024-11-14 18:30:31 -07:00
Commit Graph

46879 Commits

Author SHA1 Message Date
Austin Clements
8d34585171 doc/go1.16: announce openbsd/mips64 port
Updates #40995.
For #40700.

Change-Id: I4dced8d70e2f1fa2da98e2eb1a5f1f829f55bb6b
Reviewed-on: https://go-review.googlesource.com/c/go/+/275787
Trust: Austin Clements <austin@google.com>
Reviewed-by: Joel Sing <joel@sing.id.au>
2020-12-07 17:52:08 +00:00
Ian Lance Taylor
9c0e2db051 test: add new test that gofrontend failed to handle
The gofrontend code would in some circumstances incorrectly generate a
type descriptor for an alias type, causing the type to fail to be
equal to the unaliased type.

Change-Id: I47d33b0bfde3c72a9a186049539732bdd5a6a96e
Reviewed-on: https://go-review.googlesource.com/c/go/+/275632
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-12-07 17:29:52 +00:00
Alberto Donizetti
7f9a2bc2bc doc/go1.16: fix typo
For #40700

Change-Id: Idea442d45d18ca8cedc0b160df23eac6b86755ef
Reviewed-on: https://go-review.googlesource.com/c/go/+/275677
Trust: Alberto Donizetti <alb.donizetti@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2020-12-07 17:19:41 +00:00
Robert Griesemer
cd15a48036 [dev.typeparams] cmd/compile/internal/types2: correct error position for inherited const init expression
Enabled fixedbugs/issue8183.go for run.go with new typechecker
now that issue is fixed.

Fixes #42992.
Updates #42991.

Change-Id: I23451999983b740d5f37ce3fa75ee756daf1a44f
Reviewed-on: https://go-review.googlesource.com/c/go/+/275517
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2020-12-07 16:44:07 +00:00
Tobias Klauser
ac0ba6707c doc/go1.16: add missing </a> tag
For #40700

Change-Id: Ic4e16106cbbe18d0c9efffee81c5234ddeedfd32
Reviewed-on: https://go-review.googlesource.com/c/go/+/275674
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Alberto Donizetti <alb.donizetti@gmail.com>
2020-12-07 10:56:21 +00:00
Martin Möhrmann
c155931974 internal/cpu: add darwin/arm64 CPU feature detection support
Fixes #42747

Change-Id: I6b1679348c77161f075f0678818bb003fc0e8c86
Reviewed-on: https://go-review.googlesource.com/c/go/+/271989
Trust: Martin Möhrmann <moehrmann@google.com>
Run-TryBot: Martin Möhrmann <martisch@uos.de>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-12-07 07:59:54 +00:00
Matthew Dempsky
d90b199e9c [dev.regabi] cmd/compile: silence errors about missing blank methods
If an interface contains a blank method, that's already an error. No
need for useless follow-up error messages about not implementing them.

Fixes #42964.

Change-Id: I5bf53a8f27d75d4c86c61588c5e2e3e95563d320
Reviewed-on: https://go-review.googlesource.com/c/go/+/275294
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-12-07 06:40:04 +00:00
Tobias Klauser
e10c94af26 doc/go1.16: document riscv64 port changes
For #36641
For #40700

Change-Id: Ib268559a2ce7839372dbf273d95876d8d4521a45
Reviewed-on: https://go-review.googlesource.com/c/go/+/274478
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Joel Sing <joel@sing.id.au>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-12-07 02:31:33 +00:00
Matthew Dempsky
e885df2731 [dev.regabi] cmd/compile: change iexport to avoid map[ir.Node]
In the past, we had a lot of trouble with misusing *types.Sym
throughout the frontend, so I tried to push us towards always passing
around ONAMEs instead. But for constructing and writing out the symbol
indexes for the indexed export data, keying by *types.Sym is exactly
what we want.

Passes buildall w/ toolstash -cmp.

Updates #42982.

Change-Id: Idd8f1fb057d75a52a34ebc7788d9332fb49caf8d
Reviewed-on: https://go-review.googlesource.com/c/go/+/275755
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>
2020-12-06 21:06:05 +00:00
Matthew Dempsky
2d4c95565a [dev.regabi] cmd/compile: change nowritebarrierrec to use map[*ir.Func]
All of the uses were already using *ir.Func index operands, so only
needs the map type itself updated.

Passes buildall w/ toolstash -cmp.

Updates #42982.

Change-Id: I568d8601f3eb077e07e887f2071aa1a2667d803c
Reviewed-on: https://go-review.googlesource.com/c/go/+/275754
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
2020-12-06 21:05:50 +00:00
Matthew Dempsky
1b5eed8982 [dev.regabi] cmd/compile: replace NodeQueue with NameQueue
Similar to the previous CL, the only two users of NodeQueue only
needed it for tracking objects, not arbitrary AST nodes. So change
it's signature to use *Name instead of Node.

This does require a tweak to the nowritebarrierrec checker, because
previously it was pushing the ODCLFUNC *Func pointers into the queue,
whereas now we push the ONAME/PFUNC *Name pointers instead. However,
it's trivial and safe to flip between them.

Also, this changes a handful of export-related code from Node to
*Name, to avoid introducing type assertions within iexport.go.

Passes buildall w/ toolstash -cmp.

Updates #42982.

Change-Id: I867f9752121509fc3da753978c6a41d5015bc0ce
Reviewed-on: https://go-review.googlesource.com/c/go/+/275753
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2020-12-06 21:05:41 +00:00
Matthew Dempsky
6c5967e528 [dev.regabi] cmd/compile: change NodeSet to NameSet
The only user of NodeSet (computing initialization dependencies) only
needs to store *Names in this structure. So change its definition to
match that need, and update the code in initorder.go accordingly.

Passes buildall w/ toolstash -cmp.

Updates #42982.

Change-Id: I181a8aaf9bc71e88f4ac009c4f381a718080e48f
Reviewed-on: https://go-review.googlesource.com/c/go/+/275752
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>
2020-12-06 21:05:34 +00:00
Ikko Ashimine
3b2a578166 internal/cpu: fix typo in cpu_arm64.go
auxillary -> auxiliary

Change-Id: I7c29c4a63d236c3688b8e4f5af70650d43cd89c0
GitHub-Last-Rev: d4a18c71a1
GitHub-Pull-Request: golang/go#43024
Reviewed-on: https://go-review.googlesource.com/c/go/+/275592
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Keith Randall <khr@golang.org>
2020-12-05 16:20:01 +00:00
Jason A. Donenfeld
be9379f8a8 syscall: correct CertOpenStore to expect a 0 return value on failure
According to [1], this function returns NULL when it errors, rather than
INVALID_HANDLE_VALUE, which other Win32 functions return. This was
pointed out in CL 273446 for the x/sys package, and this patch here
cleans it up for the syscall package and updates the vendored x/sys
package using the usual `go get/go mod vendor` dance. The function is
currently in use by crypto/x509/root_windows.go, which calls
CertOpenStore(CERT_STORE_PROV_MEMORY), which I assume can fail under OOM
or other weird conditions. Quick reversing indicates that [1] is
correct, as there's a `xor eax, eax` in the error paths of the function
just before jumping to the epilogue.

[1] https://docs.microsoft.com/en-us/windows/win32/api/wincrypt/nf-wincrypt-certopenstore#return-value

Change-Id: I77c0b0319c13313212f8710785252c494da56ed5
Reviewed-on: https://go-review.googlesource.com/c/go/+/273827
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Trust: Alex Brainman <alex.brainman@gmail.com>
2020-12-05 12:36:42 +00:00
Filippo Valsorda
4de4480dc3 doc/go1.16: cleanup crypto release notes
For #40700
Fixes #42897

Change-Id: Id3b87841a899818d6939dcc3edbaaa0bc183e913
Reviewed-on: https://go-review.googlesource.com/c/go/+/275313
Trust: Filippo Valsorda <filippo@golang.org>
Trust: Roland Shoemaker <roland@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
2020-12-04 22:08:54 +00:00
zikaeroh
0b99ea3b16 cmd/vendor: sync pprof@v0.0.0-20201203190320-1bf35d6f28c2
Pulls in a fix to make versioned import paths more readable in pprof's
graph view.

Updated via the instructions in README.vendor.

Updates #36905

Change-Id: I6a91de0f4ca1be3fc69d8e1a39ccf4f5bd0387ef
Reviewed-on: https://go-review.googlesource.com/c/go/+/275513
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
2020-12-04 21:49:30 +00:00
Robert Griesemer
02820d61a9 [dev.typeparams] test: enable some more errorcheck tests
Change-Id: I103e3eeacd5b11efd63c965482a626878ba5ac81
Reviewed-on: https://go-review.googlesource.com/c/go/+/275216
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>
2020-12-04 21:22:23 +00:00
Cuong Manh Le
46b6e70e3b [dev.regabi] cmd/compile: replace ir.Node with *ir.Name in Order
Passes buildall w/ toolstash -cmp.

Updates #42982

Change-Id: I7121c37f72ccbc141a7dd17fba1753f2c6289908
Reviewed-on: https://go-review.googlesource.com/c/go/+/275353
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>
2020-12-04 20:55:42 +00:00
Cuong Manh Le
b75f51c645 [dev.regabi] cmd/compile: replace ir.Node with *ir.Name in Liveness
Passes buildall w/ toolstash -cmp.

Updates #42982

Change-Id: Iad8df321adfd576da070c13ed16a9651d4e59ad8
Reviewed-on: https://go-review.googlesource.com/c/go/+/275352
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>
2020-12-04 20:55:36 +00:00
Matthew Dempsky
133b03e1c3 [dev.regabi] cmd/compile: rewrite code to use DeclaredBy
Passes buildall w/ toolstash -cmp.

Updates #42990.

[git-generate]
cd src/cmd/compile/internal/gc
rf '
ex {
  import "cmd/compile/internal/ir"
  var x, stmt ir.Node
  x.Name() != nil && x.Name().Defn == stmt ->  ir.DeclaredBy(x, stmt)
  x.Name() == nil || x.Name().Defn != stmt -> !ir.DeclaredBy(x, stmt)
}
'

Change-Id: I222a757296dbcb5d0889d617d221a9d7319f2d74
Reviewed-on: https://go-review.googlesource.com/c/go/+/275306
Reviewed-by: Russ Cox <rsc@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>
2020-12-04 20:25:19 +00:00
Matthew Dempsky
d9cb84c84b [dev.regabi] cmd/compile: add SameSource, Uses, and DeclaredBy helpers
Currently, because we use the same *Name to represent both declaration
and uses of an object, it's ambiguous what "n1 == n2" means when
comparing two Node values. It can mean any of: Are these the same
syntactic element? Is n1 a use of declared variable n2? Are n1 and n2
both uses of the same declared variable?

We'd like to introduce a new IdentExpr node to replace use of Name
within the AST, but that means those three cases need to be handled
differently. The first case needs to stay "n1 == n2", but the other
cases need to become "n1.Name() == n2" and "n1.Name() == n2.Name()",
respectively. ("n1.Name() == n2.Name()" also currently works for the
second case, but eventually we'll want to get rid of the Name.Name
method.)

This CL introduces helper functions SameSource and Uses to handle
these cases. It also introduces DeclaredBy, which is another somewhat
common case that the next CL introduces uses of.

Passes buildall w/ toolstash -cmp.

Updates #42990.

Change-Id: Ia816c124446e9067645d5820a8163f295968794f
Reviewed-on: https://go-review.googlesource.com/c/go/+/275305
Reviewed-by: Russ Cox <rsc@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>
2020-12-04 20:25:07 +00:00
Dmitri Shuralyov
edf60be151 doc/go1.16: document no language changes
There are no language changes in Go 1.16, so document that.

For #40700.
Fixes #42976.

Change-Id: I80b0d2ce6cf550c00c0f026ee59ac9fbce6310be
Reviewed-on: https://go-review.googlesource.com/c/go/+/275117
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-12-04 18:03:43 +00:00
Russ Cox
5dbd2e8e44 [dev.regabi] cmd/compile: remove DeepCopyNode interface
The only reason for the DeepCopyNode interface was to
allow the type syntaxes to avoid being constrained by
Left, Right etc. methods. Now those are gone, so the
general traversal methods they implement (doChildren, editChildren)
do the right thing for DeepCopy.

Passes buildall w/ toolstash -cmp.

Change-Id: I54672c011114a95efabff32dbcf02e6071f91b9e
Reviewed-on: https://go-review.googlesource.com/c/go/+/275379
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2020-12-04 16:52:57 +00:00
Russ Cox
9ab3d854ad [dev.regabi] cmd/compile: avoid general traversal in deadcode
deadcode is trying to walk the statements it can find,
but it can sweep in other nodes too. Stop doing that:
only walk known statements containing statements.

Otherwise, if we put panics in expression accessors that
shouldn't be used anymore, deadcode can trip them.

deadcode would be a good candidate to rewrite using
EditChildren, but that would certainly cause toolstash
changes, since deadcode is so ad-hoc about exactly
which parts of the function it looks at. For now just
remove the general traversal and leave as is.

Passes buildall w/ toolstash -cmp.

Change-Id: I06481eb87350905597600203c4fa724d55645b46
Reviewed-on: https://go-review.googlesource.com/c/go/+/275377
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2020-12-04 16:52:56 +00:00
Russ Cox
bb5aa2b664 [dev.regabi] cmd/compile: implement editChildren for nodes
Put each node in charge of its EditChildren implementation.
This removes the final generic use of Left, SetLeft, Right, SetRight,
and so on in package ir.

Passes buildall w/ toolstash -cmp.

Change-Id: I9821cc20f5b91cc9b44eb1f386cc82f20cd6770c
Reviewed-on: https://go-review.googlesource.com/c/go/+/275376
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2020-12-04 16:52:54 +00:00
Russ Cox
4725c3ffd1 [dev.regabi] cmd/compile: implement doChildren for nodes
Put each node in charge of its DoChildren implementation.
This removes a generic use of Left, Right, and so on
in func DoChildren, heading toward removing those even from
being used in package ir.

Passes buildall w/ toolstash -cmp.

Change-Id: Ibdf56f36801217cf24549e063da0078c1820a56b
Reviewed-on: https://go-review.googlesource.com/c/go/+/275375
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2020-12-04 16:52:53 +00:00
Russ Cox
18f2df7e81 [dev.regabi] cmd/compile: implement copy for nodes
Put each node in charge of making copies of its own slices.
This removes a generic use of Body, SetBody, and so on
in func Copy, heading toward removing those even from
being used in package ir.

Passes buildall w/ toolstash -cmp.

Change-Id: I249b7fe54cf72e9d2f0467b10f3f257abf9b29b9
Reviewed-on: https://go-review.googlesource.com/c/go/+/275374
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2020-12-04 16:52:52 +00:00
Russ Cox
d855b30fe4 [dev.regabi] cmd/compile: use ir.EditChildren for inline rewriting
This CL rephrases the general inlining rewriter in terms of ir.EditChildren.
It is the final part of the code that was processing arbitrary nodes using
Left, SetLeft, and so on. After this CL, there should be none left except
for the implementations of DoChildren and EditChildren, which fall next.

Passes buildall w/ toolstash -cmp.

Change-Id: I9c36053360cd040710716f0b39397a80114be713
Reviewed-on: https://go-review.googlesource.com/c/go/+/275373
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2020-12-04 16:52:51 +00:00
Russ Cox
b9df26d7a8 [dev.regabi] cmd/compile: use ir.Find for "search" traversals
This CL converts all the generic searching traversal to use ir.Find
instead of relying on direct access to Left, Right, and so on.

Passes buildall w/ toolstash -cmp.

Change-Id: I4d951aef630c00bf333f24be79565cc564694d04
Reviewed-on: https://go-review.googlesource.com/c/go/+/275372
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2020-12-04 16:52:50 +00:00
Russ Cox
0d1b44c645 [dev.regabi] cmd/compile: introduce IR visitors
This CL introduces the general visitor functionality that will replace
the Left, SetLeft, Right, SetRight, etc methods in the Node interface.

For now, the CL defines the functionality in terms of those methods,
but eventually the Nodes themselves will implement DoChildren
and EditChildren and be relieved of implementing Left, SetLeft, and so on.

The CL also updates Inspect (which moved to visit.go) and DeepCopy
to use the new functionality.

The Find helper is not used in this CL but will be used in a future one.

Passes buildall w/ toolstash -cmp.

Change-Id: Id0eea654a884ab3ea25f48bd8bdd71712b5dcb44
Reviewed-on: https://go-review.googlesource.com/c/go/+/275311
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2020-12-04 16:52:48 +00:00
Russ Cox
7fcf5b994c [dev.regabi] cmd/compile: replace inlcopy with ir.DeepCopy
Now inlcopy and ir.DeepCopy are semantically the same,
so drop the inlcopy implementation.

Passes buildall w/ toolstash -cmp.

Change-Id: Id2abb39a412a8e57167a29be5ecf76e990dc9d3d
Reviewed-on: https://go-review.googlesource.com/c/go/+/275310
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2020-12-04 16:52:47 +00:00
Russ Cox
989a3f5041 [dev.regabi] cmd/compile: adjustments to Copy and DeepCopy
DeepCopy is not called DeepSepCopy, so it should use Copy, not SepCopy.

Also, the old gc.treecopy, which became ir.DeepCopy, only copied
the Left, Right, and List fields - not Init, Rlist, Body - and I didn't
notice when I moved it over. A general utility function should of
course copy the whole node, so do that.

Finally, the semantics of Copy should not depend on whether a
particular child node is held directly in a field or in a slice,
so make Copy duplicate the slice backing arrays as well.
(Logically, those backing arrays are part of the node storage.)

Passes buildall w/ toolstash -cmp.

Change-Id: I18fbe3f2b40078f566ed6370684d5585052b36a1
Reviewed-on: https://go-review.googlesource.com/c/go/+/275309
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2020-12-04 16:52:46 +00:00
Russ Cox
99ecfcae31 [dev.regabi] cmd/compile: swap inlining order of if then vs else blocks
The upcoming general iterators will process nodes in
source code order, meaning that the "then" block comes
before the "else" block. But for an if node, "then" is Body
while "else" is Rlist, and the inliner processes Rlist first.

The order of processing changes the order of inlining decisions,
which can affect which functions are inlined, but in general
won't affect much. (It's not like we know that we should prefer
to inline functions in else bodies over then bodies.)

Swapping these is not safe for toolstash -cmp.
Doing it in a separate CL lets the upcoming CLs all be toolstash-safe.

Change-Id: Id16172849239b0564930d2bbff1260ad6d03d5ab
Reviewed-on: https://go-review.googlesource.com/c/go/+/275308
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2020-12-04 16:52:45 +00:00
Russ Cox
478bde3a43 io/fs: add Sub
Sub provides a convenient way to refer to a subdirectory
automatically in future operations, like Unix's chdir(2).

The CL also includes updates to fstest to check Sub implementations.

As part of updating fstest, I changed the meaning of TestFS's
expected list to introduce a special case: if you list no expected files,
that means the FS must be empty. In general it's OK not to list all
the expected files, but if you list none, that's almost certainly a
mistake - if your FS were broken and empty, you wouldn't find out.
Making no expected files mean "must be empty" makes the mistake
less likely - if your file system ever worked, then your test will keep
it working.

That change found a testing bug: embedtest was making exactly
that mistake.

Fixes #42322.

Change-Id: I63fd4aa866b30061a0e51ca9a1927e576d6ec41e
Reviewed-on: https://go-review.googlesource.com/c/go/+/274856
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>
2020-12-04 16:49:30 +00:00
Bryan C. Mills
5d4569197e cmd/go/internal/modload: fix minor errors in comments
Change-Id: I38848e7bcd5dfa9f7feb415e1c54921768bf1ab8
Reviewed-on: https://go-review.googlesource.com/c/go/+/275295
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-12-04 16:31:09 +00:00
Cherry Zhang
21cfadf0dc runtime: avoid receiving preemotion signal while exec'ing
The iOS kernel has the same problem as the macOS kernel. Extend
the workaround of #41702 (CL 262438 and CL 262817) to iOS.

Updates #35851.

Change-Id: I7ccec00dc96643c08c5be8b385394856d0fa0f64
Reviewed-on: https://go-review.googlesource.com/c/go/+/275293
Trust: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-12-04 16:04:44 +00:00
Dmitri Shuralyov
7358064508 doc/go1.16: preannounce dropping macOS 10.12 support
Go 1.16 will be the last to support macOS 10.12 Sierra.
Go 1.17 will require macOS 10.13 High Sierra.

For #23011.

Change-Id: I80052bdde4d9f1c5d71b67b85f65fb0b40856750
Reviewed-on: https://go-review.googlesource.com/c/go/+/275299
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-12-04 15:43:07 +00:00
Russ Cox
37588ffcb2 cmd/go, embed: exclude .* and _* from embedded directory trees
Discussion on #42328 led to a decision to exclude files matching
.* and _* from embedded directory results when embedding an
entire directory tree.

This CL implements that new behavior.

Fixes #42328.

Change-Id: I6188994e96348b3449c7d9d3d0d181cfbf2d4db1
Reviewed-on: https://go-review.googlesource.com/c/go/+/275092
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>
2020-12-04 13:50:44 +00:00
Alberto Donizetti
b67b7ddabc doc/go1.16: add reflect changes to release notes
For #40700
Fixes #42911

Change-Id: I1bd729f72ae3a29d190ffc34a40c3d0b59ebbbb4
Reviewed-on: https://go-review.googlesource.com/c/go/+/274474
Trust: Alberto Donizetti <alb.donizetti@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2020-12-04 08:49:16 +00:00
Filippo Valsorda
cc386bd05a doc/go1.16: fix broken <code> tag
For #40700

Change-Id: I0083db494284d6142e1b8b981fca4ac30af2012a
Reviewed-on: https://go-review.googlesource.com/c/go/+/275312
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Filippo Valsorda <filippo@golang.org>
2020-12-04 03:10:36 +00:00
Matthew Dempsky
84cb51d7d7 [dev.regabi] cmd/compile: eliminate more SetOrig
This CL consolidates and cleans up fmt.go's logic for skipping past
Nodes introduced during typechecking. This allows eliminating SetOrig
on ConvExpr and Name. Also changes ConstExpr.SetOrig to a panic for
good measure.

The only remaining SetOrig uses now are for rewriting multi-value
"f(g())" calls and "return g()" statements, and type-checking
composite literals. It should be possible to eliminate both of those
as well.

Passes buildall w/ toolstash -cmp.

Change-Id: I478aea1a17dfb7a784293b930bf9081637eb2d7a
Reviewed-on: https://go-review.googlesource.com/c/go/+/275179
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2020-12-04 01:20:58 +00:00
Filippo Valsorda
2c2980aa0c doc/go1.16: pre-announce GODEBUG=x509ignoreCN=0 removal in Go 1.17
For #40700
Updates #24151

Change-Id: Id63dcaad238f7534bfce8902b8cb3efd8db5942d
Reviewed-on: https://go-review.googlesource.com/c/go/+/266539
Trust: Filippo Valsorda <filippo@golang.org>
Trust: Katie Hockman <katie@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
2020-12-04 00:56:40 +00:00
Robert Griesemer
9ff27e9fad [dev.typeparams] test: run all errorcheck tests that pass compiler with -G flag
Replace existing ad-hoc file exclusion mechanism with list of
excluded files; i.e., files for which the compiler with -G
option doesn't produce matching error messages yet.

Remove -G option since we now always run all passing tests.

Change-Id: I0655d2cf8bc135b3f50b1a811b8f49090c427580
Reviewed-on: https://go-review.googlesource.com/c/go/+/275212
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2020-12-03 23:13:59 +00:00
Cherry Zhang
37a32a1833 cmd/compile: make sure address of offset(SP) is rematerializeable
An address of offset(SP) may point to the callee args area, and
may be used to move things into/out of the args/results. If an
address like that is spilled and picked up by the GC, it may hold
an arg/result live in the callee, which may not actually be live
(e.g. a result not initialized at function entry). Make sure
they are rematerializeable, so they are always short-lived and
never picked up by the GC.

This CL changes 386, PPC64, and Wasm. On AMD64 we already have
the rule (line 2159). On other architectures, we already have
similar rules like
(OffPtr [off] ptr:(SP)) => (MOVDaddr [int32(off)] ptr)
to avoid this problem. (Probably me in the past had run into
this...)

Fixes #42944.

Change-Id: Id2ec73ac08f8df1829a9a7ceb8f749d67fe86d1e
Reviewed-on: https://go-review.googlesource.com/c/go/+/275174
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2020-12-03 21:34:39 +00:00
Michael Pratt
b78b427be5 runtime, time: strictly enforce when, period constraints
timer.when must always be positive. addtimer and modtimer already check
that it is non-negative; we expand it to include zero. Also upgrade from
pinning bad values to throwing, as these values shouldn't be possible to
pass (except as below).

timeSleep may overflow timer.nextwhen. This would previously have been
pinned by resetForSleep, now we fix it manually.

runOneTimer may overflow timer.when when adding timer.period. Detect
this and pin to maxWhen.

addtimer is now too strict to allow TestOverflowRuntimeTimer to test an
overflowed timer. Such a timer should not be possible; to help guard
against accidental inclusion siftup / siftdown will check timers as it
goes. This has been replaced with tests for period and sleep overflows.

Change-Id: I17f9739e27ebcb20d87945c635050316fb8e9226
Reviewed-on: https://go-review.googlesource.com/c/go/+/274853
Trust: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-12-03 21:23:16 +00:00
Michael Pratt
b635e4b808 time, runtime: don't set timer when = 0
timer when == 0, in the context of timer0When and timerModifiedEarliest,
is a sentinel value meaning there are no timers on the heap.
TestCheckRuntimeTimerOverflow reaching into the runtime to set a timer
to when = 0 when it is otherwise not possible breaks this invariant.

After golang.org/cl/258303, we will no longer detect and run this timer,
thus blocking any other timers lower on the heap from running. This
manifests as random timers failing to fire in other tests.

The need to set this overflowed timer to when = 0 is gone with the old
timer proc implementation, so we can simply remove it.

Fixes #42424

Change-Id: Iea32100136ad8ec1bedfa77b1e7d9ed868812838
Reviewed-on: https://go-review.googlesource.com/c/go/+/274632
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Michael Pratt <mpratt@google.com>
2020-12-03 21:21:23 +00:00
Austin Clements
4eb7ceba06 doc/go1.16: update runtime and compiler sections
This resolves all TODOs for the runtime and compiler and mentions
several other changes.

For #40700.
Fixes #42892.
Fixes #42894.

Change-Id: I18d14cfe572baf679ecf8b0a4e82c4b866da5a04
Reviewed-on: https://go-review.googlesource.com/c/go/+/275176
Trust: Austin Clements <austin@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2020-12-03 20:42:21 +00:00
Ian Lance Taylor
bacb307b80 test: match gofrontend error messages
fixedbugs/bug487.go:17:17: error: function result count mismatch
fixedbugs/bug487.go:18:16: error: function result count mismatch

fixedbugs/issue6977.go:37:26: error: duplicate method ‘m’
fixedbugs/issue6977.go:38:21: error: duplicate method ‘m’
fixedbugs/issue6977.go:39:26: error: duplicate method ‘m’
fixedbugs/issue6977.go:40:21: error: duplicate method ‘m’

Change-Id: Ie3c8a4650cd8f4c239bdceac25dc188a6a50ca34
Reviewed-on: https://go-review.googlesource.com/c/go/+/275178
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2020-12-03 20:30:02 +00:00
Bryan C. Mills
7f5a3196c9 cmd/go/internal/modload: rename constants to reflect that lazy loading is not yet implemented
Updates #36460
Updates #42288

Change-Id: I82a3b7e97a8e2f83bae2318ca9fb5c38c0c811cd
Reviewed-on: https://go-review.googlesource.com/c/go/+/275172
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2020-12-03 20:11:10 +00:00
Matthew Dempsky
351bc2f38c [dev.regabi] cmd/compile: store types.Field on {Selector,CallPart}Expr
It's useful to have quick access to the types.Field that a given
selector or method value expression refer to. Previously we abused Opt
for this, but couldn't do that for OCALLPART because escape analysis
uses Opt.

Now that we have more flexibility, we can simply add additional
pointer fields for this. This also allows getting rid of an unneeded
ONAME node for OCALLPART.

Passes buildall w/ toolstash -cmp.

Change-Id: I980d7bdb19abfd0b6f58a232876861b88dee1e47
Reviewed-on: https://go-review.googlesource.com/c/go/+/275034
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>
2020-12-03 19:33:13 +00:00