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

46953 Commits

Author SHA1 Message Date
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
Alberto Donizetti
bdc9a837e9 doc/go1.16: add path, path/filepath changes to release notes
For #40700
Fixes #42910

Change-Id: Ie380f5a03930d20dd5001c4cc184cadf2db33de7
Reviewed-on: https://go-review.googlesource.com/c/go/+/274475
Trust: Alberto Donizetti <alb.donizetti@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2020-12-03 19:25:37 +00:00
Austin Clements
9b0e8a2c95 doc/go1.16: tidy darwin/arm64 port section
For #40700.

Change-Id: I4f5d93e4ed13864f8b7dcc772d7ae074772b5a3f
Reviewed-on: https://go-review.googlesource.com/c/go/+/275175
Trust: Austin Clements <austin@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-12-03 19:02:05 +00:00
Jonathan Albrecht
b1369d5862 math/big: remove the s390x assembly for shlVU and shrVU
The s390x assembly for shlVU does a forward copy when the shift amount s
is 0. This causes corruption of the result z when z is aliased to the
input x.

This fix removes the s390x assembly for both shlVU and shrVU so the pure
go implementations will be used.

Test cases have been added to the existing TestShiftOverlap test to
cover shift values of 0, 1 and (_W - 1).

Fixes #42838

Change-Id: I75ca0e98f3acfaa6366a26355dcd9dd82499a48b
Reviewed-on: https://go-review.googlesource.com/c/go/+/274442
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Trust: Robert Griesemer <gri@golang.org>
2020-12-03 18:43:06 +00:00
Matthew Dempsky
a2058bac21 [dev.regabi] cmd/compile: add ConstExpr
Currently, we represent constant-folded expressions with Name, which
is suboptimal because Name has a lot of fields to support declared
names (which are irrelevant to constant-folded expressions), while
constant expressions are fairly common.

This CL introduces a new lightweight ConstExpr type that simply wraps
an existing expression and associates it with a value.

Passes buildall w/ toolstash -cmp.

name                      old time/op       new time/op       delta
Template                        252ms ± 3%        254ms ± 1%     ~     (p=0.821 n=12+10)
Unicode                         120ms ± 2%        107ms ± 7%  -11.09%  (p=0.000 n=12+12)
GoTypes                         918ms ± 2%        918ms ± 1%     ~     (p=0.974 n=12+10)
Compiler                        5.19s ± 1%        5.18s ± 0%     ~     (p=0.190 n=12+11)
SSA                             12.4s ± 1%        12.3s ± 1%     ~     (p=0.283 n=10+12)
Flate                           152ms ± 2%        148ms ± 4%   -2.68%  (p=0.007 n=10+12)
GoParser                        212ms ± 1%        211ms ± 2%     ~     (p=0.674 n=10+12)
Reflect                         543ms ± 3%        542ms ± 3%     ~     (p=0.799 n=12+12)
Tar                             224ms ± 2%        225ms ± 2%     ~     (p=0.378 n=12+12)
XML                             292ms ± 1%        299ms ± 3%   +2.18%  (p=0.006 n=10+12)

name                      old user-time/op  new user-time/op  delta
Template                        243ms ± 4%        244ms ± 5%     ~     (p=0.887 n=12+12)
Unicode                         112ms ± 6%        100ms ±10%  -10.76%  (p=0.000 n=12+12)
GoTypes                         898ms ± 3%        895ms ± 3%     ~     (p=0.671 n=12+12)
Compiler                        5.10s ± 1%        5.08s ± 1%     ~     (p=0.104 n=12+11)
SSA                             12.2s ± 2%        12.1s ± 1%     ~     (p=0.487 n=11+12)
Flate                           144ms ± 6%        145ms ± 5%     ~     (p=0.695 n=12+11)
GoParser                        205ms ± 5%        204ms ± 3%     ~     (p=0.514 n=12+12)
Reflect                         528ms ± 3%        531ms ± 4%     ~     (p=0.630 n=12+12)
Tar                             218ms ± 4%        219ms ± 3%     ~     (p=0.843 n=12+12)
XML                             284ms ± 5%        291ms ± 5%     ~     (p=0.069 n=11+12)

name                      old alloc/op      new alloc/op      delta
Template                       37.0MB ± 0%       36.7MB ± 0%   -0.72%  (p=0.000 n=12+12)
Unicode                        31.9MB ± 0%       29.5MB ± 0%   -7.60%  (p=0.000 n=12+12)
GoTypes                         119MB ± 0%        118MB ± 0%   -0.40%  (p=0.000 n=12+12)
Compiler                        629MB ± 0%        626MB ± 0%   -0.36%  (p=0.000 n=11+12)
SSA                            1.45GB ± 0%       1.43GB ± 0%   -0.78%  (p=0.000 n=12+12)
Flate                          22.2MB ± 0%       21.9MB ± 0%   -1.12%  (p=0.000 n=12+12)
GoParser                       29.4MB ± 0%       29.3MB ± 0%   -0.36%  (p=0.000 n=12+12)
Reflect                        76.1MB ± 0%       75.8MB ± 0%   -0.38%  (p=0.000 n=12+12)
Tar                            33.4MB ± 0%       33.2MB ± 0%   -0.61%  (p=0.000 n=12+12)
XML                            43.2MB ± 0%       42.8MB ± 0%   -1.03%  (p=0.000 n=11+12)

name                      old allocs/op     new allocs/op     delta
Template                         375k ± 0%         375k ± 0%     ~     (p=0.854 n=12+12)
Unicode                          300k ± 0%         300k ± 0%     ~     (p=0.766 n=12+12)
GoTypes                         1.30M ± 0%        1.30M ± 0%     ~     (p=0.272 n=12+12)
Compiler                        5.89M ± 0%        5.89M ± 0%     ~     (p=0.478 n=12+12)
SSA                             14.0M ± 0%        14.0M ± 0%     ~     (p=0.266 n=12+12)
Flate                            226k ± 0%         226k ± 0%     ~     (p=0.898 n=12+12)
GoParser                         313k ± 0%         313k ± 0%   -0.01%  (p=0.042 n=12+11)
Reflect                          971k ± 0%         971k ± 0%     ~     (p=0.080 n=12+12)
Tar                              342k ± 0%         342k ± 0%     ~     (p=0.600 n=12+12)
XML                              416k ± 0%         416k ± 0%     ~     (p=0.217 n=11+12)

name                      old maxRSS/op     new maxRSS/op     delta
Template                        43.1M ± 5%        42.5M ± 5%     ~     (p=0.086 n=12+12)
Unicode                         49.4M ± 2%        47.0M ± 2%   -4.88%  (p=0.000 n=12+12)
GoTypes                         85.3M ± 2%        84.6M ± 2%   -0.84%  (p=0.047 n=11+11)
Compiler                         394M ± 3%         386M ± 2%   -1.97%  (p=0.000 n=10+11)
SSA                              847M ± 4%         821M ± 2%   -2.98%  (p=0.000 n=11+12)
Flate                           36.0M ± 7%        35.2M ± 7%     ~     (p=0.128 n=12+12)
GoParser                        39.4M ± 7%        39.5M ± 4%     ~     (p=0.413 n=12+11)
Reflect                         64.0M ± 3%        63.6M ± 3%     ~     (p=0.413 n=11+12)
Tar                             43.3M ± 5%        43.3M ± 5%     ~     (p=0.503 n=12+12)
XML                             47.6M ± 4%        46.4M ± 2%   -2.46%  (p=0.013 n=11+12)

Change-Id: If5781be346351c30b2228807211b5e57f777c506
Reviewed-on: https://go-review.googlesource.com/c/go/+/275033
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 18:04:03 +00:00
Matthew Dempsky
beb5e05404 [dev.regabi] cmd/compile: refactoring prep for ConstExpr
The next CL adds ConstExpr, which is a more memory efficient
representation for constant expressions than Name. However, currently
a bunch of Val helper methods are defined on Name. This CL changes
them into standalone functions that work with any Node.Val
implementation.

There's also an existing standalone function named Int64Val, which
takes a Type argument to specify what type of integer is expected. So
to avoid collisions, this CL renames it to IntVal.

Passes buildall w/ toolstash -cmp.

[git-generate]
cd src/cmd/compile/internal/ir
rf 'mv Int64Val IntVal'
sed -i -E -e 's/\(n \*Name\) (CanInt64|((I|Ui)nt64|Bool|String)Val)\(/\1(n Node/' name.go

cd ../gc
rf '
ex {
  import "cmd/compile/internal/ir"
  var n ir.Node
  n.CanInt64() -> ir.CanInt64(n)
  n.Int64Val() -> ir.Int64Val(n)
  n.Uint64Val() -> ir.Uint64Val(n)
  n.BoolVal() -> ir.BoolVal(n)
  n.StringVal() -> ir.StringVal(n)
}
'

cd ../ir
rf '
mv CanInt64 Int64Val Uint64Val BoolVal StringVal val.go
rm Node.CanInt64 Node.Int64Val Node.Uint64Val Node.BoolVal Node.StringVal
'

Change-Id: I003140bda1690d770fd608bdd087e6d4ff00fb1f
Reviewed-on: https://go-review.googlesource.com/c/go/+/275032
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-03 18:03:53 +00:00
Robert Griesemer
7a1aa7dfaf [dev.typeparams] test: adjust more test cases to match compiler -G output
With this CL, the first ~500 errorcheck tests pass when running

go run run.go -v -G

in the $GOROOT/test directory (the log output includes a few dozen
tests that are currently skipped).

Change-Id: I9eaa2319fb39a090df54f8699ddc29ffe58b1bf1
Reviewed-on: https://go-review.googlesource.com/c/go/+/274975
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-03 17:55:56 +00:00
Russ Cox
7e81135be7 [dev.regabi] cmd/compile: rename addinit(n, init) to initExpr(init, n)
Recreated manually to push below some CLs it depended on.

Change-Id: I1b3316fcdce39cbb33e5cbb471f5cd1cd2efc1f5
Reviewed-on: https://go-review.googlesource.com/c/go/+/274599
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-03 17:45:50 +00:00
Russ Cox
6e30fc10fc [dev.regabi] all: merge master (d0c0dc682c) into dev.regabi
Change-Id: Ia54d7306ca7550b8d5623f505070558d275faa23
2020-12-03 12:33:12 -05:00
Robert Griesemer
07d32c8183 [dev.typeparams] cmd/compile/internal/types: adjust some error messages to match the compiler
Change-Id: I04bd7b294de4ed0fb01bc0609e09debea2d797bd
Reviewed-on: https://go-review.googlesource.com/c/go/+/274974
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-03 16:32:49 +00:00
Martin Möhrmann
dda2991c2e internal/cpu: disable FMA when OSXSAVE is not enabled on x86
All instructions in the FMA extension on x86 are VEX prefixed.
VEX prefixed instructions generally require OSXSAVE to be enabled.

The execution of FMA instructions emitted by the Go compiler on amd64
will generate an invalid opcode exception if OSXSAVE is not enabled.

Fixes #41022

Change-Id: I49881630e7195c804110a2bd81b5bec8cac31ba8
Reviewed-on: https://go-review.googlesource.com/c/go/+/274479
Trust: Martin Möhrmann <moehrmann@google.com>
Run-TryBot: Martin Möhrmann <moehrmann@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2020-12-03 16:31:53 +00:00
Ian Lance Taylor
58768ae15b test: match gccgo error messages
assign.go:59:28: error: ‘x’ repeated on left side of :=
assign.go:65:20: error: ‘a’ repeated on left side of :=

method2.go:36:11: error: reference to method ‘val’ in type that is pointer to interface, not interface
method2.go:37:11: error: reference to method ‘val’ in type that is pointer to interface, not interface

Change-Id: I8f385c75a82fae4eacf4618df8f9f65932826494
Reviewed-on: https://go-review.googlesource.com/c/go/+/274447
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2020-12-03 16:28:44 +00:00
Russ Cox
59b8916d48 [dev.regabi] cmd/compile: handle OCONVNOP better in ssa
This CL improves handling of OCONVNOP nodes during ssa generation,
so it is not toolstash safe.

An OCONVNOP wrapper is necessary for the "for" condition of
certain compiled range loops, and the boolean evaluator was
not looking through them properly, generating unnecessary
temporaries. That change saved 8k of the (13 MB) go binary.

The other changes just streamline the handling of OCONVNOP
to be more like what OSTMTEXPR will be like. They have no
effect on output size but do tweak the ssa graph a little, which
causes different register decisions and therefore different output.

Change-Id: I9e1dcd413b60944e21554c3e3f2bdc9adcee7634
Reviewed-on: https://go-review.googlesource.com/c/go/+/274598
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2020-12-03 16:22:40 +00:00
Russ Cox
932733d421 doc/go1.16: document embed, io/fs, runtime/metrics
Fixes #42915.

Change-Id: Ia6e205aaac3cbf4ba7340deafad444ac3e573559
Reviewed-on: https://go-review.googlesource.com/c/go/+/275114
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-12-03 16:08:40 +00:00
Russ Cox
c519b156fc doc/go1.16: more release notes
Fixes #42899 (flag).
Fixes #42900 (io).
Fixes #42901 (log).
Fixes #42902 (log/syslog).
Fixes #42903 (mime/multipart).
Fixes #42904 (net).
Fixes #42905 (net/http).
Fixes #42906 (net/http/httputil).
Fixes #42907 (net/smtp).
Fixes #42909 (os/signal).
Fixes #42913 (syscall).

Change-Id: Id09f038751d61fe0f1ff57b525e49473dd75c95f
Reviewed-on: https://go-review.googlesource.com/c/go/+/275113
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2020-12-03 16:05:27 +00:00
Russ Cox
5246fa5e75 mime/multipart: handle ReadForm(math.MaxInt64) better
Returning an error about integer overflow is needlessly pedantic.
The meaning of ReadForm(MaxInt64) is easily understood
(accept a lot of data) and can be implemented.

Fixes #40430.

Change-Id: I8a522033dd9a2f9ad31dd2ad82cf08d553736ab9
Reviewed-on: https://go-review.googlesource.com/c/go/+/275112
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-03 16:05:09 +00:00
Cherry Zhang
07cba70d57 cmd/compile, runtime: use __msan_memmove for moving data, split msanread to fields
Currently, for data moving, we generate an msanread of the source,
followed by an msanwrite of the destination. msanread checks
the source is initialized.

This has a problem: if the source is an aggregate type containing
alignment paddings, the padding bytes may not be thought as
initialized by MSAN. If we copy the aggregate type by value, if
it counts as a read, MSAN reports using uninitialized data. This
CL changes it to use __msan_memmove for data copying, which tells
MSAN to propagate initialized-ness but not check for it.

Caveat: technically __msan_memmove is not a public API of MSAN,
although the C compiler does generate direct calls to it.

Also, when instrumenting a load of a struct, split the
instrumentation to fields, instead of generating an msanread for
the whole struct. This skips padding bytes, which may not be
considered initialized in MSAN.

Fixes #42820.

Change-Id: Id861c8bbfd94cfcccefcc58eaf9e4eb43b4d85c6
Reviewed-on: https://go-review.googlesource.com/c/go/+/270859
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
2020-12-03 15:40:11 +00:00
Tobias Klauser
d0c0dc682c doc/go1.16: document os package changes
For #39444
For #40700
Fixes #42908

Change-Id: Idae35adecd79e9d7d207f9d78cb009a980e5c8a9
Reviewed-on: https://go-review.googlesource.com/c/go/+/274477
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Russ Cox <rsc@golang.org>
2020-12-03 14:53:56 +00:00
Cuong Manh Le
00e5727790 [dev.regabi] cmd/compile: remove okAs
The check for blank in okAs is redundant with what its callers already
done, so just inline the conversion in callers side instead.

Passes toolstash-check.

Change-Id: I606105e2d2cf8e80214722a13c3101c464d20d82
Reviewed-on: https://go-review.googlesource.com/c/go/+/274793
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-03 08:30:09 +00:00
Dan Scales
5a3b6796cd [dev.regabi] cmd/compile: remove extra typ field in Name struct
Noticed the typ field was duplicated, since it is also in miniExpr inside Name.

Also clarified the comments for Func, now that it is actually the ODCLFUNC node.

Change-Id: Ia483a0ad34bb409cd92c43d4ae0a6852f9e4f644
Reviewed-on: https://go-review.googlesource.com/c/go/+/274619
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Dan Scales <danscales@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
2020-12-03 07:22:32 +00:00
KimMachineGun
da54dfb6a1 doc/go1.16: document new behavior of asn1.Unmarshal on invalid argument
For #41509

Change-Id: Ie761c428710d15848cb80ffd2d85de747113f2d4
GitHub-Last-Rev: 0554162459
GitHub-Pull-Request: golang/go#42315
Reviewed-on: https://go-review.googlesource.com/c/go/+/267057
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-12-03 02:35:36 +00:00
Robert Griesemer
6b4da14dd3 [dev.typeparams] cmd/compile: provide scaffolding to get types2 types during noding
Initial setup of types2.Info structure to provide access to types
computed by generic typechecker.

Use -G flag to control compiler phases with new typechecker:

-G    (or -G=1)  parsing and typechecking ony
-G -G (or -G=2)  parsing, typechecking, and noding
-G=3             continue after noding (currently will run old
                 typechecker again, leading to duplicate errors

Change-Id: I87dd54f7c3773228f288f7a134ac809d9481ca95
Reviewed-on: https://go-review.googlesource.com/c/go/+/274444
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2020-12-03 01:56:40 +00:00
Joe Tsai
78e442ea79 doc/go1.16: add encoding/json note for tag change
For #40700
Fixes #42898

Change-Id: I652657ff8d6cce20bf868f0b1101d723d3f704d1
Reviewed-on: https://go-review.googlesource.com/c/go/+/274614
Trust: Joe Tsai <joetsai@digital-static.net>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2020-12-03 01:27:00 +00:00
Roland Shoemaker
f26f227f66 doc/go1.16: add crypto/tls Config.Clone note
For #40700
Fixes #42896

Change-Id: I842c9d60b18abe2ee061c6705a5c7ba62b224d77
Reviewed-on: https://go-review.googlesource.com/c/go/+/274613
Trust: Roland Shoemaker <roland@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2020-12-02 23:27:22 +00:00
Russ Cox
64bc656aed [dev.regabi] cmd/compile: use explicit block statements for init
For statements like goto that don't need an init, use an
explicit block statement instead of forcing them to have one.

There is also one call to addinit that is being replaced with
a block. That call is the source of much of my confusion
regarding init statements: walkstmt calls addinit on a statement,
whereas all the other uses of addinit are on expressions.

After this CL, they're all expressions.

Passes buildall w/ toolstash -cmp.

Change-Id: Ifdef9d318c236dc1a7567f9e9ef4a6bedd3fe81f
Reviewed-on: https://go-review.googlesource.com/c/go/+/274597
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-02 23:18:21 +00:00
Carlos Alexandro Becker
48838c35dc go/parser: ignore subdirectories in ParseDir
Issue and PR on GoReleaser:
- https://github.com/goreleaser/goreleaser/issues/1897
- https://github.com/goreleaser/goreleaser/pull/1899

Fixes #42951.

Change-Id: Ia0d6018e0bad59cd60cd600188c368c431032a4b
GitHub-Last-Rev: be59d85fe2
GitHub-Pull-Request: golang/go#42581
Reviewed-on: https://go-review.googlesource.com/c/go/+/269897
Trust: Robert Griesemer <gri@golang.org>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2020-12-02 23:05:56 +00:00
Rob Findley
72cc2353f0 [dev.typeparams] go/printer: adapt changes from dev.go2go
Import go/printer changes from the dev.go2go branch, with the following
modifications:
 - update tests to only use bracketed notation for type parameters
 - remove the UseBrackets mode, since it is now implied
 - remove guards on ast.Field.Type != nil

Patchset #1 contains the dev.go2go source, unmodified except to resolve
merge conflicts.

Change-Id: I3ddecfd3bee0fc32425a30fe6bd93b24fd3187e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/273226
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Trust: Robert Griesemer <gri@golang.org>
Trust: Robert Findley <rfindley@google.com>
2020-12-02 20:46:14 +00:00